Advertisement
Shuudoushi

center api?

Apr 14th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.29 KB | None | 0 0
  1. w,h = term.getSize()
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. function printCenter(line)
  5.         local width = string.len(line)
  6.         if width < w then
  7.                 local x,y = term.getCursorPos()
  8.                 term.setCursorPos(w/2 - width/2,y)
  9.         end
  10.         print(line)
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement