[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: `break [N]' and `continue [N]' in Lua
- From: lb@...
- Date: Sat, 21 Jun 2003 21:53:59 +0200
Hi,
The attached file contains modified Lua 5 parser and lexer files with
added `continue' keyword. In addition, both `break' and `continue'
statements may have optional integer argument specifying which loop is
to be broken or continued. For example:
for i = 1, 10 do
for j = 1, 10 do
for k = 1, 10 do
break -- breaks `for k' loop
break 1 -- breaks `for k' loop
break 2 -- breaks `for j' loop
break 3 -- breaks `for i' loop
break 4 -- error, no loop to break
continue 2 -- continues `for j' loop
...
end
end
end
Compared with the version I posted previously, this is a bug fix
version (upvalues were not closed properly - thanks to Rici for
finding the bug).
Regards,
Leszek
Attachment:
cont2.tar.gz
Description: GNU Zip compressed data