xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 09:23 PM |
I'm good with numeric, not generics.
for i, v in pairs(game.Workspace:GetChildren()) do print(i,v) end
the above code will work, but is this right?
i is the index, or place inside the table I want the loop to iterate through?
v is the value, or the value of the index inside the table?
and the pairs is the table i want it to traverse through? (the children of workspace?)
|
|
|
| Report Abuse |
|
|
| |
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 09:25 PM |
this is mainly a thread i'm using to learn generic for loops,
there wasn't an error in the code |
|
|
| Report Abuse |
|
|
|
| 16 May 2015 09:26 PM |
| You cant print an object. That is like saying print(game:service'TeleportService') |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 16 May 2015 09:27 PM |
| http://wiki.roblox.com/index.php?title=Loops |
|
|
| Report Abuse |
|
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 09:28 PM |
| if you print an object it will default to printing the name of the object |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 16 May 2015 09:28 PM |
| TheNewChicken is 100% wrong it is perfectly fine |
|
|
| Report Abuse |
|
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 09:30 PM |
i knew it worked before i posted it qq
i want to know what pairs means |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 16 May 2015 09:31 PM |
| it's putting the objects into a table |
|
|
| Report Abuse |
|
|
A2D8
|
  |
| Joined: 15 Jun 2014 |
| Total Posts: 548 |
|
|
| 16 May 2015 09:31 PM |
| You absolutely can print an object. Try it before you spew it. |
|
|
| Report Abuse |
|
|
|
| 16 May 2015 09:35 PM |
| Sorry, you dont need to copy an attitude and gang up. I have tried it, sorry im from the olden days when all this stuff wasnt out. |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 16 May 2015 09:40 PM |
@TheNew
your's still works :P |
|
|
| Report Abuse |
|
|