From d1cac9d7be97e7c6ae8d28047c4a3e59a7929db1 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 14 Jun 2013 06:43:43 +0000 Subject: lua: add support for lua-5.2 --- lua-client.c | 8 ++++++-- 1 file 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); -- cgit v1.2.3