Table.insert: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "</source>" to "</syntaxhighlight>"
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
<languages />
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
'''Class:''' [[table]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/table|table]]<br/>
 
=== <translate>Description</translate> ===
=== Description ===
<translate>Inserts element value at position pos in table, shifting up other elements to open space, if necessary. The default value for pos is n+1, where n is the length of the table, so that a call table.insert(t,x) inserts x at the end of table t.</translate>
Inserts an element value at position pos in table, shifting up other elements to open space if necessary.
<source lang="lua">
<syntaxhighlight lang="lua">
table.insert(table,pos,value)
table.insert(table,pos,value)
</source>
</syntaxhighlight>
=== <translate>Parameters</translate> ===
 
'''table''': (table) <translate>table where to insert new element</translate> <br/>
The default value for pos is n+1, where n is the length of the table, so that a call table.insert(t,x) inserts x at the end of table t.
'''pos''': (number) <translate>index where to insert new element</translate> '''optional'''<br/>
 
'''value''': (any) <translate>value to insert in table</translate> '''optional'''<br/>
=== Parameters ===
'''table''': (table) table where to insert new element<br/>
'''pos''': (number) index where to insert new element '''optional'''<br/>
'''value''': (any) value to insert in table<br/>
 
 
----
 
=== Description ===
Appends the provided value to the end of the array.
<syntaxhighlight lang="lua">
table.insert(table,value)
</syntaxhighlight>
 
=== Parameters ===
'''table''': (table) table where to insert new element<br/>
'''value''': (any) value to insert at end of table<br/>


{{Table}}
{{Table}}

Latest revision as of 13:33, 13 July 2023

Available since: Gideros 2011.6
Class: table

Description

Inserts an element value at position pos in table, shifting up other elements to open space if necessary.

table.insert(table,pos,value)

The default value for pos is n+1, where n is the length of the table, so that a call table.insert(t,x) inserts x at the end of table t.

Parameters

table: (table) table where to insert new element
pos: (number) index where to insert new element optional
value: (any) value to insert in table



Description

Appends the provided value to the end of the array.

table.insert(table,value)

Parameters

table: (table) table where to insert new element
value: (any) value to insert at end of table