Log In  

Hi @zep!

pico8 0.2.6b / linux:

cls()
if (false)?1 --hi
print(2)
print(3)

expected output: 2 3
actual output: 3

Here's an altered version that works as expected:

cls()
if (false)?1
print(2)
print(3)

(this prints 2 3, as expected)


3 things seem required to trigger this bug:

  1. shorthand if
  2. shorthand print on the same line
  3. !! further text after the shorthand print (" --hi", in this example. but just a single trailing space triggers the bug too)

When these are all true, the next line seems to get scooped up into the shorthand line. This can include attaching an else to the wrong if, like in this more complicated example:

cls()
if false then
 if (false)?1 --hi
else
 print(2)
 print(3)
end
print(4)

expected output: 2 3 4
actual output: 4

P#148053 2024-05-07 11:54

I think I'm have a similar issue, 0.2.6b on windows :

p=0
function _draw()
 cls(1)
 p+=1

 --draw red circ only when p==30
 --but always draw orange one
 --[[ 
 if (p==30)p=0?"\ae6" 
 circfill(64,64,4,8)
 circfill(64,64,2,9)
 --]]

 --always draw red circ
 --and draw orange one
 --[[
 if (p==30)p=0 
 circfill(64,64,4,8) 
 circfill(64,64,2,9)
 --]]

 --draw red circ 
 --and draw orange one
 ---[[ 
 if (p==30)p=0print("\ae6")
 circfill(64,64,4,8)
 circfill(64,64,2,9)
 --]]  
end

Notice that I found this by check on a low character game, so looks like some developper take advantage of this potential issue :)

P#148344 2024-05-13 06:29 ( Edited 2024-05-13 06:30)

[Please log in to post a comment]