Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clr")
- print("[5] 6 ")
- local sel = 1
- local nums = {5,6}
- while true do
- local e = {os.pullEvent("key")}
- if e[2] == keys.left and sel == 2 then
- term.setCursorPos(1,1)
- term.clearLine()
- sel = 1
- local other = 2
- print("["..tostring(nums[sel]).."] "..nums[other].." ")
- elseif e[2] == keys.right and sel == 1 then
- term.setCursorPos(1,1)
- term.clearLine()
- sel = 2
- local other = 1
- print(" "..tostring(nums[other]).." ["..nums[sel].."]")
- elseif e[2] == keys.enter then
- term.setCursorPos(1,2)
- local choice = io.read()
- if choice then
- term.setCursorPos(1,2)
- term.clearLine()
- choice = tonumber(choice)
- if choice == nums[sel] + 1 or choice == nums[sel] - 1 then
- nums[sel] = tonumber(choice)
- end
- if sel == 1 then
- local other = 2
- term.setCursorPos(1,1)
- term.clearLine()
- print("["..tostring(nums[sel]).."] "..nums[other].." ")
- elseif sel == 2 then
- local other = 1
- term.setCursorPos(1,1)
- term.clearLine()
- print(" "..tostring(nums[other]).." ["..nums[sel].."]")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement