I am trying to save data in a table. I am using the loadsave module created by robmiracle located here
http://developer.coronalabs.com/code/super-simple-lua-table-save-and-load-file-functions
It seems easy enough however, for some reason it not working for me. Here’s what I am trying to do. Create a table from a lua file and change the value of the element of the table from another lua file then save the table. Here’s what I tried and I’ve been at this for a while.
File1.lua
loadsave=require(“loadsave”)
myTable = loadTable(“myTable.json”) – this load myTable everytime I open the app
myTable = {}
myTable.score1 = 100
myTable.score2 = 50
saveTable(myTable, “myTable.json”)
file2. lua
file1=require(“file1”)
loadsave=require(“loadsave”)
myTable = loadTable(“myTable.json”) – this load myTable everytime I open the app
The questions I have how can I can the value of MyTable.score1 from file2.lua and still save it?? I tried this:
file1.myTable.score1=20 --change value of myTable.score1=20 in file1.lua
saveTable(myTable, “myTable.json”) --save the table
Any help would be appreciated.Thanks
