From the API guide: group:insert( [index,] child, [, resetTransform] )
I want to insert an item at the back of the group, or group[1]. If i have a group and I add an item, say it has 4 items in it, the 5th item will be group[5]. I could probably do a for loop to re order things for me but it seems like I should be able to insert something into a group at any index I want, but it doesn’t seem to work, and the for loop could end up being costly cpu wise. Probably not for what I’m doing, but if it were a bigger project.
Ideally, I would want it to work like this (assume I’ve already got 4 items in my group):
[code]
local img = display.newImage(“foo.png”,0,0)
group:insert(img[1]) – where I insert “img” into whatever index I want, bumping everything else up
Even the manual says:
Inserts child at index into group, shifting up other elements as necessary
Unless I’m reading it wrong…
Am I right in thinking that the group method was added to Lua by Ansca? [import]uid: 0 topic_id: 443 reply_id: 300443[/import]