From f4fa2e1435b0e409ae6a73e7c9fd7a321eb46516 Mon Sep 17 00:00:00 2001 From: MCJack123 Date: Sun, 7 May 2023 23:02:29 -0400 Subject: [PATCH] Fixed table.insert for real --- src/ltablib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ltablib.c b/src/ltablib.c index a1a51bb..db5962c 100644 --- a/src/ltablib.c +++ b/src/ltablib.c @@ -156,13 +156,13 @@ static int tinsert (lua_State *L) { luaL_igeti(L, 1, i-1, i * 2 + 1); luaL_iseti(L, 1, i, i * 2 - 2); /* t[i] = t[i-1] */ } + lua_pop(L, 1); break; } default: { return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); } } - lua_pop(L, 1); luaL_setn(L, 1, e); /* new size */ luaL_iseti(L, 1, pos, -2); /* t[pos] = v */ return 0;