MCPcopy Create free account
hub / github.com/DFHack/dfhack / dfhack_timeout_active

Function dfhack_timeout_active

library/LuaTools.cpp:1992–2014  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1990}
1991
1992int 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
2016static void cancel_timers(std::multimap<int,int> &timers)
2017{

Callers

nothing calls this directly

Calls 8

lua_gettopFunction · 0.85
lua_settopFunction · 0.85
luaL_checktypeFunction · 0.85
lua_pushnilFunction · 0.85
lua_rawgetpFunction · 0.85
lua_rawgetiFunction · 0.85
lua_pushvalueFunction · 0.85
lua_rawsetiFunction · 0.85

Tested by

no test coverage detected