When a short-form "if" is directly followed by an "end", it causes an error:
function test(x) if (x==1) print "boo" end test(1) |
Inserting a newline before the "end" fixes it:
function test(x) if (x==1) print "boo" end test(1) |
v0.1.0 on Windows
P#10137 2015-04-22 19:34 ( Edited 2015-04-28 11:03)
Fixed for the next update (0.1.1)
An alternative workaround in the meantime is to put indentation before the if:
function test(x) if (x==1) print "boo" end test(1) |
is also ok.
Apologies anyone who got stumped by this bug and the cryptic <eof> error message. So confusing!
P#10202 2015-04-25 02:39 ( Edited 2015-04-25 06:40)
Actually, I did write it this way (indented), but it was somehow trimmed away upon pasting the code.
I just tested it again, and indenting doesn't change the behavior for me; only the newline does.
P#10222 2015-04-26 04:51 ( Edited 2015-04-26 08:53)
Another interesting thing about the short-if is that a space is required between the ")" and expression,
if(w==nil) w=1 -- OK if(w==nil)w=1 -- Error |
P#10274 2015-04-28 07:03 ( Edited 2015-04-28 11:03)
[Please log in to post a comment]