Quantcast WoWInterface - View Single Post - Defining functions
View Single Post
12-12-13, 06:42 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,567
Originally Posted by Vlad View Post
local _G, name, realm = _G -- the _G assignment is often frowned upon or looked at as redundant
name, realm = _G.UnitName(...)
>_<

Yes, the _G upvalue there is redundant and useless clutter, unless you are looking up globals you are constructing dynamically (eg _G["PartyFrame"..i.."HealthBar"]). In your example, you would be better off just upvaluing UnitName directly, or not bothering to upvalue at all (unless you're running that code inside an OnUpdate script or CLEU handler or something similarly spammy).
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote