WoW:API UnitHealthMax: Difference between revisions

m
Move page script moved page API UnitHealthMax to WoW:API UnitHealthMax without leaving a redirect
(added note about 0 return for non exist unit)
m (Move page script moved page API UnitHealthMax to WoW:API UnitHealthMax without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi}} __NOTOC__
Returns the maximum health of the specified unit. Returns the exact hitpoints for friendly players and pets in your raid/party, percentages otherwise.
Returns the maximum health of the specified unit.


  local max_health = UnitHealthMax(unit);
  local max_health = UnitHealthMax(unit);
Line 13: Line 13:
Print the maximum health of ''player'' and ''target'' units to the chat window:
Print the maximum health of ''player'' and ''target'' units to the chat window:
  ChatFrame1:AddMessage('Player max health: ' .. UnitHealthMax("player") .. " HP");
  ChatFrame1:AddMessage('Player max health: ' .. UnitHealthMax("player") .. " HP");
  ChatFrame1:AddMessage('Target max health: ' .. UnitHealthMax("target").. "%");
  ChatFrame1:AddMessage('Target max health: ' .. UnitHealthMax("target") .. " HP");
Anonymous user