|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|