View Single Post
12/04/16, 09:45 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
No, it's the item's itemLink then, and not only the name of the item.
To get the item's name from that link use the function here:

Code:
* GetItemLinkName(*string* _itemLink_)
** _Returns:_ *string* _itemName_
Use it like this then:

btw: Is it correct that your variable "bFound" is a global one?
If you use global variables please create one global array for your addon's namespace like this
Code:
myAddonName = {}
and add your addon's variables to it then. Otherwise you might get in trouble if any other addon uses "bFound" too!

Code:
myAddonName.bFound = false
Lua Code:
  1. RegisterForEvent(EVENT_LOOT_RECEIVED, XL.OnItemLooted)  
  2.  
  3.        
  4. function XL.OnItemLooted (numID, lootedBy, itemLinkStr, quantity, itemSound, lootType, self)
  5.  
  6.     myAddonName.bFound = false
  7.  
  8.         d (itemLinkStr)
  9.         local itemName = GetItemLinkName(itemLinkStr)
  10.  
  11.     if itemName ~= nil and (string.find(itemName, "Needle") ~= nil) then myAddonName.bFound  = true
  12.     end
  13.  
  14.     -- Do something here
  15. end
  Reply With Quote