This commit is contained in:
Roberto Ierusalimschy
2024-01-29 14:29:24 -03:00
parent 108e0bdc84
commit c31d6774ac
7 changed files with 25 additions and 24 deletions

3
lapi.c
View File

@@ -1262,9 +1262,8 @@ LUA_API int lua_next (lua_State *L, int idx) {
api_checknelems(L, 1);
t = gettable(L, idx);
more = luaH_next(L, t, L->top.p - 1);
if (more) {
if (more)
api_incr_top(L);
}
else /* no more elements */
L->top.p -= 1; /* remove key */
lua_unlock(L);