lua-users home
lua-l archive

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

On Wed, May 6, 2015 at 9:22 AM, Hisham <> wrote:

> The point is not how to workaround this. Aapo's question still stands.

In other languages where return is a statement, when debugging I often
insert returns mid-function to disable functionality.  I assume the
Lua requires return at the end of blocks to avoid confusion:

function foo ()
  a ()
  b ()
  c ()    -- foo will return c()
  d ()

If you wanted to allow labels after returns, you would need to modify
Lua's grammar.

block ::= {stat} [retstat]
retstat ::= return [explist] [‘;’]

Would need to become something like:

block ::= {stat} [retstat] [label]

Or possibly:

block ::= {stat} [retstat] {label}

This would not cause confusion similar to the above, as labels are not

I would not oppose such a change.