Difference between revisions of "Assert"

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>Issues an error when the value of its argument v is false (i.e., nil or false); otherwise, returns all its arguments. message is an error message; when absent, it defaults to "assertion failed!"</translate>
 
<translate>Issues an error when the value of its argument v is false (i.e., nil or false); otherwise, returns all its arguments. message is an error message; when absent, it defaults to "assertion failed!"</translate>
 
<source lang="lua">
 
<source lang="lua">
assert(v,message)
+
assert(v,message)
 
</source>
 
</source>
 +
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
'''v''': (any) <translate>expression/function to assert</translate> <br/>
+
'''v''': (any) <translate>expression/function to assert</translate><br/>
 
'''message''': (string) <translate>error message if assert fails</translate> '''optional'''<br/>
 
'''message''': (string) <translate>error message if assert fails</translate> '''optional'''<br/>
 +
 +
{{(global)}}

Revision as of 03:57, 11 February 2020


Available since: Gideros 2011.6
Class: (global)

Description

Issues an error when the value of its argument v is false (i.e., nil or false); otherwise, returns all its arguments. message is an error message; when absent, it defaults to "assertion failed!"

assert(v,message)

Parameters

v: (any) expression/function to assert
message: (string) error message if assert fails optional