Posted 25 September 2012 - 10:53 PM
I am trying to modify the error() function to print the error location and message using a printer when called. So far, I can get it to print the error message, but I was wondering how the original error function gets it's location information so I could replicate it somehow.
Here's what I have so far (added to the bios.lua file):
Here's what I have so far (added to the bios.lua file):
local nativeError = error
function error(err, level)
local printer = nil
for _, sSide in pairs(rs.getSides()) do
if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "printer" then
printer = peripheral.wrap(sSide)
break
end
end
if printer then
if printer.newPage() then
printer.setPageTitle("WolfOS Error Log")
printer.write(err)
printer.endPage()
print("Error log printed.")
end
end
nativeError(err, level)
end