generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Is this correct? (Generic for loop)

Previous Thread :: Next Thread 
xLink123 is not online. 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
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
16 May 2015 09:24 PM
print(i.Name,v.Name)
Report Abuse
xLink123 is not online. 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
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
16 May 2015 09:26 PM
You cant print an object. That is like saying print(game:service'TeleportService')
Report Abuse
TimeTicks is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
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 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
16 May 2015 09:40 PM
@TheNew

your's still works :P
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image