Chame como
Platform.casting.interruptibility(flag)
Registre a dependência Platform.casting.interruptibility e depois chame-a por esse nome. Uma chamada com namespace não passa self: use uma chamada com dois-pontos ou passe o objeto você mesmo.
O que faz
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
| Nome | Tipo | O que faz |
|---|---|---|
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. |
Edições
As funções auxiliares integradas são registradas em todas as edições. O que muda é a API do jogo que elas leem; quando uma está ausente, a função auxiliar recorre a uma alternativa ou retorna nil com um motivo.
Não lê nenhuma API do jogo diretamente.
Valores secretos (Retail e Forever)
No Retail e no Forever, o jogo entrega valores secretos aos addons. Esta função auxiliar verifica o que lê (addon.Platform:CanReadValue) e retorna nil com um motivo como restricted-value em vez de um valor secreto que não consegue comparar. Trate nil como indisponível, não como false.
Como o addon a chama
Platform.casting.GetUnitCastObservationrecord.interruptible,record.interruptibleReason=interruptibility(tuple[kind=='cast' and 8 or 7])
Dependências
platform(builtin:Platform/casting.lua:platform)
Código-fonte
Platform/casting.lua, linha 64. Somente leitura no jogo; Duplicar cria uma cópia editável.
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