Chiamala come
Platform.spells.identifier(value, idOnly)
Registra la dipendenza Platform.spells.identifier, poi chiamala con quel nome. Una chiamata con spazio dei nomi non passa self: usa una chiamata con i due punti o passa tu l'oggetto.
Cosa fa
Validates a spell argument. Accepts a readable positive finite integer spell ID or, unless idOnly is true, a nonempty spell name string. Returns true, or false with "restricted-value" for a secret value or "invalid-spell" for anything else.
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
value | any | Spell ID or name to validate. |
idOnly | boolean | nil | True accepts numeric spell IDs only and rejects names. |
Valori restituiti
| 1 | boolean | True when value is acceptable; false otherwise. |
|---|---|---|
| 2 | string | nil | restricted-value or invalid-spell when rejected. |
Edizioni
Le funzioni di supporto integrate sono registrate su ogni edizione. Ciò che cambia è l'API di gioco che leggono; dove ne manca una, la funzione di supporto ripiega su un'alternativa o restituisce nil con un motivo.
Non legge direttamente alcuna API di gioco.
Valori segreti (Retail e Forever)
Su Retail e Forever il gioco fornisce agli addon valori segreti. Questa funzione di supporto controlla ciò che legge (addon.Platform:CanReadValue) e restituisce nil con un motivo come restricted-value invece di un valore segreto che non può confrontare. Considera nil come non disponibile, non come false.
Come la chiama l'addon
Platform.spells.GetSpellChargeslocal valid,reason=identifier(spell)Platform.spells.GetSpellCooldownlocal valid, reason = identifier(spell)Platform.spells.IsAutoRepeatActivelocal valid,reason=identifier(spellID,true)Platform.spells.cooldownValueslocal valid,reason=identifier(spell)
Dipendenze
platform(builtin:Platform/spells.lua:platform)
Sorgente
Platform/spells.lua, riga 22. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Platform.spells.identifier(value, idOnly)
if not platform:CanReadValue(value) then return false, "restricted-value" end
if type(value) == "number" and value > 0 and value < math.huge and value % 1 == 0 then return true end
if not idOnly and type(value) == "string" and #value > 0 then return true end
return false, "invalid-spell"