Thanks in advance for any help. Still figuring out how Lua works…
I made a function that uses transition.to. That function can accept a function closure as an argument, which it then passes to the transition.to’s onComplete. Is there a way to add a line of code to that function enclosure before it is passed to transition.to?
Stripped-down example:
[lua]local myVariable = false
local myObject = display.newRect(50,50,50,50)
function testFunction( object, args )
myVariable = true
transition.to(object, {time= 1000, x = args.x, onComplete = args.complete})
--I need to add this to onComplete:
--myVariable = false
end
testFunction(myObject, {x = 200, complete = function() print(“transition completed”) end})[/lua]
I could just add it to the closure, but I’d end up having to add it a few hundred times…
Any info appreciated.