Difference between revisions of "Table.remove"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Removes from table the element at position pos, shifting down other elements to close the space if necessary.
 
Removes from table the element at position pos, shifting down other elements to close the space if necessary.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(varies) = table.remove(table,pos)
 
(varies) = table.remove(table,pos)
</source>
+
</syntaxhighlight>
  
 
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.
 
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.

Latest revision as of 15:33, 13 July 2023

Available since: Gideros 2011.6
Class: table

Description

Removes from table the element at position pos, shifting down other elements to close the space if necessary.

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

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.

Parameters

table: (table) table from which to remove element
pos: (number) index at which to remove element (default is last element) optional

Return values

Returns (varies) removed value