I am new to Lua and Computer Craft only creating basic programs with basic 2 deep menus. Here is my issue I have a menu and it loads first set fine, then press option 1 it goes into it, but then any button sends it to main menu.
Please help here is my code I have now let me know how to do it better and correctly.
Thanks
bOut = 0
function Main_Menu()
while true do
term.clear()
term.setCursorPos(1,1)
--clearscreen()
print ( [[
+********************************+
| |
| Information Kiosk |
| |
+--------------------------------+
| Please Choose |
| 1. Store Directory |
| 2. How to Buy |
| 3. How to Sell |
+********************************+
]] )
os.pullEvent = os.pullEventRaw
e, p = os.pullEvent()
if e == "char" then
if p == "1" then
Store_Directory()
elseif p == "2" then
elseif p == "3" then
else
end
end
end
end
function Store_Directory()
term.clear()
term.setCursorPos(1,1)
print ( [[
+********************************+
| |
| Store Directory |
| |
+--------------------------------+
| A. Fire Items |
| B. |
| C. |
| press 0 to return to main menu |
+********************************+
]] )
os.pullEvent = os.pullEventRaw
e, p = os.pullEvent()
if e == "char" then
if p == "a" then
term.clear()
term.setCursorPos(1,1)
print ( [[
+********************************+
| |
| Fire Items |
| |
+--------------------------------+
| You can find Fire Items |
| in store # |
| 21 |
| Upper level left side |
+********************************+
]] )
sleep(5)
Main_Menu()
elseif p == "b" then
elseif p == "c" then
elseif p == "0" then
Main_Menu()
else
end
end
end
Main_Menu()