Advertisement
guitarplayer616

Speed Logic Engine

Jul 6th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.07 KB | None | 0 0
  1. shell.run("clr")
  2. print("[5] 6 ")
  3. local sel = 1
  4. local nums = {5,6}
  5. while true do
  6.     local e = {os.pullEvent("key")}
  7.     if e[2] == keys.left and sel == 2 then
  8.         term.setCursorPos(1,1)
  9.         term.clearLine()
  10.         sel = 1
  11.         local other = 2
  12.         print("["..tostring(nums[sel]).."] "..nums[other].." ")
  13.     elseif e[2] == keys.right and sel == 1 then
  14.         term.setCursorPos(1,1)
  15.         term.clearLine()
  16.         sel = 2
  17.         local other = 1
  18.         print(" "..tostring(nums[other]).." ["..nums[sel].."]")
  19.     elseif e[2] == keys.enter then
  20.         term.setCursorPos(1,2)
  21.         local choice = io.read()
  22.         if choice then
  23.             term.setCursorPos(1,2)
  24.             term.clearLine()
  25.             choice = tonumber(choice)
  26.             if choice == nums[sel] + 1 or choice == nums[sel] - 1 then
  27.                 nums[sel] = tonumber(choice)
  28.             end
  29.             if sel == 1 then
  30.                 local other = 2
  31.                 term.setCursorPos(1,1)
  32.                 term.clearLine()
  33.                 print("["..tostring(nums[sel]).."] "..nums[other].." ")
  34.             elseif sel == 2 then
  35.                 local other = 1
  36.                 term.setCursorPos(1,1)
  37.                 term.clearLine()
  38.                 print(" "..tostring(nums[other]).." ["..nums[sel].."]")
  39.             end
  40.         end
  41.     end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement