lua-users home
lua-l archive

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


On Thu, Jan 14, 2010 at 12:50 AM, pan shizhu <pan.shizhu@gmail.com> wrote:
> in a function you can use error() for break, return for continue.

Ouch.

I usually just use a nested repeat:

for i = 1, 10 do repeat
    if i % 3 == 0 then
        break -- continue
    end
    print( i )
until true end -- poetic, uh?

The only problem is when you _do_ want to break the outer loop.

--rb