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 "]]".



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.


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

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

s = " ... [[ ... "

Curious, what does "..." mean ?


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


Yet Pico-8 accepts it as not an error ?


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.


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


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



[Please log in to post a comment]