lua table insert
snippet in lua

lua add table to value

user1309

table.insert(table, position:num, value:any)

Lua array add item

user2402

local tbl = {}
table.insert(tbl, "Hello World")

lua insert table into table

user2824

table.insert(tabletoaddto, pos:num, tabletoinsert)

lua table insert

user3032


t = { "the", "quick", "brown", "fox" }
table.insert (t, 2, "very") -- new element 2
table.insert (t, "jumped")  -- add to end of table
table.foreachi (t, print)

 -->

1 the
2 very
3 quick
4 brown
5 fox
6 jumped