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

Crash Support?

Started by ebernerd, 07 September 2013 - 10:51 PM
ebernerd #1
Posted 08 September 2013 - 12:51 AM
So, I am developing an OS with WolfNinja2, and I was wondering how FireWolf's crash screen worked, where it was put into a nice setup.

Could anyone help, just kinda list the basic functions needed?

I would like to make a Windows 8 Style blue screen. The big ":(/>" :D/>

Thanks in advance.
-deadmau5
jay5476 #2
Posted 08 September 2013 - 01:43 AM
it uses pcall (protected call) and then displays it in a custom error format eg.
suc,err = pcall(print(var)) if not suc then print(err) end
that will show the error attempt to call number
ebernerd #3
Posted 08 September 2013 - 01:53 AM
it uses pcall (protected call) and then displays it in a custom error format eg.
suc,err = pcall(print(var)) if not suc then print(err) end
that will show the error attempt to call number
And how do I implement this into a program? When do I use it?
jay5476 #4
Posted 08 September 2013 - 02:09 AM
say in firewolf you acsess a site it sends you the code you do

suc, err = pcall(code)
if not suc then
print(err) -- or do stuff with the information
end
theoriginalbit #5
Posted 08 September 2013 - 05:35 AM
Have a read of my tutorial.

it should also be noted on top of jay5476's code that you should do the following


local ok, err = pcall(shell.run, "someProgram")
if not ok and err ~= "Terminated" then
  print(err)
end
That way you're handling errors of a program, and also making sure you don't show the error screen if they terminated the program.