Advertisement
Mr_jack

calc

Jul 29th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. image = paintutils.loadImage("calc")
  2. cuunter = "-"
  3.  
  4. local function clear()
  5. term.clear()
  6. term.setCursorPos(4,3)
  7. end
  8.  
  9. clear()
  10.  
  11. local function cursor()
  12. term.setCursorPos(4,3)
  13. end
  14. local function cursor2()
  15. term.setCursorPos(3,3)
  16. end
  17. local function cursor3()
  18. term.setCursorPos(4,4)
  19. end
  20. local function cursor4()
  21. term.setCursorPos(4,5)
  22. end
  23. local function cursor5()
  24. term.setCursorPos(4,6)
  25. end
  26.  
  27. local function ERROR()
  28. term.clear()
  29. write"ERROR"
  30. sleep(2)
  31. term.clear()
  32. end
  33.  
  34.  
  35.  
  36. while true do
  37. number1 = read()
  38. cursor2()
  39. action = read()
  40. cursor3()
  41. number2 = read()
  42. if action == "+" then
  43. cursor4()
  44. print("----")
  45. cursor5()
  46. print(number1+number2)
  47. sleep(2)
  48. clear()
  49. end
  50. if action == "-" then
  51. cursor4()
  52. print("----")
  53. cursor5()
  54. print(number1-number2)
  55. sleep(2)
  56. cllear()
  57. end
  58. if action == "*" then
  59. cursor4()
  60. print("----")
  61. cursor5()
  62. print(number1*number2)
  63. sleep(2)
  64. clear()
  65. end
  66. if action == "/" then
  67. cursor4()
  68. print("----")
  69. cursor5()
  70. print(number1/number2)
  71. sleep(2)
  72. clear()
  73. end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement