Pico-8 API Documentation

Strings

Strings

string manipulation

#s -- string length
"three " .. 4 -- string concatenation
sub(str, from, [to]) -- substring
tostr(val, [hex]) -- convert val to a string; if hex is true and val is a number, output format is "0x0000.0000"
tonum(str) -- cast parseable str to number; nil if str isn't a number; "0xAF" format for hex
"123.45" + 0 -- alternative to tonum
split(str, [separator], [convert_numbers]) --
ord(str [index]) -- Convert a character to its character code, ex. ord(@) -- returns 64
chr(num) -- Convert character code to character ex. chr(64) -- returns "@"

special characters

print("l:\x8b r:\x91 u:\x94 d:\x83 o:\x8e x:\x97")
Edit this page on GitHub