x=x+shl( 1, y ) |
Works fine.
x+=shl( 1, y ) |
Syntax error: unclosed (
x+=shl(1, y ) |
Syntax error: unexpected symbol near ')'
Yeah, this is an invisible shortcoming of how the += language extension is implemented. x+=y isn't a part of Lua, so Pico-8 adds it by replacing x+=y with x=x+(y) before giving it to Lua.
In these cases, it sees
x+=shl( |
and replaces it with
x=x+(shl() |
which produces the "unclosed (" error. When it sees
x+=shl(1, |
it replaces it with
x=x+(shl(1,) |
which produces the "unexpected symbol near ')'" error.
It'd be a big change to fix it, I think. Pico-8 would have to be much smarter about doing its own parsing around the += operator.
Probably not a bug per se, but it would be good to note this somewhere in the documentation.
What do you mean? It is a bug in the pico8 pre-processor, as it’s not a desired or documented limitation. Two independent things in the language fail to work as expected when combined.
[Please log in to post a comment]