aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-06-14 06:43:43 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-06-14 06:43:43 +0000
commitd1cac9d7be97e7c6ae8d28047c4a3e59a7929db1 (patch)
tree66d1062f6d82da97468c6123b4eccf02841e1bea
parentebf1667be0629c74370e4b9e7f7d3b91f3feea71 (diff)
downloadpingu-d1cac9d7be97e7c6ae8d28047c4a3e59a7929db1.tar.bz2
pingu-d1cac9d7be97e7c6ae8d28047c4a3e59a7929db1.tar.xz
lua: add support for lua-5.2
-rw-r--r--lua-client.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lua-client.c b/lua-client.c
index 9004dbf..ad18f30 100644
--- a/lua-client.c
+++ b/lua-client.c
@@ -14,6 +14,10 @@
#define LIBNAME "pingu.client"
+#if LUA_VERSION_NUM < 502
+# define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l))
+#endif
+
static int pusherror(lua_State *L, const char *info)
{
lua_pushnil(L);
@@ -61,7 +65,7 @@ close_err:
return ret;
}
-static const luaL_reg reg_pingu_methods[] = {
+static const luaL_Reg reg_pingu_methods[] = {
{"open", Padm_open},
{NULL, NULL},
};
@@ -69,7 +73,7 @@ static const luaL_reg reg_pingu_methods[] = {
LUALIB_API int luaopen_pingu_client(lua_State *L)
{
- luaL_register(L, LIBNAME, reg_pingu_methods);
+ luaL_newlib(L, reg_pingu_methods);
lua_pushliteral(L, "version");
lua_pushliteral(L, PINGU_VERSION);
lua_settable(L, -3);