Yes, like that, but you would do it through loops. You can setup the tables similar to this, and then put whatever data you want in the cells.
local tiles = {}
local width = 10
local height = 10
for x=1, width do
tiles[x] = {}
for y=1, height do
tiles[x][y] = {value = math.random()}
end
end
pprint(tiles)
print(tiles[2][4].value)
print(tiles[10][10].value)
You could code a custom level editor for your game’s unique data too. This editor would run in engine and be able to save / load to a directory you specify. Think of like an editor other strategy games might have.
Or use something like Tiled and then export .lua files with it. I believe it allows you to specify extra data to cells which you can then import through lua. Here’s an old example which may help Big List of Defold Pro Tips!
A custom editor may be the way to go though. It’s not as hard as it may sound!