summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-05-08 17:02:15 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-05-08 17:02:15 (GMT)
commit5a2e166f5aeedecdb637d14db5d840396b8d62c3 (patch)
treea5f55b9919b0ca75232f49f1f747b06a431923fe
parent63d2bbecf70df7f88d4fa4ab8186e07d1051d960 (diff)
nopsyncd builds now using Lua 5.2
-rw-r--r--src/l_pipe.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/l_pipe.c b/src/l_pipe.c
index 3812905..dd08fd1 100644
--- a/src/l_pipe.c
+++ b/src/l_pipe.c
@@ -123,7 +123,7 @@ static int l_pipe_consume(lua_State *L)
return 1;
}
-static const struct luaL_reg pipe_funcs [] = {
+static const struct luaL_Reg pipe_funcs [] = {
{ "signal", l_pipe_signal },
{ "getreadfd", l_pipe_getreadfd },
{ "consume", l_pipe_consume },
@@ -132,6 +132,13 @@ static const struct luaL_reg pipe_funcs [] = {
LUALIB_API int luaopen_pipe(lua_State *L)
{
+#if LUA_VERSION_NUM > 501
+ lua_newtable(L);
+ luaL_setfuncs(L, pipe_funcs, 0);
+ lua_pushvalue(L, -1);
+ lua_setglobal(L, LUA_PIPELIBNAME);
+#else
luaL_register(L, LUA_PIPELIBNAME, pipe_funcs);
+#endif
return 1;
}