lua-users home
lua-l archive

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


On 24 November 2013 01:11, Paul Merrell <marbux@gmail.com> wrote:
> ... thus far, I have been unable to persuade goto to
> accept a string variable as the target label. I get a missing name
> error for the variable label's name. Is this a known limitation or is
> there some way to write something like:

The goto statement takes a name, rather than an expression[1]. It gets
compiled as a JMP to a bytecode offset, so there's no way to use
variable labels.

$ luac -l -p - <<< 'goto label ::label::'
main <stdin:0,0> (2 instructions at 0x8cd2970)
0+ params, 2 slots, 1 upvalue, 0 locals, 0 constants, 0 functions
1 [1] JMP       0 0 ; to 2
2 [1] RETURN   0 1

[1]: http://www.lua.org/manual/5.2/manual.html#9