Skip to content

casting_or_channeling

The casting_or_channeling function checks if a specified unit is currently casting or channeling a spell. This function is useful for determining if a unit is engaged in a spellcasting activity.

Parameters

  • unit (string): The unit identifier (such as "player", "target", "focus", etc.) for which to check the casting or channeling status.

Returns

  • is_casting_or_channeling (boolean): Returns true if the unit is currently casting or channeling a spell, otherwise returns false.

Example Usage in Lua

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

local api = ...

-- Function to check if a unit is casting or channeling a spell
function CheckCastingOrChanneling(unit)
    local is_casting_or_channeling = api.casting_or_channeling(unit)
    if is_casting_or_channeling then
        print("The unit '" .. unit .. "' is currently casting or channeling a spell.")
    else
        print("The unit '" .. unit .. "' is not casting or channeling any spell.")
    end
end

-- Example usage: Check if the player is casting or channeling a spell
CheckCastingOrChanneling("player")