DYankee

FreqFunc

Apr 9th, 2022 (edited)
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. PasteId = "vN3NrXdp"
  2.  
  3. local function reset()
  4.     term.clear()
  5.     term.setCursorPos(1,1)
  6. end
  7.  
  8. local function print_left(text)
  9.     local x, y = term.getCursorPos()
  10.     local w, h = term.getSize()
  11.     term.setCursorPos(1,y)
  12.     term.write(text)
  13. end
  14.  
  15. local function print_centered(text)
  16.     local x, y = term.getCursorPos()
  17.     local w, h = term.getSize()
  18.     term.setCursorPos(math.floor((w - #text) / 2) + 1, y)
  19.     term.write(text)
  20. end
  21.  
  22. local function print_right(text)
  23.     local x, y = term.getCursorPos()
  24.     local w, h = term.getSize()
  25.     term.setCursorPos(x - #text)
  26.     term.write(text)
  27. end
  28.  
  29. return{
  30.     print_left = print_left,
  31.     print_centered = print_centered,
  32.     print_right = print_right,
  33.     reset = reset,
  34. }
Add Comment
Please, Sign In to add comment