Determines whether two given units refer to one and the same unit.

UnitIsUnit(UnitId1, UnitId2);

Parameters Edit

Arguments Edit

string - The first UnitId.
string - The second UnitId.

Returns Edit

Boolean value - true if both UnitId refer to the same unit, false otherwise.
nil will be returned if the target UnitId does not exist (see Example 2).

Example Edit

-- Example 1:
if ( UnitIsUnit( "player", "target" ) ) then
  SendChatMessage("I look good!", "SAY" );

-- Example 2: Do not implement it like hereunder, because it will not pass the test if the UnitId you gave does not exist;
-- In the example, the condition has to be read as:
--  "if target is targeting something, but not the player"
-- not as:
-- "if target is not targeting player".

if ( UnitIsUnit("player", "targettarget") == false) then
  SendChatMessage("I look good!", "SAY" ); -- will not be run if target is not targeting anyone.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.