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).