Hi Jacob,

Am 05.07.2017 um 22:10 schrieb Jacob Champion:
On 07/05/2017 12:30 PM, Jacob Champion wrote:
So... do we care?
If we do, here's a potential patch to *partially* return to the previous
behavior:

--- modules/lua/lua_apr.c
+++ modules/lua/lua_apr.c
@@ -97,6 +97,12 @@ int ap_lua_init(lua_State *L, apr_pool_t *p)
     lua_gettable(L, 2);
     lua_settable(L, 1);

+#if LUA_VERSION_NUM >= 502
+    /* For compatibility, maintain the "apr_table" global that was used
by the
+     * old luaL_register() implementation. */
+    lua_setglobal(L, "apr_table");
+#endif
+
     return 0;
 }

Lua's package.loaded["apr_table"] is still not set here, like it was
with luaL_register. From quick Googling, I think that means it won't
work with the deprecated module() system. I'm not a Lua programmer, so
comments/review/advice welcome.

Thanks for trying to improve this. I'd be all for it if we find a more compatible way of removing the deprecated code. Concerning stability, our docs page tells us:

"mod_lua is still in experimental state. Until it is declared stable, usage and behavior may change at any time, even between stable releases of the 2.4.x series. Be sure to check the CHANGES file before upgrading."

So that would allow us to break things but of course we still do want to not break stuff if we could. But sticking to 5.1 APIs IMHO is now making too many problems.

I'll add our ASF lua Guru Daniel Gruno as CC, maybe he has an idea. I don't understand enough about the lua module system.

@Daniel: this is about the following change:

Index: modules/lua/lua_apr.c
--- modules/lua/lua_apr.c (original)
+++ modules/lua/lua_apr.c Tue Jul  4 20:48:43 2017
@@ -82,7 +82,11 @@ static const luaL_Reg lua_table_methods[
 int ap_lua_init(lua_State *L, apr_pool_t *p)
 {
     luaL_newmetatable(L, "Apr.Table");
+#if LUA_VERSION_NUM < 502
     luaL_register(L, "apr_table", lua_table_methods);
+#else
+    luaL_newlib(L, lua_table_methods);
+#endif
     lua_pushstring(L, "__index");
     lua_pushstring(L, "get");
     lua_gettable(L, 2);

to get rid of old API uses for newer lua versions. Trunk r1800817, 2.4.x r1800835.

Thanks and regards,

Rainer

Reply via email to