View Single Post
  #2  
Old 05-19-2015, 10:29 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
You can omit the parentheses if the name doesn't contain any special characters:

PHP Code:
Bar.foobar(); 
The @ is also always unnecessary, it's a bad habit that I'm afraid I helped popularize:

PHP Code:
("-Something/With/Weird/Characters!").foobar(); // works fine 
Personally, I don't see any reason to use the findWeapon syntax. Usually for weapons that I want other scripts to call, I wouldn't worry too much about the name (e.g. -HealthSystem), and instead do something like:

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
Health this;

...with the idea of it being better to be explicit rather than implicit (other scripts can now do Health.foobar()).

The (minimal) added benefit is that you can avoid using parentheses (no dashes), you're reminded that other scripts might be calling it, and you avoid trouble with renames.

There might be some benefit to the findWeapon syntax in that you can avoid conflicts between other objects, but I've never really seen that happen in all the time I was coding.
__________________
Reply With Quote