I'm trying to create a 9 by 5 board to replicate a game I play with a friend, DigitalVeer, called Fanorona.
He showed me a way that we can make a 2D matrix as the following:
grid = { };
function newPoint(x, y)
if not grid[y] then
grid[y] = { }
end
grid[y][x] = {x = x; y = y; vector = Vector2.new(x, y)}
end
for y = 1, 5 do
for x = 1, 9 do
newPoint(x, y)
end
end
What are some other ways for creating a 2D matrix in a way good for dealing with things such as boards where I also need to store values inside the arrays?
