Table Type
function table.create(n: number, value: any?): {any}function table.insert(list: {any}, value: any)function table.insert(list: {any}, position: number, value: any)function table.remove(list: {any}, position: number?): any?function table.move(source: {any}, sourceFrom: number, sourceTo: number, destPosition: number, destination: {any}?)function table.clear(table: {any})
-- Conversionfunction table.pack(...: any): { [number]: any, n: number }function table.unpack(list: {any}, from: number?, to: number?): ...anyfunction table.concat(list: {string}, separator: string?, from: number?, to: number?): string
-- Queryfunction table.find(table: {any}, value: any, start: number?): number?function table.sort(list: {any}, comparison: ((a: any, b: any) -> boolean)?)
function table.maxn(list: {any}): numberfunction table.freeze(table: table): tablefunction table.isfrozen(table: table): booleanfunction table.clone(table: table): tablefunction table.shrink(table: table, reorder: boolean?): tableArray-like Tables
Section titled “Array-like Tables”Tables can be used as arrays:
local example = {1,2,3,4}Iterating an array:
for index, value in example do print(index, value)endCreation and Manipulation
Section titled “Creation and Manipulation”Dictionary-like Tables
Section titled “Dictionary-like Tables”Tables can be used as dictionaries/maps:
local example = {key1 = "value1", key2 = "value2"}Iterating a dictionary:
for key, value in example do print(key, value)endConversion
Section titled “Conversion”Additional Utilities
Section titled “Additional Utilities”Deprecated
Section titled “Deprecated”function table.foreach<K, V, R>(t: { [K]: V }, f: (K, V) -> R?): R?function table.foreachi<V, R>(t: {V}, f: (number, V) -> R?): R?function table.getn<V>(t: {V}): number