Lua API

Debug module

Functions for debugging scripts.

Usage

local Debug = ELONA.require("core.Debug")

Functions

log (message) Logs a message to log.txt.
report_error (message) Reports an error to the game console and log file.
enable_wizard () Enable Wizard mode.
disable_wizard () Disable Wizard mode.
is_wizard () Returns whether you are Wizard or not.
is_muggle () Returns whether you are Muggle or not.
has_wizard_flag (flag_name) Return if you are Wizard and flag_name is on.

Functions

# log (message)

Logs a message to log.txt.

Parameters:
  • message : (string) the message to log
# report_error (message)

Reports an error to the game console and log file.

Parameters:
  • message : (string) the error message to report
# enable_wizard ()

Enable Wizard mode.

It is equivalent to turn core.wizard.is_enabled on.

# disable_wizard ()

Disable Wizard mode.

It is equivalent to turn core.wizard.is_enabled off.

# is_wizard ()

Returns whether you are Wizard or not.

It is opposite to Debug.is_muggle.

Note: You might want to make a limitation of "unless you are Wizard". For example, if you make an achievement system, Wizard players can obtain all of them much easier than you expect. However, before calling Debug.is_wizard, remember that Elona is a single-player game.

Returns:
  • (boolean) true if Wizard mode; otherwise false.
# is_muggle ()

Returns whether you are Muggle or not.

It is opposite to Debug.is_wizard.

Returns:
  • (boolean) true if Muggle mode; otherwise false.
# has_wizard_flag (flag_name)

Return if you are Wizard and flag_name is on.

Parameters:
  • flag_name : (string) The flag option's name.
Returns:
  • (boolean) true if Muggle mode; otherwise false.
  • (boolean) true if you are Wizard and flag_name is on; if not, false. Even if flag_name is not a boolean option, its value is interpreted as boolean (e.g., check truthy or falsy).