11-29-12, 02:05 PM | #1 |
Global (a nil value) Problem!
Ive been trying to figure out the problem for 2 hours.
What is the problem here? Lua Code:
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/ ..\..\FrameXML\UI.xsd"> <Script File="final.lua"/> <Frame name="Final_Frame"> <Scripts> <OnLoad> finalproj(); </OnLoad> </Scripts> </Frame> </Ui> Code:
## Interface: 50100 ## Title: Sodras Final ## Notes: This is Sodras final project. ## Version: 1.0 final.lua final.xml |
|
11-29-12, 02:33 PM | #2 |
Well, you're loading your Lua twice, you're using XML, everything is global, your buttons are not parented to your frame, and you're trying to set scripts to functions that you didn't define anywhere, so there are a lot of problems... just get rid of the whole XML file and replace your Lua file with this:
Code:
local frame = CreateFrame("Frame", "FinalFrame", UIParent) -- you may want to actually position the frame somewhere, give it visible regions, etc. local button =CreateFrame("Button", "$parentButton", frame, "UIPanelButtonTemplate") button:SetPoint("BOTTOMRIGHT", UIParent, 0, 66) button:SetWidth(80) button:SetHeight(22) button:SetText("Twelve") button:SetScript("OnClick", function(self, mouseButton) -- do something here when clicked end) local chanbutton = CreateFrame("Button", "$parentChannelButton", UIParent, "UIPanelButtonTemplate") chanbutton:SetPoint("BOTTOMRIGHT", UIParent, 0, 88) chanbutton:SetWidth(160) chanbutton:SetHeight(22) chanbutton:SetText("Fav. Channel") chanbutton:SetScript("OnClick", function(self, mouseButton) -- do something here when clicked end)
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
|
11-29-12, 02:46 PM | #3 | |
The only error when I post the whole lua script is that final() is a nil value. I NEED to use XML to call the function, its part of the project. Could you just tell me why its saying Final is a nil value? Heres the whole lua script Lua Code:
This used to work yesterday, barely anything has changed. I used comments so I could try and debug it. |
||
11-29-12, 03:32 PM | #4 |
Actually, I'm going to do what you said.
Thank you. |
|
WoWInterface » Developer Discussions » Lua/XML Help » Global (a nil value) Problem! |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|