Marlingaming

Security Handler - Crash Menu

Jan 11th, 2022 (edited)
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. --this program acts as a crash menu, allowing the user to choose what action to take once a crash has occured
  2. os.pullEvent = os.pullEventRaw
  3. version = "1.0.0"
  4. settings.load(".settings")
  5.  
  6. local function Clear()
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. end
  10.  
  11. function DrawMenu()
  12. term.setCursorPos(1,6)
  13. print("SECURITY HANDLER - CRASH MENU")
  14. print("a crash/Terminate event has occured,")
  15. print("please choose one of the following")
  16. print("--Options--")
  17. print("1 - return to menu")
  18. print("2 - reboot")
  19. print("3 - shutdown")
  20. local event
  21. repeat
  22.     event = {os.pullEvent("key")}
  23. until event[2] == keys.one or event[2] == keys.two or event[2] == keys.three
  24. if event[2] == keys.one then
  25.     shell.run(settings.get("os_DesktopLoc"))
  26. elseif event[2] == keys.two then
  27.     os.reboot()
  28. elseif event[2] == keys.three then
  29.     os.shutdown()
  30. end
  31. DrawMenu()
  32. end
  33.  
  34. DrawMenu()
Add Comment
Please, Sign In to add comment