For example:
frame1 = CreateFrame("frame","frame1",UIParent)
frame2 = CreateFrame("frame","frame1",UIParent)
frame1 == frame2 ?
or frame2 is new widget object?
If second is right then i have a new snippet for optimize all addons
lua Code:
local oldCreateFrame = CreateFrame
CreateFrame = function(ftype, name, ...)
local frame, texture, fontstring, animation, animationg
if name ~= nil and name:find('map') then return oldCreateFrame(ftype, name, ...) end
if _G[name] ~= nil then
frame = _G[name]
else
frame = oldCreateFrame(ftype, name, ...)
end
local oldCreateTexture = frame.CreateTexture
frame.CreateTexture = function(name, ...)
if _G[name] ~= nil then
texture = _G[name]
else
texture = oldCreateTexture(name, ...)
end
return texture
end
local oldCreateFontString = frame.CreateFontString
frame.CreateFontString = function(name, ...)
if _G[name] ~= nil then
fontstring = _G[name]
else
fontstring = oldCreateFontString(name, ...)
end
return fontstring
end
local oldCreateAnimationGroup = frame.CreateAnimationGroup
frame.CreateAnimationGroup = function(name, ...)
if _G[name] ~= nil then
animationg = _G[name]
else
animationg = oldCreateAnimationGroup(name, ...)
end
return animationg
end
local oldCreateAnimation = frame.CreateAnimation
frame.CreateAnimation = function(atype, name, ...)
if _G[name] ~= nil then
animation = _G[name]
else
animation = oldCreateAnimation(atype, name, ...)
end
return animation
end
return frame
end