# HG changeset patch # User jbe # Date 1471722990 -7200 # Node ID 90e6db4506778b26def90840256db9b95593193e # Parent 1fd00eed96eea65e6c758f21aec740e291f37ec3# Parent 73d832c4a9b51801d1508cdd2088f7baabf4c8ce merge diff -r 1fd00eed96ee -r 90e6db450677 moonbridge_io.c --- a/moonbridge_io.c Sat Aug 20 21:54:15 2016 +0200 +++ b/moonbridge_io.c Sat Aug 20 21:56:30 2016 +0200 @@ -790,8 +790,7 @@ handle->fd = *fd; /* required for set_linger call */ moonbr_io_handle_set_linger(L, handle, 0); handle->fd = -1; /* avoid closing incomplete handle */ - luaL_getmetatable(L, MOONBR_IO_HANDLE_MT_REGKEY); - lua_setmetatable(L, -2); + luaL_setmetatable(L, MOONBR_IO_HANDLE_MT_REGKEY); lua_newtable(L); // uservalue lua_newtable(L); lua_setfield(L, -2, "writequeue"); @@ -875,8 +874,7 @@ lua_pushinteger(L, ntohs(addr_in.sin_port)); lua_setfield(L, -2, "remote_tcpport"); } - luaL_getmetatable(L, MOONBR_IO_HANDLE_PUBLIC_MT_REGKEY); - lua_setmetatable(L, -2); + luaL_setmetatable(L, MOONBR_IO_HANDLE_PUBLIC_MT_REGKEY); lua_setfield(L, -2, "public"); lua_setuservalue(L, -2); handle->fd = *fd; @@ -1286,8 +1284,7 @@ child->pid = 0; lua_newtable(L); lua_setuservalue(L, -2); - luaL_getmetatable(L, MOONBR_IO_CHILD_MT_REGKEY); - lua_setmetatable(L, -2); + luaL_setmetatable(L, MOONBR_IO_CHILD_MT_REGKEY); if (socketpair(PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0, sockin)) { moonbr_io_errmsg(); lua_pushnil(L);