Hi,
Background: I am having a display group in a LUA table that I am filling up with other groups from a external module. So the group contains several of groups. I am having problems to access a specified group within the “main” group. Is it possible to get a hold of the “group2” reference or is this mission impossible?
Code is shortened down, but this is the basic functionality
main.lua
local getAnimal = require( "getAnimal" );
local animals = {}
animals[1] = display.newGroup()
animals[1].x = 1 \* 1024;
animals[1].y = 0
animals[1]:insert(getAnimal.get(1))
animalGroup:insert(animals[1])
And in my external module I am sending back three groups to the above table with groups.
getAnimal.lua
local master = {}
local get = function( animalID )
local container = display.newGroup()
local group1 = display.newGroup()
local group2 = display.newGroup()
local group3 = display.newGroup()
local img1 = display.newImage("test1.png",0,0)
local img2 = display.newImage("test2.png",0,0)
local img3 = display.newImage("test3.png",0,0)
group1:insert(img1)
group2:insert(img2)
group3:insert(img3)
container:insert(group1)
container:insert(group2)
container:insert(group3)
return container
end
master.get = get
return master
Everything is working fine, but how can I get a reference of group2 that I am putting in my main group?
Best regards, Joakim [import]uid: 81188 topic_id: 22839 reply_id: 322839[/import]