Alumian 5 Report post Posted December 5, 2016 Hi guys, Has anyone ever encountered an issue similar to this? Starting from today, if I reload my UI then the game starts throwing exceptions more or less saying that my functions don't exist. Funny thing is, if I restart my client completely, then it works, but as soon as I reload the UI again, the issue starts happening again. Literally the only difference between now, and when it was working properly before is that just before each function I added a multi line comment to document the function, but of course all of the multi line comments are closed properly. It's not even like these functions are being tested. No. These were some of the first functions I wrote and I have been using them frequently. I ensured that there are no bugs in the functions. An example of where this exception is thrown might be if I do the following: function print(str) DEFAULT_CHAT_FRAME:AddMessage(str) end function foo() print("string") end And like I said, if I restart my client completely, it works just fine. As in, if I don't change the code at all. But if I reload my UI then it throws an exception. Thoughts? Also, yes I know there is little point to adding a print function since I can just use DEFAULT_CHAT_FRAME:AddMessage. I'm lazy and print is easier to write. Sue me. Also also, yes I know there is a reserved function for print in lua but I have previously run the print function (prior to implementing my own version) and it was not recognised and no, this is not what is causing the issue. I have been using my print function since literally day 1 of this addon and it has never caused any problems. 0 Share this post Link to post Share on other sites
Shino 27 Report post Posted December 5, 2016 Have you ever tried to deactivate all other addons and try this? When you reload the UI the addons are initialized a little different sometimes. cheers! 0 Share this post Link to post Share on other sites
Alumian 5 Report post Posted December 5, 2016 Hey Shino, Thanks for the response - I just tried it with disabling all other addons but it didn't make a difference. The thing that has struck me as really wierd just now is that on my mage it works perfectly, but on my warlock it bugs out (I'm on a different private server at the moment for the purpose of developing the addon). But there is absolutely no reference to any characters at all in the code anywhere. Nor are there any saved variables for the addon O.o Any other thoughts? 0 Share this post Link to post Share on other sites
Renew 26 Report post Posted December 5, 2016 (edited) this has to work 100% you are doing something wrong outside the code you posted... Edited December 5, 2016 by Renew 0 Share this post Link to post Share on other sites
Alumian 5 Report post Posted December 5, 2016 (edited) Yeah I know the code should work, I'll show you the specific call and function that is throwing the exception. Although it's important to remember that: The exception is not thrown if I have just restarted my client The exception is only thrown after I have reloaded my UI The exception is only thrown on one specific character whereas it is not thrown on another despite having no reference to any characters / saved variables This function has been working perfectly until this issue started happening despite having worked on this addon previously today No code regarding this function was modified EDIT: The specific exception is: Interface\Addons\CEPGP\CEPGP.lua:422: attempt to call global 'getEPGP' (a nil value) local ep, gp = getEPGP(offNote) --[[getEPGP(Officer Note) returns EP and GP ]] function getEPGP(offNote) local EP, GP = nil EP = strsub(offNote, 1, strfind(offNote, ",")-1) GP = strsub(offNote, strfind(offNote, ",")+1, string.len(offNote)) return EP, GP end I just really don't understand why it throws an exception on just -one- character and not any others. It's not like the script is any different. Edited December 5, 2016 by Alumian 0 Share this post Link to post Share on other sites
Renew 26 Report post Posted December 5, 2016 you call the function in line 422 but you create it in line 817? this shouldnt work at all xD 0 Share this post Link to post Share on other sites
Alumian 5 Report post Posted December 5, 2016 It shouldn't matter where the call is.. For example: print("Adding " .. amount .. " EP to " .. player) function print(str) DEFAULT_CHAT_FRAME:AddMessage(str) end You don't need to put the call after defining the function. It's all initialised at the same time as your UI I'm quite certain. This is just one example of how my addon has been written and it has never given me an issue before. Besides, that still doesn't explain why it would occur on one character but not another. 0 Share this post Link to post Share on other sites
Lag 0 Report post Posted December 5, 2016 I dont get it. You say you have a problem with your print function but post a error that says that the function getEPGP that is called in line 422 cannot be found o.O 0 Share this post Link to post Share on other sites
Alumian 5 Report post Posted December 5, 2016 (edited) I was giving an example. The error is identical for the two functions. I could say function foo() print("Frisaba Quijadarme, y un panto: basta qu") end function print(str) DEFAULT_CHAT_FRAME:AddMessage(str) end but it will throw the same exception. The error is not exclusive to the print function. I have checked over and over again. There are no syntax errors and it is only occuring on the one character if there was a syntax error, it would consistently throw the exception regardless of character. Edited December 5, 2016 by Alumian 0 Share this post Link to post Share on other sites
Shino 27 Report post Posted December 5, 2016 Renew is right, given it is the same document. But that is not really up to the debate, thus we don't know the rest of the code. What exactly is the error btw? Attempt to call global? Again look at how you initialize your addon the way reload works compare to a login is different. Thus the events that are executed may not be in the same order. So make sure not to call this function before the addon is even theoretically loaded. Also a little thing that happened to me was that some savedVariables were messing with my functions. Else I can't really help you If I don't have more information. cheers! 0 Share this post Link to post Share on other sites