Advertisement
Guest User

Untitled

a guest
Jul 11th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. local event = require("event")
  2. local component = require("component")
  3. local gpu = component.gpu
  4. local kb = require("keyboard")
  5. local os = require("os")
  6.  
  7. --[[
  8. local primary = 81
  9. local secondary = 69
  10. local up = 38
  11. local left = 37
  12. local right = 39
  13. local down = 40
  14. ]]--
  15. function primaryButton()
  16.   gpu.set(1, 1, "Primary Button  ")
  17. end
  18.  
  19. function secondaryButton()
  20.   gpu.set(1, 1, "Secondary Button")
  21. end
  22.  
  23. function upButton()
  24.   gpu.set(1, 1, "Up Button       ")
  25. end
  26.  
  27. function leftButton()
  28.   gpu.set(1, 1, "Left Button     ")
  29. end
  30.  
  31. function rightButton()
  32.   gpu.set(1, 1, "Right Button    ")
  33. end
  34.  
  35. function downButton()
  36.   gpu.set(1, 1, "Down Button     ")
  37. end
  38.  
  39. while true do
  40.     if kb.isKeyDown("q") == true then
  41.         primaryButton()
  42.     elseif kb.isKeyDown("e") == true then
  43.         secondaryButton()
  44.     elseif kb.isKeyDown("up") == true then
  45.         upButton()
  46.     elseif kb.isKeyDown("down") == true then
  47.         downButton()
  48.     elseif kb.isKeyDown("left") == true then
  49.         leftButton()
  50.     elseif kb.isKeyDown("right") == true then
  51.         rightButton()
  52.     else
  53.         os.sleep(.5)
  54.     end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement