It seems that the parser treats “=” and “+=” slightly differently in this snippet:
x=rnd();print(x) -- ok x=rnd() print(x) -- ok x=rnd()print(x) -- ok x+=rnd();print(x) -- ok x+=rnd() print(x) -- ok x+=rnd()print(x) -- runtime error |
P#29251 2016-09-24 04:59 ( Edited 2016-09-27 21:39)
:: ultrabrite
actually it's worse than that!
the next character is mangled:
x=1 x+=5qq=2 -- parsed as x+=5 q=2 print(qq) print(q) |
runs fine and prints nil 2 (instead of 2 nil)
P#29253 2016-09-24 07:17 ( Edited 2016-09-24 13:13)
:: samhocevar
Here’s another simple one that gives a syntax error:
x +=1 |
P#29318 2016-09-24 17:13 ( Edited 2016-09-24 21:13)
:: AlexClarke
a line end is a statement end
x;
+=1;
P#29521 2016-09-27 17:21 ( Edited 2016-09-27 21:21)
[Please log in to post a comment]



