World of Warcraft Forever API · SecondsFormatterAPI.md, for your AI
SecondsFormatterAPI (widget methods)
35 functions, as Blizzard documents them for Forever 1.60.1 (70959).
Making an addon with an AI? Tell it: Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it. It checks every call against this API before you try it in the game, then publishes it here. How it works.
Functions
CanApproximate
canApproximate = self:CanApproximate(seconds)
Returns true if the given number of seconds is within an appropriate range for approximated formatting.
Arguments
seconds | Seconds |
|---|
Returns
canApproximate | bool |
|---|
CanRoundUpIntervals
canRound = self:CanRoundUpIntervals()
Returns true if the formatter can promote values to higher interval bands.
Returns
canRound | bool |
|---|
CanRoundUpLastUnit
canRound = self:CanRoundUpLastUnit()
Returns true if the formatter should round the final unit up rather than down.
Returns
canRound | bool |
|---|
EvaluateDesiredUnitCount
count = self:EvaluateDesiredUnitCount(seconds)
Returns the unit count that a given number of seconds will use for formatting.
Arguments
seconds | Seconds |
|---|
Returns
count | number |
|---|
EvaluateMaxInterval
interval = self:EvaluateMaxInterval(seconds)
Returns the maximum interval band that a given number of seconds will use for formatting.
Arguments
seconds | Seconds |
|---|
Returns
interval | SecondsFormatterInterval |
|---|
EvaluateMinInterval
interval = self:EvaluateMinInterval(seconds)
Returns the minimum interval band that a given number of seconds will use for formatting.
Arguments
seconds | Seconds |
|---|
Returns
interval | SecondsFormatterInterval |
|---|
Format
formattedSeconds = self:Format(seconds, [abbreviation])
Formats a number of seconds and returns the resulting string.
Arguments
seconds | Seconds | |
|---|---|---|
abbreviation | SecondsFormatterAbbreviation may be nil | Optional abbreviation mode to use in-place of the default. |
Returns
formattedSeconds | string |
|---|
FormatZero
formattedSeconds = self:FormatZero([abbreviation])
Returns formatted string representing a zero second duration.
Arguments
abbreviation | SecondsFormatterAbbreviation may be nil | Optional abbreviation mode to use in-place of the default. |
|---|
Returns
formattedSeconds | string |
|---|
GetApproximationSeconds
approximationSeconds = self:GetApproximationSeconds()
Returns the threshold below which numeric values are formatted as approximated strings.
Returns
approximationSeconds | Seconds |
|---|
GetConvertToLower
convert = self:GetConvertToLower()
Returns true if the formatter should lowercase all unit format strings.
Returns
convert | bool |
|---|
GetDefaultAbbreviation
abbreviation = self:GetDefaultAbbreviation()
Returns the default abbreviation mode used for formatting.
Returns
abbreviation | SecondsFormatterAbbreviation may be nil |
|---|
GetDesiredUnitCount
count = self:GetDesiredUnitCount()
Returns the desired unit count for formatting.
Returns
count | number may be nil | Nil if configured to use a curve. |
|---|
GetDesiredUnitCountCurve
curve = self:GetDesiredUnitCountCurve()
Returns the desired unit count curve for formatting.
Returns
curve | LuaCurveObject may be nil | Nil if configured to static unit count. |
|---|
GetMaxInterval
interval = self:GetMaxInterval()
Returns the maximum interval band permitted for formatting.
Returns
interval | SecondsFormatterInterval may be nil | Nil if configured to use a curve. |
|---|
GetMaxIntervalCurve
curve = self:GetMaxIntervalCurve()
Returns the maximum interval band curve permitted for formatting.
Returns
curve | LuaCurveObject may be nil | Nil if configured to static interval band. |
|---|
GetMillisecondsThreshold
threshold = self:GetMillisecondsThreshold()
Returns the threshold below which a value will be formatted as a decimal number of seconds with one place for milliseconds (eg. '3.4')
Returns
threshold | Seconds |
|---|
GetMinInterval
interval = self:GetMinInterval()
Returns the minimum interval band permitted for formatting.
Returns
interval | SecondsFormatterInterval may be nil | Nil if configured to use a curve. |
|---|
GetMinIntervalCurve
curve = self:GetMinIntervalCurve()
Returns the minimum interval band curve permitted for formatting.
Returns
curve | LuaCurveObject may be nil | Nil if configured to static interval band. |
|---|
GetRounding
rounding = self:GetRounding()
Returns how fractional seconds are rounded when not displaying milliseconds.
Returns
rounding | SecondsFormatterRounding | The configured rounding mode. |
|---|
GetStripIntervalWhitespace
strip = self:GetStripIntervalWhitespace()
Returns the whitespace stripping mode of the formatter.
Returns
strip | SecondsFormatterIntervalWhitespace |
|---|
Reset
self:Reset()
Resets all stored configuration of the formatter.
SetApproximationSeconds
self:SetApproximationSeconds(seconds)
Configures the formatter to render numeric values between zero and this value as approximated strings (eg. '< 1m').
Arguments
seconds | Seconds |
|---|
SetCanRoundUpIntervals
self:SetCanRoundUpIntervals(canRound)
Configures the formatter to promote intervals if values are large enough (eg. '60m' -> '1h').
Arguments
canRound | bool |
|---|
SetCanRoundUpLastUnit
self:SetCanRoundUpLastUnit(canRound)
Configures the formatter to round the last formatted unit up, rather than down.
Arguments
canRound | bool |
|---|
SetConvertToLower
self:SetConvertToLower(convert)
Configures the formatter to convert all interval format strings to lowercase.
Arguments
convert | bool |
|---|
SetDefaultAbbreviation
self:SetDefaultAbbreviation(abbreviation)
Sets the default abbreviation mode used for formatting.
Arguments
abbreviation | SecondsFormatterAbbreviation |
|---|
SetDesiredUnitCount
self:SetDesiredUnitCount(count)
Sets the desired unit count used for formatting.
Arguments
count | number |
|---|
SetDesiredUnitCountCurve
self:SetDesiredUnitCountCurve(curve)
Sets the desired unit count used for formatting to a curve that will be evaluated with seconds values to produce a desired unit count.
Arguments
curve | LuaCurveObject |
|---|
SetMaxInterval
self:SetMaxInterval(interval)
Sets the maximum interval band used for formatting.
Arguments
interval | SecondsFormatterInterval |
|---|
SetMaxIntervalCurve
self:SetMaxIntervalCurve(curve)
Sets the maximum interval band used for formatting to a curve that will be evaluated with seconds values to produce a value matching a SecondsFormatterInterval enum member.
Arguments
curve | LuaCurveObject |
|---|
SetMillisecondsThreshold
self:SetMillisecondsThreshold(threshold)
Sets the threshold below which a value will be formatted as a decimal number of seconds with one place for milliseconds (eg. '3.4')
Arguments
threshold | Seconds |
|---|
SetMinInterval
self:SetMinInterval(interval)
Sets the minimum interval band used for formatting.
Arguments
interval | SecondsFormatterInterval |
|---|
SetMinIntervalCurve
self:SetMinIntervalCurve(curve)
Sets the minimum interval band used for formatting to a curve that will be evaluated with seconds values to produce a value matching a SecondsFormatterInterval enum member.
Arguments
curve | LuaCurveObject |
|---|
SetRounding
self:SetRounding(rounding)
Sets how fractional seconds are rounded when not displaying milliseconds.
Arguments
rounding | SecondsFormatterRounding | The rounding mode to use. |
|---|
SetStripIntervalWhitespace
self:SetStripIntervalWhitespace(strip)
Sets the whitespace stripping mode for the formatter.
Arguments
strip | SecondsFormatterIntervalWhitespace |
|---|