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.

P#24329 2016-07-02 19:37 ( Edited 2016-07-27 06:12)

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

P#24363 2016-07-02 23:45 ( Edited 2016-07-03 03:45)

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.

P#24365 2016-07-02 23:57 ( Edited 2016-07-03 03:57)

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)

P#24459 2016-07-03 16:22 ( Edited 2016-07-03 20:22)

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)
P#24462 2016-07-03 16:34 ( Edited 2016-07-03 20:34)

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

P#25956 2016-07-27 02:12 ( Edited 2016-07-27 06:13)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-18 10:10:00 | 0.007s | Q:18