Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. function yN()
  2. local n=1
  3. while true do
  4. local x, y=term.getCursorPos()
  5. term.clearLine()
  6. if n==1 then
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. print ("[ Start ]")
  10. print (" Stop ")
  11. else
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. print (" Start ")
  15. print ("[ Stop ]")
  16. end
  17. term.setCursorPos(x, y)
  18. a, b=os.pullEvent()
  19. while a~="key" do a, b=os.pullEvent() end
  20. if b==200 and n==2 then
  21. n=1
  22. end
  23. if b==208 and n==1 then
  24. n=2
  25. end
  26. if b==28 then
  27. if n==1 then
  28. print("Start")
  29. else
  30. print("Stop")
  31. end
  32. break
  33. end
  34. end
  35. if n==1 then return true end
  36. if n==2 then return false end
  37. return false
  38. end
  39.  
  40. yN()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement