error
Throws an error with the specified message at the current line and call frame or if specified, level frames upward.
  | 
  |||
| Throws an error with specified error message. | |||
| Code | error("example error message")
 | 
    ||
| Output | program.lua:1: example error message
 | 
    ||
  | 
  |||
| Throws an error with specified error message at a higher frame.
 (note how it specified the error as happening on line 5, where myFunction() is being called, because we traversed up.)  | 
  |||
| Code | local function myFunction()
  error("example error message", 2)
end
myFunction()
 | 
    ||
| Output | program.lua:5: example error message
 | 
    ||
| error Function  | |
|---|---|
| 
Syntax error( 
  | |
| Returns | nil | 
| API | Base globals | 
| Source | CC:Tweaked | 
    This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.