if then else execution order issue
Hi. Thanks for the work so far on AluminumLua. It's a project with great promise!
I'm noticing a significant scoping issue with "if" statements within function calls. The first is:
bar = 0 function foo() print "start" if bar == 0 then print "bar is zero" end print "finish" end foo()
The output from this lua code is: start finish bar is zero
The internal "then" block is executed after the outer block of the function "foo", printing "finish" before printing "bar is zero".
The code does not exhibit the problem if the "if" is scoped outside of a function, like so:
bar = 0 print "start" if bar == 0 then print "bar is zero" end print "finish"
Also you can work around it by making a separate function to execute the "if" block like so:
bar = 0 function ifBlock() if bar == 0 then print "bar is zero" end end function foo() print "start" ifBlock() print "finish" end foo()
But neither of these solutions are ideal!