Debugging
Assert
Assert(condition, msg)
Validates that condition
is truthy.
If not, immediately halts the game, and displays the given error message along with a stack trace.
Since this stops the game entirely, this function should only be used to help debug issues, and should not be used in the normal flow of game logic.
condition
: The condition to check. Should return a Truthy value when everything is working as expected.message
: The error message to display if the assertion fails. This parameter is optional. This expression is only executed if the condition is false, so you can write expensive operations here without worrying about performance. You may want to include enough information to help debug the problem.
While Assert
looks like a normal function, it is not, it is a compiler intrinsic.
That is why it is able to conditionally execute the second parameter.
ConsoleError
ConsoleError(x)
Displays an error message in the browser console.
ConsoleInspect
x.ConsoleInspect -> x
ConsoleInspect(x) -> x
Displays a value in the browser console, and returns the same value. This allows it to be placed in the middle of an expression without affecting the result.
let x = ConsoleInspect(42);
ConsoleLog
ConsoleLog(x)
Displays a message in the browser console.
Panic
Panic(msg)
Immediately halts the game, and displays the given error message along with a stack trace.
Since this stops the game entirely, this function should only be used to help debug issues, and should not be used in the normal flow of game logic.