What does mean i in:
for i, object in pairs() end
Testing your code can reveal more than you'd think.
local t = {"a", "b", "c"} for i, v in pairs(t) do print(i) end --Output: 1 2 3
i
is the current index of the table, while v
is the value. print
is life!
If you don't know what an index and a value is, read this.
i
is the variable for index
, basically representing the index, example.
local table = {number = 1, 5} for index, value in pairs(table) do print(index,value) end
this returns in the output
number 1
2 5
in this example number
is the index and 1
is the value.
http://wiki.roblox.com/index.php?title=Global_namespace/Basic_functions&redirect=no#pairs