| 1990 | } |
| 1991 | |
| 1992 | int dfhack_timeout_active(lua_State *L) |
| 1993 | { |
| 1994 | int id = luaL_optint(L, 1, -1); |
| 1995 | bool set_cb = (lua_gettop(L) >= 2); |
| 1996 | lua_settop(L, 2); |
| 1997 | if (!lua_isnil(L, 2)) |
| 1998 | luaL_checktype(L, 2, LUA_TFUNCTION); |
| 1999 | |
| 2000 | if (id < 0) |
| 2001 | { |
| 2002 | lua_pushnil(L); |
| 2003 | return 1; |
| 2004 | } |
| 2005 | |
| 2006 | lua_rawgetp(L, LUA_REGISTRYINDEX, &DFHACK_TIMEOUTS_TOKEN); |
| 2007 | lua_rawgeti(L, 3, id); |
| 2008 | if (set_cb && !lua_isnil(L, -1)) |
| 2009 | { |
| 2010 | lua_pushvalue(L, 2); |
| 2011 | lua_rawseti(L, 3, id); |
| 2012 | } |
| 2013 | return 1; |
| 2014 | } |
| 2015 | |
| 2016 | static void cancel_timers(std::multimap<int,int> &timers) |
| 2017 | { |
nothing calls this directly
no test coverage detected