Samotage820

cc monitor signs

Aug 4th, 2021 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.35 KB | None | 0 0
  1. local m = peripheral.wrap("bottom")
  2. m.setTextScale(0.5)
  3. m.clear()
  4. lines = {}
  5.  
  6. local function writeCentered(text, y)
  7.     local width, _ = m.getSize()
  8.     m.setCursorPos(math.floor((width-#text)/2)+1, y)
  9.     m.write(text)
  10. end
  11.  
  12. local function writeLines(lines)
  13.     for i=1, #lines do
  14.         writeCentered(lines[i], i)
  15.     end
  16. end
  17.  
  18. writeLines(lines)
Add Comment
Please, Sign In to add comment