Skip to content

Commit

Permalink
Let __gc be inside of the metatables.
Browse files Browse the repository at this point in the history
  • Loading branch information
fidlej committed Oct 31, 2012
1 parent 90308e2 commit 96206fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zmq.c
Expand Up @@ -526,15 +526,15 @@ DLL_EXPORT int luaopen_libluazmq(lua_State *L)
{
/* context metatable. */
luaL_newmetatable(L, MT_ZMQ_CONTEXT);
lua_createtable(L, 0, sizeof(ctxmethods) / sizeof(luaL_reg) - 1);
luaL_register(L, NULL, ctxmethods);
lua_setfield(L, -2, "__index");
lua_pushvalue(L, -1);
lua_setfield(L, -1, "__index");

/* socket metatable. */
luaL_newmetatable(L, MT_ZMQ_SOCKET);
lua_createtable(L, 0, sizeof(sockmethods) / sizeof(luaL_reg) - 1);
luaL_register(L, NULL, sockmethods);
lua_setfield(L, -2, "__index");
lua_pushvalue(L, -1);
lua_setfield(L, -1, "__index");

luaL_register(L, "zmq", zmqlib);

Expand Down

0 comments on commit 96206fb

Please sign in to comment.