Perhaps it’s again time to consider adding table.new?
It would be nice to have a function like
table.rebuild( [ t, ] min_array_size, min_hash_size)
which sets size constraints and shrinks the table.
The size constraints are active until next invocation of table.rebuild.
if the first parameter (t) is omitted then new table is created.
If 2nd or 3rd parameter is nil, it defaults to zero.