Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[Menu Commands]]---
- local function hey()
- print("hi")
- end
- local function hi()
- print("Awesome")
- end
- --[[Menu Table]]--
- buttons = {
- [1] = {buttonType = 1, buttonX = 1, buttonY = 1, command = hey},
- [2] = {buttonType = 1, buttonX = 2, buttonY = 2, command = hi},
- [3] = {buttonType = 2, buttonX = 3, buttonY = 3, command = hey}
- }
- --[[Menu Functions]]--
- function button(table)
- while true do
- event, p1, p2, p3 = os.pullEvent()
- for k,v in ipairs(table) do
- if table[k].buttonType == p3 then
- if table[k].buttonX == p1 and table[k].buttonY == p2 then
- table[k].command()
- end
- end
- end
- end
- end
- --[[Main Program]]--
- term.clear()
- term.setCursorPos(1,1)
- write("#")
- term.setCursorPos(2,2)
- write("@")
- term.setCursorPos(1,3)
- button(buttons)
Add Comment
Please, Sign In to add comment