8 posts
Posted 04 March 2012 - 12:56 PM
Does anybody know how I can do this ?
Basically all it is is that you press up and down to select an option, just like the LILO bootloader … and come to think of it the GRUB bootloader too.
473 posts
Location
Poland
Posted 04 March 2012 - 01:24 PM
Like this:
function CUI(m)
local n=1
local 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]")
local 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
8 posts
Posted 04 March 2012 - 02:53 PM
Thank you !
79 posts
Posted 05 March 2012 - 11:59 PM
[INSERT DERP COMMENT HERE]
(Lol i was being stupid and posted a comment that didnt make sense)
454 posts
Location
London
Posted 06 March 2012 - 12:15 AM