[SOLVED] Detecting special characters with love.textinput()
Posted: Fri Nov 02, 2018 12:05 am
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?
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?