Page 1 of 1

Functions with underscores _ in their name.

Posted: Thu Jan 10, 2013 5:58 am
by Balthasar
Noticed something funny today. If you have a function with an underscore in the title, you can't connect a button to it in the dungeon editor interface. Nothing with an underscore will show up in the 'action' drop-down list.

Re: Functions with underscores _ in their name.

Posted: Thu Jan 10, 2013 11:10 am
by Asteroth
Yup, seen that. LOTS of confusion ensued.

Re: Functions with underscores _ in their name.

Posted: Thu Jan 10, 2013 12:03 pm
by Grimwold
I hadn't actually seen the consequences of using underscores for functions, but I am strict adherer to the conventions of underscores_for_variables and camelCase() for functions.

Re: Functions with underscores _ in their name.

Posted: Thu Jan 10, 2013 1:07 pm
by Komag
I use camelCase for everything, just makes a lot of sense to me, but having a different format for variables might be helpful, I'll consider it

Re: Functions with underscores _ in their name.

Posted: Thu Jan 10, 2013 1:16 pm
by Balthasar
I've been using it as a feature!

My script is large and in charge with plenty of functions, but only a few of them are intended to be linked to buttons. So any function that I don't want to use with a button, I put an underscore in the name. Then when I am linking up any buttons, there aren't a billion options to choose from.

Re: Functions with underscores _ in their name.

Posted: Thu Jan 10, 2013 7:37 pm
by petri
It's a feature :) I guess the idea was that if the function name starts or ends with an underscore it's private to the script and therefore not exposed in the dropdown. The check seems to be a little too trigger happy and rejects all functions with underscores in their name.

Re: Functions with underscores _ in their name.

Posted: Thu Jan 10, 2013 9:02 pm
by Komag
Ha! Good to know. So Balthasar was the only one adept enough to figure that out on his own ;)