Question about 2 dimensional table.insert/remove
Posted: Sun Nov 24, 2019 1:46 pm
I'm having huge troubles with tables right now. I'm currently making an endless runner where each value of a table represents a tile. I thought that I could endlessly add values/tiles in a row from a table while also removing the first one. Everything besides that works perfectly fine.
This is an example code. So I've first created a table with 3 rows:
Now I want to extend the third row, by the value of 5, for e.g.:
This only adds another row, between the already existing second and third row.
How do I use table.insert and table.remove for a 2 dimensional table
and/or is there a way to move the first column to the last place and changing the values ?
Thanks in advance and sorry for my bad English!!
This is an example code. So I've first created a table with 3 rows:
Code: Select all
map = {
{1, 1, 1, 1},
{0, 0, 0, 0},
{2, 3, 2, 3}
}
Code: Select all
table.insert(map, 3,{5})
How do I use table.insert and table.remove for a 2 dimensional table
and/or is there a way to move the first column to the last place and changing the values ?
Thanks in advance and sorry for my bad English!!