[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Newbie questions regarding luasocket, tables
- From: roberto@... (Roberto Ierusalimschy)
- Date: Tue, 8 May 2007 16:01:52 -0300
> In this case, I think the argument for having #t return the real table
> size isn't that it adds a feature, but that it removes an annoying
> special case, leading to a more regular and predictable language.
I don't think so. For instance, many programs use tables with both
"keys" and "indices", such as this:
polyline = { color = "red", thickness = 4;
{0, 0}, {3.5, 4.3}, ...
}
When they iteract over the indices, they want the size of the array part,
not of the entire table.
Lots of people complain that #t does not handle holes in an array.
Returning the "real table size" (that is, the number of elements in the
table) would certainly not improve this situation.
-- Roberto
- References:
- Newbie questions regarding luasocket, tables, mpb
- Re: Newbie questions regarding luasocket, tables, Shmuel Zeigerman
- Re: Newbie questions regarding luasocket, tables, Luiz Henrique de Figueiredo
- Re: Newbie questions regarding luasocket, tables, Sam Roberts
- Re: Newbie questions regarding luasocket, tables, Roberto Ierusalimschy
- Re: Newbie questions regarding luasocket, tables, Sam Roberts