Difference between revisions of "Table.insert"
From OpenEUO
(Created page with " table.insert (table, [pos,] value) 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, whe...") |
|||
Line 2: | Line 2: | ||
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 (see §2.5.5), 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 (see §2.5.5), so that a call table.insert(t,x) inserts x at the end of table t. | ||
+ | |||
+ | [[Table.remove]] | ||
[http://www.lua.org/manual/5.1/manual.html#2.5.5 Lua Manual - The length operator #] | [http://www.lua.org/manual/5.1/manual.html#2.5.5 Lua Manual - The length operator #] | ||
[http://www.lua.org/manual/5.1/manual.html#2.5.7 Lua Manual - Table Constructors] | [http://www.lua.org/manual/5.1/manual.html#2.5.7 Lua Manual - Table Constructors] |
Latest revision as of 12:50, 9 October 2010
table.insert (table, [pos,] value)
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 (see §2.5.5), so that a call table.insert(t,x) inserts x at the end of table t.