diff options
author | Kim Alvefur <zash@zash.se> | 2014-09-18 02:22:48 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-09-18 02:22:48 +0200 |
commit | 31be1596b93612e1c848402bd21207ad06ae30e8 (patch) | |
tree | 361f642064745fd1a6601050e7573062ff65e2ad /util-src/encodings.c | |
parent | 57b543c70405092fc24f859c05c734fc8b361030 (diff) | |
parent | b19f5a09a19534973d522e7400139f040d76391b (diff) | |
download | prosody-31be1596b93612e1c848402bd21207ad06ae30e8.tar.gz prosody-31be1596b93612e1c848402bd21207ad06ae30e8.zip |
Merge 0.10->trunk
Diffstat (limited to 'util-src/encodings.c')
-rw-r--r-- | util-src/encodings.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c index b9b6160a..2d5d49d4 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -20,6 +20,10 @@ #include "lua.h" #include "lauxlib.h" +#if (LUA_VERSION_NUM == 502) +#define luaL_register(L, N, R) luaL_setfuncs(L, R, 0) +#endif + /***************** BASE64 *****************/ static const char code[]= @@ -361,35 +365,26 @@ static const luaL_Reg Reg_idna[] = /***************** end *****************/ -static const luaL_Reg Reg[] = -{ - { NULL, NULL } -}; - LUALIB_API int luaopen_util_encodings(lua_State *L) { #ifdef USE_STRINGPREP_ICU init_icu(); #endif - luaL_register(L, "encodings", Reg); + lua_newtable(L); - lua_pushliteral(L, "base64"); lua_newtable(L); luaL_register(L, NULL, Reg_base64); - lua_settable(L,-3); + lua_setfield(L, -2, "base64"); - lua_pushliteral(L, "stringprep"); lua_newtable(L); luaL_register(L, NULL, Reg_stringprep); - lua_settable(L,-3); + lua_setfield(L, -2, "stringprep"); - lua_pushliteral(L, "idna"); lua_newtable(L); luaL_register(L, NULL, Reg_idna); - lua_settable(L,-3); + lua_setfield(L, -2, "idna"); - lua_pushliteral(L, "version"); /** version */ lua_pushliteral(L, "-3.14"); - lua_settable(L,-3); + lua_setfield(L, -2, "version"); return 1; } |