MCPcopy Index your code
hub / github.com/NetHack/NetHack / l_obj_timer_peek

Function l_obj_timer_peek

src/nhlobj.c:519–539  ·  view source on GitHub ↗

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"); */

Source from the content-addressed store, hash-verified

517 returns 0 if no such timer attached to the object. */
518/* local timeout = o:peek_timer("hatch-egg"); */
519staticfn int
520l_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.

Callers

nothing calls this directly

Calls 5

l_obj_checkFunction · 0.85
nhl_get_timertypeFunction · 0.85
peek_timerFunction · 0.85
obj_to_anyFunction · 0.85
nhl_errorFunction · 0.85

Tested by

no test coverage detected