table

Show Deprecated

This library provides generic functions for table/array manipulation, providing all its functions inside the global table variable. Most functions in the table library assume that the table represents an array or a list. For these functions, the "length" of a table means the result of the length operator.

Summary

Functions

  • clear(table : table):()

    Sets all keys in the given table to nil.

  • Returns a shallow copy of the provided table.

  • concat(t : Array,sep : string,i : number,j : number):string

    Returns the given range of table elements as a string where each element is separated by the given separator.

  • create(count : number,value : Variant):table

    Returns a new table populated with many instances of the specified value.

  • find(haystack : table,needle : Variant,init : number):Variant

    Returns the index of the first occurrence of needle within haystack starting from init.

  • Makes the given table read-only.

  • insert(t : Array,pos : number,value : Variant):()

    Inserts the provided value to the target position of the array.

  • insert(t : Array,value : Variant):()

    Appends the provided value to the end of the array.

  • Returns true if the given table is frozen and false if it isn't frozen.

  • Returns the maximum numeric key of the provided table, or zero if the table has no numeric keys.

  • move(src : table,a : number,b : number,t : number,dst : table):table

    Copies the specified range of elements from one table to another.

  • pack(values... : Variant):Variant

    Returns a new table containing the provided values.

  • remove(t : Array,pos : number):Variant

    Removes the specified element from the array, shifting later elements down to fill in the empty space if possible.

  • sort(t : Array,comp : function):()

    Sorts table elements using the provided comparison function or the < operator.

  • unpack(list : table,i : number,j : number):Tuple

    Returns all elements from the given list as a tuple.

Functions

clear

()

Parameters

table: table

Returns

()

clone

Parameters

Returns

concat

Parameters

sep: string
Default Value: 1

Returns

create

Parameters

count: number
value: Variant

Returns

find

Variant

Parameters

haystack: table
needle: Variant
init: number

Returns

Variant

freeze

Parameters

Returns

insert

()

Parameters

pos: number
value: Variant

Returns

()

insert

()

Parameters

value: Variant

Returns

()

isfrozen

Parameters

Returns

maxn

Parameters

Returns

move

Parameters

src: table
dst: table
Default Value: src

Returns

pack

Variant

Parameters

values...: Variant

Returns

Variant

remove

Variant

Parameters

pos: number

Returns

Variant

sort

()

Parameters

comp: function
Default Value: nil

Returns

()

unpack

Parameters

list: table
Default Value: 1
Default Value: #list

Returns