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 » Scripting Helpers
Home Search
 

Re: for _, do

Previous Thread :: Next Thread 
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
23 Nov 2012 11:57 AM
Quenty tried to explain this to me, however, he had no luck. (Sorry Quenty!)

Could anyone else explain this?

Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
23 Nov 2012 11:58 AM
for index,value in pairs(table) do



At any point in the loop, the following will be true:

table[index] == value

And it will occur for EVERY index--value pairing.

If you use

ipairs

instead of

pairs

Then it will have the same condition, but it will only occur for the index being positive integers.
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
23 Nov 2012 12:08 PM
Okay, I did not understand much of that..

I should probably understand how to read tables, first, though..
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
23 Nov 2012 12:16 PM
for i, v in pairs(game.Workspace:GetChildren()) do -- this is what v will do get children in workspace..
if v.ClassName == "Tool" then
v:Remove()
Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
23 Nov 2012 12:18 PM
table = {["index1"] = "value1"; ["index2"] = "value2";}

for i, v in pairs(table) do
print(i, v)
end

--> index1 value1
--> index2 value2

Does that help a bit?

¬ SHG Scripter Tier-2 ♣ LuaLearners Elite
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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