Hello there! We are conducting a survey to better understand the user experience in making a first edit. If you have ever made an edit on Gamepedia, please fill out the survey. Thank you!

API UnitLevel

From Wowpedia
Jump to: navigation, search

Returns the unit's level.

level = UnitLevel("unit")

Arguments

unit 
String - The unitId to get information from. (e.g. "player", "target")

Returns

level 
Number - The unit level. Returns -1 for bosses, or players more than 10 levels above the player

Details

  • Note that the value returned by UnitLevel("player") will most likely be incorrect when called in a PLAYER_LEVEL_UP event handler, or shortly after leveling in general. Check the PLAYER_LEVEL_UP payload for the correct level.
  • If the unit's level is unknown, i.e. a Level ?? target, or is a special boss, UnitLevel() will return -1.

See also