Fandom

WoWWiki

API UnitExists

104,753pages on
this wiki
Add New Page
Talk1 Share
WoW API < UnitExists

Determines if the unit exists.

exists = UnitExists("unit")

Parameters Edit

Arguments Edit

("unit")
unit 
String - The UnitId to query (e.g. "player", "party2", "pet", "target" etc.)

Returns Edit

exists 
1 if the unit exists and is in the current zone, or nil if not

Example Edit

Just a simple example:


function 1stBuff()
	if(UnitExists("target")) then 
		MeinZiel="target";
		DEFAULT_CHAT_FRAME:AddMessage("My targets 1st buff: "..(UnitBuff(MeinZiel, 1)));
	else 
		MeinZiel="player";
		DEFAULT_CHAT_FRAME:AddMessage("My own 1st buff: "..(UnitBuff(MeinZiel, 1)));
	end;
end


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.