Let's say I have an Array {"Hi", "Bye", "Welcome"} and I want to add an "Potato" on the [4] how can I do that? Thanks!
✓ ANSWER ACCEPTED
How do I add Values to an Array?
1 answer
✓ Accepted answer
Using table.insert.
Pretty easy actually;
local aa={'a',1}
table.insert(aa,3,'b') --1st argument is the table, 2nd one is the position, 3rd is the value(string, bool, int).
--To make it so it's at the last position.
table.insert(aa,#aa+1,'last')
EDIT* Made a mistake, 2nd argument is the position, the 3rd is the value.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
If i want it to be added at the end, I use #aa + 1?
Made a mistake. Fixed it though.