Assert a value and throw a game assert and JS error if it's falsey... |
hackAssert(value, message); |
Parameter | Type | Mandatory | Notes | Warzone Version |
---|---|---|---|---|
value | Variant | The value to assert as truthy. | 3.2 | |
message | String | A message to associate with the assertion. Note: You can specify multiple strings as additional parameters. | 3.2 |
Value | Type | Notes | Warzone Version |
---|---|---|---|
undefined | Undefined | The function does not return anything if value is truthy. | 3.2 |
<error> | Error | The value specified was falsey and failed the assertion. | 3.2 |
The function will evaluate the value as truthey or falsey:
If a debugger is attached to Warzone, when a game assert is thrown Warzone will halt to allow debugging. Otherwise the game will continue running.
An error will be logged to the log file and console (see debug() for platform-specific access to console messages) should the assertion fail.
// this should pass (and do nothing) hackAssert(true, "this should do nothing"); // this should fail (and cause a game assert + JS error) hackAssert(false, "NASDA routine systems test: What could possibly go wrong?"); |
This function is likely to be changed in the future. |
AvailabilityRequires:
|
ContentsJump to: |
See alsoRelated articles:
Add-on APIs: |