lua-users home
lua-l archive

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




2011/6/14 steve donovan <steve.j.donovan@gmail.com>
On Tue, Jun 14, 2011 at 12:35 PM, David Given <dg@cowlark.com> wrote:
> @label: -- 0
> do
>  goto label
>  do
>    @label: -- 1
>  end
>  @label: -- 2
> end
>
> Does the goto jump to 0, 1, 2, or is this a compilation error?

Using the experimental method, it goes to the first label. In fact,
putting a 'goto label' in block 1 still goes to 0, which is a wee bit
surprising.

Of course (talking about code generation) first prize is if Lua
supported some kind of #line directive and truly become the C of
dynamic languages. But that might be a bit specialized ...

steve d.

But this program output:
0
2

:(


the code: 

@label: -- 0
print"0"
do
 goto label
 do
   @label: -- 1
   print"1"
 end
 @label: -- 2
 print"2"
end