[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.2 (rc2) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 25 Feb 2013 13:26:52 -0300
> I am very pleased my posting on table.insert and table.remove:
> has been acted upon, however examining the rc2 source code, should not the
> upper boundary for table.remove be 'aux_getn()' rather than 'aux_getn()+1'?
> Mostly it will not matter since that value will be nil anyway, but it could
> cause problems in some scenarios where there is a __len metamethod.
Consider this somewhat common idiom:
-- print and remove all elements from a list 't':
while true do
local e = table.remove(t, 1)
if e == nil then break end
That code would break if 'table.remove' did not accept len+1.