Log In  

This works:

s = [[ ... [ ... ]]
x = 0
x += 1

But this no longer works:

s = [[ ... [[ ... ]]
x = 0
x += 1
** syntax error line 3(tab 0)
** x += 1
** syntax error near '+'

It seems that in the search/replace phase of PICO-8 parsing, when "x += 1" gets replaced with "x = x + (1)", something erroneously considers that the second "[[" was opening a nested string, and does not perform any replacements until it finds a (nonexisting) matching "]]".

P#58567 2018-10-31 08:03 ( Edited 2018-11-02 19:14)

I'm noticing you are not including all closing brackets on the 2nd one. Perhaps it just needs a closing ?

s = [[ ... [[ ... ]]]]
x = 0
x += 1

Although I'm not sure what "..." means.

P#58574 2018-10-31 12:56 ( Edited 2018-10-31 16:56)

@dw817 it is illegal to nest [[ ]] brackets, so there is no "closing" required. These two are equivalent in Lua 5.2:

s = [[ ... [[ ... ]]

s = " ... [[ ... "
P#58620 2018-11-01 07:27 ( Edited 2018-11-01 11:27)

Curious, what does "..." mean ?

P#58623 2018-11-01 13:37 ( Edited 2018-11-01 17:37)

@dw817 nothing, it's just three dots :-) I could have put any random characters there. Sorry if that was confusing.

P#58635 2018-11-01 17:55 ( Edited 2018-11-01 21:55)

Yet Pico-8 accepts it as not an error ?

P#58640 2018-11-01 21:39 ( Edited 2018-11-02 01:39)

The PICO-8 parser accepts [[ abc [[ def ]] ghi ]] and treats it as two nested strings, but then the PICO-8 Lua interpreter treats it as an error and fails to run.

P#58660 2018-11-02 03:31 ( Edited 2018-11-02 07:31)

Two nested strings ? Can you give a working example of this, please ?

P#58673 2018-11-02 12:23 ( Edited 2018-11-02 16:23)

There is no working example of it, since it is illegal.

P#58683 2018-11-02 15:14 ( Edited 2018-11-02 19:14)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 12:28:03 | 0.012s | Q:21