lua-users home
lua-l archive

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

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 ) 

for value in iterator() do
   process( value )