Quick question about table.insert()

So the parameters for table.insert() are array, numberposition and value, correct?

If my table looked like this:
local t = {"This", "Is", "a", "table",}

And I ran the code:
table.insert(t, 1, "!")

Would my table look like…
This: local t = {"!", "This", "Is", "a", "table",}
Or this: local t = {"!", "Is", "a", "table",}

Thanks so much!

It would look like

When you insert “in between” elements, the elements to the right are shifted 1 index down to make a gap, then the new value is where the gap is.

1 Like