Nasal optimisation: Difference between revisions

m
(One intermediate revision by the same user not shown)
Line 91: Line 91:
The following code can be used to provide a basic and yet sophisticated way to run Nasal code in a scheduled (per frame or at a suitable rate) and in a managed way (i.e. something knows which modules are registered)
The following code can be used to provide a basic and yet sophisticated way to run Nasal code in a scheduled (per frame or at a suitable rate) and in a managed way (i.e. something knows which modules are registered)


Each module that wish to be executed needs to implement itself as a receiver or have a receiver wrapper (as follows). Generally I prefer to use a receiver wrapper as it helps to isolate the code that does the work from the code that interfaces to the scheduler.
Each module that wishes to be executed needs to implement itself as a receiver or have a receiver wrapper (as follows). Generally I prefer to use a receiver wrapper as it helps to isolate the code that does the work from the code that interfaces to the scheduler.


<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
Line 404: Line 404:
                                 ,
                                 ,
                                 func(pp, obj, element){
                                 func(pp, obj, element){
                                     proces individual element;  
                                     process individual element;  
                                     params
                                     params
                                     pp is the partition processor that called this
                                     pp is the partition processor that called this