Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Wojbie's TopLevelCoorutineOverwrite
- --Adds a global variable _AfTeRtLcO after running.
- --Path to program to run after TLCO - Warning - will not have shell and multishell apis. If nil loads shell or multishell
- local sProgram = false
- --"/rom/programs/advanced/multishell"
- --"rom/programs/shell"
- if _AfTeRtLcO then print("Already tlcoed") return end
- local m = _G.os.shutdown
- local first=false
- function _G.os.shutdown()
- if first then first=false return end
- _G.os.shutdown = m
- _G._AfTeRtLcO = true
- term.redirect(term.native())
- local ok, err = pcall( function()
- parallel.waitForAny(
- function()
- if sProgram then --run specified program
- os.run( {}, sProgram )
- elseif term.isColour() then --run normal stuff
- os.run( {}, "rom/programs/advanced/multishell" )
- else
- os.run( {}, "rom/programs/shell" )
- end
- os.run( {}, "rom/programs/shutdown" ) --shut stuff up after it closes.
- end,
- function() os.loadAPI("/rom/apis/rednet") rednet.run() end --commment this line to deactivate rednet
- )
- end )
- -- If the shit errored, let the user read it.
- term.redirect( term.native() )
- if not ok then
- printError( err )
- pcall( function()
- term.setCursorBlink( false )
- print( "Press any key to continue" )
- os.pullEvent( "key" )
- end )
- end
- os.shutdown()
- end
- local t = _G.type
- function _G.type(A)
- if A=="Breakout" then print("Breaking") _G.type=t os.queueEvent("key") error("Breaking",2)
- else return t(A) end
- end
- shell.exit()
- os.queueEvent("key")
- os.queueEvent("modem_message", "Breakout", 1, 1, "Breakout" )
- error("Breaking",2)
Advertisement
Add Comment
Please, Sign In to add comment