Hi all,
I’ve been using Rob Miracle’s tutorials on saving game data… I started with the basic:
storyboard.state = {} storyboard.state.life1 = 1 storyboard.state.life2 = 1 storyboard.state.life3 = 1
Which works well to a degree. Then I tried ‘raising the bar’ a little by using the JSON command to save to system.DocumentsDirectory
My main.lua now looks like this:
local loadsave = require("loadsave") local storyboard = require "storyboard" storyboard.state = {} storyboard.state.life1 = 1 storyboard.state.life2 = 1 storyboard.state.life3 = 1 loadsave.saveTable(storyboard.state, "myTable.json", system.DocumentsDirectory) newTable = loadsave.loadTable("myTable.json", system.DocumentsDirectory) loadsave.printTable(newTable)
I’ve tested on my device and the data isn’t being read if I quit and reopen the application, it just seems to reset to it’s initial values.
Can anyone tell me what I’m doing wrong?
All the best