From c31d6774ac7db4cfbc548ce507ae65ab6036f873 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 29 Jan 2024 14:29:24 -0300 Subject: Details --- lapi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index b8e58801..bb76b15a 100644 --- a/lapi.c +++ b/lapi.c @@ -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); -- cgit v1.2.3-55-g6feb