Skip to content

Commit

Permalink
[lua] use lua5.2+ lua_rawlen instead of lua_objlen
Browse files Browse the repository at this point in the history
Change-Id: I9ad64c1632d08907a64fc02b5e54b62a2d6a5550
  • Loading branch information
stbuehler committed Dec 27, 2024
1 parent 96f43af commit 35ad3e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/lighttpd/core_lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/main/value_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 35ad3e0

Please sign in to comment.