Thread Tools Display Modes
04/13/14, 03:55 PM   #1
LucretiaValdis
 
LucretiaValdis's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 2
Strange Errors

Hello Everyone!
I'm getting these Strange UI-Errors:

5224600099212242119:3 function expected instead of nil
stack traceback:
5224600099212242119:3 in function '(main chunk)'

I just cant figure out what causes it because filenames are completely lacking.
Anyone got an idea what causes these errors?
Sorry if this question has already been asked, didn't find anything.

Greetings
  Reply With Quote
04/14/14, 01:52 PM   #2
Iyanga
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 183
Originally Posted by LucretiaValdis View Post
Hello Everyone!
I'm getting these Strange UI-Errors:

5224600099212242119:3 function expected instead of nil
stack traceback:
5224600099212242119:3 in function '(main chunk)'

I just cant figure out what causes it because filenames are completely lacking.
Anyone got an idea what causes these errors?
Sorry if this question has already been asked, didn't find anything.

Greetings
Yes, a function was expected but the lua parser only got a nil.

Basically you tried to call a non-existing function, this happens with typos, for example:

function MySimpleFunc(param)
end

function MyOtherFunc()
MySimpelFunc(param)
end

or forgetting the function keyword for a function declaration or calling a function _before_ it was defined.
  Reply With Quote
04/14/14, 02:20 PM   #3
Wukar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 27
Iyanga pointed most of it out.

Sometimes, functions are only callable (and work) with :FunctionName(params) instead of .FunctionName(params)

Most prominent typo for me is .SetHidden(false) instead of :SetHidden(false)
  Reply With Quote
04/14/14, 02:44 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Functions most definitely work with dot-notation instead of colon-notation. But with dot-notation, you need to pass your frame/object through as the first parameter.

myFrame:SetHidden(false)

is just syntactic sugar for

myFrame.SetHidden(myFrame, false)
  Reply With Quote
04/14/14, 02:53 PM   #5
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Also, main chunk is usually a sign that something in the XML is trying to call something that it doesn't know about. It could either be that the xml is being listed in the txt file before the lua or it is misspelt of a totally wrong parameter has been passed, which could be due to what Seerah mentioned amongst others.
  Reply With Quote
04/14/14, 02:57 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
No, it wouldn't be a missing/wrong parameter. The OP either misspelled the function name or the function hasn't been created yet when the XML loads. (Hint, load your Lua first before the XML.)
  Reply With Quote
04/14/14, 05:26 PM   #7
LucretiaValdis
 
LucretiaValdis's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 2
Oh you're all great, thank you very much everyone!

I was experimenting with different XMLs i wrote and copy pasted them around in the Textfile - the last Change put it above the LUA file and got me these errors - now everything works fine

I was confused because the Errors only occured every now and then on a reload - not really reproducibly and the Addon worked just fine as well ^^;

Thanks and Greetings!
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Strange Errors


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