summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-04-30 18:47:41 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-04-30 18:47:41 (GMT)
commite5e740fee49b8a52b5d42debf07488503ca5ec40 (patch)
treece9cd65ae0958a5678f16055d3057e0d6bf9beb6
parent673f30441b353881d428380661d7e6782b7aa85b (diff)
support for Lua 5.2
-rw-r--r--config8
-rw-r--r--src/lua-mq.c10
2 files changed, 14 insertions, 4 deletions
diff --git a/config b/config
index 643ceb1..7266fb9 100644
--- a/config
+++ b/config
@@ -3,14 +3,16 @@
# Default prefix
PREFIX = /usr
+LUA_VER=5.2
+
# System's libraries directory (where binary libraries are installed)
-LUA_LIBDIR= $(PREFIX)/lib/lua/5.1
+LUA_LIBDIR= $(PREFIX)/lib/lua/$(LUA_VER)
# System's lua directory (where Lua libraries are installed)
-LUA_DIR= $(PREFIX)/share/lua/5.1
+LUA_DIR= $(PREFIX)/share/lua/$(LUA_VER)
# Lua includes directory
-LUA_INC= $(PREFIX)/include/lua5.1
+LUA_INC= $(PREFIX)/include/lua$(LUA_VER)
# OS dependent
LIB_OPTION= -lrt -shared #for Linux
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;
}