WoW:API UnitIsFriend: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
(boilerplate) |
||
Line 1: | Line 1: | ||
{{wowapi}} | {{wowapi}} | ||
This function will determine | This function will determine whether two units are friendly to each other (i.e. able to help each other in combat). | ||
isFriend = UnitIsFriend("unit","otherunit"); | |||
== | == Arguments == | ||
;unit:String - A valid [[API TYPE UnitId|unit]]. | |||
;otherunit:String - A valid [[API TYPE UnitId|unit]]. | |||
== | == Returns == | ||
;IsFriend:Boolean flag - 1 if otherunit is friendly to unit; nil otherwise. | |||
== | == Example == | ||
The following snippet outputs a message when the player has a hostile target. | |||
if UnitExists("target") and not UnitIsFriend("player", "target") then | |||
print(UnitName("target") .. " is evil! Run!"); | |||
end | |||
Revision as of 18:35, 31 August 2009
← WoW API < UnitIsFriend
This function will determine whether two units are friendly to each other (i.e. able to help each other in combat).
isFriend = UnitIsFriend("unit","otherunit");
Arguments
Returns
- IsFriend
- Boolean flag - 1 if otherunit is friendly to unit; nil otherwise.
Example
The following snippet outputs a message when the player has a hostile target.
if UnitExists("target") and not UnitIsFriend("player", "target") then print(UnitName("target") .. " is evil! Run!"); end