|
@@ -233,24 +233,23 @@ static int ul_ufd_add(lua_State *L)
|
|
|
int ref;
|
|
|
int fd_ref;
|
|
|
|
|
|
- flags = luaL_checkinteger(L, -1);
|
|
|
+ flags = luaL_checkinteger(L, 3);
|
|
|
if (!flags) {
|
|
|
lua_pushstring(L, "flags cannot be zero");
|
|
|
lua_error(L);
|
|
|
}
|
|
|
- lua_pop(L, 1);
|
|
|
|
|
|
- luaL_checktype(L, -1, LUA_TFUNCTION);
|
|
|
+ luaL_checktype(L, 2, LUA_TFUNCTION);
|
|
|
|
|
|
- fd = get_sock_fd(L, -2);
|
|
|
+ fd = get_sock_fd(L, 1);
|
|
|
|
|
|
lua_getglobal(L, "__uloop_cb");
|
|
|
- lua_pushvalue(L, -2);
|
|
|
+ lua_pushvalue(L, 2);
|
|
|
ref = luaL_ref(L, -2);
|
|
|
lua_pop(L, 1);
|
|
|
|
|
|
lua_getglobal(L, "__uloop_fds");
|
|
|
- lua_pushvalue(L, -3);
|
|
|
+ lua_pushvalue(L, 1);
|
|
|
fd_ref = luaL_ref(L, -2);
|
|
|
lua_pop(L, 1);
|
|
|
|