Table.insert: Difference between revisions
From GiderosMobile
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''Available since:''' Gideros 2011.6<br/> | '''<translate>Available since</translate>:''' Gideros 2011.6<br/> | ||
=== Description === | === <translate>Description</translate> === | ||
<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> | <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> | ||
<source lang="lua"> | <source lang="lua"> | ||
table.insert(table,pos,value) | table.insert(table,pos,value) | ||
</source> | </source> | ||
=== Parameters === | === <translate>Parameters</translate> === | ||
'''table''': (table) <translate>table where to insert new element</translate> <br/> | '''table''': (table) <translate>table where to insert new element</translate> <br/> | ||
'''pos''': (number) <translate>index where to insert new element</translate> '''optional'''<br/> | '''pos''': (number) <translate>index where to insert new element</translate> '''optional'''<br/> | ||
'''value''': (any) <translate>value to insert in table</translate> '''optional'''<br/> | '''value''': (any) <translate>value to insert in table</translate> '''optional'''<br/> | ||
Revision as of 06:28, 24 August 2018
Available since: Gideros 2011.6
Description
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.
table.insert(table,pos,value)
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 optional