I’ve been developing for several months and written lots of code. But the following problem is causing me issues. Up to now I’ve been duplicating code as a work around, but really want to learn how to do it properly!
I have a table to hold my displayObjects in this case a list of buttons eg.
butt = {back,color,forward}
butt.back = display.newImage(file)
each is a displayObject or nil all correctly assigned with all data correct and working properly.
Question: How do I traverse all these buttons? in the current App I have about 10 buttons I want to change the y coord when changing the device orientation, but could just as easily be removing, or shifting all the buttons.
I’ve tried in pairs and ipairs but don’t really understand those structures, the ‘Programming-in-Lua Guide’ jumps through these in a paragraph each, if you don’t get it immediately you’re lost! also
for i=1, #butt do – is wrong I think
for i=1, (butt.numChildren) do --gives an error
Help!
[import]uid: 3093 topic_id: 23798 reply_id: 323798[/import]