Here is a question:
Why am I unable to add objects to the dedicated display group using a 2nd independent function within linedraw.lua?
--linedraw.lua
function LD.drawDot2()
local dot2 = display.newCircle(0,0,25 ) ; dot2:setFillColor(255,200,80)
dot2.x = math.random(-32,352) ; dot2.y = math.random(-44,524)
putInGroup:insert(dot2)
end
LD.drawDot2()
I get: “attempt to index upvalue ‘putInGroup’ (a nil value)”.
In my testing, it appears that only one function at a time can access the passed display group.
That is, unless one tries to fire LD.drawDot2 from level1.lua.
I’d really like it if all functions within linedraw.lua were aware of the passed display group, so that I could work within linedraw.lua as well.
Idea:
I guess I could wrap the entire module in a master function and pass the display group into there, but there has to be a better way. [import]uid: 73951 topic_id: 35817 reply_id: 144373[/import]