Heres the function i use when i need arrow selection menues. It's pretty straight forward, and relies on pullEvent like popdog said.
function noColorInput(text,...)
term.clear()
term.setCursorPos(1,1)
print(text) --print menu text
local cursX,cursY = term.getCursorPos()
local button = 1 --start selection
local tButtons = {...}
while true do
for i=1,#tButtons do --render menu
local menuText = tButtons[i]
if button == i then
menuText = "["..menuText.."]" -- render selection cursor
end
term.setCursorPos(1,cursY+i-1)
term.clearLine()
term.setCursorPos(tTerm.xMid-math.floor(#menuText/2),cursY+i-1) -- if you intend to copy my function, you'll have to replace tTerm.xMid with half the size of your screen.
term.write(menuText)
end
local _e,key = os.pullEvent"key" -- get key inputs
if key == 28 then --enter
return tButtons[button]
elseif key == 208 then --down arrow
button = button+1
elseif key == 200 then --up arrow
button = button-1
end
if button > #tButtons then -- attempt to go below bottom selection
button = 1
elseif button < 1 then -- attempt to go above top selection
button = #tButtons
end
end
end
noColorInput("Please pick a selection","selection1,"menu2","herpDerp")
Edited by CometWolf, 20 February 2014 - 06:47 PM.