TIMAS_Bro

tbrowse.lua

Jun 17th, 2023
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function main()
  2.   shell.run("/disk/browser.lua")
  3. end
  4. local function anticopy()
  5.   local oldpull = os.pullEvent -- saving a copy of the old os.pullEvent
  6.   os.pullEvent = os.pullEventRaw -- os.pullEvent terminates when it receives terminate event, pullEventRaw does not
  7.  
  8.   while true do
  9.     evt = {os.pullEvent()}
  10.     if evt[1] == "terminate" then
  11.         term.setBackgroundColor(colors.red)
  12.         print("YOU ARE TRYING  TO TERMINATE PROGRAM! NOW FULLY RESTART YOUR PC")
  13.         -- do other stuff here
  14.     end
  15.   end
  16.  
  17.   os.pullEventRaw = oldpull -- always reset what you changed
  18. end
  19. parallel.waitForAll(main, anticopy)
Add Comment
Please, Sign In to add comment