Posted 26 November 2012 - 04:31 AM
This is my simple menu:
After the menu touch the end, the variable menuStat can be:
"1" if the choice is the frist
"2" if the choice is the second
menuStat = 0
repeat
term.clear() -- Clear the screen
term.setCursorPos(1,1) -- Set the cursor pos
print "Select your langauge" -- Message to print above the menu
pressedOk = false
if menuStat == 1 then
print[[> Francais - French]] -- Text to show if the cursor is on the first choice
print[[ English - Anglais]]
elseif menuStat == 2 then
print[[ Francais - French]] -- Text to show if the cursor is on the second choice
print[[> English - Anglais]]
end
event, param1 = os.pullEvent("key")
if param1 == 208 then menuStat = menuStat + 1
elseif param1 == 200 then menuStat = menuStat - 1
elseif param1 == 28 then pressedOk = true end
if menuStat == 3 then menuStat = 1
elseif menuStat == 0 then menuStat = 2 end
until pressedOk == true
menuStat = tostring(menuStat)
After the menu touch the end, the variable menuStat can be:
"1" if the choice is the frist
"2" if the choice is the second