summaryrefslogtreecommitdiff
path: root/src/lua-mq.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua-mq.c')
-rw-r--r--src/lua-mq.c10
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;
}