Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local reactor = peripheral.wrap("BigReactors-Reactor_1")
  2. local mon = peripheral.wrap("monitor_0")
  3.  
  4. -- clear the monitor at startup
  5. mon.setBackgroundColor(colors.black)
  6. mon.clear()
  7.  
  8. function repeats(s, n)
  9.   return n > 0 and s .. repeats(s, n-1) or ""
  10. end
  11.  
  12.  
  13. function drawLine (m, row, color)
  14.   local currentColor = m.getBackgroundColor()
  15.   local oldX, oldY = m.getCursorPos()
  16.   local sizeX, sizeY = m.getSize()
  17.  
  18.   m.setCursorPos(row, 0)
  19.   m.setBackgroundColor(color)
  20.   m.write(repeats(" ", sizeX))
  21.  
  22.   m.setCursorPos(oldX, oldY)
  23.   m.setBackgroundColor(currentColor)
  24. end
  25.  
  26. function drawDisplay ()
  27.   drawLine(mon, 1, colors.red)
  28. end
  29.  
  30. drawDisplay()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement