Advertisement
Guest User

init.lua

a guest
Aug 3rd, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1.  
  2. Monitor = {}
  3. Monitor.__index = Monitor
  4.  
  5. function Monitor:new(side)
  6.     if peripheral.getType(side) ~= "monitor" then
  7.         error("ERROR: This peripheral is not a monitor! It's a " .. monitor.getType())
  8.     end
  9.     local monitor = {}
  10.     print(type(peripheral))
  11.     print(getmetatable(peripheral))
  12.     setmetatable(monitor,Monitor)
  13.     setmetatable(Monitor, peripheral.wrap(side))
  14.     monitor.side = side
  15.     monitor:getCursorPos()
  16.     monitor:intialize()
  17.     return monitor
  18. end
  19.  
  20. function Monitor:initialize()
  21.     monitor.clear()
  22.     monitor.setCursorPos(1,1)
  23.     monitor.setTextScale(.5)
  24. end
  25.  
  26. function Monitor:getType()
  27.     return peripheral.getType(self.side)
  28. end
  29.  
  30. function Monitor:newLine()
  31.     x,y = self.getCursorPos()
  32.     self.setCursorPos(1,y+1)
  33. end
  34.  
  35. monitor = Monitor:new("top")
  36. monitor:newLine()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement