View Single Post
07-04-12, 06:49 PM   #65
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
getglobal has been deprecated for years. It was actually removed from the game for a while -- and there are dozens, if not hundreds, of posts on these forums asking for help updating old addons that were throwing nil values because of getglobal usage -- though it looks like Blizzard has re-added a Lua implemention of it for some reason. Despite its reapparance, there is no reason you should ever use it. It's a function call, so it's automatically slower and more expensive than a table lookup. Plus, with it implemented in Lua (in UIParent.lua):

Code:
function getglobal(varr)
    return _G[varr];
end
It's even more inefficient because it's still doing the table lookup you should be doing, but it's also adding a Lua function call. Huge waste, and Blizzard should be embarrassed to have such bloated, inefficient crap in their code.

TL;DR: Use _G[x], not getglobal(x).
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.