Page 1 of 1

Combining love.graphics.print text strings?

Posted: Tue Nov 06, 2012 3:55 am
by Jack
To combine text strings, I always use string.format, which is very slow and will cut my framerate in half when doing a lot of printing with it.

For example:
love.graphics.print(string.format("%s%s%","variable:",var),10,10)

is how I use it, and I'm wondering if there is an easier way to print out text strings and variable info in one line without having to use this long and slow process?


Oh, I just figured it out by reading a small section of the Lua manual thing. To anybody else needing this, here's how you do it instead of the method above:
love.graphics.print("variable:"..var,500,500)

Re: Combining love.graphics.print text strings?

Posted: Tue Nov 06, 2012 3:59 am
by Qcode
Have you not tried using .. to concatenate strings?

love.graphics.print(variable .. var,10,10)

Is that not what you're looking for?