m
Move page script moved page API ipairs to WoW:API ipairs without leaving a redirect
No edit summary |
m (Move page script moved page API ipairs to WoW:API ipairs without leaving a redirect) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{luaapi}} | |||
Returns an iterator triple that allows the Lua for loop to iterate over the array portion of a table. | |||
iteratorFunc, table, startState = ipairs(table) | |||
== Example == | |||
local fruits={"apple","orange","banana","kiwi"} | local fruits={"apple","orange","banana","kiwi"} | ||
| Line 34: | Line 33: | ||
Note that t[0] is never reached because it starts counting at [1], t["four"] is never reached because it is not an array index, and t[5] is never reached because the iterator ceases when it checks t[4] and finds a nil value. | Note that t[0] is never reached because it starts counting at [1], t["four"] is never reached because it is not an array index, and t[5] is never reached because the iterator ceases when it checks t[4] and finds a nil value. | ||