Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- buttons = {}
- --putting buttons into a table
- table.insert(buttons, button.cButton(1,5,1,4))
- table.insert(buttons, button.cButton(1,5,5,8))
- -- drawing the buttons
- function dBox(x,y)
- for i = 1, y do
- for z = 1, x-1 do
- term.write(" ")
- end
- print(" ")
- end
- end
- term.clear()
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(1,1)
- dBox(5,4)
- term.setCursorPos(1,5)
- term.setBackgroundColor(colors.orange)
- dBox(5,4)
- -- part of example
- _,_,x,y = os.pullEvent()
- but = button.check(buttons,x,y)
- if but == 1 then
- term.setCursorPos(15, 10)
- print("hi")
- elseif but == 2 then
- term.setCursorPos(15, 10)
- print("button2")
- end
Advertisement
Add Comment
Please, Sign In to add comment