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 *
| 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 | * |
nothing calls this directly
no test coverage detected