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

how to make custom messages like an error message without the file name and line number?

Started by Bubbycolditz, 08 April 2017 - 07:08 PM
Bubbycolditz #1
Posted 08 April 2017 - 09:08 PM
I was wondering how i can make an error message without the line number or file name. This is kind of annoying as i am working with my OS. All i just want is Failed with no line number or file name. Pastebin is in my Signature.
SquidDev #2
Posted 08 April 2017 - 09:18 PM
You've got two options:

If you just want to print an error message, but not exit then printError is your best bet. This prints some red text (if your computer supports colour) and continues.

printError("Woops.") -- Displays "Woops."
print("Will still be executed")

If you want to actually produce an error, then you can pass 0 as the second argument to error. This will mean no file/line information is included.

error("Woops.", 0) -- Displays "Woops." and exists.
print("Will not be executed").
Imprivate #3
Posted 08 April 2017 - 09:19 PM
You want to use error()


error("Failed",0)
Edited on 08 April 2017 - 07:22 PM