WoW:API UnitIsUnit: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Move page script moved page API UnitIsUnit to API UnitIsUnit without leaving a redirect)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<center>'''UnitIsUnit''' </center>
{{wowapi}} __NOTOC__
 
Returns true if the two specified units are the same, false otherwise.
Returns true if the two specified units are the same, false otherwise.
isSame = UnitIsUnit(unit1, unit2);


----
==Parameters==
;''Arguments''
===Arguments===
 
:;unit1 : [[UnitId]] - The first unit to query (e.g. "party1", "pet", "player")
:(String unit1, String unit2)
:;unit2 : [[UnitId]] - The second unit to compare it to (e.g. "target")
 
===Returns===
:;unit1 : The first unit to query (e.g. "party1", "pet", "player")
:;isSame : Boolean - 1 if the two units are the same entity, nil otherwise.
:;unit2 : The second unit to compare it to (e.g. "target")


----
==Example==
;''Returns''
  if ( UnitIsUnit("targettarget", "player") ) then
 
  message("Look at me, I have aggro from " .. UnitName("target") .. "!");
:Boolean unitIsUnit
 
:;unitIsUnit : True if the two units are the same, false otherwise.
 
----
;''Example''
  if ( UnitIsUnit("party1", "target") ) then
  TargetUnit("partypet1");
else
  TargetUnit("party1");
  end;
  end;
 
===Result===
----
Displays a message if your target is targetting you.
{{Template:WoW API}}
[[Category:API Functions|UnitIsUnit]]
[[Category:API Unit Functions|UnitIsUnit]]

Latest revision as of 04:47, 15 August 2023

WoW API < UnitIsUnit

Returns true if the two specified units are the same, false otherwise.

isSame = UnitIsUnit(unit1, unit2);

Parameters[edit]

Arguments[edit]

unit1
UnitId - The first unit to query (e.g. "party1", "pet", "player")
unit2
UnitId - The second unit to compare it to (e.g. "target")

Returns[edit]

isSame
Boolean - 1 if the two units are the same entity, nil otherwise.

Example[edit]

if ( UnitIsUnit("targettarget", "player") ) then
 message("Look at me, I have aggro from " .. UnitName("target") .. "!");
end;

Result[edit]

Displays a message if your target is targetting you.