When you use table.insert and try to insert at index 0, table.insert(table,0,value), it will not add the new value to the list, it will instead overwrite any value at index 0. This happens when trying to insert at any index less than 0. This is not intended behavior and was changed in a recent update. I had to change some code that relied on the length of a table, table.insert(table, #table, value). This code segment would not work.
Where the bug happens:
It happens when you try to table.insert a value at index 0 or less.
When it started happening:
It started happening after the most recent roblox update on 7/7/2021
Screenshots and videos of the bug:
Steps to reproduce the issue:
Create a table
table.insert multiple values at index 0
none of them have been inserted
they have all overwritten index 0 instead of being added to the table
This is an intentional behavior change which will be noted in the release notes when they get posted. Before implementing this change we ran extensive analytics and found that almost no games would be affected by this - note that table.insert(t, #t, i) now produces a script analysis warning because this code is incorrect (it’s not just the first insertion that’s problematic, all insertions use off-by-one indices and so you don’t get the correct order).
This change was necessary to fix cases where table.insert with a large negative value or NaN as an index would soft-hang the process.