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/mime.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/mime.c')
-rw-r--r-- | src/mime.c | 9 |
1 files changed, 1 insertions, 8 deletions
@@ -6,10 +6,7 @@ | |||
6 | 6 | ||
7 | #include "lua.h" | 7 | #include "lua.h" |
8 | #include "lauxlib.h" | 8 | #include "lauxlib.h" |
9 | 9 | #include "compat.h" | |
10 | #if !defined(LUA_VERSION_NUM) || (LUA_VERSION_NUM < 501) | ||
11 | #include "compat-5.1.h" | ||
12 | #endif | ||
13 | 10 | ||
14 | #include "mime.h" | 11 | #include "mime.h" |
15 | 12 | ||
@@ -81,12 +78,8 @@ static UC b64unbase[256]; | |||
81 | \*-------------------------------------------------------------------------*/ | 78 | \*-------------------------------------------------------------------------*/ |
82 | MIME_API int luaopen_mime_core(lua_State *L) | 79 | MIME_API int luaopen_mime_core(lua_State *L) |
83 | { | 80 | { |
84 | #if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE) | ||
85 | lua_newtable(L); | 81 | lua_newtable(L); |
86 | luaL_setfuncs(L, func, 0); | 82 | luaL_setfuncs(L, func, 0); |
87 | #else | ||
88 | luaL_openlib(L, "mime", func, 0); | ||
89 | #endif | ||
90 | /* make version string available to scripts */ | 83 | /* make version string available to scripts */ |
91 | lua_pushstring(L, "_VERSION"); | 84 | lua_pushstring(L, "_VERSION"); |
92 | lua_pushstring(L, MIME_VERSION); | 85 | lua_pushstring(L, MIME_VERSION); |