Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Jazzas OS 1.0.0
- --Load APIs
- os.loadAPI(resources/APIs/menu)
- --Variables
- termW, termH = term.getSize()
- --Functions
- function print.center(str,yLine)
- term.setCursorPos(termW-#str/2,yLine)
- print(str)
- end
- menu.printMenu()
- --menu API V1.0
- --Variables
- local menuSelect = 1
- local menuRunning true
- --Functions
- function printMenu(title,pointer,...)
- menuOps = {...}
- while menuRunning do
- clear()
- print.center(title)
- term.setCursorPos(2,1)
- for local i=1,#menuOps,1 do
- if i=menuSelect then term.setTextColor(red) end print.center(menuOps[i],i+1)
- end
- local event, local key = os.pullEvent("key")
- if key == 200 and menuSelect > 1 then
- menuSelect = menuSelect - 1
- elseif key == 208 and menuSelect < #menuOps then
- menuSelect = menuSelect + 1
- elseif key == 28 then
- local menuRunning false
- end
- end
- end
- menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement