Difference between revisions of "Error"
From GiderosMobile
Line 3: | Line 3: | ||
'''<translate>Available since</translate>:''' Gideros 2011.6<br/> | '''<translate>Available since</translate>:''' Gideros 2011.6<br/> | ||
'''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/> | '''<translate>Class</translate>:''' [[Special:MyLanguage/(global)|(global)]]<br/> | ||
+ | |||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
− | <translate>Terminates the last protected function called and returns message as the error message. Function error never returns. | + | <translate>Terminates the last protected function called and returns message as the error message. Function error never returns. |
− | |||
Usually, error adds some information about the error position at the beginning of the message. The level argument specifies how to get the error position. With level 1 (the default), the error position is where the error function was called. Level 2 points the error to where the function that called error was called; and so on. Passing a level 0 avoids the addition of error position information to the message.</translate> | Usually, error adds some information about the error position at the beginning of the message. The level argument specifies how to get the error position. With level 1 (the default), the error position is where the error function was called. Level 2 points the error to where the function that called error was called; and so on. Passing a level 0 avoids the addition of error position information to the message.</translate> | ||
<source lang="lua"> | <source lang="lua"> | ||
− | + | error(message,level) | |
</source> | </source> | ||
+ | |||
=== <translate>Parameters</translate> === | === <translate>Parameters</translate> === | ||
'''message''': (string) <translate>error message</translate> <br/> | '''message''': (string) <translate>error message</translate> <br/> | ||
'''level''': (number) <translate>the call stack level</translate> '''optional'''<br/> | '''level''': (number) <translate>the call stack level</translate> '''optional'''<br/> | ||
+ | |||
+ | {{(global)}} |
Revision as of 04:02, 11 February 2020
Available since: Gideros 2011.6
Class: (global)
Description
Terminates the last protected function called and returns message as the error message. Function error never returns.
Usually, error adds some information about the error position at the beginning of the message. The level argument specifies how to get the error position. With level 1 (the default), the error position is where the error function was called. Level 2 points the error to where the function that called error was called; and so on. Passing a level 0 avoids the addition of error position information to the message.
error(message,level)
Parameters
message: (string) error message
level: (number) the call stack level optional