Hi, I was interested to use uqmi in another project using gentoo, so I needed to create an ebuild package. I'm using lua-5.3, so I hit some compile errors with libubox
Now, I sense that you are unlikely to upgrade your lua anytime soon, but these changes seem pretty trivial and I think with a wrapper for "luaL_setfuncs" which does something like the following you should be able to support all versions of lua 5.1-5.4? #if LUA_VERSION_NUM < 502 # define luaL_setfuncs(L,l,nup) luaI_openlib(L,NULL,l,nup) #endif I'm not really a lua guy though... Just know enough to shoot foot off.. Could someone please take a look at this and perhaps smooth it off to ensure it works with your existing lua5.1 as well? Signed-off-by: Ed Wildgoose <li...@wildgooses.com> --- a/lua/uloop.c 2020-12-14 14:00:27.826908981 +0000 +++ b/lua/uloop.c 2020-12-14 14:00:43.478066405 +0000 @@ -57,7 +57,7 @@ lua_pushvalue(L, -1); lua_setmetatable(L, -3); lua_pushvalue(L, -2); - luaI_openlib(L, NULL, reg, 1); + luaL_setfuncs(L, reg, 1); lua_pushvalue(L, -2); return ret; @@ -341,8 +341,8 @@ if (pid == 0) { /* child */ - int argn = lua_objlen(L, -3); - int envn = lua_objlen(L, -2); + int argn = lua_rawlen(L, -3); + int envn = lua_rawlen(L, -2); char** argp = malloc(sizeof(char*) * (argn + 2)); char** envp = malloc(sizeof(char*) * (envn + 1)); int i = 1; @@ -404,7 +404,7 @@ return 1; } -static luaL_reg uloop_func[] = { +static luaL_Reg uloop_func[] = { {"init", ul_init}, {"run", ul_run}, {"timer", ul_timer}, @@ -428,7 +428,11 @@ lua_createtable(L, 1, 0); lua_setglobal(L, "__uloop_fds"); - luaL_openlib(L, "uloop", uloop_func, 0); + //luaL_openlib(L, "uloop", uloop_func, 0); + lua_newtable(L); + luaL_setfuncs(L, uloop_func, 0); + lua_setglobal(L, "uloop"); + lua_pushstring(L, "_VERSION"); lua_pushstring(L, "1.0"); lua_rawset(L, -3); _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel