Skip to content

spell_known

The spell_known function checks if a specified spell is known by the player. This function is useful for determining whether a spell is available for use, either through being learned or talented.

Parameters

  • spell (number): The ID of the spell to check.

Returns

  • is_known (boolean): Returns true if the spell is known by the player, either through being learned or talented, otherwise returns false.

Example Usage in Lua

Here is an example of how to use the spell_known function in Lua:

local api = ...

-- Function to check if a spell is known and print the result
function PrintSpellKnown(spell)
    local is_known = api.spell_known(spell)
    if is_known then
        print("The spell with ID " .. spell .. " is known by the player.")
    else
        print("The spell with ID " .. spell .. " is not known by the player.")
    end
end

-- Example usage: Check if the spell with ID 12345 is known by the player
PrintSpellKnown(12345)