This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Sewbacca's profile picture

Get modifier keys

Started by Sewbacca, 26 February 2016 - 04:18 PM
Sewbacca #1
Posted 26 February 2016 - 05:18 PM
Hey guys,
I have a little question:
How can I get modifier keys like CTRL + L or T + A?

Sewbacca
KingofGamesYami #2
Posted 26 February 2016 - 05:42 PM
Control + (key) is possible, T+A is not.

Run this little script to figure out how this works:


--#proof of concept control keys
while true do
  local event = {os.pullEvent()}
  if event[ 1 ] == "char" or event[ 1 ] == "key" then
    print( event[ 1 ] .. ": " .. event[ 2 ] )
  end
end

(actually, in newer versions you could track key_up events. But I haven't played with that yet)
Sewbacca #3
Posted 01 March 2016 - 07:36 PM
Thank you, I didn't know the key_up event. I solved it (here is the working code)
Edited on 01 March 2016 - 06:40 PM