UnitExists

From Warcraft Wiki
Jump to navigation Jump to search

Returns true if the unit exists.

exists = UnitExists(unit)

Arguments

unit
string : UnitId

Returns

exists
boolean - true if the unit exists and is in the current zone, or false if not

Example

The snippet below prints a message describing what the player is targeting.

if UnitExists("target") then
 print("You're targeting a " .. UnitName("target"))
else
 print("You have no target")
end