Playsound LUA broken

UI and Macro
I had created an addon a year or so ago to play a sound when you deathgripped and it worked fine but now it doesn't. I know there are addons to do this already but I'd like to use my own and understand why it does not work.

Can someone please give me some input? I no longer have no idea what is going on now that I'm looking at it again...

the code is the following:

function comeHere_OnEvent(event, arg1, arg2)
local spellName = GetSpellInfo(49576)
if strfind(arg2, spellName) and arg1 == "player" then
PlaySoundFile("Interface\\AddOns\\comeHere\\Sounds\\comeHere.mp3") end
end

The error I now get is
Interface\AddOns\comeHere\comeHere.lua:3: bad argument #1 to 'strfind' (string expected, got nil)

Please let me know why this is wrong/bad. Thank you
Could you post your whole code? It appears that arg2 is nil, but it's hard to tell why that is without knowing which events you've registered or how comeHere_OnEvent is being called.

Join the Conversation

Return to Forum