wasliebob

Calculator

Aug 6th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. term.clear()
  2. mon = peripheral.wrap("top")
  3.  
  4. pi = 1.27
  5.  
  6. local args = {...}
  7.  
  8. if args[2] == "+" then
  9. print(args[1] + args[3])
  10.  
  11. else if args[2] == "-" then
  12. print(args[1] - args[3])
  13.  
  14. else if args[2] == "*" then
  15. print(args[1] * args[3])
  16.  
  17. else if args[2] == "/" then
  18. print(args[1] / args[3])
  19.  
  20. else if args[2] == "pi" then
  21. print(args[1] * pi)
  22.  
  23. else if args[2] == "kw" then
  24. print(args[1] * args[1])
  25.  
  26. else if args[1] == "help" then
  27. help()
  28. end
  29. end
  30. end
  31. end
  32. end
  33. end
  34. end
  35.  
  36. function help()
  37. print("Standaard: <nummer> <action> <number>")
  38. print("PI: <nummer> <pi>")
  39. print("Kwadraad: <number> <kw>")
  40. end
  41.  
  42. function pos()
  43. mon.setCursorPos(mon.getCursorPos() + 1, mon.getCursorPos())
  44. end
Advertisement
Add Comment
Please, Sign In to add comment