melee

Tests that a unit is within melee of another unit, defaults to the player and the players target.

melee(target, source) : boolean

Example

if melee('target', 'pet') or melee() then
-- My pet or me is in melee
end