From a1e597c7273908071d69644b07e15c1a97c87378 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 19 Jun 2013 14:24:33 +0000 Subject: add support for Lua 5.2 --- rc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rc.c b/rc.c index 4f2bd1d..4ab8036 100644 --- a/rc.c +++ b/rc.c @@ -7,6 +7,9 @@ #include "lualib.h" #include "lauxlib.h" +#if LUA_VERSION_NUM < 502 +# define luaL_newlib(L,l) (lua_newtable(L), luaL_register(L,NULL,l)) +#endif #define MYNAME "rc" #define MYVERSION "OpenRC library for " LUA_VERSION " version " VERSION @@ -238,7 +241,7 @@ static int Psys(lua_State *L) return 1; } -static const luaL_reg R[] = +static const luaL_Reg R[] = { {"runlevel_get", Prunlevel_get}, {"runlevel_exists", Prunlevel_exists}, @@ -269,7 +272,7 @@ static const luaL_reg R[] = LUALIB_API int luaopen_rc (lua_State *L) { - luaL_register(L, MYNAME, R); + luaL_newlib(L, R); set_literal("version", MYVERSION); /** version */ set_literal("initdir", RC_INITDIR); /** initdir */ -- cgit v1.2.3