Nasal scripting language: Difference between revisions

Jump to navigation Jump to search
Line 2,340: Line 2,340:


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
   setlistener( "/sim/signals/reinit", remove_listeners );
   _setlistener( "/sim/signals/reinit", remove_listeners );
</syntaxhighlight>
</syntaxhighlight>
Note how we're using the low level _setlistener() call directly here, to avoid adding the listener id to the "cleanup" vector, which would mean that we're also removing this listener - i.e. the cleanup would then only work once.


Now, you'll probably have noticed that it would make sense to consider wrapping all these helpers and variables inside an enclosing helper class, this can be accomplished in Nasal using a hash.  
Now, you'll probably have noticed that it would make sense to consider wrapping all these helpers and variables inside an enclosing helper class, this can be accomplished in Nasal using a hash.  

Navigation menu