Go Back   WowAce Forums > General > Lua Code Discussion
Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding].

Reply
 
Thread Tools
Old 04-10-2012   #1
gnomi123
Newbie
 
Join Date: Nov 2009
Posts: 3
Default GetGuildInfo("unit") lua error

Hello, people out there
Im pretty new to addonprogramming, but i think i got the concepts pretty well now. But an Error of the BlizzardUI is bothering me, called:

Message: ...face\AddOns\Blizzard_InspectUI\InspectGuildFram e.lua:18: Usage: GetGuildInfo("unit")

I already spended a lot time searching for solutions on google, but i wasnt able to find any. I know that the Error is caused by my NotifyInspect() call, but i really cant see what to do against it. I securehooked the function to make sure its my own call I get the response of and I dealt with the inconsistence of the function too, using a queue.

But this Error is still showing up, I heared about the Addon InspectFix which should fix this for all addons, but I cant really get its point in the code.

So please, help me
(I dont think that you will need my code for this, since its a trouble with some Blizz-stuff, but you can still request it from me, ofc)

Another problem that i just discovered is that GetInventoryItemLink(name, slot) sometimes returns the mogged item, not the real one. But only sometimes.

Last edited by gnomi123; 04-10-2012 at 07:47 AM.
gnomi123 is offline   Reply With Quote
Old 04-10-2012   #2
Farmbuyer
Amazing Member
 
Farmbuyer's Avatar
 
Join Date: Feb 2005
Posts: 1,107
Default Re: GetGuildInfo("unit") lua error

Known Blizzard bug. Install

http://www.curse.com/addons/wow/inspectfix

as a workaround.
__________________
In wizardry, one must often be willing to consider serendipitous events as unqualified successes. -Vaarsuvius
Farmbuyer is offline   Reply With Quote
Old 04-11-2012   #3
gnomi123
Newbie
 
Join Date: Nov 2009
Posts: 3
Default Re: GetGuildInfo("unit") lua error

Like I said, I know that addon. But I would like to know what its code does to avoid it, exactly. And I cant force everyone who uses my addon to install InspectFix too, can I?
As a workaround, I simply used SetCVar("ScriptErrors", "0") to prevent any luaerrors to show up.
What still is remaining is the problem that - sometimes - Im not getting back the real item, but the mogged one. Is there any way to prevent this?
gnomi123 is offline   Reply With Quote
Old 04-11-2012   #4
Seerah
Legendary Member
 
Seerah's Avatar
 
Join Date: May 2006
Posts: 6,606
Default Re: GetGuildInfo("unit") lua error

Quote:
Originally Posted by gnomi123 View Post
But I would like to know what its code does to avoid it, exactly.
Did you open it up to look at the code?

Quote:
As a workaround, I simply used SetCVar("ScriptErrors", "0") to prevent any luaerrors to show up.
Don't do that!
__________________
Seerah is offline   Reply With Quote
Old 04-11-2012   #5
Ketho
Senior Member
 
Ketho's Avatar
 
Join Date: Dec 2008
Location: The Netherlands
Posts: 252
Default Re: GetGuildInfo("unit") lua error

I don't know what InspectFix does exactly, but ..

in one of my addons I use a workaround, by setting InspectFrame.unit to yourself
This should at least prevent InspectGuildFrame_Update() line 18 from giving an error

Setting it to "player" should be safer than e.g. "none", "target" or the applicable unit id, since otherwise it still has a chance to give an error a bit further up at line 25

The idea is that it doesn't really matter what unit id it's set to, as long as it won't give an error, and since there isn't any actual inspecting going on anyway
  1. Blizzard_InspectUI is loaded and InspectFrame is shown -> don't NotifyInspect()
  2. Blizzard_InspectUI is loaded and InspectFrame is not shown -> NotifyInspect(), set InspectFrame.unit to "player"
  3. Blizzard_InspectUI is not loaded -> NotifyInspect()
This is my example code:
Code:
if CanInspect(unit) then
	if InspectFrame then
		if not InspectFrame:IsShown() then
			InspectFrame.unit = "player"
			NotifyInspect(unit)
		end
	else
		NotifyInspect(unit)
	end
end
This thread's subject is only about safely calling NotifyInspect() to avoid this Blizzard error in particular right?

Edit: It seems this bug will be fixed in MoP
(5.0.1.15589) AddOns/Blizzard_InspectUI/InspectGuildFrame.lua Line 7
__________________

Last edited by Ketho; 04-13-2012 at 01:11 AM.
Ketho is offline   Reply With Quote
Old 04-12-2012   #6
Torhal
Moderator
 
Torhal's Avatar
 
Join Date: Feb 2008
Location: Alabama
Posts: 2,157
Send a message via ICQ to Torhal
Default Re: GetGuildInfo("unit") lua error

Quote:
Originally Posted by gnomi123 View Post
As a workaround, I simply used SetCVar("ScriptErrors", "0") to prevent any luaerrors to show up.
...which makes any other AddOn your users have installed do the same. Ugh.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author/Maintainer of Archy, Ackis Recipe List, Revelation, Spamalyzer, Volumizer, and many other AddOns.
Torhal is offline   Reply With Quote
Old 04-12-2012   #7
gnomi123
Newbie
 
Join Date: Nov 2009
Posts: 3
Default Re: GetGuildInfo("unit") lua error

Thanks a lot, Ketho. That is the answer I needed.
The remaining problem is, that GetInventoryItemLink(name, slot) sometimes returns the item which was used for mogging, not the one with the right stats. Does someone know how to deal with that?
gnomi123 is offline   Reply With Quote
Old 05-24-2012   #8
oscarucb
Junior Member
 
oscarucb's Avatar
 
Join Date: Dec 2007
Posts: 68
Default Re: GetGuildInfo("unit") lua error

Quote:
Originally Posted by Ketho View Post
I don't know what InspectFix does exactly, but ..

in one of my addons I use a workaround, by setting InspectFrame.unit to yourself
This should at least prevent InspectGuildFrame_Update() line 18 from giving an error

Setting it to "player" should be safer than e.g. "none", "target" or the applicable unit id, since otherwise it still has a chance to give an error a bit further up at line 25
This is a dangerous suggestion. In general addons have no business blindly modifying private members of FrameXML classes. However if you choose to follow this strategy it is VERY important that you never modify InspectFrame.unit while the InspectFrame is shown - I've seen two separate addons do that in a broken attempt to silence this error, and it can cause the Inspect window to break in VERY strange ways.
oscarucb is offline   Reply With Quote
Old 05-25-2012   #9
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: United States
Posts: 8,055
Default Re: GetGuildInfo("unit") lua error

Quote:
Originally Posted by oscarucb View Post
This is a dangerous suggestion.
Less dangerous than setting the ScriptErrors cvar to 0... at least if you break the inspect frame, the problem is obvious to you (and your users). If you simply hide the problem, it becomes much more difficult to even tell that a problem is happening at all.

Plus, even if you interfere with other inspect addons, I'd have to say that's better than hiding errors from all addons, most of which have nothing to do with inspecting.
__________________
Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge
Troubleshoot an addon | Turn any code into an addon | More addon resources
Need help with your code? Attach or paste your whole, real files.
Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead!
Phanx is offline   Reply With Quote
Old 05-25-2012   #10
oscarucb
Junior Member
 
oscarucb's Avatar
 
Join Date: Dec 2007
Posts: 68
Default Re: GetGuildInfo("unit") lua error

Quote:
Originally Posted by Phanx View Post
Less dangerous than setting the ScriptErrors cvar to 0...
Yes, that goes without saying - ScriptErrors is a user setting, one that addons have no business changing without the user's consent.
oscarucb is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:33 AM.