Does setting a key to nil in a table construction actually do anything?

I have seen some scripts that have something like

local t =
    thing = nil

This doesn’t even add the key to the table, the table would still be empty at the end. So why is it done, does it actually do anything.

I do it as a way of identifying what the property is going to be. Then if I need to ever think “oh, what was thing called again?” it’s in the table initialization.

Once actual types come out of beta it’ll probably be useless, though. That’ll be nice.

It probably has to do with a legacy method of allocating a size during table construction by pre-filling a table with a given amount of elements or the developer not knowing that what they’re doing is wholly pointless. Thinking more the latter than the former.

Pre-filling isn’t necessary any longer now that table.create exists. The size argument allows you to specify how many slots should be pre-allocated during table construction so that your table isn’t reallocating and resizing when you start going over the element space.

So: unless there’s allocation merit here, no, it does nothing.

I believe it might. Setting keys to nil doesnt usually delete them right away (this is after assignment though so idk). This is to prevent next from causing problems after key deletion.
You can tell if it still “exists” by using next(table, oldKey)
If it errors then its been completely deleted
Otherwise, it left behind a tombstone
I know for arrays however they will be there until elements are added