Call as
Platform.actions.spellID(id)
Record the dependency Platform.actions.spellID, 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
Validates a spell ID argument. Returns true for a readable positive finite integer; otherwise nil with "restricted-value" for a secret value or "invalid-spell" for anything else (including spell names).
Arguments
| Name | Type | What it does |
|---|---|---|
id | any | Value to validate as a spell ID. |
Returns
| 1 | boolean | nil | True when id is a valid spell ID; nil otherwise. |
|---|---|---|
| 2 | string | nil | restricted-value or invalid-spell when invalid. |
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.actions.GetSpellRangeStatelocal valid,reason=spellID(id)
Dependencies
platform(builtin:Platform/actions.lua:platform)
Source
Platform/actions.lua, line 33. Read only in game; Duplicate makes an editable copy.
Platform.actions.spellID(id)
if not platform:CanReadValue(id) then return nil,"restricted-value" end
if type(id)~="number" or id<1 or id==math.huge or id%1~=0 then return nil,"invalid-spell" end
return true