edoreld

Untitled

Oct 11th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. function startMonitor()
  2. monitor = peripheral.wrap("top")
  3. wm, hm = monitor.getSize()
  4. end
  5. startMonitor()
  6.  
  7. local cwrite = function(text)
  8. local x2,y2 = monitor.getCursorPos()
  9. local x,y = monitor.getSize()
  10. monitor.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  11.  
  12. monitor.write(text)
  13. end
  14.  
  15. cwrite("Hello World!") -- centers printed text to monitor
Advertisement
Add Comment
Please, Sign In to add comment