pub fn next(t: table, index: option<any>) -> (any, any)Expand description
Allows a program to traverse all fields of a table. Its first argument
is a table and its second argument is an index in this table. A call
returns the next index of the table and its associated value; when
called with nil as its second argument, returns an initial index and
its associated value. When called with the last index, or with nil
in an empty table, returns nil.
The order in which the indices are enumerated is not specified, even for numeric indices.
§Examples
local t = { a = 1 }
print(next(t)) --> a 1
print(next(t, "a")) --> nil (no more fields)
print(next({})) --> nil (empty table)