Does anyone know how you can make menus that goto other pages? Like 'Email' would goto a Email Client, etc..
GUI ( Menus )
Started by 1vannn, Nov 26 2012 12:33 PM
1 reply to this topic
#1
Posted 26 November 2012 - 12:33 PM
#2
Posted 26 November 2012 - 01:33 PM
The other "pages" could be other programs, and you could just have a program display a menu, you press a corresponding key, and then open up a specified function.
Menu options could be stored in one table, while the programs they open could be triggered by another.
This program would print:
And pressing 1, for example, would go to the email program.
Menu options could be stored in one table, while the programs they open could be triggered by another.
local options = {'Email','Music','Web Browser','Exit'}
local programs = {'email','music','webbrowser'}
while true do
term.clear()
term.setCursorPos(1,1)
print 'Select an Option'
print ''
for i=1, #options do
print(i..'. '..options[i])
end
local _, char = os.pullEvent('char')
local num = tonumber(char)
if num then
if programs[num] then
shell.run(programs[num])
elseif options[num] == 'Exit' then
shell.run('clear')
break
end
end
end
This program would print:
Select an Option 1. Email 2. Music 3. Web Browser 4. Exit
And pressing 1, for example, would go to the email program.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











