Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- button = {}
- --mon = peripheral.wrap("left")
- mon = term
- function fillTable(name, xmin, xmax, ymin, ymax, text, color)
- button[name] = {}
- button[name]["text"] = text
- button[name]["xmin"] = xmin
- button[name]["xmax"] = xmax
- button[name]["ymin"] = ymin
- button[name]["ymax"] = ymax
- button[name]["color"] = color
- end
- function createBox(name)
- tableData = button[name]
- currentY = tableData["ymin"]
- while currentY ~= tableData["ymax"] do
- mon.setCursorPos(tableData["xmin"], currentY)
- for i = 1,tableData["xmax"] do
- write(" ")
- end
- currentY = currentY +1
- end
- end
- function createButton(name)
- tableData = button[name]
- mon.setBackgroundColor(tableData["color"])
- xLoc = tableData["xmin"] + (math.ceil((tableData["xmax"] - string.len(tableData["text"]))/2))
- yLoc = math.ceil((tableData["ymax"]+tableData["ymin"])/2)-1
- createBox(name)
- mon.setCursorPos(xLoc,yLoc)
- mon.write(tableData["text"])
- end
Add Comment
Please, Sign In to add comment