Combining love.graphics.print text strings?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Jack
Prole
Posts: 10
Joined: Sat Jan 07, 2012 5:01 am

Combining love.graphics.print text strings?

Post 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)
Last edited by Jack on Tue Nov 06, 2012 3:59 am, edited 1 time in total.
User avatar
Qcode
Party member
Posts: 170
Joined: Tue Jan 10, 2012 1:35 am

Re: Combining love.graphics.print text strings?

Post 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?
Post Reply

Who is online

Users browsing this forum: Google Adsense [Bot] and 3 guests