Log In  


> a = "\F7"
> PRINT(a)

> b = SPLIT(a)[1]
> PRINT(b)
7
> PRINT(a==b)
FALSE
> PRINT(TYPE(b))
NUMBER

notice that taking the string "\F7", and running it through SPLIT turns it into the number 7.

should b not be equal to a for any STRING value of a in the above?



1

split converts to numbers by default if it encounters something that looks like a number. pscii control codes affect printing but are themselves non-printing characters so I guess split interprets that as a number. You can change that behaviour though.

This should work the way you're expecting. The second argument is the separator and the third is whether to automatically convert numbers or not so this tell is not to.

b = split(a, ',', false)

@Lark result is strange but actually makes sense :

\f is a way to input a single character (form feed) into a string, same as \t for a single tabulation or \n for a single new line character.
pico-8's split default behavior is to to use "," as separator and to convert what it can to numbers.
\f is among the "blank" characters, and is treated as an insignificant space in the context of number conversion.

> b=split("  \t \n \f   \n \t \f  4")
> ? b[1]
4
> 


[Please log in to post a comment]