lua-users home
lua-l archive

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

Asko Kauppi wrote:
It's deep down in the code, but this is what catches it:

    local n= table.getn(tbl)

    if (n>0 and (not tbl[n])) then  -- BUG TRAPPING in Lua5.1w1 !!!
        print( "TWN:", n, tbl.n )
        error "TRAPPED!"

TWN:    2       nil

I'm pretty sure (as was mentioned some time in the past) that
the 'n' index no longer literally exists in the table (thank
goodness!).  getn/setn now keep the table->'n' mapping somewhere
private (or not-so-private -- perhaps the registry -- but at
least this stops tables being implicitly polluted with 'n').