WoW API < UnitHealthMax

Returns the maximum health of the specified unit.

local max_health = UnitHealthMax(unit);

Parameters[edit | edit source]

UnitId - the unit whose max health to query.

Returns[edit | edit source]

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

Example[edit | edit source]

Print the maximum health of player and target units to the chat window:

ChatFrame1:AddMessage('Player max health: ' .. UnitHealthMax("player") .. " HP");
ChatFrame1:AddMessage('Target max health: ' .. UnitHealthMax("target") .. " HP");
Community content is available under CC-BY-SA unless otherwise noted.