room = {
[1] = {
[1] = "Tappez commencer ou quitter",
[2] = "alice.png"
},
[2] = {
[1] = "Il était une fois dans un autre monde...",
[2] = "start.png"
},
}
room = {}
room[1] = {}
room[1][1] = "Tappez commencer ou quitter"
room[1][2] = "alice.png"
room[2] = {}
room[2][1] = "Il était une fois dans un autre monde..."
room[2][2] = "start.png"
You mean that?
Last edited by GVovkiv on Mon Jul 12, 2021 4:56 pm, edited 1 time in total.
my_table = {}
for x = 1, width_of_table do
my_table[x] = {}
for y = 1, height_of_table do
my_table[x][y] = false
-- Or whatever other value you want here. I used a boolean for ease of checking later
-- but you can use an empty string "" or a number 0 or whatever you want to denote that the cell is "empty"
end
end
Then you'll be able to just replace any table cell in the grid at any time with whatever you want like you do in the OP.
You can keep nesting tables if you want too. However deep you need to go.
my_table = {}
for x = 1, width_of_table do
my_table[x] = {}
for y = 1, height_of_table do
my_table[x][y] = false
-- Or whatever other value you want here. I used a boolean for ease of checking later
-- but you can use an empty string "" or a number 0 or whatever you want to denote that the cell is "empty"
end
end
Then you'll be able to just replace any table cell in the grid at any time with whatever you want like you do in the OP.
You can keep nesting tables if you want too. However deep you need to go.