Name
Pairs -- traverse over all fields of a table (V2.0)
Synopsis
func, state, val = Pairs(table)
Function
This function can be used in conjunction with the generic For statement to traverse over all fields of a table. As required by the generic For statement, Pairs() will return three values: An iterator function, a private state information, and an initial value for the traversal. The iterator function will then return the key/value combination of all table fields.

If you want to traverse over the integer indices of a table only, use the IPairs() 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
See Generic For statement


Show TOC