Animation loop inconsistent updates

I think I've found a bit of a strange quirk with the animation loop API. In my game, there are a lot of loops running simultaneously, being restarted and drawn based on certain conditions of the game. This has led me to find an inconsistency in the isValid() check.

If you do something simple, like create a new animation loop, give it an imagetable and set it to not loop:

test =, my_imagetable, false)

This animation loop will run forever, and never be invalid, as long as you do not call any of its methods or read any of its properties. You can check isValid() every frame, it will always return true. However the moment you read its frame, image, draw it to the screen, etc. it will update and cease to be valid.

This leads me to believe the update calculations are being done when you read most of these properties, but for some reason not in isValid(). This might be intentional, not sure, but it is problematic when doing things like checking validity before beginning drawing an animation loop that might only appear onscreen for part of its run time, due to player input or other in-game reasons. This led to a bug in my game where observing the current frame by simply printing it fixed the bug. This is probably not desirable.

This is happening on SDK 2.1.0 and 2.1.1 on both the Windows simulator and on device.

Also, a feature request: a function or property to allow manually setting a loop to be invalid. As far as I can tell, this is currently impossible?

Thanks! I'll file an issue so we can take a look at this.

In the meantime you have access to the source in CoreLibs/animation.lua if you feel like looking into a fix for your own project before we get a chance!

1 Like