[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table library changes (was Re: table.new in 5.3?)
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 25 Nov 2013 19:01:20 +0200
On Mon, Nov 25, 2013 at 5:24 PM, John Hind <john.hind@zen.co.uk> wrote:
> for element in list do
>
> This works because 'list' has a metatable which supplies the appropriate iterator factory for tables specialised as lists.
I do think __iter is a good candidate for a new metamethod. Penlight
'lists' have an iter() method which I tend to use fairly often, even
though I _know_ it's not that efficient. (Moonscript has 'for x in
*t' which expands to the fast but ugly explicit loop)