Humenius

Untitled

Dec 11th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. function writeCenter(text, y, mon)
  2. local w, h = mon.getSize() or term.getSize()
  3. if mon then
  4. mon.setCursorPos( math.ceil( w/2 - #text/2 + 1 ), y )
  5. mon.write( text )
  6. else
  7. term.setCursorPos( math.ceil( w/2 - #text/2 ), y )
  8. term.write( text )
  9. end
  10. end
  11.  
  12. local mon = peripherals.wrap("back")
  13. writeCenter("ME",2,mon)
  14. writeCenter("Server",3,mon)
Advertisement
Add Comment
Please, Sign In to add comment