Returns the function next followed by a table. |
||
Syntax |
|
|
Argument |
Name |
Description |
|
T |
A table to iterate. |
Outputs |
Name |
Description |
|
f |
A function. Returns the function next followed by a table. |
|
T |
A table, the same table as input. |
Example |
Syntax |
|
|
t = {'a','b',1,true,'c',false,'d'} t(23) = 'hyper' t.myfield = 'math' for key,value in ipairs(t) do print(key,value) end |
|
|
Result |
|
|
1 a 2 b 3 1 4 true 5 c 6 false 7 d |
|
Comments |
'ipairs' iterates over integer keys, starting from 1, until it finds one which is not in the table. This function is usually used with a 'for' loop. |
|
See Also: |