lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This is true, but pedantic (I think). The first value in the triple has to
be a function (more precisely, callable) otherwise an error is raised (at
present). Admittedly at present the non-callability error is detected on the
first attempted iteration of the loop. This would have to be changed to test
during loop setup so the metamethod could be triggered. However I do not see
any significant problem with this change.

> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-
> bounces@bazar2.conectiva.com.br] On Behalf Of Mark Hamburg
> Sent: 16 December 2009 22:41
> To: Lua list
> Subject: Re: '__iter', yet again!
> 
> That, however, is a semantic change. The generic for doesn't take
> collections. It takes an iterator triple. Note in particular that for
> doesn't take pairs. pairs takes a table and returns an iterator triple
> for the table.
> 
> Mark