WoWInterface - View Single Post - How could this be written neater?
View Single Post
05-08-17, 06:54 AM   #9
A Rage Talon Dragon Guard
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 328
The only reason why I do local _G = getfenv(0) is my paranoia o_O

I've seen addons that do some weird manipulations w/ environments, so _G may end up being something else, and a check like _G == getfenv(0) will return false.

IMHO, if you have no paranoia and don't call global functions from inside OnUpdate and prob OnEvent funcs, only if you register for REALLY spammy events, e.g., CLEU, personally, I consider UNIT_POWER_FREQUENT spammy too, there's no point in creating upvalues for pretty much anything.

Another reason might be to please one's Lua linter

Last edited by lightspark : 05-08-17 at 06:58 AM.
  Reply With Quote