table Library Functions
Apply table.insert, remove, sort, concat, move, and unpack.
The table Module
The table module provides functions to manipulate Lua tables used as arrays: insert, remove, sort, concat, move, and unpack.
table.insert
table.insert(t, val) appends to the end. table.insert(t, pos, val) inserts at position, shifting later elements right.
local t = {"a", "b", "d"}
table.insert(t, "e") -- append
table.insert(t, 3, "c") -- insert at index 3
print(table.concat(t, ",")) -- a,b,c,d,eAll lessons in this course
- math Library Functions
- table Library Functions
- os and io Libraries
- The debug Library