lua-users home
lua-l archive

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

2012/2/1 Dirk Laurie <>:
> 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".

It seems to me that this is an ad hoc definitions that goes against
the intuitive, simple logic. Even if it is correct from the formal
point of view yet it does constitute a problem in my point of view
because it is against common understanding.

I'm also wondering what about the repeat/until construct where the
until branch sees all the local declarations inside the body of the

For example:

local i = 0
  if i % 2 == 0 then goto a end
  local j = 10 - i
  i = i + 1
until j <= 0

should be considered valid ?

The until statement sees the j variable but when the goto statement is
given the local declaration of j is skipped. Is the code above valid
or not ?

Please note that this was exactly the same reason the prevented the
introduction of the continue statement. I don't understand why this
was a good reason against the reasonable "continue" statement and it
does not hold for the much worst goto statement.