Class Core.Output

The output structure controls everything that can be printed in the Stormwind Library and also by the addons.

Methods

core.output:color (value, color) Colors a string with a given color according to how World of Warcraft handles colors in the chat and output.
core.output:error (message) Outputs an error message using the game's error frame.
core.output:getFormattedMessage (message) Formats a standard message with the addon name to be printed.
core.output:isTestingMode () Determines whether the output structure is in testing mode.
core.output:out (messages) This is the default printing method for the output structure.
core.output:print (message) Prints a message using the default Lua output resource.
core.output:printed (message) Determines whether a message was printed in the output structure with the out() method.
core.output:setTestingMode () Sets the output mode to 'test', changing the state of the output structure to be used in tests.

Metamethods

core.output:__construct () Output constructor.


Methods

core.output:color (value, color)
Colors a string with a given color according to how World of Warcraft handles colors in the chat and output.

This method first looks for the provided color, if it's not found, it will use the primary color from the addon properties. And if the primary color is not found, it won't color the string, but return it as it is.

Parameters:

  • value string The string to be colored
  • color string The color to be used

Returns:

    string The colored string
core.output:error (message)
Outputs an error message using the game's error frame.

The error frame by default is a red message that appears in the middle of the screen, usually used for errors that need the user's attention like attempting to use an ability that is on cooldown or trying to mount in a place where it's not allowed.

If, for some reason, the error frame is not available, it will fall back to the default output method.

Parameters:

  • message string The error message to be printed
core.output:getFormattedMessage (message)
Formats a standard message with the addon name to be printed.

Parameters:

  • message string The message to be formatted

Returns:

    string The formatted message
core.output:isTestingMode ()
Determines whether the output structure is in testing mode.

Returns:

    boolean Whether the output structure is in testing mode
core.output:out (messages)
This is the default printing method for the output structure. Although there's a print() method in the output structure, it's recommended to use this method instead, as it will format the message with the addon name and color it according to the primary color from the addon properties.

This method accepts a string or an array. If an array is passed it will print one line per value.

Parameters:

core.output:print (message)
Prints a message using the default Lua output resource.

Parameters:

  • message string The message to be printed
core.output:printed (message)
Determines whether a message was printed in the output structure with the out() method.

This method must be used only in test environments and if self:setTestingMode() was called before self:out() calls, otherwise it will always return false.

Parameters:

  • message string The message to be checked if it was printed

Returns:

    boolean Whether the message was printed
core.output:setTestingMode ()
Sets the output mode to 'test', changing the state of the output structure to be used in tests.

Metamethods

core.output:__construct ()
Output constructor.
generated by LDoc 1.5.0 Last updated 2024-09-11 16:27:53