lua-users home
lua-l archive

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


> Oh, one more thing, I seriously think the cases having table name twice
> (s.a. 't[*t+1]=' suck). Variable names may be long, and typing them
> twice to make a single thing makes no sense.
Roberto Ierusalimschy :
> Well, with this argument we are back to the discussion of why Lua does
> not have += :) (After all, to write t=t+1 you need to write the variable
> name twice.)

>> Just to make it clear, by length of a table I mean the index of the last
>> non-nil element plus 1, or 0 on an empty table. This value can be stored
>> as part of the table structure and updated as needed on the C side:

> This implies in extra memory for every table in Lua. Moreover, there is
> the problem of how to update it efficiently when you erase a field.

I agrree with Mark Hamburg that we have two separate issues; syntax
and implemenatation.

Syntax (the lesser isue), it would be nice if we dont have to repeat the name.
Would an integer in the table structure use more memory nett than the
'n' implementation?
Methinks more efficient inserts would be helpful to most of my programs.

DB