Anyone loaded nested tables from a file with corona?(I have successfully saved nested tables but have had problems restoring them). I have gotten into the habit of using them for my applications data (yes I know mysql but past experience tells me that Lua Tables are “crazy fast” and mysql tends to slow things down… there are advantages but unless you are working with huge amounts of data… lua tables preform much better)
I have been disappointed that solutions I have used to do this in other implementations of Lua have not worked in Corona and the example for saving tables is inadequate for nested tables.
I know the solution is out there and would hate to reinvent the wheel to do it.
Allen
(Standing on the shoulders of giants whenever possible) [import]uid: 40100 topic_id: 10248 reply_id: 310248[/import]
Thank you, I got json working (never did get it to restore a nested table but flattened my data structure and made it work).
I once used a bit’o code that serialized a Lua table to… a Lua table… it made retoring it as easy as setting a varible… not sure it can be done that way in corona… can a string be excuted as code…something like
MyTable = [[MyTableAsString]]
(now to figure out why saving and retoring in the simulator works great and the app fails to run on my phone) [import]uid: 40100 topic_id: 10248 reply_id: 37701[/import]
Should be able too… Although I am writing for android and can’t get it working on the device. [import]uid: 40100 topic_id: 10248 reply_id: 37719[/import]
I tried several versions of json… json4lua is nice but it uses loadstring (which can’t be used in corona) I don’t recall which one I ended up with.(was one that a link was posted for on these forums) All of them seemed to encode and save fine in the simulator, none of them would load a nested table, and I have yet to get this working on my android. [import]uid: 40100 topic_id: 10248 reply_id: 37734[/import]
u can use the json.lua included in the CoronaSDK. /CoronaSDK/SampleCode/Networking/Facebook/json.lua [import]uid: 12088 topic_id: 10248 reply_id: 37739[/import]