Added functions pr & showError

Not everything finished yet
master
Zocker1999NET 7 years ago
parent 035a04a7ae
commit ecd73e0e2a

@ -18,13 +18,74 @@ if sysType:sub(1,2) == "oc" and coroutine == nil then
coroutine = require("coroutine")
end
local function pr(t)
if t == nil then
t = ""
end
t = tostring(t)
if sysType == "cc" then
print(t)
sleep(0.5)
else
end
end
local function showError(err)
if sysType == "cc" then
local file = fs.open("/startup","w")
file.write([[
print("To start Mindows again, please restart the computer once again.")
local file = fs.open("/startup","w")
file.write('shell.run("/mindows/startup.lua")')
file.close()
]])
file.close()
parallel.waitForAny(function
if term.isColor() then
term.setBackgroundColor(colors.blue)
else
term.setBackgroundColor(colors.black)
end
term.clear()
term.setTextColor(colors.white)
term.setCursorPos(1,1)
pr("Mindows Crash Report")
pr()
pr("System crashed caused by")
pr(err)
pr()
pr("Mindows will not boot after the next restart of this computer. If you would like to start Mindows again, restart the computer once again.")
sleep(10)
end,function
local ev,key = os.pullEvent("key")
if key == keys.leftAlt then
return nil
end
)
os.shutdown()
return nil
else
end
end
local fn = nil
local thread = coroutine.create()
local function resume(...)
local ok,err = coroutine.resume(thread,...)
if not ok then
local ret = {coroutine.resume(thread,...)}
local err = ret[2]
if ret[1] then
if type(err) ~= "string" then
err = "Unknown error"
end
showError(err)
end
if coroutine.status(thread) == "dead" then
showError("Thread dead")
end
end
Loading…
Cancel
Save