I need to be able to tell if caps lock is on so I can use the 'key' event and have it properly capitalize characters if caps lock is on. Is there any way to do this?
I can't just use the 'char' event.


How can you tell if caps lock is on?
Started by ashnwill, Oct 06 2016 06:26 PM
2 replies to this topic
#1
Posted 06 October 2016 - 06:26 PM
#2
Posted 06 October 2016 - 06:40 PM
Well, there's is no way of knowing it then. Why cannot you use the "char" event, which is meant just for this?
#3
Posted 06 October 2016 - 07:03 PM
With the following code, you should be able to detect if caps lock is changed, but you need the char event, because if the computer starts or if the user left the computer, you can't know if he used caps:
function detectCapsChanged () while true do local event, key = os.pullEvent() if event == 'key' and key == keys.caps then -- I dunno how exactly is the name in keys CapsChanged() -- A local event handler end end end
Edited by Sewbacca, 06 October 2016 - 07:04 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users