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) 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/ http://wowprogramming.com/FrameXML/UI.xsd"> |
It has to do with the way the files are ordered in the .toc (again)
We changed it to XML first so the .lua code could "see" AMD_TabOnCharacterFrame Now, when it's created, you're asking AMD_TabOnCharacterFrame to call a function in your .lua (which hasn't been loaded yet) Instead of using an OnLoad script in the XML just do whatever you were going to do to AMD_TabOnCharacterFrame in the .lua. Lua Code:
Depending on what the end goal is there might be a better alternative but this should work for now. |
Actually, it's ok I remember what I had changed, I put the XML file before the LUA file in the TOC file.
|
I'm not sure I understood that.
What is "OnLoad Change" is that the name of a function? I'm getting the error "attempt to call method 'SetText' (a nil value)". I'm using this code however, slightly different from yours. Lua Code:
Quote:
|
Quote:
Quote:
I don't know what your code looks once you've made changes so I'm just guessing what might work. |
Ah ok sure I understand now, yeah I removed the button and pretty much everything as I was trying to figure out what I had broken.
If what was in my Onload function was a script that prints out a table into the frame can I not reference an onload function in lua? |
Your OnLoad function was global so it can be called pretty much anywhere. The only proviso being that the file containing the function has to be loaded before the function is used (same goes for within in the same .lua file, a function (variable etc.) must be defined before it is used.)
Lua Code:
Lua Code:
|
Oh sorry what I meant was how to change this:
Code:
<Scripts> Like maybe Lua Code:
|
You don't need
Code:
AMD_TabOnCharacterFrame:OnLoad(AMD_OnLoad(self)); Lua Code:
Adding an OnLoad function in lua to AMD_TabOnCharacterFrame doesn't really make sense in your case as it's already been loaded so, just using: Lua Code:
instead of adding the function and making the call would do the same. |
Oh but my onload function updates some stuff.
Lua Code:
|
All times are GMT -6. The time now is 10:49 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI