API UnitHealthMax

Returns the maximum health of the specified unit; however, this function behaves differently between Retail and Classic.

local max_health = UnitHealthMax(unit);

Arguments

 * unit : UnitId - the unit whose max health to query.

Returns

 * max_health : Integer - the maximum health of the specified unit; however, returns 0 if the specified unit does not exist (eg. "target" when there is no target) and returns 100 in Classic for units not in the same party or raid

Example
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");