diff options
-rw-r--r-- | src/l_pipe.c | 9 |
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; } |