peek at an object timer. return the turn when timer triggers. returns 0 if no such timer attached to the object. */ local timeout = o:peek_timer("hatch-egg"); */
| 517 | returns 0 if no such timer attached to the object. */ |
| 518 | /* local timeout = o:peek_timer("hatch-egg"); */ |
| 519 | staticfn int |
| 520 | l_obj_timer_peek(lua_State *L) |
| 521 | { |
| 522 | int argc = lua_gettop(L); |
| 523 | |
| 524 | if (argc == 2) { |
| 525 | struct _lua_obj *lo = l_obj_check(L, 1); |
| 526 | short timertype = nhl_get_timertype(L, 2); |
| 527 | |
| 528 | if (timer_is_obj(timertype) && lo && lo->obj) { |
| 529 | lua_pushinteger(L, peek_timer(timertype, obj_to_any(lo->obj))); |
| 530 | return 1; |
| 531 | } else { |
| 532 | lua_pushinteger(L, 0); |
| 533 | return 1; |
| 534 | } |
| 535 | } else |
| 536 | nhl_error(L, "l_obj_timer_peek: Wrong args"); |
| 537 | /*NOTREACHED*/ |
| 538 | return 0; |
| 539 | } |
| 540 | |
| 541 | /* stop object timer(s). return the turn when timer triggers. |
| 542 | returns 0 if no such timer attached to the object. |
nothing calls this directly
no test coverage detected