TinyEditor@legacy41577754 (talk | contribs) No edit summary |
User-6548696 (talk | contribs) (Change return values) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{wowapi}} |
{{wowapi}} |
||
+ | Checks if a specified unit is a player. |
||
− | <!-- List return values and arguments as well as function name, follow Blizzard usage convention for args --> |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | ;unit: String - [[UnitId]] of the unit to check. |
||
⚫ | |||
− | Determines if the unit is a player. It is important to note that it returns nil rather than false, nil is treated like false for most operations but it is *not* a proper boolean. |
||
+ | ;isTrue : Boolean - true if the unit is a player, false otherwise. |
||
− | ---- |
||
⚫ | |||
− | |||
− | :''[[API_TYPE_UnitId|UnitId]]'' |
||
− | |||
− | ---- |
||
⚫ | |||
− | |||
− | :''True/nil'' |
||
− | |||
− | ---- |
||
− | ;''Example'' |
||
− | <!-- List return values and arguments as well as function name, follow Blizzard usage convention for args --> |
||
− | |||
− | if (UnitIsPlayer(UnitId)) then |
||
− | --Do something here |
||
− | elseif (UnitIsPlayer(UnitId) ~= nil) then |
||
− | --Do something here |
||
− | end |
Revision as of 12:07, 29 October 2014
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Checks if a specified unit is a player.
isTrue = UnitIsPlayer(unit)
Arguments
- unit
- String - UnitId of the unit to check.
Returns
- isTrue
- Boolean - true if the unit is a player, false otherwise.