So I am trying to figure out how to save my whole array/table to a save file. I tried using the JSON encode function and similar concepts around the forums but none of them work because of how I set up my tables. I have a grid in the game which is the users inventory and I want to save the inventory as it’s own file. Here is how I set up the grid:
[lua]local grid = {}
for i=1, gridWidth do
grid[i] = {}
for j=1, gridHeight do
grid[i][j] = {}
grid[i][j].data1 = blahblah
grid[i][j].data2 = blah
grid[i][j].bg = display.newImageRect(“image.png”, 10, 10)
grid[i][j].data3 = blahblah2
end
end[/lua]
I set up the table this way because it is VERY easy to access anything I need by using “grid[xCoord][yCoord].data” I want to have the ability to save/load the entire “grid” table. Does anyone have any insight on this? [import]uid: 63320 topic_id: 24606 reply_id: 324606[/import]