Skip to content

sonolus.script.debug

debug_log(value: int | float | bool)

Log a value in debug mode.

debug_pause()

Pause the game if in debug mode.

error(message: str | None = None) -> Never

Raise an error, and if runtime checks are set to notify, log a message and pause the game.

This function is used to raise an error during runtime and terminate the current callback.

If runtime checks are set to notify (default in dev), this function will log a message and pause the game before terminating.

Parameters:

Name Type Description Default
message str | None

The message to log.

None

notify(message: str)

Log a code that can be decoded by the dev server and pause the game if runtime checks are set to notify.

If runtime checks are not set to notify, this function will do nothing.

Parameters:

Name Type Description Default
message str

The message to log.

required

require(value: int | float | bool, message: str | None = None)

Require a condition to be true, or raise an error.

Similar to assert, but will terminate the current callback even if runtime checks are set to none.

If runtime checks are set to notify (default in dev), this function will log a message and pause the game before terminating.

Parameters:

Name Type Description Default
value int | float | bool

The condition to check.

required
message str | None

The message to log if the condition is false.

None

static_error(message: str | None = None) -> Never

Raise a static error.

This function is used to raise an error during compile-time if the compiler cannot guarantee that this function will not be called during runtime.

Parameters:

Name Type Description Default
message str | None

The message to log.

None