IAA_ShRaPNeL

Untitled

Aug 3rd, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. --this function will print the text in the centre of the current line
  2. local printcentred =
  3. function(text)
  4. local maxw, maxh = term.getSize() --screen dimensions
  5. local curx, cury = term.getCursorPos() --cursor pos
  6. term.setCursorPos((maxw-#text)/2,cury) --set it to the point where write will make the text centred
  7. term.write(text) --write the text
  8. term.setCursorPos(curx,cury+1) --return the cursor to the same position on the next line
  9. end
  10. local maxw, maxh = term.getSize() --screen dimensions
  11. term.setCursorPos(1,math.floor(maxh/2))--set cursor to the start of the upper middle line
  12. printcentred("Welcome To")--print centred on that line
  13. printcentred("Server Name")--print centred on the next line
Add Comment
Please, Sign In to add comment