[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: I'd give my right arm for a continue statement
- From: Petite Abeille <petite_abeille@...>
- Date: Mon, 24 Jan 2011 21:28:53 +0100
On Jan 22, 2011, at 9:00 AM, Steve Litt wrote:
> I'd give my right arm for a continue statement within a loop.
Another perennial lua-l meta-thread :P
> Have any of you found convenient ways to simulate a continue statement in Lua?
FWIW, I don't use continue statement personally and tend to implement conditional loop with iterator and, optionally, coroutine, e.g.:
local function iterator()
return coroutine.wrap( function() if -- complex conditions -- then coroutine.yield( --complex result-- ) end end )
end
for value in iterator() do
process( value )
end