diff options
author | Diego Nehab <diego.nehab@gmail.com> | 2015-08-21 15:39:34 -0300 |
---|---|---|
committer | Diego Nehab <diego.nehab@gmail.com> | 2015-08-21 15:39:34 -0300 |
commit | e75444ccd1f30a3b5fbc7cec4a85e831bd0560ed (patch) | |
tree | 71475c18fee070c770fc0fe25d0859b7d54c8fbb /src/luasocket.c | |
parent | 321c0c9b1f7b6b83cd83b58e7e259f53eca69373 (diff) | |
download | luasocket-e75444ccd1f30a3b5fbc7cec4a85e831bd0560ed.tar.gz luasocket-e75444ccd1f30a3b5fbc7cec4a85e831bd0560ed.tar.bz2 luasocket-e75444ccd1f30a3b5fbc7cec4a85e831bd0560ed.zip |
New compat.h module implements luaL_setfuncs.
Makes initialization code simpler everywhere.
Diffstat (limited to 'src/luasocket.c')
-rw-r--r-- | src/luasocket.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/luasocket.c b/src/luasocket.c index c4eeab3..7d9c802 100644 --- a/src/luasocket.c +++ b/src/luasocket.c | |||
@@ -17,6 +17,7 @@ | |||
17 | \*=========================================================================*/ | 17 | \*=========================================================================*/ |
18 | #include "lua.h" | 18 | #include "lua.h" |
19 | #include "lauxlib.h" | 19 | #include "lauxlib.h" |
20 | #include "compat.h" | ||
20 | 21 | ||
21 | /*=========================================================================*\ | 22 | /*=========================================================================*\ |
22 | * LuaSocket includes | 23 | * LuaSocket includes |
@@ -83,12 +84,8 @@ static int global_unload(lua_State *L) { | |||
83 | static int base_open(lua_State *L) { | 84 | static int base_open(lua_State *L) { |
84 | if (socket_open()) { | 85 | if (socket_open()) { |
85 | /* export functions (and leave namespace table on top of stack) */ | 86 | /* export functions (and leave namespace table on top of stack) */ |
86 | #if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE) | ||
87 | lua_newtable(L); | 87 | lua_newtable(L); |
88 | luaL_setfuncs(L, func, 0); | 88 | luaL_setfuncs(L, func, 0); |
89 | #else | ||
90 | luaL_openlib(L, "socket", func, 0); | ||
91 | #endif | ||
92 | #ifdef LUASOCKET_DEBUG | 89 | #ifdef LUASOCKET_DEBUG |
93 | lua_pushstring(L, "_DEBUG"); | 90 | lua_pushstring(L, "_DEBUG"); |
94 | lua_pushboolean(L, 1); | 91 | lua_pushboolean(L, 1); |