1. Best:
Lua Code:
<Texture name="Sample">
<OnMouseEnter>
--Code
</OnMouseEnter>
</Texture>
2. Also Good:
Lua Code:
--This is run once when the addon loads
function InitializeAddon(texture)
texture:SetHandler("OnMouseEnter", function()
--Code
end)
end
3. Bad:
Lua Code:
--This is run often
function SetupTexture(texture, width, height)
texture:SetHandler("OnMouseEnter", function()
--Code
end)
texture:SetDimensions(width, height)
end
Instead of 3, which keeps setting the same handler code over and over again use 1 or 2 to only do it once.