Can't load JSON table correctly - part of save state

Hi everyone,

I’m trying to save the progress of a game using json and Rob Miricle’s loadsave.lua

This code in scene1 creates a table to say the game has started:

myData = {} myData.gameStart = true loadsave.saveTable(myData, "myData.json", system.DocumentsDirectory)

This is the ‘menu’ scene before ‘scene1’ and should bring up either ‘Continue’ or ‘Start Game’ based on the table.

myData = loadsave.loadTable("myData.json") --gameStart = true --This works on it's own but doesnt load from the table     function strtCon()         if gameStart == true then             local continueGameTxt = display.newText("Continue",550,440,native.systemFontBold,42)                 continueGameTxt:setFillColor( 0, 0, 0 )                 sceneGroup:insert( continueGameTxt )                 continueGameTxt:addEventListener( "touch", continueGameTxt)         else             local startGameTxt = display.newText("Start Game",550,440,native.systemFontBold,42)                 startGameTxt:setFillColor( 0, 0, 0 )                 sceneGroup:insert( startGameTxt )                 startGameTxt:addEventListener( "touch", startGameTxt)         end             end strtCon()

This is the saved state entry

{"gameStart":true}

Goes to ‘Start Game’ every time!

Sorry if this is an obvious one but i’ve been playing around for ages and can’t get it to work

Cheers!

You’re trying to make the srtCon function do something based on the myData table that you save?

If so, then gameStart == true should be myData.gameStart == true.

Amazing!

Cheers Vince_, worked a treat!

You’re trying to make the srtCon function do something based on the myData table that you save?

If so, then gameStart == true should be myData.gameStart == true.

Amazing!

Cheers Vince_, worked a treat!