Recursion and transition.to

Should I worry about a memory leak using the code below?

It moves an image of a piston up and down continuously.

What I’m asking is, does a transition become garbage once it
completes and it’s callback function is called?

y appears to remain constant and it isn’t global

[lua]machine.pump2.trans = function()
transition.to( machine.pump2, { time=1000, y=y+25, onComplete=function()
transition.to( machine.pump2, { time=1000, y=y+15, onComplete=machine.pump2.trans})
end
} )
end
machine.pump2.trans1 = machine.pump2.trans()[/lua] [import]uid: 8384 topic_id: 15612 reply_id: 315612[/import]

You might want to see this article here

this talks about pulsating, which is similar to what you are after, where you want to move between two transitions states.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15612 reply_id: 57685[/import]