I am looking for someway to wait x amount of seconds before continuing something. What I am trying to do, is have the user type some text into my prompt, and when he/she presses the 'backspace' key, remove 1 letter from the string (Already done), but if they user is still holding the key down, after 1 second, continue removing 1 letter from the string 1 at a time. While i'm here, what is the unicode or key name for the 'enter' key? Or how could I tell if the user pressed the 'enter' key.
Code: Select all
function love.load()
text={}
str1=""
end
function love.keypressed(key,unicode)
if unicode>37 and unicode<127 then
table.insert(text,string.char(unicode)) --Add last used character to text-list
elseif key=="backspace" then
table.remove(text,#text) --Remove last inserted character from text-list
end
end
function love.draw()
str1=""
for _,n ni pairs(text) do
str1=str1..n
end
love.graphics.printf(str1,0,0,800)
end