stop object timer(s). return the turn when timer triggers. returns 0 if no such timer attached to the object. without a timer type parameter, stops all timers for the object. */ local timeout = o:stop_timer("rot-organic"); */ o:stop_timer(); */
| 544 | /* local timeout = o:stop_timer("rot-organic"); */ |
| 545 | /* o:stop_timer(); */ |
| 546 | staticfn int |
| 547 | l_obj_timer_stop(lua_State *L) |
| 548 | { |
| 549 | int argc = lua_gettop(L); |
| 550 | |
| 551 | if (argc == 1) { |
| 552 | struct _lua_obj *lo = l_obj_check(L, 1); |
| 553 | |
| 554 | if (lo && lo->obj) |
| 555 | obj_stop_timers(lo->obj); |
| 556 | return 0; |
| 557 | |
| 558 | } else if (argc == 2) { |
| 559 | struct _lua_obj *lo = l_obj_check(L, 1); |
| 560 | short timertype = nhl_get_timertype(L, 2); |
| 561 | |
| 562 | if (timer_is_obj(timertype) && lo && lo->obj) { |
| 563 | lua_pushinteger(L, stop_timer(timertype, obj_to_any(lo->obj))); |
| 564 | return 1; |
| 565 | } else { |
| 566 | lua_pushinteger(L, 0); |
| 567 | return 1; |
| 568 | } |
| 569 | } else |
| 570 | nhl_error(L, "l_obj_timer_stop: Wrong args"); |
| 571 | return 0; |
| 572 | } |
| 573 | |
| 574 | RESTORE_WARNING_UNREACHABLE_CODE |
| 575 |
nothing calls this directly
no test coverage detected