6.6 – Table Manipulation

This library provides generic functions for table manipulation. It provides all its functions inside the table table.

Remember that, whenever an operation needs the length of a table, all caveats about the length operator apply (see §3.4.7). All functions ignore non-numeric keys in the tables given as arguments.

table.move()
  • References/Lua/Lua/Standard Libraries/Table Manipulation

table.move (a1, f, e, t [,a2]) Moves elements from table a1 to table a2, performing the equivalent to the following multiple assignment: a2[t]

2025-01-10 15:47:30
table.unpack()
  • References/Lua/Lua/Standard Libraries/Table Manipulation

table.unpack (list [, i [, j]]) Returns the elements from the given list. This function is equivalent to return list[i], list[i+1]

2025-01-10 15:47:30
table.remove()
  • References/Lua/Lua/Standard Libraries/Table Manipulation

table.remove (list [, pos]) Removes from list the element at position pos, returning the value of the removed element. When pos is an integer

2025-01-10 15:47:30
table.insert()
  • References/Lua/Lua/Standard Libraries/Table Manipulation

table.insert (list, [pos,] value) Inserts element value at position pos in list, shifting up the elements list[pos], list[pos+1],

2025-01-10 15:47:30
table.sort()
  • References/Lua/Lua/Standard Libraries/Table Manipulation

table.sort (list [, comp]) Sorts list elements in a given order, in-place, from list[1] to list[#list]. If comp is given, then

2025-01-10 15:47:30
table.concat()
  • References/Lua/Lua/Standard Libraries/Table Manipulation

table.concat (list [, sep [, i [, j]]]) Given a list where all elements are strings or numbers, returns the string list[i]..sep..list[i+1] ··· sep..list[j]. The default

2025-01-10 15:47:30
table.pack()
  • References/Lua/Lua/Standard Libraries/Table Manipulation

table.pack (···) Returns a new table with all parameters stored into keys 1, 2, etc. and with a field "n" with the total number of parameters. Note that the resulting

2025-01-10 15:47:30