Advertisement
Marlingaming

Temp Menu

Nov 25th, 2022 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. local function Options(y,options)
  2. local n = 1
  3. term.setCursorPos(1,y)
  4. term.write("==options==")
  5. while true do
  6. for i = 1, #options do
  7. term.setCursorPos(1,i + y)
  8. if n == i then term.write(">> "..options[i]) else term.write("- "..options[i]) end
  9. end
  10. local a, b = os.pullEvent("key")
  11. if b == keys.w and n > 1 then n = n - 1 end
  12. if b == keys.s and n < #options then n = n + 1 end
  13. if b == keys.enter then break end
  14. end
  15. return n
  16. end
  17.  
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement