Originally Posted by votan
Question:
What if like this:
Bad?
Lua Code:
local function DoSomeWhat() --Code end --This is run often function SetupTexture(texture, width, height) texture:SetHandler("OnMouseEnter", DoSomeWhat) texture:SetDimensions(width, height) end
|
This is slightly better than the bad example. It doesn't remake the closure every time. But it's still a waste to keep setting that same exact handler code on the control repeatedly. So it would be best to set some sort of flag to only do it once.