BkFries
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 42 |
|
|
| 23 Jul 2012 11:07 PM |
| Or whatever that is? What does that do and mean? |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 23 Jul 2012 11:10 PM |
| Well it depends what d is. What's the value of that variable? |
|
|
| Report Abuse |
|
|
BkFries
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 42 |
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 23 Jul 2012 11:28 PM |
What? A for loop takes a local variable, and 2 numbers minimum.
You have
for 1 = #1
To Lua, 1 is the variable and you only have one number(depending on #1 is).
....
|
|
|
| Report Abuse |
|
|
troop98
|
  |
| Joined: 19 Dec 2009 |
| Total Posts: 1476 |
|
| |
|
|
| 24 Jul 2012 09:49 AM |
It's a way of repeating something x number of times (This is one type of 'for' loop) Let's say we wanted to print 'Hi' 10 times, and also print what number of 'Hi' we're at.
for i=1,10 do print'Hi '..i end
Now, how will this print what number we're at? Well, the 'i' is automatically added '1' to it after each loop. So our output would be:
Hi 1 Hi 2 Hi 3 ect..
Now, what about the other type of 'for' loop? This one is usually used for a 'search' or to gather all the 'children' of on element.
for _,n in pairs(game.Players:GetChildren()) do --Get all of the 'Player' elements. if n.Name=="builderman1171" then --Find my name print'Buiderman1171 is in the game!' --Print, I am there. end end
--TehChikenHater ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|