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 | |
parent | fixed dep for dev package and added some more description (diff) |
support for Lua 5.2
-rw-r--r-- | config | 8 | ||||
-rw-r--r-- | src/lua-mq.c | 10 |
2 files changed, 14 insertions, 4 deletions
@@ -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; } |