Skip to content

MoneyFormatter

Inherits: Class

Methods

SetColor

lua
function MoneyFormatter:SetColor(colorPrefix)
  -> self

Sets a color prefix to use for the text components.

Parameters:

NameTypeDescription
colorPrefixstringThe color prefix string or nil to remove coloring

Returns:

TypeDescription
self

SetCopperHandling

lua
function MoneyFormatter:SetCopperHandling(handling)
  -> self

Changes how copper is handled.

Parameters:

NameTypeDescription
handlingEnumValueHow to handle copper

Returns:

TypeDescription
self

SetFormat

lua
function MoneyFormatter:SetFormat(format)
  -> self

Sets the format.

Parameters:

NameTypeDescription
formatEnumValueThe format to use

Returns:

TypeDescription
self

SetTrimEnabled

lua
function MoneyFormatter:SetTrimEnabled(enabled)
  -> self

Sets whether or not trailing 0 values should be trimmed.

Parameters:

NameTypeDescription
enabledbooleanWhether or not trimming should be enabled

Returns:

TypeDescription
self

ToString

lua
function MoneyFormatter:ToString(value)
  -> string

Converts a money value to a string.

Parameters:

NameTypeDescription
valuenumberThe value in copper

Returns:

TypeDescription
string

Functions

FromString

lua
function MoneyFormatter.FromString(value)
  -> number?

Converts a string money value to a number value (in copper). The value passed to this function can contain colored text, but must use text and not icon tokens.

Parameters:

NameTypeDescription
valuestringThe money value to be converted

Returns:

TypeDescription
number?

GetCopperText

lua
function MoneyFormatter.GetCopperText()
  -> string

Returns the colored copper indicator text.

Returns:

TypeDescription
string

GetGoldText

lua
function MoneyFormatter.GetGoldText()
  -> string

Returns the colored gold indicator text.

Returns:

TypeDescription
string

GetLargeNumberSeparator

lua
function MoneyFormatter.GetLargeNumberSeparator()
  -> string

Gets the large number separator.

Returns:

TypeDescription
string

GetSilverText

lua
function MoneyFormatter.GetSilverText()
  -> string

Returns the colored silver indicator text.

Returns:

TypeDescription
string

New

lua
function MoneyFormatter.New()
  -> MoneyFormatter

Creates a new money formatter.

Returns:

TypeDescription
MoneyFormatter

SetLargeNumberSeparator

lua
function MoneyFormatter.SetLargeNumberSeparator(value)

Sets the large number separator.

Parameters:

NameTypeDescription
valuestringThe string value