lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2018-07-06 14:58 GMT+02:00 Roberto Ierusalimschy <>:
>> Is it still the case in Lua 5.4 that the array part of a table is
>> never shrunk except possibly when you assign a value to a positive
>> integer index outside it?
> That was not the case in previous versions and it is not the case in 5.4.
>   t = {nil, nil, nil, nil}
>   -- array part has size 4, hash part has size 0
>   t.a = true       -- force a rehash
>   -- now, array part has size 0, hash part has size 1

OK, is a rehash still only triggered by an assignment to a new key or
will collectgarbage()
or even something else also do it now?