Cocos2d-x Lua Timers with scheduleGlobal, Callbacks and Cancellation
Environment: Cocos2d-x 3.17
Language: Lua
Use quick-Cocos2d-x’s scheduler helper to run a callback periodically:
Cancel it with the returned handle:
Store the handle on the object that owns the timer and cancel it when the scene or component exits. Otherwise a global callback may keep running and access nodes that have already been destroyed.