[SLOVED]Tables and 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
buhb11
Citizen
Posts: 81
Joined: Wed Dec 26, 2012 8:59 pm

[SLOVED]Tables and Strings

Post by buhb11 »

Hey lovers!

I want my villigers to speak and I came across this problem:

local speech1 = { "Hello sir", "Good morning!" }

Now i want to draw the ,,Hello sir,, string but i dont know how!I have tried to use
love.graphics.print(" "..table.concat(speech1 , ","),x,y) but is not working as i want. Do you have any suggestions?

I would be very grateful if you help me!
Last edited by buhb11 on Sun Apr 14, 2013 7:41 am, edited 1 time in total.
I found Love very enjoyable and nice!
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Tables and Strings

Post by kikito »

You mean like this?

Code: Select all

love.graphics.print(speech[1], x, y) -- speech[2] has "Good morning!"
When I write def I mean function.
User avatar
daviddoran
Prole
Posts: 30
Joined: Sun Mar 24, 2013 5:35 am

Re: Tables and Strings

Post by daviddoran »

Hi!

This code is working fine for me:

Code: Select all

local speech1 = {"Hello sir", "Good morning!"} 

function love.draw(dt)
	local x = 100
	local y = 100
	love.graphics.print(" "..table.concat(speech1 , ","),x,y)
end
User avatar
buhb11
Citizen
Posts: 81
Joined: Wed Dec 26, 2012 8:59 pm

Re: Tables and Strings

Post by buhb11 »

kikito wrote:You mean like this?

Code: Select all

love.graphics.print(speech[1], x, y) -- speech[2] has "Good morning!"
Yes i think like this ,i am going to try implement the random speak , thx
I found Love very enjoyable and nice!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests