I have a curiosty I wanted to shed light on. I was curious if there's any point, or if it's worth it, to setup variables like so:
"Normal" method
Lua Code:
addon.MainFrame = CreateFrame("Frame","MainFrame",UIParent);
-- Like This
addon.MainFrame.MyLabel = CreateFrame("Frame",nil,addon.MainFrame);
addon.MainFrame.MyLabel.Text = addon.MainFrame.MyLabel:CreateFontString(nil,"BACKGROUND","GameFontNormal");
-- Or Like This
addon.MyLabel = CreateFrame("Frame",nil,addon.MainFrame);
addon.MyLabel.Text = addon.MyLabel:CreateFontString(nil,"BACKGROUND","GameFontNormal");
What about making a new [local] table to house frame elements?
Lua Code:
local main = {};
main = addon.MainFrame;
main.MyLbl = CreateFrame("Frame",nil,main,"InputBoxTemplate");
main.MyLblText = main.MyLbl:CreateFontString(nil,"BACKGROUND","GameFontNormal");
-- ... etc
I guess what I'm really asking is; is there extra ways to optmize variables? Also, does the length of variable names (ie. "addon.MainFrame.MyLabel.Text" vs "main.MyLblText") affect overall addon performance?