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/inet.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/inet.c')
| -rw-r--r-- | src/inet.c | 5 |
1 files changed, 1 insertions, 4 deletions
| @@ -8,6 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | #include "lua.h" | 9 | #include "lua.h" |
| 10 | #include "lauxlib.h" | 10 | #include "lauxlib.h" |
| 11 | #include "compat.h" | ||
| 11 | 12 | ||
| 12 | #include "inet.h" | 13 | #include "inet.h" |
| 13 | 14 | ||
| @@ -41,11 +42,7 @@ int inet_open(lua_State *L) | |||
| 41 | { | 42 | { |
| 42 | lua_pushstring(L, "dns"); | 43 | lua_pushstring(L, "dns"); |
| 43 | lua_newtable(L); | 44 | lua_newtable(L); |
| 44 | #if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE) | ||
| 45 | luaL_setfuncs(L, func, 0); | 45 | luaL_setfuncs(L, func, 0); |
| 46 | #else | ||
| 47 | luaL_openlib(L, NULL, func, 0); | ||
| 48 | #endif | ||
| 49 | lua_settable(L, -3); | 46 | lua_settable(L, -3); |
| 50 | return 0; | 47 | return 0; |
| 51 | } | 48 | } |
