[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: what's wrong with this loop syntax?
- From: Bret Victor <bret@...>
- Date: Mon, 8 Jan 2007 22:24:53 +0000 (UTC)
Shmuel Zeigerman <shmuz <at> actcom.co.il> writes:
> local function strings(S)
> return function() return S:Next() end
> for str in strings(S) do
> -- [code]
Or better yet:
for str in S.Next, S do
This assumes that the function S.Next doesn't change during
the iteration, which is a pretty safe bet.