Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- https://pastebin.com/D8yWJ7rh
- function newManager(side)
- local manager = {
- buttons = {},
- monitor = peripheral.wrap(side),
- newButton = function(self, label)
- print("creating button ''"..label.."''")
- self.buttons[label] = {
- label = label,
- text = "_ "..label
- }
- end,
- draw = function(self)
- print("starting draw()")
- self.monitor.clear()
- self.monitor.setCursorPos(1,2)
- local yPos = 2
- for button in self.buttons do
- self.monitor.write(button.text)
- yPos = yPos + 1
- self.monitor.setCursorPos(1,yPos)
- end
- end
- }
- return manager
- end
- local mgr = newManager("top")
- mgr:newButton("Iron")
- mgr:newButton("Dye")
- mgr:newButton("Coal")
- mgr:draw()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement