diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-07-26 18:00:40 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-07-26 18:00:40 (GMT) |
commit | 84d7a21071fa177657674596885c870c614d600b (patch) | |
tree | 5b5eab74f6af6209a8b3f059f37dae768da945f9 /src/l_log.c | |
parent | 4e1b5c83907da256858c127fcca36777591a11d3 (diff) |
make it work with lua 5.2
Diffstat (limited to 'src/l_log.c')
-rw-r--r-- | src/l_log.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/l_log.c b/src/l_log.c index 8da64bb..a405909 100644 --- a/src/l_log.c +++ b/src/l_log.c @@ -79,7 +79,7 @@ static int l_log_printf(lua_State *L) return 0; } -static const struct luaL_reg log_funcs [] = { +static const struct luaL_Reg log_funcs [] = { { "init", l_log_init }, { "close", l_log_close }, { "add_target", l_log_add_target }, @@ -90,7 +90,14 @@ static const struct luaL_reg log_funcs [] = { LUALIB_API int luaopen_log(lua_State *L) { +#if LUA_VERSION_NUM > 501 + lua_newtable(L); + luaL_setfuncs(L, log_funcs, 0); + lua_pushvalue(L, -1); + lua_setglobal(L, LUA_LOGLIBNAME); +#else luaL_register(L, LUA_LOGLIBNAME, log_funcs); +#endif lua_pushliteral(L, "ERROR"); lua_pushinteger(L, ERROR); lua_settable(L, -3); |