API IsItemInRange

From Wowpedia
Jump to: navigation, search

Returns if you are in range of the specified unit to use the specified item.

result = IsItemInRange("itemName" or "itemLink"[, "unit"])

Arguments

item 
Mixed - which item to query, either by ID (number), name (string), or link (string).
unit 
String - which unit the range should be checked to

Returns

6.0:

Boolean - If the item is not in range, false; if the item is in range, true; if the query is invalid, nil.

Pre-6.0:

Flag - If the item is not in range, 0; if the item is in range, 1; if the query is invalid, nil.


Example

if ( IsItemInRange("Heavy Silk Bandage","target") ) then
  -- light up a part of the interface
else
  -- darken
end

Common Ranges

Bandages: 18 yards