Getting Input from User.

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
Afrricyn
Prole
Posts: 11
Joined: Fri Feb 21, 2020 4:17 pm

Getting Input from User.

Post by Afrricyn »

[SOLVED]
Hello Fellow Lovers,
New to Lua and Love2d, so I'm having trouble trying to get input from the user, I looked on the website and I found

Code: Select all

function love.textinput(t)
however, I'm not sure how to implement that into my situation or even use it.
I'm trying to if a save is "[EMPTY]" and the user presses 'enter', it should take their next inputs until the length is longer or equal to 3 and then change the save name from "[empty]" to what they entered
Image

Within the update function

Code: Select all

if love.keyboard.wasPressed("enter") or love.keyboard.wasPressed("return") then
        if save[highlighted] == "[EMPTY]" then
            -- save[highlighted] = [inputted text from user]
        end
end
once they've entered the text, I would also like to substring it to 3 characters and then upper it to capitals but I have no clue how?
thanks in advance,
Attachments
SaveSelectionState.lua
(1.93 KiB) Downloaded 219 times
Last edited by Afrricyn on Thu Jun 04, 2020 2:04 pm, edited 1 time in total.
Afrricyn
Prole
Posts: 11
Joined: Fri Feb 21, 2020 4:17 pm

Re: Getting Input from User.

Post by Afrricyn »

[SOLVED] - managed to do it.
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Getting Input from User.

Post by Jeeper »

A friendly tip is to always include the solution that you found and are using. Because when other people search for a similar thing all they find is that you solved it, but not how.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 80 guests