Advertisement
Guest User

Untitled

a guest
Jan 12th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local function handleInput()
  2.     --Handle CTRL keys.
  3.     if(keyboard.isControlDown) then
  4.         --Exit
  5.         if(keyboard.isKeyDown(keyboard.keys.c)) then
  6.             term.clear()
  7.             running = false
  8.         end
  9.     else
  10.         --Go up
  11.         if(keyboard.isKeyDown(keyboard.keys.w)) then
  12.             if not (selected == 1) then
  13.                 selected = selected - 1
  14.             end
  15.             refresh()
  16.         --Go down
  17.         elseif (keyboard.isKeyDown(keyboard.keys.s)) then
  18.             if not (selected == getMachineListSize()) then
  19.                 selected = selected + 1
  20.             end
  21.             refresh()
  22.         end
  23.     end
  24. end
  25.  
  26. while running do
  27.     handleInput()
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement