Advertisement
Guest User

startup

a guest
Jan 24th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. local commands = {42, 57, 200, 203, 205, 208}
  2. local nums = {0, 1, 3, 5, 4, 2}
  3. local p = peripheral.wrap("bottom")
  4. local function contains(keycode)
  5.   keycode = tonumber(keycode)
  6.   for i=1,#commands do
  7.     if (keycode==commands[i]) then
  8.       return i
  9.     end
  10.   end
  11.   return -1
  12. end
  13. while true do
  14.   local event, keycode, _ = os.pullEvent("key")
  15.   local index = contains(keycode)
  16.   if (index~=-1) then
  17.     p.move(nums[index], false, false)
  18.   end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement