Faulty table.remove pos parameter documentation

there’s no documentation that references towards that table.remove(t, nil) would remove #t, the only thing that’s mentioned is if 0 is used it removes #t, this feels like an error in either documentation or unintentional error in the engine as utilizing table.remove(t, 0) doesn’t do anything

this oversight has caused a number of faulty behaviors as the expectation was that nil wouldn’t cause a removal of #t

Documentation

pos = 0
afbeelding

pos = nil
afbeelding

Page URL: https://create.roblox.com/docs/reference/engine/libraries/table#remove

2 Likes

This is just an acknowledgment announcement!

We’ve filed a ticket into our internal database for this issue, and will come back as soon as we have updates!

Thanks for flagging!

2 Likes

Hello Plushie! Thanks for flagging this issue.

You called out a couple issues with the remove function for tables. The first one is that the docs state that using 0 parameter can work with a numeric key set to 0 which doesn’t seem to work in practice. The second issue is that using ‘nil’ as a parameter seems to remove the last entry which isn’t documented.

I’ve verified that using 0 as a parameter doesn’t seem to work as expected and I’ve removed it from our documentation. I’ve also added a sentence regarding the default behavior if a pos was not provided (defaults to the length of the table, removing the last element) which would explain your ‘nil’ behavior as well.

Thanks again for raising this up and please reach out if you see any other discrepancies.

Have a great day :slight_smile:

1 Like