Advertisement
s3ptum

center test

Jan 17th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while true do
  2. mon = peripheral.wrap("back")
  3. term.redirect(mon)
  4. mon.clear()
  5.  
  6. local function centerText(text)
  7. local x,y = term.getSize()
  8. local x2,y2 = term.getCursorPos()
  9. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  10. write(text)
  11. end
  12.  
  13. centerText("Hello World")
  14.  
  15. sleep(10)
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement