Reference › Function reference › Platform

Platform.actions.findSlot

dependency

Call as

Platform.actions.findSlot(id, bank)

Record the dependency Platform.actions.findSlot, 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

Finds the spell-book slot of a spell with FindSpellBookSlotBySpellID. bank "pet" searches the pet book, "any" searches the player book and then the pet book, and any other value searches the player book only. Returns the slot and its book type, or nil, nil and a reason: spell-not-in-book, invalid-api-result, or a reason from call (missing-api, api-error, restricted-value).

Arguments

NameTypeWhat it does
idnumberSpell ID to locate; not validated here (callers check it with spellID first).
bankstringSpell-book scope: spell, pet or any.

Returns

1number | nilPositive integer spell-book slot, or nil when not found or unavailable.
2string | nilBook type for that slot: BOOKTYPE_PET (pet) or BOOKTYPE_SPELL (spell); nil on failure.
3string | nilReason when the slot 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.

  • Not available on that edition (the reason is in the tooltip)
  • Only while Blizzard's deprecation fallbacks are on
Game APIClassic EraTBC AnniversaryClassic progressionForeverRetail
FindSpellBookSlotBySpellIDClassic EraTBC AnniversaryClassic progressionForeverRetail

How the addon calls it

Dependencies

Source

Platform/actions.lua, line 92. Read only in game; Duplicate makes an editable copy.

Platform.actions.findSlot(id, bank)
    local pet=bank=="pet"
    local slot,reason=call(FindSpellBookSlotBySpellID,id,pet)
    if reason then return nil,nil,reason end
    if slot==nil and bank=="any" then
        pet=true;slot,reason=call(FindSpellBookSlotBySpellID,id,true)
        if reason then return nil,nil,reason end
    end
    if slot==nil then return nil,nil,"spell-not-in-book" end
    if type(slot)~="number" or slot<1 or slot==math.huge or slot%1~=0 then return nil,nil,"invalid-api-result" end
    return slot,pet and (BOOKTYPE_PET or "pet") or (BOOKTYPE_SPELL or "spell")

Back to Function reference