[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Project lead nominations for standard libraries?
- From: Javier Guerra Giraldez <javier@...>
- Date: Mon, 3 Jan 2011 05:30:26 -0500
On Mon, Jan 3, 2011 at 5:24 AM, Axel Kittenberger <email@example.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