Log In  


Is there a way to determine rendered text height, knowing that said text may contain the tall rendering mode option ? I could search for the presence of "\^t" if I can find a way to express the escaped version of that.

-- always prints 6
local text = "\^thello"
local h = 6
if sub(text,1,3) == "\^t" then h = 12 end
print(h)


Apparently \^ is treated as one character. Try sub(text,1,2) == "\^t"

Edit: the special character's value is equivalent to nil so this may return false positives in cases of other special characters or nil values.


1

yes! you can call print off-screen and use the maxx,maxy values that it returns: https://www.lexaloffle.com/dl/docs/pico-8_manual.html#PRINT

(version 0.2.5d added the second return value)


Nice call @merwok! Didn't know about the second return value


Thanks @kozm0naut and @merwok! 2 solutions for 1. It must be Friday. :p


Strange. Are you sure about this? I am running 2.5g but print("hello", 0,0) definitely returns only, in the present case, 20.

> res = print("hello", 0, 0)
> ?(res)
20

My bad.

> x,y = print("hello", 0,0)
> ?(x)
20
> ?(y)
6

Sorry for noise.


no worry! let’s blame lua multivals :-p



[Please log in to post a comment]