Thread Tools Display Modes
10-21-10, 05:36 AM   #1
Ruinit
A Deviate Faerie Dragon
Join Date: Aug 2009
Posts: 19
Lua Help with error please

With this code I get an error could you please tell me what is wrong with it. Thanks.

function GRM_BriefListOnClick()
--------------------------------------------------------------
if ( GRM_BriefLast_Selected ) then
_G[GRM_BriefLast_Selected]:UnlockHighlight();
end
GRM_BriefLast_Selected = self:GetName();
_G[GRM_BriefLast_Selected]:LockHighlight();

local title = _G[GRM_BriefLast_Selected.."_Text"]:GetText();

GRM_ClearBriefText();
GRM_BriefTitle_Edit:SetText(title);
GRM_BriefBodyScrollText:SetText(GRM_BriefList[title]);
GRM_BriefTitle_Edit:ClearFocus();
GRM_BriefBodyScrollText:ClearFocus();
end



ERROR MESSAGE

1x GoldRaidManager-4.0.1.0\GoldRaidManager.lua:1278: attempt to index global 'self' (a nil value)
<string>:"*:OnClick":1: in function <[string "*:OnClick"]:1>

Locals:
self = GRM_BriefList_Entry3 {
0 = <userdata>
}
button = "LeftButton"
down = false
  Reply With Quote
10-21-10, 05:41 AM   #2
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Try changing function GRM_BriefListOnClick() to function GRM_BriefListOnClick(self) - the error stems from the self referenced a few lines down being nil.
__________________
Oh, the simulated horror!
  Reply With Quote
10-21-10, 05:54 AM   #3
Ruinit
A Deviate Faerie Dragon
Join Date: Aug 2009
Posts: 19
Originally Posted by Ailae View Post
Try changing function GRM_BriefListOnClick() to function GRM_BriefListOnClick(self) - the error stems from the self referenced a few lines down being nil.
Thank you for your help.

No that did not correct it I still get. This error when clicking on it.

1x GoldRaidManager-4.0.1.0\GoldRaidManager.lua:1278: attempt to index local 'self' (a nil value)
<string>:"*:OnClick":1: in function <[string "*:OnClick"]:1>

Locals:
self = GRM_BriefList_Entry1 {
0 = <userdata>
}
button = "LeftButton"
down = false

---
  Reply With Quote
10-21-10, 06:01 AM   #4
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Yeah, think I got it wrong.

The action is probably defined in an associated .xml-file, try to find the <OnClick> part that calls the function and add the 'self' there.

I'm guessing it would end up looking like:

xml Code:
  1. <OnClick>
  2.     GRM_BriefListOnClick(self)
  3. </OnClick>
__________________
Oh, the simulated horror!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Lua Help with error please

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