Global data ends up in a Dictionary in the Codea preferences plist under the “CODEA_GLOBAL_DATA_STORE” key.
I want to be able to store level data (in a table) in the global data store and then load it from another App (the game which uses the level). This is easy enough once you have converted the table to a string.
My question is does anyone know a way to query the CODEA_GLOBAL_DATA_STORE Dictionary to get a list of keys? Ideally I need a “file manager” class which will return a list of existing keys. I suspect that this isn’t possible (from within Codea) otherwise it would have been done in the sample App Spritely.
The alternative is to try to come up with a way of saving each level to a unique key - I’m trying to avoid a user accidentally overwriting a level.
Thanks @Fred - my problem is that the table I’m trying to save is quite complicated, it is a two dimensional array containing a class which contains functions. The simple table serializers can’t handle this. Do you have a link to the JSON converter?
I think the issue is that the class implementation includes userdata. Can anyone confirm this? From what I have read this is the one data type you can’t serialize (or at least it appears very difficult).
I dont actually need to save the structure of the class as all I need are its contents. I will just write a function to extract the class data into a comma separated string and another one to read that data back in.
Hey Reefwing, this is slightly off topic but I’ve been reading your tutorials and they are really helpful. Thanks for bothering to share it forward. I know you’re learning stuff as you go which is helpful, but it takes that extra step to post it for those of us behind you.