How to disable uppercase in love.textinput ?

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
User avatar
Harrylechienfou
Prole
Posts: 30
Joined: Tue May 21, 2019 2:02 pm

How to disable uppercase in love.textinput ?

Post by Harrylechienfou »

Hello everybody.
I'm using the love.textinput function currently for my game project, but I have a problem that I can't solve and I hope you can help me.

The problem is that, by default, the uppercase is enable in the function love.textinput, and I have no idea how to disable it. I'm working on a text adventure kinda game and the uppercase is a huge problem for my gameplay : because it's enable, "Map Name", "map name", "Map name" and "MAP NAME" are not considered the same text by my function (obviously) which lead to a lot of... well, problems I guess.

Any idea on how to solve the problem ? I'm new to both lua/love 2d and game developpement in general, so please excuse-me if my question is a bit silly.
Also, I'm french so I hope my english is not too bad.

Thanks everybody !
User avatar
CrimsonGuy
Prole
Posts: 48
Joined: Thu Apr 04, 2019 3:32 pm

Re: How to disable uppercase in love.textinput ?

Post by CrimsonGuy »

Dont know much about about text input, but i guess you can transform the string thats giving you troubles all to UPPERCASE or all to lowercase so you dont have to worry about that.

https://stackoverflow.com/questions/320 ... ase-in-lua

Its a workaround, hope it helps
User avatar
zorg
Party member
Posts: 3441
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to disable uppercase in love.textinput ?

Post by zorg »

Be aware that, as far as i know, string:lower() and string:upper() only consider the 7-bit ASCII (or at most, the 8bit extended range of the currently used locale) range of characters, and it won't work on utf-8 codepoints since they can be multi-byte which the functions don't support.

https://stackoverflow.com/questions/115 ... characters

(Note that Löve and LuaJIT itself, that löve uses by default, does have basic support for utf8 strings and some methods with them, but no advanced functionality like case conversion methods, for example.)
Me and my stuff :3True 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.
User avatar
Harrylechienfou
Prole
Posts: 30
Joined: Tue May 21, 2019 2:02 pm

Re: How to disable uppercase in love.textinput ?

Post by Harrylechienfou »

Thanks so much, it works perfectly !
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 163 guests