FANDOM


add( tbl, v )

Adds a element to the end of a sequence in a table.

tbl
The table.
v
The value to add.

The add() function appends an element to the end of a sequence in a table.

Specifically, add() looks for an element at index 1, increments the index until it finds no element assigned (nil), then assigns the new value to that unused index.

Examples Edit

t = {1, 3, 5}
add(t, 7)  -- t = {1, 3, 5, 7}
add(t, 9)  -- t = {1, 3, 5, 7, 9}

See also Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.