From 97b1974039aacbcaffe62d9e86d150c36b4d9463 Mon Sep 17 00:00:00 2001 From: Bruno Silvestre Date: Fri, 6 Feb 2015 17:44:08 -0200 Subject: [PATCH] Change to luaL_newlib(). --- src/context.c | 7 +++---- src/ssl.c | 6 ++---- src/x509.c | 6 ++---- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/context.c b/src/context.c index 0136b18..5925818 100644 --- a/src/context.c +++ b/src/context.c @@ -749,13 +749,12 @@ LSEC_API int luaopen_ssl_context(lua_State *L) luaL_setfuncs(L, meta, 0); /* Create __index metamethods for context */ - lua_newtable(L); - luaL_setfuncs(L, meta_index, 0); + luaL_newlib(L, meta_index); lua_setfield(L, -2, "__index"); /* Return the module */ - lua_newtable(L); - luaL_setfuncs(L, funcs, 0); + luaL_newlib(L, funcs); + return 1; } #endif diff --git a/src/ssl.c b/src/ssl.c index 357c15f..464e65a 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -868,12 +868,10 @@ LSEC_API int luaopen_ssl_core(lua_State *L) luaL_newmetatable(L, "SSL:Connection"); luaL_setfuncs(L, meta, 0); - lua_newtable(L); - luaL_setfuncs(L, methods, 0); + luaL_newlib(L, methods); lua_setfield(L, -2, "__index"); - lua_newtable(L); - luaL_setfuncs(L, funcs, 0); + luaL_newlib(L, funcs); return 1; } diff --git a/src/x509.c b/src/x509.c index 13b2118..eb1b6f6 100644 --- a/src/x509.c +++ b/src/x509.c @@ -591,12 +591,10 @@ LSEC_API int luaopen_ssl_x509(lua_State *L) luaL_newmetatable(L, "SSL:Certificate"); luaL_setfuncs(L, meta, 0); - lua_newtable(L); - luaL_setfuncs(L, methods, 0); + luaL_newlib(L, methods); lua_setfield(L, -2, "__index"); - lua_newtable(L); - luaL_setfuncs(L, funcs, 0); + luaL_newlib(L, funcs); return 1; }