[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: [PROPOSAL] a new function: table.proto()
- From: Benoit Germain <bgermain@...>
- Date: Tue, 4 May 2010 18:42:14 +0200
> -----Message d'origine-----
> De : lua-bounces@bazar2.conectiva.com.br [mailto:lua-
> bounces@bazar2.conectiva.com.br] De la part de Javier Guerra Giraldez
>
> in any case, being a vector (which the array part of Lua's table
> already is) doesn't make any easier to find the highest integer key
> without a linear search at some point.
The idea would be that with a true vector, there is no such thing as a hole (absent key), and iterating over vector elements can perfectly yield a [scalar/nil] pair without aborting the loop. For a vector, operator # *is* the same thing as std::vector::size(). Thus the highest integer key is the vector's size, and the values can be anything you want, and nil isn't a special case that breaks iteration, just a value like any other.
Anyway, this is just noise since we are unlikely to see this happen someday (at least not in my lifetime :-).
- References:
- [PROPOSAL] a new function: table.proto(), François Perrad
- Re: [PROPOSAL] a new function: table.proto(), Duncan Cross
- Re: [PROPOSAL] a new function: table.proto(), steve donovan
- RE: [PROPOSAL] a new function: table.proto(), Benoit Germain
- Re: [PROPOSAL] a new function: table.proto(), GrayFace
- RE: [PROPOSAL] a new function: table.proto(), Benoit Germain
- Re: [PROPOSAL] a new function: table.proto(), Javier Guerra Giraldez
- Re: [PROPOSAL] a new function: table.proto(), Alex Queiroz
- Re: [PROPOSAL] a new function: table.proto(), Javier Guerra Giraldez
- RE: [PROPOSAL] a new function: table.proto(), Benoit Germain
- Re: [PROPOSAL] a new function: table.proto(), Javier Guerra Giraldez