Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Asserts whether config is truthy, and if not throws a game assert and a Javascript error... |
Notes
This requires the hackAssert() function in Warzone 3.2 or above. If that function is not available, it will fall back to just throwing a Javascript error which will still be logged but won't cause a game assert.
The value of config will be evaluated to determine if it is truthy or falsey:
- truthy – nothing will happen, the game will continue as normal
- falsey – a 'game assert' is thrown, followed by a Javascript Error
When a 'game assert' is thrown, a game error will be logged. If a debugger is connected to the game, Warzone will halt and allow you to inspect game state via the debugger, otherwise the game will continue.
If the (optional) self parameter is specified, the message associated with the assertion will be prefixed with the filename and version defined in the Self Descriptor Object.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
out("This should be true", null, out.ASSERT, true); // does nothing out("This should be true", null, out.ASSERT, false); // throws game assert & JS error |