WoW:API UnitHealth: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Factual correction - 3.0 changed it to always return exact health.)
m (Move page script moved page API UnitHealth to API UnitHealth without leaving a redirect)
 
(No difference)

Latest revision as of 04:47, 15 August 2023

WoW API < UnitHealth

Returns the current health of the specified unit.

local health = UnitHealth(unit);

Parameters

unit
UnitId - identifies the unit to query health for

Returns

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

Print the target's health to the chat frame:

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