Log In  

x=x+shl(
  1,
  y
)

Works fine.

x+=shl(
  1,
  y
)

Syntax error: unclosed (

x+=shl(1,
  y
)

Syntax error: unexpected symbol near ')'

P#60249 2018-12-22 15:47

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.

P#60283 2018-12-23 05:32 ( Edited 2018-12-23 18:10)

Good to know.

P#60293 2018-12-23 12:34

Still a problem with 0.2.3

P#97909 2021-09-28 03:26

Probably not a bug per se, but it would be good to note this somewhere in the documentation.

P#97910 2021-09-28 03:29
1

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.

P#97928 2021-09-28 14:38

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 13:21:28 | 0.007s | Q:19