table
concat
function table.concat(list: table, sep?: string, i?: integer, j?: integer)
-> string
Given a list where all elements are strings or numbers, returns the string list[i]..sep..list[i+1] ··· sep..list[j].
foreach
function table.foreach(list: any, callback: fun(key: string, value: any):<T>|nil)
-> <T>|nil
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
function table.foreachi(list: any, callback: fun(key: string, value: any):<T>|nil)
-> <T>|nil
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
function table.getn(list: <T>[])
-> integer
Returns the number of elements in the table. This function is equivalent to #list.
insert
function table.insert(list: table, pos: integer, value: any)
Inserts element value at position pos in list.
maxn
function table.maxn(table: table)
-> integer
Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices.
move
function table.move(a1: table, f: integer, e: integer, t: integer, a2?: table)
-> a2: table
Moves elements from table a1 to table a2.
a2[t],··· =
a1[f],···,a1[e]
return a2pack
function table.pack(...any)
-> table
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
function table.remove(list: table, pos?: integer)
-> any
Removes from list the element at position pos, returning the value of the removed element.
sort
function table.sort(list: <T>[], comp?: fun(a: <T>, b: <T>):boolean)
Sorts list elements in a given order, in-place, from list[1] to list[#list].
unpack
function table.unpack(list: { [1]: <T1>, [2]: <T2>, [3]: <T3>, [4]: <T4>, [5]: <T5>, [6]: <T6>, [7]: <T7>, [8]: <T8>, [9]: <T9>, [10]: <T10> }, i?: integer, j?: integer)
-> <T1>
2. <T2>
3. <T3>
4. <T4>
5. <T5>
6. <T6>
7. <T7>
8. <T8>
9. <T9>
10. <T10>
Returns the elements from the given list. This function is equivalent to
return list[i], list[i+1], ···, list[j]By default, i is 1 and j is #list.