[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: table insertion [was: Lua 5.1 (work2) now available]
- From: David Burgess <dburgess@...>
- Date: Sat, 6 Nov 2004 08:14:27 +1000
> 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
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
Methinks more efficient inserts would be helpful to most of my programs.