The original code was
Lua Code:
local function SetWidgetScript(frame,method)
if frame:IsShown() then
for i = 1, #frame.buttons do
frame.buttons[i]:HookScript("OnMouseDown", method)
end
else
frame:SetScript(
"OnShow", function()
for i = 1, #frame.buttons do
frame.buttons[i]:HookScript("OnMouseDown", method)
end
end
)
end
end
I changed the method in the "OnShow" script just to not repeat the for i=1...end part twice.
There is probably a better way to write a DRY script.