Skip to content
Dennis Corvers edited this page Oct 23, 2026 · 1 revision

Enumerable:ipairs

Returns an iterator tuple for traversing an Enumerable in a generic-for loop.

Syntax

iterator, state, initialIndex = values:ipairs()

Parameters

This method has no parameters.

Returns

The iterator function, its state, and its initial index.

Remarks

Use the method form for portable iteration. Some Lua runtimes do not honor __ipairs on tables, so plain ipairs(values) may not work with an Enumerable.

Example

for index, player in LuaQ.from({
    { name = "Ada" },
    { name = "Bryn" },
}):ipairs() do
    print(index, player.name)
end

See also

Pairs · Foreach · Functions

Clone this wiki locally