lua-users home
lua-l archive

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


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