Skip to content

spell_charges

The spell_charges function retrieves the number of charges available for a specified spell. This function is useful for determining how many times a spell can be cast before it needs to recharge.

Parameters

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

Returns

  • count (number): The number of charges available for the specified spell. Returns 0 if the spell has no charges or if the spell information is not available.

Example Usage in Lua

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

local api = ...

-- Function to print the number of charges available for a specified spell
function PrintSpellCharges(spell)
    local count = api.spell_charges(spell)
    print("The spell '" .. spell .. "' has " .. count .. " charges available.")
end

-- Example usage: Print the number of charges available for the spell "Fireball"
PrintSpellCharges("Fireball")