Riferimento › Riferimento delle funzioni › Platform

Platform.casting.durationSeconds

dipendenza

Chiamala come

Platform.casting.durationSeconds(starting, ending)

Registra la dipendenza Platform.casting.durationSeconds, poi chiamala con quel nome. Una chiamata con spazio dei nomi non passa self: usa una chiamata con i due punti o passa tu l'oggetto.

Cosa fa

Computes the total length of a cast or channel in seconds from the millisecond start and end times in a UnitCastingInfo or UnitChannelInfo result. Returns nil with "restricted-value" when either time is secret, "cast-time-unavailable" when either is nil, or "invalid-api-result" when a time is not a finite number, the start is negative or the end is not after the start.

Argomenti

NomeTipoCosa fa
startingnumber | nilCast start time in milliseconds (GetTime() scale times 1000).
endingnumber | nilCast end time in milliseconds (GetTime() scale times 1000).

Valori restituiti

1number | nilTotal cast length in seconds, or nil when unavailable.
2string | nilReason when the length is nil.

Edizioni

Le funzioni di supporto integrate sono registrate su ogni edizione. Ciò che cambia è l'API di gioco che leggono; dove ne manca una, la funzione di supporto ripiega su un'alternativa o restituisce nil con un motivo.

Non legge direttamente alcuna API di gioco.

Valori segreti (Retail e Forever)

Su Retail e Forever il gioco fornisce agli addon valori segreti. Questa funzione di supporto controlla ciò che legge (addon.Platform:CanReadValue) e restituisce nil con un motivo come restricted-value invece di un valore segreto che non può confrontare. Considera nil come non disponibile, non come false.

Come la chiama l'addon

Dipendenze

Sorgente

Platform/casting.lua, riga 42. Nel gioco è in sola lettura; Duplica crea una copia modificabile.

Platform.casting.durationSeconds(starting, ending)
    if not platform:CanReadValue(starting) or not platform:CanReadValue(ending) then return nil,'restricted-value' end
    if starting==nil or ending==nil then return nil,'cast-time-unavailable' end
    if not finite(starting) or not finite(ending) or starting<0 or ending<=starting then return nil,'invalid-api-result' end
    return (ending-starting)/1000

Torna a Riferimento delle funzioni