I’ve just moved over to analysing GGData - seems straight and to the purpose, so thumbs up from me.
However I’m struggling to get my data stored as I need it.
I essentially want the data to be stored like this:
Episode 1
-----> Unlocked - true
------------>levelNum - 1
----------------->fileName - “game1”
----------------->highScore - “999”
------------>levelNum - 2
----------------->fileName - “game2”
----------------->highScore - “999”
…
Episode 10
-----> Unlocked - false
------------>levelNum - 91
----------------->fileName - “game91”
----------------->highScore - “999”
------------>levelNum - 92
----------------->fileName - “game92”
----------------->highScore - “999”
However with the following code I’m not getting quite what I need:
for i=1,10 do
local unlocked = "false"
if ( i==1 ) then unlocked = "true" end --ensure that the first world is unlocked on creation
for j=1,10 do
box:set("episode"..i, {
unlocked = unlocked,
levelNum = j,
fileName = "game"..j,
highScore = 0
})
end
unlocked = false
end
I can understand why I’m getting the flatter data then what I need, but I can’t seem to work out how to fix it. Hopefully Graham (awesome libraries) or somebody au-fait with GGData/JSON might be able to shed some light.
UPDATE
Looking at the GGData library I’m not even certain whether I can use this multi-nested data structure, as it seems as though it’s setup for a simple key/value approach. [import]uid: 33275 topic_id: 34964 reply_id: 334964[/import]
