|reply to Immer |
Re: Addons Help
said by Immer:THIS IS A GOOD TIME FOR ME TO LAUGH AT BLIZZARD FOR TECHNICAL REASONS.
I've been getting warnings from the client that an addon was being blocked for attempting to call a Blizzard-only argument. So far, it has asked me to shut down Bagnon most of the time, but Skada a few times whenever I change talents around. Is anyone else getting these errors?
So, here's the skinny on these bugs.
In LUA, functions can return multiple values. Sometimes you don't care about one of those values, so you end up using a throwaway to make sure you get the right index. _ (a valid variable in LUA) is commonly used.
So something like:
_, name = GetUnitInfo()
You'd then use the name variable later, and you'd ignore the _, because really, who names variables _?
Furthermore, variables in LUA are global unless declared local. Most people don't put a "local _" declaration anywhere, because who the hell is using _ as an important variable? (see below for answer!)
In WoW, there's a concept called "taint". I'm not too sure of the specifics, but basically secure functions can only use untainted variables. This is how they prevetn addons from doing certain things like auto-cast and whatnot. So addons taint variables all the time. Like the _ variable, which no one in their right mind should use for real data.
The Blizzard Glyph and Talent UIs do.
So some addon taints _, and then blizzard tries to pass it into a secure function.
True, the addon devs could hide that with a local and not pollute the global namespace, but its SO COMMON that I would hope Blizzard would just name their variable something USEFUL instead of just passing it around.
The practical consequence of this is you can fix your addons by adding "local _" to the top of the first LUA file loaded, but that's annoying and would be very error prone. Some addons are already updated to do this.
The other thing you can usually do is just reload and do the glyph/talent swap immediately, with no disabling. The line of code that taints the global _ probably doesn't run right after reload.
awesome... tyvm. I know a few months back I talked about wanting to get into Lua programming. I picked up JAVA instead (oddly enough the university doesn't offer a LUA programming class, lol).