lua-users home
lua-l archive

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


On Mon, Jan 3, 2011 at 5:24 AM, Axel Kittenberger <axkibe@gmail.com> wrote:
>> O(1) implementation is possible if really needed, requires work on
>> __newindex too.
>
> I really want to see that! Cause I doubt it.

I guess Dirk means for a __len = number of 'non anonymous' items. ie
those with non-integer keys.

for that simply use a proxy table, keep a 'n' private variable,
increment for any k,v where k=>not integer and v ~= nil, decrease for
k=>not integer and v==nil

-- 
Javier