Posted 14 May 2012 - 10:56 PM
Alright, I'm trying to override the default os.pullEvent function, so I can restrict Ctrl+T to people with the Admin password
Here's my debug code so far:
It seems, however, that both T and Ctrl+T give "key-20", so I can't actually differentiate between someone typing normally and someone trying to terminate the program
I could check for the ctrl key then the t key, but there's no way to detect the release of a key (as far as I can see)
I can't check for char-t then ignore the next key-20, because char-t looks like it shows up after key-20
So, my question is this: Is there any way to differentiate between a user hitting T and hitting Ctrl+T? I'd prefer a method using os.pullEvent, since that's what I'm using atm
Here's my debug code so far:
local OldEvent = os.pullEvent
local Admin = "pass"
os.pullEvent = function()
local e,p1,p2,p3 = OldEvent()
write("\n"..e.."-"..p1)
if p2 then
write("-"..p2)
end
return e,p1,p2,p3
end
It seems, however, that both T and Ctrl+T give "key-20", so I can't actually differentiate between someone typing normally and someone trying to terminate the program
I could check for the ctrl key then the t key, but there's no way to detect the release of a key (as far as I can see)
I can't check for char-t then ignore the next key-20, because char-t looks like it shows up after key-20
So, my question is this: Is there any way to differentiate between a user hitting T and hitting Ctrl+T? I'd prefer a method using os.pullEvent, since that's what I'm using atm