Difference between revisions of "Assert"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === Issues an error when the value of its argument v is false (i.e., nil or false); otherwise, returns all...")
 
Line 4: Line 4:
 
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!"
 
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!"
 
<source lang="lua">
 
<source lang="lua">
= assert(vmessage,)
+
assert(v,message)
 
</source>
 
</source>
'''v:''' (any) expression/function to assert ''''''<br/>
+
'''v''': (any) expression/function to assert ''''''<br/>
'''message:''' (string) error message if assert fails '''optional'''<br/>
+
'''message''': (string) error message if assert fails '''optional'''<br/>

Revision as of 10:21, 23 August 2018

Available since: Gideros 2011.6

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)

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