Difference between revisions of "API UnitIsPlayer"

From Wowpedia
Jump to: navigation, search
m (If the return values are true or nil, then the second half of the IF block will never fire, so I removed it. Could have changed it to "==", but then there would be two calls to UnitIsPlayer())
Line 21: Line 21:
 
if (UnitIsPlayer(UnitId)) then
 
if (UnitIsPlayer(UnitId)) then
 
--Do something here
 
--Do something here
  +
else
elseif (UnitIsPlayer(UnitId) ~= nil) then
 
--Do something here
+
--Do something else
 
end
 
end

Revision as of 14:12, 17 June 2008

Game Flavors
Links
Patch
Added in 1.1.0 / 1.13.2
UnitIsPlayer(UnitId)

Determines if the unit is a player. It is important to note that it returns nil rather than false, nil is treated like false for most operations but it is *not* a proper boolean.


Arguments
UnitId

Returns
True/nil

Example
if (UnitIsPlayer(UnitId)) then
   --Do something here
else
   --Do something else
end