WoW:API UnitHealthMax: Difference between revisions
Jump to navigation
Jump to search
(Factual correction) |
m (Updated with new information: This function returns the actual max health of any 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"); | ||
Revision as of 07:30, 14 January 2009
← WoW API < UnitHealthMax
Returns the maximum health of the specified unit.
local max_health = UnitHealthMax(unit);
Parameters
- unit
- UnitId - the unit whose max health to query.
Returns
- max_health
- 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
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");