Skip to content

ToTable

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

Enumerable:toTable

Materializes values from an iterable into a Lua array.

Syntax

array = values:toTable()

Parameters

This method has no parameters.

Returns

A new array containing values in source iteration order.

Remarks

This is a terminal operation: it enumerates the source immediately. For dictionary-like inputs, pairs iteration order is unspecified.

Example

local partyNames = LuaQ.from({
    { name = "Ada" },
    { name = "Bryn" },
})
    :map(function(player) return player.name end)
    :toTable()
-- { "Ada", "Bryn" }

See also

Map · ToSet · ToLookup · Functions

Clone this wiki locally