WoW API: UnitHealth

From AddOn Studio
Jump to navigation Jump to search

WoW API < UnitHealth

Returns the current health of the specified unit.

local health = UnitHealth(unit);

Parameters[edit]

unit
UnitId - identifies the unit to query health for

Returns[edit]

health
Integer - current health of the specified unit, returns 0 if the specified unit does not exist (eg. "target" given but there is no target)

Example[edit]

Print the target's health to the chat frame:

DEFAULT_CHAT_FRAME:AddMessage( "target health ="..UnitHealth("target") )