Chiamala come
Platform.casting.spellIdentity(id)
Registra la dipendenza Platform.casting.spellIdentity, 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
Validates the spell ID field of a cast or channel result. Returns the ID when it is a readable positive finite integer; otherwise nil with "restricted-value" (secret), "cast-spell-unavailable" (nil) or "invalid-api-result".
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
id | any | Spell ID value from the UnitCastingInfo or UnitChannelInfo result. |
Valori restituiti
| 1 | number | nil | The validated spell ID, or nil when unavailable. |
|---|---|---|
| 2 | string | nil | Reason when the ID 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
Platform.casting.GetUnitCastObservationrecord.spellID,record.spellReason=spellIdentity(tuple[kind=='cast' and 9 or 8])
Dipendenze
platform(builtin:Platform/casting.lua:platform)
Sorgente
Platform/casting.lua, riga 53. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Platform.casting.spellIdentity(id)
if not platform:CanReadValue(id) then return nil,'restricted-value' end
if id==nil then return nil,'cast-spell-unavailable' end
if type(id)~='number' or id~=id or id<=0 or id==math.huge or id%1~=0 then return nil,'invalid-api-result' end
return id