There's something weird going on here; using ..= along with a single-line if-then-end statement causes a syntax error that makes no sense:
syntax error line 16 (tab 0) if x<2 then bad..="1" end ')' expected near 'end'
I've included 4 similar test cases that don't trigger this bug
My pico-8 version is 0.2.2 (stat(5)==30)
The ..= operator is a "shorthand" operator specific to PICO-8. These are implemented internally as a textual transform to the equivalent Lua 5.2 expression, so they come with some restrictions. According to the manual (pico-8.txt), "Shorthand assignment operators can ... be used if the whole statement is on one line." So using this operator on the same line as other keywords is not guaranteed to work.
I don't know the exact textual transform being used, but it's easy to see how PICO-8 may be trying to wrap the right-hand side of the operator in parentheses under some conditions. This appears to work (though isn't guaranteed to, per the manual):
if x then good..=("1") end
[Please log in to post a comment]