Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
could't get datasaver nor table.save to work? is there something I've missed? - Gideros Forum

could't get datasaver nor table.save to work? is there something I've missed?

edited August 2013 in Plugins
hi guys,

Sorry if this already asked before. Im creating non commercial children educational game on android. I'm trying to save player progress in a form of star-score much like angry birds. Basically on each level icon I put stars indicating how well the player went through that level.

Its okay when the app is still playing. But whenever I exit the app. reset (or clear ram). When I get back to the app, all of those progress are gone. I've tried both table.save and datasaver with no success. On device player testing failings, also I try converting them to apk file and make sure the permission to external storage available, still failing. whatever I tried it just not working. I'm a newbie in gideros and lua, so perhaps its just a silly mistake or simple step that I missed?

here are my codes (I dont understand how to enclosed it in script container in this forum text editor, sorry):
-- in main.lua

gameSkor = {}

gameSkor.huruf001 = dataSaver.loadValue("gameSkorHuruf001")
if(not gameSkor.huruf001) then --if not exist yet
gameSkor.huruf001 = 0

gameSkor.huruf002 = dataSaver.loadValue("gameSkorHuruf002")
if(not gameSkor.huruf002) then --if not exist yet
gameSkor.huruf002 = 0

-- .. etc

function updateScoreFile(skor) -- the function will be called from other file

if curGameLevel == gameHuruf_level_001 then
gameSkor.huruf001 = skor
dataSaver.saveValue("gameSkorHuruf001", gameSkor.huruf001)
elseif curGameLevel == gameHuruf_level_002 then
gameSkor.huruf002 = skor
dataSaver.saveValue("gameSkorHuruf002", gameSkor.huruf002)

kind regrads,


Sign In or Register to comment.