From 652a506fc290c5490239b9e45a6d2860cc74929a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Sat, 12 Dec 2020 21:54:15 +0200 Subject: [PATCH] [sb2] Port to lua >=5.2. Contributes to JB#52528 --- scratchbox2/luaif/sblib_luaif.c | 6 ++++-- scratchbox2/sb2d/rule_tree_luaif.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scratchbox2/luaif/sblib_luaif.c b/scratchbox2/luaif/sblib_luaif.c index 72709ed2..b7d0dbcf 100644 --- a/scratchbox2/luaif/sblib_luaif.c +++ b/scratchbox2/luaif/sblib_luaif.c @@ -237,7 +237,7 @@ int lua_sb_readlink(lua_State *l) } /* mappings from c to lua */ -static const luaL_reg reg[] = +static const luaL_Reg reg[] = { {"log", lua_sb_log}, {"path_exists", lua_sb_path_exists}, @@ -250,10 +250,12 @@ static const luaL_reg reg[] = int lua_bind_sblib_functions(lua_State *l) { - luaL_register(l, "sblib", reg); + lua_newtable(l); + luaL_setfuncs(l, reg, 0); lua_pushliteral(l,"version"); lua_pushstring(l, "2.0" ); lua_settable(l,-3); + lua_setglobal(l, "sblib"); return 0; } diff --git a/scratchbox2/sb2d/rule_tree_luaif.c b/scratchbox2/sb2d/rule_tree_luaif.c index d21aef3f..310f85e0 100644 --- a/scratchbox2/sb2d/rule_tree_luaif.c +++ b/scratchbox2/sb2d/rule_tree_luaif.c @@ -493,7 +493,7 @@ static int lua_sb_add_net_rule_to_ruletree(lua_State *l) } /* mappings from c to lua */ -static const luaL_reg reg[] = +static const luaL_Reg reg[] = { {"objectlist_create", lua_sb_ruletree_objectlist_create_list}, {"objectlist_set", lua_sb_ruletree_objectlist_set_item}, @@ -537,10 +537,12 @@ static const luaL_reg reg[] = int lua_bind_ruletree_functions(lua_State *l) { - luaL_register(l, "ruletree", reg); + lua_newtable(l); + luaL_setfuncs(l, reg, 0); lua_pushliteral(l,"version"); lua_pushstring(l, "2.0" ); lua_settable(l,-3); + lua_setglobal(l, "ruletree"); return 0; }