Returns whether a unit is dead. Only returns 1 while the unit is dead and has not yet released his or her spirit. See UnitIsGhost() for after the unit has released.


See also Unit functions.

Signature:

isDead = UnitIsDead("unit")

Arguments:

  • unit - A unit to query (string, unitID)

Returns:

  • isDead - 1 if the unit is dead; otherwise nil (1nil)

Examples:

-- Scan your party or raid and count how many people are dead
local maxNum = GetNumRaidMembers()
local unitType = "raid"
if maxNum <= 0 then
  maxNum = GetNumPartyMembers()
  unitType = "party"
end

if maxNum > 0 then
  local deadCount = 0
  for i=1,maxNum do
    if UnitIsDead(unitType .. i) then
      deadCount = deadCount + 1
    end
  end
  
  print("There are " .. deadCount .. " people dead in your " .. unitType)
else
  print("You are not in a party or raid")
end