diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-04-30 20:47:41 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-04-30 20:47:41 +0200 |
commit | e5e740fee49b8a52b5d42debf07488503ca5ec40 (patch) | |
tree | ce9cd65ae0958a5678f16055d3057e0d6bf9beb6 /src | |
parent | fixed dep for dev package and added some more description (diff) |
support for Lua 5.2
Diffstat (limited to 'src')
-rw-r--r-- | src/lua-mq.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lua-mq.c b/src/lua-mq.c index 07cd2ef..a556818 100644 --- a/src/lua-mq.c +++ b/src/lua-mq.c @@ -192,7 +192,7 @@ static int l_mq_unlink(lua_State *L) return 1; } -static const struct luaL_reg mq_funcs [] = { +static const struct luaL_Reg mq_funcs [] = { { "create", l_mq_create }, { "open", l_mq_open }, { "send", l_mq_send }, @@ -204,6 +204,14 @@ static const struct luaL_reg mq_funcs [] = { LUALIB_API int luaopen_mq(lua_State *L) { +#if LUA_VERSION_NUM > 501 + lua_newtable(L); + luaL_setfuncs(L, mq_funcs, 0); + /* since Lua 5.2 libs shouldn't do that anymore... */ + /* lua_pushvalue(L, -1); */ + /* lua_setglobal(L, "mq"); */ +#else luaL_register(L, "mq", mq_funcs); +#endif return 1; } |