combat

Returns true if the UNIT is in combat, otherwise false.

combat([UnitId]) : boolean
1. See Wowpedia for more information on WoW Unit IDs. Will default to 'player' if nothing is specified as an argument.

Example

Cast Frostbolt if my target is in fact in combat.

if combat('target') then
return cast(Frostbolt, 'target')
end

Note

This uses UnitAffectingCombat(unit), returning boolean.