![]() |
Monitoring for errors
I'm getting tired of having a problem with the addon I'm working where I get an UI error states 'function expected instead of nil'. It doesn't give me any indication on where the error is. I know it typically means I missed some parameter to a function call that was expecting one, but between my last working version and the one with the error I only added function calls that do not take parameters.
Am I missing some way to get a better idea about what the error is about? |
oh I was getting a few of those last beta weekend .. makes it even worse when you only have a few days to write and test addons rofl .. Whenever I got the message it was almost always the last piece of code I added which helped.
I would suggest maybe throwing up the error message you're getting and the block of code that it seems to refer to and go from there. |
Console can help catch some errors that occur during startup and initialization. Things that the chat window normally wouldn't show.
|
Quote:
I'll test it for sure :) |
Quote:
But thank you. |
Yay! Figured it out. It is still odd and doesn't make much sense, but has to do with how your add-on is interpreted. For some reason, it would not let me do something early like assign GetFramerate() to a variable, but if I set that variable to 0, then changed it during a function call, it will work.
|
I had a few of them. Mostly when I have a local function that is defined after the first reference...
|
You can't reference something before it has been defined. ;)
"Hey did you read that new book by your favorite author?" "No, I haven't seen it. When did it come out?" "Next week." |
Quote:
Bah - Just read it twice. (Cause a 2 pass compiler can handle forward references...) |
Don't you get a stack trace with the error? All the ones I've seen have a stack trace which gives the exact line the error occurred (at the top of the stack trace).
My usual mistakes when I cause this error are one of two things: Code:
val = GetMisSpeled() Code:
val = GetValue() Code:
Msg = "Value = ".. tostring(val) Another thing I've used successfully in some cases is the pcall() function. |
All times are GMT -6. The time now is 06:42 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI