[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: hpairs?
- From: Mark Hamburg <mark@...>
- Date: Tue, 28 Dec 2010 13:15:39 -0800
On Dec 28, 2010, at 11:45 AM, Richard Hundt wrote:
> Is there something inherently Bad about doing this?
>
> for k,v in next, t, #t > 0 and #t or nil do
> ...
> end
There is nothing in the contract for next that guarantees that it will work.
In fact depending on the way you go about constructing the table, there are probably ways in which it won't work -- e.g., I suspect you can build a table t for which #t > 0 but for which all of the elements are in the hash section and I suspect that next won't do what you want in this case.
Mark