lua-users home
lua-l archive

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


> >How about the number of elements in the table? (i.e. number of keys
> >whose values aren't nil, for you pedantic types)
> 
> I have to say I don't detest this proposal. Mostly because it's very
> easy to explain, understand, implement, holds no surprises, and
> would -drastically- speed up a lot of code dependant on table
> length.
> 
> Cons, it'd use another int per table and slow field assignment a
> smidge - although probably only noticeably for arrays - which'd be
> largely offset by the gain from t[#t + 1] code. Not opposed..

As I pointed out, it would also make the manipulation of "mixed tables"
(tables with arrays plus some extra fields) quite tricky.

-- Roberto