darearkin

Untitled

Apr 1st, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. function CUI(m)
  2. local n=1
  3. local l=#m
  4. while true do
  5. term.clear()
  6. term.setCursorPos(1,2)
  7. for i=1, l, 1 do
  8. if i==n then print(i, "["..m[i].."]") else print(i, m[i]) end
  9. end
  10. print("Select a number[arrow up/arrow down]")
  11. local a, b= os.pullEventRaw()
  12. if a == "key" then
  13. if b==200 and n>1 then n=n-1 end
  14. if b==208 and n<=l then n=n+1 end
  15. if b==28 then break end
  16. end
  17. end
  18. term.clear() term.setCursorPos(1,1)
  19. return n
  20. end
Add Comment
Please, Sign In to add comment