Call as
Platform.casting.interruptibility(flag)
Record the dependency Platform.casting.interruptibility, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.
What it does
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.
Arguments
| Name | Type | What it does |
|---|---|---|
flag | boolean | nil | Native notInterruptible value from UnitCastingInfo or UnitChannelInfo. |
Returns
| 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. |
Editions
Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.
It reads no game API directly.
Secret values (Retail and Forever)
On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.
How the addon calls it
Platform.casting.GetUnitCastObservationrecord.interruptible,record.interruptibleReason=interruptibility(tuple[kind=='cast' and 8 or 7])
Dependencies
platform(builtin:Platform/casting.lua:platform)
Source
Platform/casting.lua, line 64. Read only in game; Duplicate makes an editable copy.
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