Thread Tools Display Modes
06-01-10, 12:57 PM   #1
Blixia
A Murloc Raider
Join Date: Jun 2010
Posts: 4
UnitBuff

Hello,

For the first attempt of making a simple addon for wow I tried to make a wintergrasp addon. However I seem to fail to understand the LUA error reporting.

This is the error I get in-game:

Message: Interface\AddOns\wg\wg.lua:15: Usage: UnitBuff("unit", [index] or ["name", "rank"][, "filter"])
Time: 06/01/10 20:46:43
Count: 1
Stack: [C]: in function `UnitBuff'
Interface\AddOns\wg\wg.lua:15: in function `value'
Interface\FrameXML\ChatFrame.lua:3577: in function <Interface\FrameXML\ChatFrame.lua:3509>
[C]: in function `ChatEdit_ParseText'
Interface\FrameXML\ChatFrame.lua:3222: in function `ChatEdit_SendText'
Interface\FrameXML\ChatFrame.lua:3246: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>

Locals: (*temporary) = "player"
(*temporary) = nil

Now my question is how to read those errors and do the debugging.

Thanks in advance
  Reply With Quote
06-01-10, 01:01 PM   #2
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
--
Message: Interface\AddOns\wg\wg.lua:15: Usage: UnitBuff("unit", [index] or ["name", "rank"][, "filter"])
--

This is the problem in ur Lua code. shows the line and location and whats wrong with it. in this case ur not using UnitBuff properly.

--
Locals: (*temporary) = "player"
(*temporary) = nil
--

looks like u've manage to include the first argument of the function but theres something going in the second argument. ((someone correct me if im wrong))
  Reply With Quote
06-01-10, 01:18 PM   #3
Blixia
A Murloc Raider
Join Date: Jun 2010
Posts: 4
I am currently doing this:

if(UnitBuff("player",WG_BUFFNAME))then <- line 15
//do something
else
//do something else
end
  Reply With Quote
06-01-10, 01:23 PM   #4
Blixia
A Murloc Raider
Join Date: Jun 2010
Posts: 4
seems that WG_BUFFNAME had to be quoted.

thanks tho
  Reply With Quote
06-01-10, 01:29 PM   #5
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
lol was just bout to post glhf

UnitBuff("unit", [index] or ["name", "rank"][, "filter"])

notice name and rank etc.. are under quotes
  Reply With Quote
06-01-10, 02:42 PM   #6
Blixia
A Murloc Raider
Join Date: Jun 2010
Posts: 4
Umh,

How can I check if a player has the buff essence of wintergrasp?

What I am trying doens't seem to work
  Reply With Quote
06-01-10, 02:50 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Right now, you're checking for the buff called WG_BUFFNAME (that is, if you put it in quotes). If you intend for WG_BUFFNAME to be a variable holding the localized version of the buff name, then don't put it in quotes to make it a string. Whatever the variable equals will be a string already.

If this is what you were doing before when you got your error, then somehow your variable WG_BUFFNAME wasn't assigned to what you wanted it to be.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
06-01-10, 02:51 PM   #8
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Code:
local WG_BUFF = GetSpellInfo(57940) -- retrieves the name of the buff in whatever locale you're using

if UnitAura("player", WG_BUFF) then
	-- do stuff
end
__________________
Oh, the simulated horror!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » UnitBuff

Thread Tools
Display Modes

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

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