View Single Post
12/04/16, 01:48 AM   #1
Xego
Join Date: Apr 2016
Posts: 3
Why doesn't this piece of code work?

Hello, I have this code in my addon:

Code:
RegisterForEvent(EVENT_LOOT_RECEIVED, XL.OnItemLooted)  

		
function XL.OnItemLooted (numID, lootedBy, itemName, quantity, itemSound, lootType, self)

	bFound = false

        d (itemName)

	if (string.find(itemName, "Needle") ~= nil) then bFound  = true
	end

	-- Do something here
end
The above never detects the presence of the "Needle" string in the itemName. Why? The code seems correct.

1) I verified that the IF works by pre-injecting my own strings into itemName.

2) The d(itemName) displays correctly formed item link in chat.

How do I convert the itemName link to searchable string?
Thanks!

Last edited by Xego : 12/04/16 at 01:52 AM. Reason: Premature send
  Reply With Quote