Returns whether the player is in range to cast a spell on a unit


See also Spell functions.

Signature:

inRange = IsSpellInRange(index, "bookType", "unit") or IsSpellInRange("name", "unit")

Arguments:

  • index - Index of a spell in the spellbook (number, spellbookID)

  • bookType - Type of spellbook (string)

    • pet - The pet's spellbook
    • spell - The player's spellbook

  • name - Name of a spell (string)

  • unit - A unit to target with the spell (string, unitID)

Returns:

  • inRange - 1 if the player is near enough to cast the spell on the unit; 0 if not in range; nil if the unit is not a valid target for the spell (1nil)