Referencia › Referencia de funciones › Platform

Platform.casting.spellIdentity

dependencia

Llamar como

Platform.casting.spellIdentity(id)

Registra la dependencia Platform.casting.spellIdentity y luego llámala con ese nombre. Una llamada con espacio de nombres no pasa self: usa una llamada con dos puntos o pasa tú mismo el objeto.

Qué hace

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".

Argumentos

NombreTipoQué hace
idanySpell ID value from the UnitCastingInfo or UnitChannelInfo result.

Retornos

1number | nilThe validated spell ID, or nil when unavailable.
2string | nilReason when the ID is nil.

Ediciones

Las funciones auxiliares integradas se registran en todas las ediciones. Lo que cambia es la API del juego que leen; donde falta alguna, la función auxiliar recurre a una alternativa o devuelve nil con un motivo.

No lee directamente ninguna API del juego.

Valores secretos (Retail y Forever)

En Retail y Forever, el juego entrega a los addons valores secretos. Esta función auxiliar comprueba lo que lee (addon.Platform:CanReadValue) y, en lugar de un secreto que no puede comparar, devuelve nil con un motivo como restricted-value. Trata nil como no disponible, no como falso.

Cómo la llama el addon

Dependencias

Código fuente

Platform/casting.lua, línea 53. Solo lectura en el juego; Duplicar crea una copia editable.

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

Volver a Referencia de funciones