Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Template:Nasal Closure Wrapper

From FlightGear wiki
Jump to: navigation, search
var timers = [];
foreach(var delay; [2.0, 4.0, 8.0] ) {
#this declares an anonymous/unnamed function
var interval=delay; 
var myTimer = maketimer(interval, func() {
print("Hello from the ", interval,"-second timer!");
}); # end of the embedded func
append(timers, myTimer);
})(); # this will directly invoke the unnamed function
} # end of the foreach loop

# kill all timers
maketimer(60, func() {
foreach(var t; timers)
The following template description is not displayed when the template is inserted in an article.


This template can be used insert a Nasal snippet with an example of a function using maketimer().


{{Nasal Closure Wrapper |variable= |vector=}}

All parameters are optional.

See also Nasal Loops#for, while, foreach, and forindex loops.

Name of local variable for the foreach() loop.
Defaults to delay.
Vector for the foreach() loop.
Defaults to [2.0, 4.0, 8.0].

Technical details

This template uses {{Nasal Anonymous Func}}