Hello,
I'm trying to make a simple command-line interface by using the love.textinput(text) function (this is with Love2d version 11.1). I've got text appearing but I can't get the program to recognize when the return key is pressed. I know I can do this with love.keypressed(key) by comparing key to "return", but this doesn't work with textinput. I've tried comparing to "\r\n" (which starts a new line when it appears in a string) as well as "\r" and "\n" separately but none of that works either.
Is there a way to do this with textinput() or do I have to fall back on keypressed() for special characters like this?
[SOLVED] Detecting special characters with love.textinput()
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[SOLVED] Detecting special characters with love.textinput()
Last edited by DGM on Fri Nov 02, 2018 5:00 am, edited 1 time in total.
Re: Detecting special characters with love.textinput()
"return" is not a kind of character but a ctrl command, so you can not get it from textinput(), so just use the keypress() func.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Detecting special characters with love.textinput()
you do need to "fall back".
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Detecting special characters with love.textinput()
Fair enough. Thanks.
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests