Skip to content
Snippets Groups Projects
Commit 1b51412b authored by Marek Vavruša's avatar Marek Vavruša
Browse files

daemon/bindings: return top to previous after timer

parent 274cfa12
No related branches found
No related tags found
No related merge requests found
......@@ -449,6 +449,7 @@ static void event_callback(uv_timer_t *timer)
lua_State *L = worker->engine->L;
/* Retrieve callback and execute */
int top = lua_gettop(L);
lua_rawgeti(L, LUA_REGISTRYINDEX, (intptr_t) timer->data);
lua_rawgeti(L, -1, 1);
lua_pushinteger(L, (intptr_t) timer->data);
......@@ -457,7 +458,7 @@ static void event_callback(uv_timer_t *timer)
fprintf(stderr, "error: %s\n", lua_tostring(L, -1));
}
/* Clear the stack, there may be event a/o enything returned */
lua_settop(L, 0);
lua_settop(L, top);
/* Free callback if not recurrent or an error */
if (ret != 0 || uv_timer_get_repeat(timer) == 0) {
uv_close((uv_handle_t *)timer, (uv_close_cb) event_free);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment