WowAddons

World of Warcraft Forever API · LuaDurationObjectAPI.md, for your AI

LuaDurationObjectAPI (widget methods)

31 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

Assign

self:Assign(other)

Copies another duration object and assigns it to this one.

Arguments

otherLuaDurationObject

Copy

copy = self:Copy()

Returns a copy of this duration object.

Returns

copyLuaDurationObject

EvaluateElapsedDuration

result = self:EvaluateElapsedDuration(curve, [modifier])

Calculates the elapsed duration in seconds and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

curveLuaCurveObjectBase
modifierDurationTimeModifier default "RealTime"

Returns

resultLuaCurveEvaluatedResult

EvaluateElapsedPercent

result = self:EvaluateElapsedPercent(curve, [modifier])

Calculates the elapsed duration as a percentage value and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

curveLuaCurveObjectBase
modifierDurationTimeModifier default "RealTime"

Returns

resultLuaCurveEvaluatedResult

EvaluateRemainingDuration

result = self:EvaluateRemainingDuration(curve, [modifier])

Calculates the remaining duration in seconds and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

curveLuaCurveObjectBase
modifierDurationTimeModifier default "RealTime"

Returns

resultLuaCurveEvaluatedResult

EvaluateRemainingPercent

result = self:EvaluateRemainingPercent(curve, [modifier])

Calculates the remaining duration as a percentage value and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

curveLuaCurveObjectBase
modifierDurationTimeModifier default "RealTime"

Returns

resultLuaCurveEvaluatedResult

EvaluateTotalDuration

result = self:EvaluateTotalDuration(curve, [modifier])

Calculates the total duration in seconds and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

curveLuaCurveObjectBase
modifierDurationTimeModifier default "RealTime"

Returns

resultLuaCurveEvaluatedResult

FormatElapsedDuration

formatted = self:FormatElapsedDuration(formatter, [modifier])

Formats the elapsed duration of this object to a string.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

formatterNumericFormatter
modifierDurationTimeModifier default "RealTime"

Returns

formattedstring

FormatRemainingDuration

formatted = self:FormatRemainingDuration(formatter, [modifier])

Formats the remaining duration of this object to a string.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

formatterNumericFormatter
modifierDurationTimeModifier default "RealTime"

Returns

formattedstring

FormatTotalDuration

formatted = self:FormatTotalDuration(formatter, [modifier])

Formats the total duration of this object to a string.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments

formatterNumericFormatter
modifierDurationTimeModifier default "RealTime"

Returns

formattedstring

GetClock

clock = self:GetClock()

Returns the clock source used by this object.

Returns

clockLuaDurationClock may be nilIf nil, the duration object is using an internal default clock source equivalent to GetTime().

GetClockTime

clockTime = self:GetClockTime()

Returns the current time of the clock source used by this object.

Returns

clockTimeFrameTime

GetElapsedDuration

elapsedDuration = self:GetElapsedDuration([modifier])

Calculates the elapsed duration of the stored time span.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

elapsedDurationSeconds

GetElapsedPercent

elapsedPercent = self:GetElapsedPercent([modifier])

Calculates the elapsed duration as a percentage value.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

elapsedPercentnumber

GetEndTime

endTime = self:GetEndTime([modifier])

Calculates the end time of the stored time span.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

endTimeFrameTime

GetModRate

modRate = self:GetModRate()

Returns the divisor used to convert a duration from real time to base time.

Returns

modRatenumber

GetRemainingDuration

remainingDuration = self:GetRemainingDuration([modifier])

Calculates the remaining duration of the stored time span.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

remainingDurationSeconds

GetRemainingPercent

remainingPercent = self:GetRemainingPercent([modifier])

Calculates the remaining duration as a percentage value.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

remainingPercentnumber

GetStartTime

startTime = self:GetStartTime([modifier])

Calculates the start time of the stored time span.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

startTimeFrameTime

GetTotalDuration

totalDuration = self:GetTotalDuration([modifier])

Calculates the total duration of the stored time span.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

totalDurationSeconds

HasExpired

hasExpired = self:HasExpired([modifier])

Returns true once the duration has reached its end time.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

hasExpiredbool

HasSecretValues

hasSecretValues = self:HasSecretValues()

Returns true if the duration has been configured with any secret values.

Returns

hasSecretValuesbool

HasStarted

hasStarted = self:HasStarted([modifier])

Returns true once the duration has reached its start time.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

hasStartedbool

IsActive

isActive = self:IsActive([modifier])

Returns true while the duration is at or after its start time and before its end time.

Arguments

modifierDurationTimeModifier default "RealTime"

Returns

isActivebool

IsZero

isZero = self:IsZero()

Returns true if the duration object is measuring a zero duration time span.

Returns

isZerobool

Reset

self:Reset()

Resets the duration object to represent a zero duration time span.

SetClock

self:SetClock([clock])

Configures the clock source used by this object.

Arguments

clockLuaDurationClock may be nilIf nil, the duration object will use an internal default clock source equivalent to GetTime().

SetTimeFromEnd

self:SetTimeFromEnd(endTime, duration, [modRate])

Configures the duration object to represent an end time and a duration.

Arguments

endTimeFrameTime
durationSeconds
modRatenumber default 1Optional divisor for converting this time span to a base time.

SetTimeFromStart

self:SetTimeFromStart(startTime, duration, [modRate])

Configures the duration object to represent a start time and a duration.

Arguments

startTimeFrameTime
durationSeconds
modRatenumber default 1Optional divisor for converting this time span to a base time.

SetTimeSpan

self:SetTimeSpan(startTime, endTime)

Configures the duration object to represent a fixed start and end time span. If the end time is earlier than the start time, the duration will clamp to zero.

Arguments

startTimeFrameTime
endTimeFrameTime

SetToDefaults

self:SetToDefaults()

Resets all state on the duration, and clears the secret values flag.

It takes WowAddons

Free, for Windows, macOS and Linux: it puts the addon in your game in one click and keeps it up to date. Open it once, then press Install again.

WowAddons runs on your computer: open wowaddons.gg there.

Download for Windows