Page 1 of 1

[SLOVED]Tables and Strings

Posted: Sat Apr 13, 2013 9:08 pm
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!

Re: Tables and Strings

Posted: Sat Apr 13, 2013 9:19 pm
by kikito
You mean like this?

Code: Select all

love.graphics.print(speech[1], x, y) -- speech[2] has "Good morning!"

Re: Tables and Strings

Posted: Sat Apr 13, 2013 9:21 pm
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

Re: Tables and Strings

Posted: Sun Apr 14, 2013 7:40 am
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