summaryrefslogtreecommitdiff
path: root/src/l_sig_handler.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-07-26 18:00:40 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-07-26 18:00:40 (GMT)
commit84d7a21071fa177657674596885c870c614d600b (patch)
tree5b5eab74f6af6209a8b3f059f37dae768da945f9 /src/l_sig_handler.c
parent4e1b5c83907da256858c127fcca36777591a11d3 (diff)
make it work with lua 5.2
Diffstat (limited to 'src/l_sig_handler.c')
-rw-r--r--src/l_sig_handler.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/l_sig_handler.c b/src/l_sig_handler.c
index 82902ca..f0616b8 100644
--- a/src/l_sig_handler.c
+++ b/src/l_sig_handler.c
@@ -74,7 +74,7 @@ static int l_signal_handle(lua_State *L)
return 1;
}
-static const struct luaL_reg signal_funcs [] = {
+static const struct luaL_Reg signal_funcs [] = {
{ "init", l_signal_init },
{ "stop", l_signal_stop },
{ "handle", l_signal_handle },
@@ -84,6 +84,13 @@ static const struct luaL_reg signal_funcs [] = {
LUALIB_API int luaopen_signal(lua_State *L)
{
+#if LUA_VERSION_NUM > 501
+ lua_newtable(L);
+ luaL_setfuncs(L, signal_funcs, 0);
+ lua_pushvalue(L, -1);
+ lua_setglobal(L, LUA_SIGNALLIBNAME);
+#else
luaL_register(L, LUA_SIGNALLIBNAME, signal_funcs);
+#endif
return 1;
}