Jump to content




Key events


  • You cannot reply to this topic
4 replies to this topic

#1 sci4me

  • Members
  • 225 posts
  • LocationEarth

Posted 14 June 2014 - 04:26 AM

There is no key up event right? So, it's not possible to do things like ctrl + x? If so, it really should be added. Seriously.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 14 June 2014 - 04:37 AM

Ctrl-keypresses can be detected by seeing a Ctrl key event, then a printable key event, then NO char event.

#3 sci4me

  • Members
  • 225 posts
  • LocationEarth

Posted 14 June 2014 - 04:42 AM

Ah, really? Cool! Good to know, thanks!

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 14 June 2014 - 04:48 AM

Would this be a way of catching one, or am I not getting the idea?
local event = { os.pullEvent( "key" ) }
if event[2] == control then --#insert key code for control
 local second = { os.pullEvent( "key" ) }
 if not os.pullEvent( 'char', 1 ) then
  --#control combination pressed
 else
  --#not control combo
 end
else
 --#not control
end


#5 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 14 June 2014 - 04:59 AM

Uh, no. Check out Gopher's ctrlkeys program for a properly structured example.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users