Trying to save data via PropertyBag

So far my code goes something like this:

– First I have the property.lua in my project
– Then I do local prop = require(“property”)
local propertyBag = prop:init()
– I then set up my highscore variable like highscore = 0
– Then I do propertyBag:setProperty(“highscore”,highscore)
propertyBag:SaveToFile()
–Then when its time I do if score > highscore then
highscore = score
propertyBag:setProperty(“highscore”,highscore)
propertyBag:GetFromDisk()
propertyBag:SaveToFile()
end
(this isnt exact code)
I want to simply have my highscore value saved when you quit out and then get it back when you return.
Thanks, Jason [import]uid: 8335 topic_id: 12780 reply_id: 312780[/import]

this is what happens in ur code
[lua]–creates property in memory
propertyBag:setProperty(“highscore”,highscore)

–read property from disk, overwrites that set in above code
propertyBag:GetFromDisk()

–saves value read from above statement to file
propertyBag:SaveToFile()[/lua] [import]uid: 71210 topic_id: 12780 reply_id: 46884[/import]

@Presentbestech,

have a read on howto.oz-apps.com here for a detailed article on propertyBag

cheers,

?:slight_smile:

Author of PropertyBag class [import]uid: 3826 topic_id: 12780 reply_id: 46898[/import]