IsItemInRange

From Warcraft Wiki
Jump to navigation Jump to search

Returns whether the item is in usable range of the unit.

inRange = IsItemInRange(item [, unit])

Arguments

item
number|string : Item ID, Link or Name - If using an item name, requires the item to be in your inventory. Item IDs and links don't have this requirement.
unit
string? : UnitId - Defaults to "target"

Returns

inRange
boolean - Whether the item is in range; Returns nil if there is no unit targeted or the item ID is invalid.

Example

Prints if you are within 4 yards range of the target by checking the  [Gin-Ji Knife Set] item range.[1]

/dump IsItemInRange(90175)

Patch changes

Dragonflight Hotfix (2023-12-11): Partially unrestricted. Querying enemy units while in combat is once again permitted. (Build: 10.2.0.52485)
Dragonflight Hotfix (2023-11-16): Protected. May no longer be called in combat by insecure code. (Build: 10.2.0.52188)
Bc icon.gif Patch 2.0.1 (2006-12-05): Added.

References