[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A question about table's length
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 31 Dec 2009 07:36:13 +0200
On Wed, Dec 30, 2009 at 12:05 PM, Philippe Lhoste <PhiLho@gmx.net> wrote:
> Perhaps the comment from ltable.c:
Which is a clear statement about the current implementation. All in
all, it's best to avoid holes. We could go to a lot of trouble to
handle holey arrays, but their behaviour is not fully determined.
BTW, Lua iterator sequences have the same problems with nil values,
since they end the iteration.
A map() function could easily generate lots of holes:
map(tonumber,{'10','x','20','y'}) --> {10,nil,20,nil}
I would suggest that the result here should actually be {10,20}, that
is, if the function called by map() returns nil, then it should not be
part of the result array. We avoid holes, and get a convenient
filter-map idiom.
steve d.
- References:
- A question about table's length, h visli
- Re: A question about table's length, Klaus Ripke
- Re: A question about table's length, h visli
- Re: A question about table's length, Klaus Ripke
- Re: A question about table's length, h visli
- Re: A question about table's length, Klaus Ripke
- Re: A question about table's length, Vaughan McAlley
- Re: A question about table's length, David Manura
- Re: A question about table's length, steve donovan
- Re: A question about table's length, Philippe Lhoste