is it possible to add properties to table items? For instance, something like this:
local characters = {"hero", "baddy"}
hero.team = "good"
baddy.team = "bad"
[import]uid: 116264 topic_id: 26016 reply_id: 326016[/import]
is it possible to add properties to table items? For instance, something like this:
local characters = {"hero", "baddy"}
hero.team = "good"
baddy.team = "bad"
[import]uid: 116264 topic_id: 26016 reply_id: 326016[/import]
Hey - take a look at this; http://blog.anscamobile.com/2011/06/understanding-lua-tables-in-corona-sdk/
Fantastic blog by Jon and will teach you all about tables
(See “Data” section, I think that will suit what you are hoping to do here.)
Peach
[import]uid: 52491 topic_id: 26016 reply_id: 105397[/import]
Thanks! That has cleared up a lot of things. Just one more question though - I have been using your “ego” module to save textfiles, and I was wondering if there was any way to save tables in a similar way? [import]uid: 116264 topic_id: 26016 reply_id: 105494[/import]
I am afraid that Ego is not made for tables, it’s very bare-bones. You should take a look at Ice which is available in the code exchange. It is made by Graham Ranson (who is behind Lime) and though I haven’t gotten to play with it but I believe it is suitable.
There is also a great SQLite tutorial written by Rob Miracle which may be worth looking at.
Peach
[import]uid: 52491 topic_id: 26016 reply_id: 105556[/import]