Skip to content

Commit

Permalink
Fixed table.insert for real
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed May 8, 2023
1 parent c2124b0 commit f4fa2e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ltablib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f4fa2e1

Please sign in to comment.