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!
[SLOVED]Tables and Strings
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[SLOVED]Tables and Strings
Last edited by buhb11 on Sun Apr 14, 2013 7:41 am, edited 1 time in total.
I found Love very enjoyable and nice!
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Tables and Strings
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.
- daviddoran
- Prole
- Posts: 30
- Joined: Sun Mar 24, 2013 5:35 am
Re: Tables and Strings
Hi!
This code is working fine for me:
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
Yes i think like this ,i am going to try implement the random speak , thxkikito wrote:You mean like this?
Code: Select all
love.graphics.print(speech[1], x, y) -- speech[2] has "Good morning!"
I found Love very enjoyable and nice!
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot] and 15 guests