Ok so I want to insert a value with a key into a table, like so:
local Test = {} table.insert(Test,["Test1"] = {"Test Table"})
But it always gives me a syntax error. How would I do this?
table.insert
is just a normal function -- you give it values, not syntax constructs.
However, it is only used for inserting at the whole numbered indexes. Just set:
Test["Test1"] = {"Test Table"} -- or, equivalently Test.Test1 = {"Test Table"}
If it was a number index, using table.insert
would look like this:
table.insert(Test, 5, {"Test Table"})