zeshan

Untitled

Dec 23rd, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. local nativeTerm = term.native or term
  2.  
  3. local function invoke(sMethod, ...)
  4. nativeTerm[sMethod](...)
  5. for k,sSide in pairs(redstone.getSides()) do
  6. if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "monitor" then
  7. peripheral.call(sSide, sMethod, ...)
  8. end
  9. end
  10. end
  11.  
  12. local tArgs = { ... }
  13. if #tArgs > 1 then
  14. print( "Usage: dual_monitors [-d|--disable]" )
  15. return
  16. end
  17.  
  18. if tArgs[1] == "-d" or tArgs[1] == "--disable" then
  19. os.unloadAPI("/rom/apis/term")
  20. os.loadAPI("/rom/apis/term")
  21. term.clear()
  22. term.setCursorPos(1, 1)
  23. print(os.version())
  24. else
  25. term.write = function(text) invoke("write", text) end
  26. term.scroll = function(n) invoke("scroll", n) end
  27. term.setCursorPos = function(x, y) invoke("setCursorPos", x, y) end
  28. term.setCursorBlink = function(:o/>/> invoke("setCursorBlink", :o/>/> end
  29. term.clear = function() invoke("clear") end
  30. term.clearLine = function() invoke("clearLine") end
  31.  
  32. term.clear()
  33. term.setCursorPos(1, 1)
  34. print(os.version())
  35. end
Advertisement
Add Comment
Please, Sign In to add comment