Thread Tools Display Modes
Prev Previous Post   Next Post Next
04-28-23, 08:56 AM   #1
AeroMaxxD
An Aku'mai Servant
Join Date: Dec 2022
Posts: 33
Attempt to call global a nil value?

Would anyone happen to know why self would be a nil value?

This has been working perfectly fine for a few days, but I must have broken it somehow, I stripped the code right back to try and hung down what I broke, but I still get the error.

Code:
1x [string "*OnloadTest.xml:25_OnLoad"]:1: attempt to call global 'AMD_OnLoad' (a nil value)
[string "*OnloadTest.xml:25_OnLoad"]:1: in function <[string "*OnloadTest.xml:25_OnLoad"]:1>

Locals:
self = AMD_TabOnCharacterFrame {
 0 = <userdata>
}
(*temporary) = nil
(*temporary) = AMD_TabOnCharacterFrame {
 0 = <userdata>
}
(*temporary) = "attempt to call global 'DGT_OnLoad' (a nil value)"

Lua Code:
  1. local TabName="AMD";
  2. local TabID=CharacterFrame.numTabs+1;
  3. local Tab=CreateFrame("Button", "$parentTab"..TabID, CharacterFrame, "CharacterFrameTabTemplate", TabID);
  4. PanelTemplates_SetNumTabs(CharacterFrame, TabID);
  5. Tab:SetPoint("LEFT", "$parentTab"..(TabID-1), "RIGHT", -16, 0);
  6. Tab:SetText(TabName);
  7. -- Tab:SetID(TabID);
  8.  
  9. tinsert(CHARACTERFRAME_SUBFRAMES, "AMD_TabOnCharacterFrame");
  10.  
  11. hooksecurefunc("CharacterFrameTab_OnClick", function(self, button)
  12.     if self:GetID() == TabID then
  13.         ToggleCharacter("AMD_TabOnCharacterFrame")
  14.     end
  15. end)
  16.  
  17. function AMD_OnLoad(self)
  18.     print("AddOn loaded")
  19. end

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ http://wowprogramming.com/FrameXML/UI.xsd">
	<Frame name="AMD_TabOnCharacterFrame" parent="CharacterFrame" frameStrata="HIGH" enableMouse="true" movable="true" setallpoints="true" id="4">
		<Size x="206" y="580"/>
		<Frames>
			<Frame name="$parent_History" parent="AMD_TabOnCharacterFrame">
				<Size x="300" y="325"/>
				<Anchors>
					<Anchor point="CENTER" relativePoint="CENTER" relativeTo="CharacterFrame"/>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="History_Title" parentKey="History_title" inherits="GameFontNormal">
							<Color r="1" g="1" b="1" a="1"/>
							<Anchors>
								<Anchor point="TOP">
									<Offset x="0" y="20"/>
								</Anchor>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>
			</Frame>
		</Frames>
		<Scripts>
			<OnLoad>
				AMD_OnLoad(self)
			</OnLoad>
		</Scripts>
	</Frame>
</Ui>

Last edited by AeroMaxxD : 04-28-23 at 09:00 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » Attempt to call global a nil value?


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