lua-users home
lua-l archive

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



I haven't been using the 'n' for ages, if ever. I wouldn't think that's the problem, and my 'dump()' utility shows the table to be really, really empty. Meaning, 'for x in tbl' never goes in.

You're right about the boolean false stuff, I'll change the code.. nope.

-ak

2.9.2004 kello 14:57, Adam D. Moss kirjoitti:

 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 )
        dump(tbl)
        error "TRAPPED!"
    end
TWN:    2       nil
(empty)

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').

--Adam