Advertisement
funnybunnyofdoom

monitor

Nov 28th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. --Author: FunnyBunnyofDOOM
  2. --Date: 3/3/2018
  3. --Version: 0.0.1
  4.  
  5. --This program will allow interfacing with
  6. --the monitor easier
  7.  
  8. --Make sure to include:
  9. -- os.loadAPI(".../monitor")
  10. --In the start menu
  11. --In order to load this API
  12.  
  13. function side() --Returns the side of the monitor
  14. local sides = {"top", "bottom", "left", "right", "front", "back"}
  15. local side = ''
  16. for i=1,6 do
  17. if peripheral.getType(sides[i]) == "monitor" then
  18. side = sides[i]
  19. end
  20. if side == '' then
  21. side = 'none'
  22. end
  23. end
  24. return side
  25. end
  26.  
  27. function get() --Creates and returns a monitor object
  28. local side = side()
  29. monitor = peripheral.wrap(side)
  30. return monitor
  31. end
  32.  
  33. function redirect() --shortcut to redirect term to monitor
  34. term.redirect(get())
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement