This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MindenCucc's profile picture

BiosBreaker

Started by MindenCucc, 01 May 2015 - 08:00 PM
MindenCucc #1
Posted 01 May 2015 - 10:00 PM
There's nothing more about it. You can break out of the parallel.waitForAny, and execute code at the last line of the bios. (os.shutdown)

Pastebin:
pastebin get Fjv0RdAy break

Usage:

break <absolute path to program> [optional parameter(s)]

Yes, I know that there are some bios-breaking (that's how I call breaking out of the parallel.waitForAny) programs, but this one is a bit different. Look at the last line of the program :D/> Fancy, isn't it?
Geforce Fan #2
Posted 02 May 2015 - 04:28 PM
I did something much similar that would overwrite printError, queue a terminate event, and when the bios went to print the error it'd run your code–making it TLCO. This method is a lot simpler, and is a lot shorter.
Edited on 02 May 2015 - 02:29 PM
Exerro #3
Posted 02 May 2015 - 07:39 PM
I'm guessing this is some form of TLCO. If so, this code might be a little simpler…

local pullEvent, shutdown = os.pullEventRaw, os.shutdown
function os.shutdown()
    os.shutdown = shutdown
    os.pullEventRaw = pullEvent
    -- custom code
end
os.pullEventRaw = nil

Also, you seem to misunderstand how loadfile() works.

local f, err = loadfile( file )
if f then -- file loaded - no syntax errors
    f()
else -- syntax error in file
    printError( err )
end