Difference between revisions of "Table.remove"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Removes from table the element at position pos, shifting down other elements to close the space, if ne...")
 
Line 4: Line 4:
 
Removes from table the element at position pos, shifting down other elements to close the space, if necessary. Returns the value of the removed element. The default value for pos is n, where n is the length of the table, so that a call table.remove(t) removes the last element of table t.
 
Removes from table the element at position pos, shifting down other elements to close the space, if necessary. Returns the value of the removed element. The default value for pos is n, where n is the length of the table, so that a call table.remove(t) removes the last element of table t.
 
<source lang="lua">
 
<source lang="lua">
(varies), = table.remove(tablepos,)
+
(varies) = table.remove(table,pos)
 
</source>
 
</source>
'''table:''' (table) table from which to remove element ''''''<br/>
+
'''table''': (table) table from which to remove element ''''''<br/>
'''pos:''' (number) index at which to remove element (default is last element) '''optional'''<br/>
+
'''pos''': (number) index at which to remove element (default is last element) '''optional'''<br/>
 
'''Returns''' (varies) removed value<br/>
 
'''Returns''' (varies) removed value<br/>

Revision as of 11:17, 23 August 2018

Available since: Gideros 2011.6

Description

Removes from table the element at position pos, shifting down other elements to close the space, if necessary. Returns the value of the removed element. The default value for pos is n, where n is the length of the table, so that a call table.remove(t) removes the last element of table t.

(varies) = table.remove(table,pos)

'table: (table) table from which to remove element '
pos: (number) index at which to remove element (default is last element) optional
Returns (varies) removed value