sethxi

Monitor Text

Apr 12th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. local args = { ... }
  2. if not args[1] or not args[2] or args[3] then return end
  3.  
  4. local text = args[1]
  5. local mon = peripheral.wrap(args[2])
  6. local bgcolor = colors.blue
  7. local fgcolor = colors.white
  8.  
  9. term.redirect(mon)
  10.  
  11. local w, h = term.getSize()
  12.  
  13. term.clear()
  14. term.setBackgroundColor(bgcolor)
  15. term.setTextColor(fgcolor)
  16.  
  17. if h % 2 ~= 0 then h = h + 1 end
  18. if w % 2 ~= 0 then w = w + 1 end
  19.  
  20. term.setCursorPos(w / 2 - string.len(text) / 2 + 1, math.floor(h / 2))
  21. term.write(text)
Advertisement
Add Comment
Please, Sign In to add comment