View Single Post
09/02/15, 12:09 PM   #23
Wandamey
Guest
Posts: n/a
Originally Posted by votan View Post
Question:
What if like this:
Bad?
Lua Code:
  1. local function DoSomeWhat()
  2.         --Code
  3. end
  4.  
  5. --This is run often
  6. function SetupTexture(texture, width, height)
  7.     texture:SetHandler("OnMouseEnter", DoSomeWhat)
  8.     texture:SetDimensions(width, height)
  9. end


i suppose

Code:
onload : CreateControl + 
texture:SetHandler("OnMouseEnter", DoSomeWhat) -- we got that now i think


local function DoSomeWhat(addon.a,addon.b,addon.c...)
    use addon.a
    use addon.b
    if addon.c then  
       blabla
   else
      blob
   end
end

--This is run often
function SetupTexture(a, b, c)
     texture:SetDimensions(a, c)
     addon.a = a
     addon.b = f(b)
     addon.c = constant  -- whatever
end
would that be the expected solution?


i repeat my question about "removing" a Handler (seems we got 2 different answers with baertram, maybe it would be a good thing to clear it)

is niling a handler as bad as overwrite it?
  Reply With Quote