Hello
Recently I’ve just started to use modules. The problem I’m facing while I’m using modules is calling an object from the module I created and putting it behind other objects instead of being in the front. Here is the example:
this is the object I created from a seperate folder.
box.lua
local t = {} local rectsit = display.newRect(0,0,50,50) rectsit.x = 240 rectsit.y = 140 local function doneit() rectsit:setFillColor(0,0,0) end rectsit:addEventListener("touch", doneit) return t
this is the scene I’m calling my box.lua file
menu.lua
module(..., package.seeall) function new() local localGroup = display.newGroup() local box = require("box") local tria = display.newRect(0,0,320, 500) tria.x = 240 tria.y = 160 localGroup:insert(tria) return localGroup end
Now the problem is the object that I called is in front of the object “tria” how would I put the object I called behind “tria”.
Thanks