Remember that, whenever an operation needs the length of a table, the table should be a proper sequence or have a __len
metamethod (see ). All functions ignore non-numeric keys in tables given as arguments.
For performance reasons, all table accesses (get/set) performed by these functions are raw.
Given a list where all elements are strings or numbers, returns the string list[i]..sep..list[i+1] ··· sep..list[j]
. The default value for sep
is the empty string, the default for i
is 1, and the default for j
is #list
. If i
is greater than j
, returns the empty string.
table.insert (list, [pos,] value)
Returns a new table with all parameters stored into keys 1, 2, etc. and with a field “n
“ with the total number of parameters. Note that the resulting table may not be a sequence.
table.remove (list [, pos])
Removes from list
the element at position pos
, returning the value of the removed element. When pos
is an integer between 1 and #list
, it shifts down the elements list[pos+1], list[pos+2], ···, list[#list]
and erases element list[#list]
; The index pos
can also be 0 when #list
is 0, or #list + 1
; in those cases, the function erases the element .
The default value for pos
is #list
, so that a call table.remove(t)
removes the last element of list t
.
The sort algorithm is not stable; that is, elements considered equal by the given order may have their relative positions changed by the sort.
table.unpack (list [, i [, j]])
Returns the elements from the given table. This function is equivalent to
By default, i
is 1 and j
is #list
.