Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function one()
- shell.run("nboot")
- end
- function two()
- shell.run("sboot")
- end
- local menuOptions = {"Normal-Boot", "Lightning(NoUpdate)-Boot"}
- local termX, termY = term.getSize()
- local selected = 1
- local strSeperator = string.rep(" ",5)
- function centerText(text, termY)
- term.setCursorPos(termX/2-#text/2, termY)
- term.write(text)
- end
- function start()
- while true do
- term.clear()
- local strMenuLine = "|"
- for i,v in ipairs(menuOptions) do
- if i == selected then
- strMenuLine = strMenuLine..strSeperator.."["..v.."]"
- else
- strMenuLine = strMenuLine..strSeperator.." "..v.." "
- end
- strMenuLine = strMenuLine..strSeperator.."|"
- end
- centerText("+"..string.rep("-",(#strMenuLine-2)).."+",1)
- centerText(strMenuLine,2)
- centerText("+"..string.rep("-",(#strMenuLine-2)).."+",3)
- local id, key = os.pullEvent()
- if id == "key" then
- if key == 205 then
- selected = selected + 1
- if selected > #menuOptions then
- selected = 1
- end
- elseif key == 203 then
- selected = selected - 1
- if selected < 1 then
- selected = #menuOptions
- end
- elseif key == 28 then
- return selected
- end
- end
- end
- end
- x = start()
- print()
- if x == 1 then
- one()
- end
- if x == 2 then
- two()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement