Help in GGData library

I’m with a little problem with blibioteca GGData … When I save some value using anothervalue, example:

box.anotherValue = myData.bestscore

 I can not save another value using anotherValue because it is only by accepting one and if I save more. one he takes only one value for the two that I would be in the case by setting…

Example of how I’m doing:

[…]

        lolz:set( "value", myData.dinheiro )        lolz:save()

After …

      box.anotherValue = myData.bestscore + 0       box:save()

It takes the same amount of money and places like the bestscore … How to solve this?

what is lolz? If you create box like this 

local box = GGData:new( “sample” )
you should stick to it.
for instance:

local box = GGData:new( "sample" ) box:set("variable1", value1) box:set("variable2", value2) box:save()

Have tried to do it this way and that way there in the corona works PERFECTLY but when I put him in the cell, the menu items do not appear …

lolz is a variable that stores a number more precisely money player

I had to remove the lolz that way because of the bug that was giving, ended up like this:box.anotherValue = myData.bestscore

why do you need to create both box and lolz? You can store all the variables within one box.

But how do I do that? Since this method: 

box: set ("variable1", value1)

 does not work?

You create one box with

local box = GGData:new( "sample" )

 to store all your saved data in it.

Why the method is not working? can you share more code?

 

Yes I do, but when I start my game which the rest of the code does not appear, since the corona works everything is normal …: \ (my android is 4.1.2)

Ie, does not appear the menu items …

Scene in which I am saving is like this:

local \_M = {} local physics = require("physics") local myData = require( "mydata" ) local GGData = require( "GGData" ) local box = GGData:new( "sample" ) local lolz = GGData:new( "sample" ) local background = display.newImage("background.png") function \_M.new() local director = require("director") local localGroup = display.newGroup(); bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla local function movePerson(event, tap) &nbsp; &nbsp; &nbsp;if event.phase == "began" then &nbsp; &nbsp; &nbsp;local object = event.target &nbsp; &nbsp; &nbsp;object:applyLinearImpulse(-1, -1, event.x, event.y) &nbsp; &nbsp; &nbsp; &nbsp;scoreNumber = scoreNumber + 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score.text = scoreNumber + 1 -1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myData.paraguardar = myData.paraguardar + 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myData.dinheiro = myData.dinheiro + 0.25 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lolz:set( "value", myData.dinheiro ) &nbsp; &nbsp; &nbsp; &nbsp;lolz:save() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; physicsGravidade() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end &nbsp; &nbsp; &nbsp;end&nbsp; bla bla bla bla local function onLocalCollision(s, event) &nbsp; &nbsp;if event.phase == "ended" then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if s.myName == "chao" then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bla bla bla &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bla bla bla &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bla bla bla &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bla bla bla &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; function Comparando() &nbsp; &nbsp; if(myData.bestscore \< myData.paraguardar) then &nbsp; &nbsp; &nbsp; myData.bestscore = myData.paraguardar &nbsp; &nbsp; &nbsp; myData.bestscore3.text = myData.bestscore &nbsp; &nbsp; &nbsp; box.anotherValue = myData.bestscore + 0 &nbsp; &nbsp; &nbsp; box:save() &nbsp; end end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Comparando() &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; end &nbsp; &nbsp; &nbsp; end end&nbsp; bla bla bla bla bla bla bla bla bla bla return localGroup end return \_M

Scene where I call :

local \_M = {} function \_M.new() local director = require("director") &nbsp; local myData = require( "mydata" ) &nbsp; local GGData = require( "GGData" ) &nbsp; local box = GGData:new( "sample" ) &nbsp; local lolz = GGData:new( "sample" ) &nbsp; local localGroup = display.newGroup(); bla bla bla bla bla bla bla local function MudarParaMenu() &nbsp; &nbsp; &nbsp; myData.bestscore = box:get( "anotherValue" ) &nbsp; &nbsp; &nbsp; myData.dinheiro = lolz:get( "anotherValue" ) &nbsp; &nbsp; &nbsp; &nbsp; display.remove(localGroup) &nbsp; &nbsp; bla bla bla bla bla &nbsp; bla bla bla bla &nbsp; &nbsp; &nbsp; localGroup = nil &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print("localGroup ----------------- REMOVIDO") &nbsp; &nbsp; director:changeScene("menu") &nbsp; &nbsp; end &nbsp; &nbsp; timer.performWithDelay( 2000, MudarParaMenu ) &nbsp; &nbsp; return localGroup end return \_M

You saving the data to the one box. 
you can’t use “sample” in each box. Because the way you do it settings are exactly the same thing as lolz. 
it should be :

settings = GGData:new("sample1") lolz = GGData:new("sample2")

Nevertheless you can use only settings without creating lolz
By calling _GGData:new(“sample”) _where all different variables are stored. And BTW don’t use the same box name in different scenes if you need them. F.e : scene 1 = _GGData:new(“sample1”); _scene2 = GGData:new(“sample2”)

 

Well, in Corona ran everything perfectly, but when I put on my phone ONLY the background is on display … 

You know what might be causing this error?

This is just the lolz when I shot myData.dinheiro = lolz:get( “anotherValue” ) the rest of the menu items do not appear …

----------------edit

After a while of reasoning finally found out what it was … I’ll leave the concert bug here in case someone has the same doubts as me.

&nbsp;function Dinheiro() &nbsp; &nbsp; &nbsp; if(lolz:get( "anotherValue" ) == nil) then &nbsp; &nbsp; &nbsp; lolz.anotherValue = 0 &nbsp; &nbsp; &nbsp; lolz:save() &nbsp; &nbsp; &nbsp; myData.dinheiro = lolz:get( "anotherValue" ) &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; if(lolz:get( "anotherValue" ) &nbsp;~= nil) then &nbsp; &nbsp; &nbsp; &nbsp; myData.dinheiro = lolz:get( "anotherValue" ) &nbsp; &nbsp; &nbsp; end &nbsp;end &nbsp;Dinheiro() &nbsp; function Score() &nbsp; &nbsp; if(box:get( "anotherValue" ) == nil ) then &nbsp; &nbsp; &nbsp; box.anotherValue = 0 &nbsp; &nbsp; &nbsp; box:save() &nbsp; &nbsp; &nbsp; myData.bestscore = box:get( "anotherValue" ) &nbsp; &nbsp; end &nbsp; &nbsp; if(box:get( "anotherValue" ) ~= nil ) then &nbsp; &nbsp; &nbsp; myData.bestscore = box:get( "anotherValue" ) &nbsp; &nbsp; end end Score()

And once again thank you so much Patso {;

what is lolz? If you create box like this 

local box = GGData:new( “sample” )
you should stick to it.
for instance:

local box = GGData:new( "sample" ) box:set("variable1", value1) box:set("variable2", value2) box:save()

Have tried to do it this way and that way there in the corona works PERFECTLY but when I put him in the cell, the menu items do not appear …

lolz is a variable that stores a number more precisely money player

I had to remove the lolz that way because of the bug that was giving, ended up like this:box.anotherValue = myData.bestscore

why do you need to create both box and lolz? You can store all the variables within one box.

But how do I do that? Since this method: 

box: set ("variable1", value1)

 does not work?

You create one box with

local box = GGData:new( "sample" )

 to store all your saved data in it.

Why the method is not working? can you share more code?

 

Yes I do, but when I start my game which the rest of the code does not appear, since the corona works everything is normal …: \ (my android is 4.1.2)

Ie, does not appear the menu items …

Scene in which I am saving is like this:

local \_M = {} local physics = require("physics") local myData = require( "mydata" ) local GGData = require( "GGData" ) local box = GGData:new( "sample" ) local lolz = GGData:new( "sample" ) local background = display.newImage("background.png") function \_M.new() local director = require("director") local localGroup = display.newGroup(); bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla local function movePerson(event, tap) &nbsp; &nbsp; &nbsp;if event.phase == "began" then &nbsp; &nbsp; &nbsp;local object = event.target &nbsp; &nbsp; &nbsp;object:applyLinearImpulse(-1, -1, event.x, event.y) &nbsp; &nbsp; &nbsp; &nbsp;scoreNumber = scoreNumber + 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; score.text = scoreNumber + 1 -1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myData.paraguardar = myData.paraguardar + 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; myData.dinheiro = myData.dinheiro + 0.25 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lolz:set( "value", myData.dinheiro ) &nbsp; &nbsp; &nbsp; &nbsp;lolz:save() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; physicsGravidade() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end &nbsp; &nbsp; &nbsp;end&nbsp; bla bla bla bla local function onLocalCollision(s, event) &nbsp; &nbsp;if event.phase == "ended" then&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if s.myName == "chao" then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bla bla bla &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bla bla bla &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bla bla bla &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bla bla bla &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; function Comparando() &nbsp; &nbsp; if(myData.bestscore \< myData.paraguardar) then &nbsp; &nbsp; &nbsp; myData.bestscore = myData.paraguardar &nbsp; &nbsp; &nbsp; myData.bestscore3.text = myData.bestscore &nbsp; &nbsp; &nbsp; box.anotherValue = myData.bestscore + 0 &nbsp; &nbsp; &nbsp; box:save() &nbsp; end end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Comparando() &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; end &nbsp; &nbsp; &nbsp; end end&nbsp; bla bla bla bla bla bla bla bla bla bla return localGroup end return \_M

Scene where I call :

local \_M = {} function \_M.new() local director = require("director") &nbsp; local myData = require( "mydata" ) &nbsp; local GGData = require( "GGData" ) &nbsp; local box = GGData:new( "sample" ) &nbsp; local lolz = GGData:new( "sample" ) &nbsp; local localGroup = display.newGroup(); bla bla bla bla bla bla bla local function MudarParaMenu() &nbsp; &nbsp; &nbsp; myData.bestscore = box:get( "anotherValue" ) &nbsp; &nbsp; &nbsp; myData.dinheiro = lolz:get( "anotherValue" ) &nbsp; &nbsp; &nbsp; &nbsp; display.remove(localGroup) &nbsp; &nbsp; bla bla bla bla bla &nbsp; bla bla bla bla &nbsp; &nbsp; &nbsp; localGroup = nil &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print("localGroup ----------------- REMOVIDO") &nbsp; &nbsp; director:changeScene("menu") &nbsp; &nbsp; end &nbsp; &nbsp; timer.performWithDelay( 2000, MudarParaMenu ) &nbsp; &nbsp; return localGroup end return \_M

You saving the data to the one box. 
you can’t use “sample” in each box. Because the way you do it settings are exactly the same thing as lolz. 
it should be :

settings = GGData:new("sample1") lolz = GGData:new("sample2")

Nevertheless you can use only settings without creating lolz
By calling _GGData:new(“sample”) _where all different variables are stored. And BTW don’t use the same box name in different scenes if you need them. F.e : scene 1 = _GGData:new(“sample1”); _scene2 = GGData:new(“sample2”)

 

Well, in Corona ran everything perfectly, but when I put on my phone ONLY the background is on display … 

You know what might be causing this error?

This is just the lolz when I shot myData.dinheiro = lolz:get( “anotherValue” ) the rest of the menu items do not appear …

----------------edit

After a while of reasoning finally found out what it was … I’ll leave the concert bug here in case someone has the same doubts as me.

&nbsp;function Dinheiro() &nbsp; &nbsp; &nbsp; if(lolz:get( "anotherValue" ) == nil) then &nbsp; &nbsp; &nbsp; lolz.anotherValue = 0 &nbsp; &nbsp; &nbsp; lolz:save() &nbsp; &nbsp; &nbsp; myData.dinheiro = lolz:get( "anotherValue" ) &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; if(lolz:get( "anotherValue" ) &nbsp;~= nil) then &nbsp; &nbsp; &nbsp; &nbsp; myData.dinheiro = lolz:get( "anotherValue" ) &nbsp; &nbsp; &nbsp; end &nbsp;end &nbsp;Dinheiro() &nbsp; function Score() &nbsp; &nbsp; if(box:get( "anotherValue" ) == nil ) then &nbsp; &nbsp; &nbsp; box.anotherValue = 0 &nbsp; &nbsp; &nbsp; box:save() &nbsp; &nbsp; &nbsp; myData.bestscore = box:get( "anotherValue" ) &nbsp; &nbsp; end &nbsp; &nbsp; if(box:get( "anotherValue" ) ~= nil ) then &nbsp; &nbsp; &nbsp; myData.bestscore = box:get( "anotherValue" ) &nbsp; &nbsp; end end Score()

And once again thank you so much Patso {;