Difference between revisions of "Table"

From GiderosMobile
Line 8: Line 8:
 
  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.</translate>
 
  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.</translate>
 
{|-
 
{|-
| style="width: 50%;"|
+
| style="width: 50%; vertical-align:top;"|
 
=== Methods ===
 
=== Methods ===
[[table.concat]] {{<translate>returns concatenated table elements i to j separated by sep</translate>}}<br/>
+
[[table.concat]] ''<translate>returns concatenated table elements i to j separated by sep</translate>''<br/>
[[table.getn]] {{<translate>returns size of table, or n field, or table.setn value, or 1 less first index with nil value
+
[[table.getn]] ''<translate>returns size of table, or n field, or table.setn value, or 1 less first index with nil value
  [Deprecated in Lua 5.1, use # operator]</translate>}}<br/>
+
  [Deprecated in Lua 5.1, use # operator]</translate>''<br/>
[[table.insert]] {{<translate>insert value at location pos in table, default pos=n 1</translate>}}<br/>
+
[[table.insert]] ''<translate>insert value at location pos in table, default pos=n 1</translate>''<br/>
[[table.remove]] {{<translate>removes element at pos from table, default pos=n</translate>}}<br/>
+
[[table.remove]] ''<translate>removes element at pos from table, default pos=n</translate>''<br/>
[[table.sort]] {{<translate>sorts in-place elements 1 to n, comp(v1,v2- true if v1<v2, default <</translate>}}<br/>
+
[[table.sort]] ''<translate>sorts in-place elements 1 to n, comp(v1,v2- true if v1<v2, default <</translate>''<br/>
| style="width: 50%;"|
+
| style="width: 50%; vertical-align:top;"|
 
=== Events ===
 
=== Events ===
 
=== Constants ===
 
=== Constants ===
 
|}
 
|}

Revision as of 14:30, 23 August 2018

Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6

Description

This library provides generic functions for table manipulation. It provides all its functions inside the table table.


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.concat returns concatenated table elements i to j separated by sep
table.getn returns size of table, or n field, or table.setn value, or 1 less first index with nil value

[Deprecated in Lua 5.1, use # operator]

table.insert insert value at location pos in table, default pos=n 1
table.remove removes element at pos from table, default pos=n
table.sort sorts in-place elements 1 to n, comp(v1,v2- true if v1<v2, default <

Events

Constants