[SOLVED] How to make an object rotate or move forever?

You pasted the wrong code above. I did originally typo it, but this is the final version I posted:

transition.to( self, { time=1000, rotation=self.rotation+20, transition=easing.inOutBack, onComplete=self } )

What I’ve done is ‘attached’ the function directly to the object and then had the transition look at the object for an onComplete method.

Your code could well have worked fine, but it has been my practice for years to use local functions instead of global ones.  My technique above makes the function local (to the object).

Because there are effectively ‘two’ onComplete methods, I simply swap them on each call.