WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Lua Help with error please (https://www.wowinterface.com/forums/showthread.php?t=36069)

Ruinit 10-21-10 05:36 AM

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

Ailae 10-21-10 05:41 AM

Try changing function GRM_BriefListOnClick() to function GRM_BriefListOnClick(self) - the error stems from the self referenced a few lines down being nil.

Ruinit 10-21-10 05:54 AM

Quote:

Originally Posted by Ailae (Post 213036)
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

---

Ailae 10-21-10 06:01 AM

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>


All times are GMT -6. The time now is 03:08 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI