ReBraLaCC, on 20 August 2016 - 10:01 AM, said:
if ev[2] == keys.leftCrtl and ev2[2] == keys.u then
Both can't be true at once.
You get one event per key pressed, in the order they're pressed. Under later versions of CC you also get "key_up" events indicating when keys are released. If you want to know whether multiple keys are held at the same time, then you'll need to record buttons of interest...
For eg:
local heldCtrl = false
while true do
local ev = {os.pullEvent()}
if ev[1] == "key" then
if ev[2] == keys.leftCtrl then
heldCtrl = true
elseif heldCtrl and ev2[2] == keys.u then
return true
end
elseif ev[1] == "key_up" and ev[2] == keys.leftCtrl then
heldCtrl = false
end
end