Running into a problem which I’m sure has a simple fix when I use the rob miracle loadsave function. See code:
json = require( “json” ) – Include the Corona JSON library
local loadsave = require( “loadsave” )
myData = loadsave.loadTable(“myData.json”)
myData={}
myData.someValue = true
loadsave.saveTable(myData, “myData.json”)
if I run this code at the beginning of running my app - it works but - every time I launch it I’m immediately saving over my old data with a clear slate (making saving pointless), whereas this code:
json = require( “json” ) – Include the Corona JSON library
local loadsave = require( “loadsave” )
myData = loadsave.loadTable(“myData.json”)
print(myData.someValue) – this brings up an error saying that it can’t because myData is a nil value
will bring up an error reading myData as null, *if* it’s the first time launching an app - as nothing has ever been saved yet.
Just curious as to what the workaround would be. Regards.