The introduction of the "continue" statement was enough for the second
point. For me it is very odd how the same arguments that prevented the
introduction of the continue statement have been ignored when
introducing the goto statement. Here an illustration. The following
code snippet is invalid:
for i = 1, 10 do
local x = 2*i
print(x)
if i < 5 then goto a end
local y = i + 1
::a::
print(x, y)
end
Of course. `print(x,y)` is a non-void statement.
while the following is valid:
for i = 1, 10 do
local x = 2*i
print(x)
if i < 5 then goto a end
local y = i + 1
::a::
end
but both violates the rule that a goto cannot jump in a scope where a
new local was defined.
Not so. The scope of the local stops just before the `::a::`, because a label is a void statement. The manual is clear on this point, as Xavier Wang has pointed out in the thread on "Clarification on goto scope".