INext

From Pico-8 Wiki
Jump to navigation Jump to search
inext( tbl, [index] )
A stateless iterator of index-value pairs for sequence elements in a table.
tbl
The table.

index
The current index.

The inext() function is the stateless iterator that underpins ipairs(), as used in for k,v in ipairs(t) to iterate over sequence elements in a table. It takes the table and the current index and returns the next index/value pair, or nil if there isn't one. The index passed in may be omitted or nil to retrieve the first index/value pair of the table.Under normal conditions, inext() is not referred to directly, instead being supplied under the hood by ipairs().

See also