Table

From GiderosMobile
(Redirected from Category:Table)

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2011.6

Description

This library provides generic functions for table manipulation.

Most functions in the table library assume that the table represents an array or a list. For these functions, when we talk about the "length" of a table we mean the result of the length operator.

Methods

table.clear sets all keys in the given table to nil
table.clone duplicates a table
table.concat returns concatenated table elements i to j separated by sep
table.create creates a table with the array portion allocated to the given number of elements
table.find returns the index of the first occurrence of what within table starting from init
table.foreach iterates over the provided table, passing the key and value of each iteration over to the provided function
table.foreachi similar to table.foreach() except index-value pairs are passed instead of key-value pairs
table.freeze makes the given table read-only
table.getn returns the number of elements in the table passed
table.insert inserts value at location pos in table, default pos=n 1
table.isfrozen returns true if the given table is frozen and false if it isn't frozen
table.maxn returns the maximum numeric key of the provided table, or zero if the table has no numeric keys
table.move copies the specified range of elements from one table to another
table.pack returns a new table containing the provided values
table.remove removes element at pos from table, default pos=n
table.share makes a table thread safe
table.sort sorts in-place elements 1 to n, comp(v1,v2- true if v1<v2, default <)
table.unpack returns all elements from the given list as a tuple

Events

Constants