diff --git a/include/lighttpd/core_lua.h b/include/lighttpd/core_lua.h index fc1503a1..057c6a04 100644 --- a/include/lighttpd/core_lua.h +++ b/include/lighttpd/core_lua.h @@ -174,4 +174,8 @@ INLINE int li_lua_equal(lua_State *L, int index1, int index2) { #endif } +#if LUA_VERSION_NUM == 501 +#define lua_rawlen(L, index) lua_objlen(L, index) +#endif + #endif diff --git a/src/main/value_lua.c b/src/main/value_lua.c index c0a8a0ac..60ec3a2a 100644 --- a/src/main/value_lua.c +++ b/src/main/value_lua.c @@ -26,12 +26,12 @@ static int lua_kvlist_index(lua_State *L) { if (LUA_TTABLE != lua_type(L, 1)) goto fail; - len = lua_objlen(L, 1); + len = lua_rawlen(L, 1); for (i = len; i >= 1; lua_pop(L, 1), --i) { lua_rawgeti(L, 1, i); if (LUA_TTABLE != lua_type(L, -1)) continue; - if (2 != lua_objlen(L, -1)) continue; + if (2 != lua_rawlen(L, -1)) continue; lua_rawgeti(L, -1, 1); switch (lua_type(L, -1)) {