Log In  


Speaking of strings, I just saw one of zep's tweets that had this in it:

?"MUSIC"

Did anyone else know that this is shorthand for PRINT("MUSIC")? I don't think it's standard Lua. It's more a BASIC thing. It's not in the manual.

I could shorten my Pi-Ko-Pon game a bit with this...

Edit: Well, maybe. It has to be by itself on a line, and it has to be at the start of the line. Still, useful for printing vars at the prompt:

> STR="THIS IS HANDY"
> ?STR
"THIS IS HANDY"
>

Worth noting: It calls PRINT(), so if you've overridden PRINT(), your routine will get called when you use the ? operator.

3


Yea, that does seem odd...
PICO-8 is what was originally going to be LEX500, so maybe it's leftover from that?


Very cool, glad to know of this. The beginning-of-line requirement makes sense because it isn't a valid Lua statement, so it's implemented as a preprocessor directive, likely intended exclusively for the command line.


Yes, ? just wraps the rest of the line in PRINT() -- including parameters. It was motivated mostly by wanting to print stuff out on command-line, but it's also allowed in programs and is supported. (will add it to the manual)


Nice, so it's kinda the shortest way to draw something on screen :

?0,64,64,7
pset(64,64,7)
spr(0,64,64)

Any chance you could add the option to ignore leading whitespace? That's actually more friendly to the command line as well.



[Please log in to post a comment]