| 2048 | } |
| 2049 | |
| 2050 | static void run_timers(color_ostream &out, lua_State *L, |
| 2051 | std::multimap<int,int> &timers, int table, int bound) |
| 2052 | { |
| 2053 | while (!timers.empty() && timers.begin()->first <= bound) |
| 2054 | { |
| 2055 | int id = timers.begin()->second; |
| 2056 | timers.erase(timers.begin()); |
| 2057 | |
| 2058 | lua_rawgeti(L, table, id); |
| 2059 | |
| 2060 | if (lua_isnil(L, -1)) |
| 2061 | lua_pop(L, 1); |
| 2062 | else |
| 2063 | { |
| 2064 | lua_pushnil(L); |
| 2065 | lua_rawseti(L, table, id); |
| 2066 | |
| 2067 | Lua::SafeCall(out, L, 0, 0); |
| 2068 | } |
| 2069 | } |
| 2070 | } |
| 2071 | |
| 2072 | void DFHack::Lua::Core::onUpdate(color_ostream &out) |
| 2073 | { |
no test coverage detected