tablelib¶
concat¶
Given a list where all elements are strings or numbers, returns the string list[i]..sep..list[i+1] ··· sep..list[j]
.
foreach¶
Executes the given f over all elements of table. For each element, f is called with the index and respective value as arguments. If f returns a non-nil value, then the loop is broken, and this value is returned as the final value of foreach.
foreachi¶
Executes the given f over the numerical indices of table. For each index, f is called with the index and respective value as arguments. Indices are visited in sequential order, from 1 to n, where n is the size of the table. If f returns a non-nil value, then the loop is broken and this value is returned as the result of foreachi.
getn¶
Returns the number of elements in the table. This function is equivalent to #list
.
insert¶
Inserts element value
at position pos
in list
.
maxn¶
Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices.
move¶
Moves elements from table a1
to table a2
.
pack¶
Returns a new table with all arguments stored into keys 1
, 2
, etc. and with a field "n"
with the total number of arguments.
remove¶
Removes from list
the element at position pos
, returning the value of the removed element.
sort¶
Sorts list elements in a given order, in-place, from list[1]
to list[#list]
.
unpack¶
Returns the elements from the given list. This function is equivalent to
By default,i
is 1
and j
is #list
.