MCPcopy Create free account
hub / github.com/defold/defold / TimerCancel

Function TimerCancel

engine/script/src/script_timer.cpp:664–675  ·  view source on GitHub ↗

cancel a timer * * You may cancel a timer from inside a timer callback. * Cancelling a timer that is already executed or cancelled is safe. * * @name timer.cancel * @param handle [type:number] the timer handle returned by timer.delay() * @return true [type:boolean] if the timer was active, false if the timer is already cancelled / complete * @examples *

Source from the content-addressed store, hash-verified

662 *
663 */
664 static int TimerCancel(lua_State* L)
665 {
666 int top = lua_gettop(L);
667 const int handle = luaL_checkint(L, 1);
668
669 dmScript::HTimerWorld timer_world = CheckTimerWorld(L);
670
671 bool cancelled = dmScript::CancelTimer(timer_world, (dmScript::HTimer)handle);
672 lua_pushboolean(L, cancelled ? 1 : 0);
673 assert(top + 1 == lua_gettop(L));
674 return 1;
675 }
676
677 /*# trigger a callback
678 *

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
CheckTimerWorldFunction · 0.85
CancelTimerFunction · 0.85
lua_pushbooleanFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected