Name
IPairs -- traverse over all integer keys of a table (V2.0)
Synopsis
func, state, val = IPairs(table)
Function
This function can be used in conjunction with the generic For statement to traverse over all integer keys of a table. As required by the generic For statement, IPairs() will return three values: An iterator function, a private state information, and an initial value for the traversal. The iterator function returned by IPairs() will stop the traversal when it encounters a key whose value is set to Nil.

If you want to traverse over all fields of a table instead of just the integer indices, use the Pairs() function instead.

See Generic For statement for details.

Inputs
table
table to traverse
Results
func
iterator function
state
private state information
val
initial traversal value
Example
a = {"one", "two", "three"}
For i, v In IPairs(a)
  DebugPrint(i, v)
Next
The code above will print "0 one", "1 two" and "2 three".

Show TOC