[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: table insertion [was: Lua 5.1 (work2) now available]
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 05 Nov 2004 14:09:49 -0200
> 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.
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
> 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.