Guest User

mainMenu

a guest
Oct 16th, 2014
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. function thread1()
  2.   term.clear()
  3.   term.setCursorPos(1,1)
  4.   write (" SteveCell        ")
  5.   local time = os.time()
  6.   local formatTime = textutils.formatTime(time, false)
  7.   write (formatTime)
  8.   print ("")
  9.   print ("")
  10.   for i=1,13 do
  11.     write ("-")
  12.   end
  13.   print("")
  14.   print ("1. Clock")
  15.   print ("2. Calender")
  16.   print ("3. Memo")
  17.   print ("4. Shutdown")
  18.   for i=1,13 do
  19.     write ("-")
  20.   end
  21.   print ("")
  22.   print ("")
  23.   write ("Choose an option: ")
  24.   local choice = io.read()
  25.   local choiceValid = false
  26.   if (choice == "1") then
  27.     -- do this
  28.   elseif (choice == "2") then
  29.     -- do that
  30.   elseif (choice == "3") then
  31.     -- do this
  32.   elseif (choice == "4") then
  33.     shell.run("shutdown")
  34.   else
  35.     print ("Choice Invalid")
  36.     os.sleep(2)
  37.     shell.run("mainMenu")
  38.   end
  39. end
  40.  
  41. function thread2()
  42.   localmyTimer = os.startTimer(5)
  43.   while true do
  44.     local event,timerID = os.pullEvent("timer")
  45.     if timerID == myTimer then break end
  46.   end
  47.   return
  48. end
  49.  
  50. parallel.waitForAny(thread1, thread2)
  51. shell.run("mainMenu")
Advertisement
Add Comment
Please, Sign In to add comment