As the title says. If I have a table p in lua, is using
table.remove(p)
the same as
p[#p] = nil
if so which is quicker - I'd guess the second, but would like some reassurance.
By the 'same as' I mean does the internal array storage shrink using assignment to nil? I can't seem to find this documented anywhere. Does setting the last element in an array to nil, or the last 10 elements in an array to nil mean the array will be shrunk, or does it always keep the storage and never shrink the array again?
I've assumed the array is contiguous, i.e. it has values stored in each array entry up to #p.