Llamar como
Platform.casting.interruptibility(flag)
Registra la dependencia Platform.casting.interruptibility 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
Converts the native notInterruptible flag of a cast or channel into an interruptible Boolean (its inverse). Returns nil with "restricted-value" for a secret flag, "interruptibility-unavailable" when the flag is nil, or "invalid-api-result" when it is not a Boolean.
Argumentos
| Nombre | Tipo | Qué hace |
|---|---|---|
flag | boolean | nil | Native notInterruptible value from UnitCastingInfo or UnitChannelInfo. |
Retornos
| 1 | boolean | nil | True when the cast can be interrupted, false when it cannot; nil when unavailable. |
|---|---|---|
| 2 | string | nil | Reason when the result 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
Platform.casting.GetUnitCastObservationrecord.interruptible,record.interruptibleReason=interruptibility(tuple[kind=='cast' and 8 or 7])
Dependencias
platform(builtin:Platform/casting.lua:platform)
Código fuente
Platform/casting.lua, línea 64. Solo lectura en el juego; Duplicar crea una copia editable.
Platform.casting.interruptibility(flag)
if not platform:CanReadValue(flag) then return nil,'restricted-value' end
if flag==nil then return nil,'interruptibility-unavailable' end
if type(flag)~='boolean' then return nil,'invalid-api-result' end
return not flag