[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re[4]: why no "continue" statement for loops?
- From: lb@...
- Date: Tue, 24 Jun 2003 07:56:35 +0200
BA> Just out of interest, what happens in the following example?
BA> function foo()
BA> local foo2 = function()
BA> while true do
BA> break 2
BA> end
BA> end
BA> while true do
BA> foo2()
BA> end
BA> end
BA> Does the "break 2" exit foo()? Or just foo2()?
BA> I would expect an error to be generated by this code. 'break N'
BA> should not be expected to cross call frame boundary for a simple
BA> reason that the context of a function call is generally unknown.
That is how Lua behaves at trying to run the above code. A compilation
error occurs: "test:5: no loop to break near `end'".
Leszek