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

Function l_obj_timer_has

src/nhlobj.c:495–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493/* does object have a timer of certain type? */
494/* local hastimer = o:has_timer("rot-organic"); */
495staticfn int
496l_obj_timer_has(lua_State *L)
497{
498 int argc = lua_gettop(L);
499
500 if (argc == 2) {
501 struct _lua_obj *lo = l_obj_check(L, 1);
502 short timertype = nhl_get_timertype(L, 2);
503
504 if (timer_is_obj(timertype) && lo && lo->obj) {
505 lua_pushboolean(L, obj_has_timer(lo->obj, timertype));
506 return 1;
507 } else {
508 lua_pushboolean(L, FALSE);
509 return 1;
510 }
511 } else
512 nhl_error(L, "l_obj_timer_has: Wrong args");
513 return 0;
514}
515
516/* peek at an object timer. return the turn when timer triggers.
517 returns 0 if no such timer attached to the object. */

Callers

nothing calls this directly

Calls 4

l_obj_checkFunction · 0.85
nhl_get_timertypeFunction · 0.85
obj_has_timerFunction · 0.85
nhl_errorFunction · 0.85

Tested by

no test coverage detected