summaryrefslogtreecommitdiff
path: root/luaext/lposix.c
diff options
context:
space:
mode:
authorAnders F Bjorklund <afb@users.sourceforge.net>2012-09-12 23:26:38 +0200
committerPanu Matilainen <pmatilai@redhat.com>2012-10-09 08:28:52 +0300
commitac959fed0082cb253d45c7a04866e8654e962442 (patch)
tree8267396b9e374d6d0a0f178d03f9425c2ba0363e /luaext/lposix.c
parent389b1ab706be8eddba9f00c7084759f670ce96ac (diff)
downloadrpm-ac959fed0082cb253d45c7a04866e8654e962442.tar.gz
rpm-ac959fed0082cb253d45c7a04866e8654e962442.tar.bz2
rpm-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/lposix.c')
-rw-r--r--luaext/lposix.c10
1 files changed, 7 insertions, 3 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;
}