lua-users home
lua-l archive

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


I'm not sure this is needed, but if other people disagree :) then I think
the Perl-esque idea of breaking out to a labelled statement is the way to
go.

The problem with using numeric levels is that refactoring the code and
changing the number of nested scopes means looking for and changing any
"break N" statements, which I think is a likely source of tricky-to-debug
errors.

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Karel Tuma

hi listers,

i've found myself doing lot of miserable things today, due to inability of
lua
to simply break out of multiple nested breakable scopes in one statement.

finding nothing useful in powerpatches archive i wrote this rather naive
and unintrusive patch - so there is generally no reason why it shouldn't
work,
but i've tested it extensively only with various for/while nested loops.

use:
while foo do
	while bar do
		if baz then eek() break 2 end
	end
end