Lua.VM.Stdlib.Table (Lua v1.0.0-rc.2)

View Source

Lua 5.3 table standard library.

Provides functions for table manipulation including insertion, removal, concatenation, sorting, and array operations.

Functions

  • table.insert(list, [pos,] value) - Inserts element into list
  • table.remove(list [, pos]) - Removes element from list
  • table.concat(list [, sep [, i [, j]]]) - Concatenates list elements
  • table.sort(list [, comp]) - Sorts list in-place
  • table.pack(...) - Packs arguments into table with 'n' field
  • table.unpack(list [, i [, j]]) - Returns elements from list
  • table.move(a1, f, e, t [, a2]) - Moves elements between tables

Metamethod handling

table.insert, table.remove, table.concat, table.move, and table.sort route every read through __index, every write through __newindex, and every length lookup through __len. This matches Lua 5.3 §6.6 and the reference implementation in ltablib.c, which uses lua_geti/lua_seti/luaL_len for these operations rather than reaching into the raw table.