Skip to content

table.flatten

starkos edited this page Apr 10, 2021 · 3 revisions

⚠️ We have a new website! Visit now for the most update to date documentation.
       This wiki is no longer being maintained.


Flattens a hierarchy of arrays into a single array containing all of the values.

table.flatten(arr)

Parameters

arr is an table containing indexed values, which may themselves also contain indexed values.

Return Value

A new array containing all of the elements, nested or otherwise.

Availability

Premake 5.0 or later.

Examples

-- returns { "A", "B", "C", "D" }
flat = table.flatten { "A", { "B", "C", { "D" } } }
Clone this wiki locally