diff options
author | Anders F Bjorklund <afb@users.sourceforge.net> | 2012-09-12 23:26:38 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-10-09 08:28:52 +0300 |
commit | ac959fed0082cb253d45c7a04866e8654e962442 (patch) | |
tree | 8267396b9e374d6d0a0f178d03f9425c2ba0363e /luaext | |
parent | 389b1ab706be8eddba9f00c7084759f670ce96ac (diff) | |
download | librpm-tizen-ac959fed0082cb253d45c7a04866e8654e962442.tar.gz librpm-tizen-ac959fed0082cb253d45c7a04866e8654e962442.tar.bz2 librpm-tizen-ac959fed0082cb253d45c7a04866e8654e962442.zip |
Add lua 5.2 support.
Add compatibility support for both lua-5.1 and lua-5.2,
assuming that the LUA_COMPAT might have been disabled.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Diffstat (limited to 'luaext')
-rw-r--r-- | luaext/lposix.c | 10 | ||||
-rw-r--r-- | luaext/lrexlib.c | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/luaext/lposix.c b/luaext/lposix.c index 3b251571d..f3c787eab 100644 --- a/luaext/lposix.c +++ b/luaext/lposix.c @@ -810,7 +810,7 @@ static int Pmkstemp(lua_State *L) return 2; } -static const luaL_reg R[] = +static const luaL_Reg R[] = { {"access", Paccess}, {"chdir", Pchdir}, @@ -874,15 +874,19 @@ static int exit_override(lua_State *L) exit(luaL_optint(L, 1, EXIT_SUCCESS)); } -static const luaL_reg os_overrides[] = +static const luaL_Reg os_overrides[] = { {"exit", exit_override}, {NULL, NULL} }; +#ifndef lua_pushglobaltable +#define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX) +#endif + int luaopen_rpm_os(lua_State *L) { - lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_pushglobaltable(L); luaL_openlib(L, "os", os_overrides, 0); return 0; } diff --git a/luaext/lrexlib.c b/luaext/lrexlib.c index 81931c0a6..9da5c8254 100644 --- a/luaext/lrexlib.c +++ b/luaext/lrexlib.c @@ -169,7 +169,7 @@ static int rex_gc (lua_State *L) return 0; } -static const luaL_reg rexmeta[] = { +static const luaL_Reg rexmeta[] = { {"match", rex_match}, {"gmatch", rex_gmatch}, {"__gc", rex_gc}, @@ -305,7 +305,7 @@ static const luaL_reg pcremeta[] = { /* Open the library */ -static const luaL_reg rexlib[] = { +static const luaL_Reg rexlib[] = { #ifdef WITH_POSIX {"newPOSIX", rex_comp}, #endif |