assert: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) m (Macros:Functions:assert moved to assert) |
Verisimilar (talk | contribs) m (Updated with recent version changes.) |
||
Line 1: | Line 1: | ||
{{stub|Examples of usage.}} | |||
{{MacroFunction | {{MacroFunction | ||
|name=assert | |name=assert | ||
|version=1.3b49 | |version=1.3b49 | ||
|description= | |description= | ||
Halts execution and prints a custom error message if a condition is | Halts execution and prints a custom error message if a condition is {{false}}. Note that the error message will be displayed in chat even if the command itself is in a [H: ] block. | ||
|usage= | |usage= | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
assert(condition, message) | |||
</source> | </source> | ||
<source lang="mtmacro" line> | |||
assert(condition, message, prefix) | |||
</source> | |||
'''Parameters''' | |||
{{param|condition|The test condition that must evaluate to {{true}} for the macro to continue.}} | |||
{{param|message|The custom error message that is presented if the macro is halted due to the {{false}} condition.}} | |||
{{param|prefix|Determines if the error message should have the message prefix {{code|"Macro defined error: "}}. Defaults to {{true}}, set to {{false}} if you do not wish your custom error message to have the message prefix.}} | |||
|also= | |||
{{func|abort}} | |||
|changes= | |||
{{change|1.3b51|Added {{code|prefix}} parameter option.}} | |||
}} | }} | ||
[[Category:Miscellaneous Function]] | [[Category:Miscellaneous Function]] |
Revision as of 05:19, 31 March 2009
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
This article needs: Examples of usage.
assert() Function
• Introduced in version 1.3b49
Halts execution and prints a custom error message if a condition is
false
(0
). Note that the error message will be displayed in chat even if the command itself is in a [H: ] block.Usage
assert(condition, message)
assert(condition, message, prefix)
Parameters
condition
- The test condition that must evaluate totrue
(1
) for the macro to continue.message
- The custom error message that is presented if the macro is halted due to thefalse
(0
) condition.prefix
- Determines if the error message should have the message prefix"Macro defined error: "
. Defaults totrue
(1
), set tofalse
(0
) if you do not wish your custom error message to have the message prefix.
See Also
Version Changes
- 1.3b51 - Added
prefix
parameter option.