lua-users home
lua-l archive

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




2011/6/14 Lorenzo Donati <lorenzodonatibz@interfree.it>
On 14/06/2011 6.02, Xavier Wang wrote:

Sorry for top posting but maybe there is a mailer problem here (encoding?).
I don't understand the reply. This is what I get from your reply:



Or, makes goto jumps into a local variable's scope:

for i = 1, 10 do
    if i % 2 == 0 then goto continue end
    print(i)
    local continue
end

is that OK?

But I suggested using a pair of colons on both sides of the label as in "::continue::" (without quotes).

So this should be the code.


for i = 1, 10 do
 if i % 2 == 0 then goto continue end
 print(i)
 local continue
 ::continue::
 -- and if you use continue (the local) here, the compiler will flag the error bacuse you're jumping in a variable scope.
end

Sorry for my confusion, I mean maybe using a local variable scope for goto destination is better than define a (whatever) label statement.

i.e. goto statement only used transfer to the beginning of the life time of some local variable. that will avoid introducing new grammar for labels.