View Single Post
04-06-13, 07:36 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by ravagernl View Post
Because your syntax is wrong. You can not set a script handler using the syntactic colon operator. SetScript/HookScript expect a reference to a function. Using the colon is just a shorter way of passing the table as the first argument:
lua Code:
  1. local someaddon = {a = 10, plus = function(self) self.a = self.a + 5 end}
  2. someaddon:plus(5)
  3. print(someaddon.a) -- prints 15
  4.  
  5. local addonb = {a = 30, plus = someaddon.plus}
  6. addonb:plus(10)
  7. print(addonb.a) -- prints 40
  8.  
  9. someaddon.plus(addonb, 5)
  10. print(someaddon.a) -- prints 20
  11. print(addonb.a) -- prints 40
And if i do it like that?

Code:
local function OnUpdate(self, elapded)
    PVPSound:UpdateSoundEffectEngine(self, elapsed)
end

function PVPSound:UpdateSoundEffectEngine(self, elapsed)

end

PVPSoundEffectSoundEngineFrame:SetScript("OnUpdate", OnUpdate)
  Reply With Quote