Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ menu ]]--
- --[[ variables ]]--
- local options={
- "option1",
- "option2",
- "option3"
- }
- local n=CUI(options)
- print(n)
- --[[ functions ]]--
- function CUI(m)
- n=1
- l=#m
- while true do
- term.clear()
- term.setCursorPos(1,2)
- for i=1, l, 1 do
- if i==n then print(i, " ["..m[i].."]") else print(i, " ", m[i]) end
- end
- print("Select a number[arrow up/arrow down]")
- a, b= os.pullEventRaw()
- if a == "key" then
- if b==200 and n>1 then n=n-1 end
- if b==208 and n<=l then n=n+1 end
- if b==28 then break end
- end
- end
- term.clear() term.setCursorPos(1,1)
- return n
- end
Advertisement
Add Comment
Please, Sign In to add comment