Difference between revisions of "Table.insert"
From GiderosMobile
 (Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Inserts element value at position pos in table, shifting up other elements to open space, if necessary...")  | 
				|||
| Line 4: | Line 4: | ||
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.  | 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.  | ||
<source lang="lua">  | <source lang="lua">  | ||
| − | + |  table.insert(table,pos,value)  | |
</source>  | </source>  | ||
| − | '''table  | + | '''table''': (table) table where to insert new element ''''''<br/>  | 
| − | '''pos  | + | '''pos''': (number) index where to insert new element '''optional'''<br/>  | 
| − | '''value  | + | '''value''': (any) value to insert in table '''optional'''<br/>  | 
Revision as of 10:21, 23 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)
'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