Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
best way to handle a loaded local table? — Gideros Forum

best way to handle a loaded local table?

piepie Member
edited July 2014 in Suggestions & requests
Hi, I started developing my game saving variables in a global table (I know this maybe was not a good idea, since I now need to increase the number of values to be stored there.
;;) ).

This table is saved as json and is reloaded on resume game, as a side note.

I was wondering the best way to manage it through a "global" object:

If I create a new object with

tableManager = Core.class()

I then could load my json file in

tableManager:init()
--load jsonfile
end

and get my value out by using something like this.

tableManager:getValue(index)
--return jsonfile[index]
end

but how do I keep jsonfile local and at the same time accessible from outside tableManager without loading the json file at every call?

I mean, I can add this tableManager somewhere in my code, and I can access its methods, but how do I store my jsonfile values in a local table inside tableManager to retrieve it with the appropriate tableManager method?

I think I can write my jsonfile in a tableManager property (tableManager.jsonvalues) but I'm not doing it "the local way", am I right?

I hope my noob question makes sense..
:)

thank you in advance

Comments

Sign In or Register to comment.