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 doc

From FlightGear wiki
Jump to: navigation, search

The following template description is not displayed when the template is inserted in an article.


This template is to be used to document Nasal API functions. The underlying aim is to unify Nasal documentation on the wiki.


{{Nasal doc
| syntax      =
| text        =
| mode        =
| source      =
| version     =
| commit      =
| private     =
| param1      =
| param10     =
| param1text  =
| param10text  =
| example1text =
| example1     =
| example10text =
| example10     =

All parameters are optional.

Basic data

Syntax of the function.
Description of the function.
If this is set to "class", all parameters except source, version, and text become unavailable.
When given, should be a repository link template, such as {{flightgear file}} with the text as "Source" (see example below). Ideally, a line number should be given as well.
Optional version statement, stating which version of FlightGear the function was added.
Optional commit link. If given, the parameter should use one of {{fgdata commit}}, {{flightgear commit}}, or {{simgear commit}} with the link label "commit."
The private function behind the function being documented. It is often named the same, but usually has an underscore (_) preceding it. An example is cmdarg() and _cmdarg().
Names of the parameters of the function. There can be up to ten parameters, from param1 to param10.
Description of the parameters. There can be up to ten parameters, from param1text to param10text.
Description of the example. There can be up to ten of these, from example1text to example10text.
Examples of the usage of the function. There can be up to ten examples, from example1 to example10.


=== function() ===
{{Nasal doc
| syntax     = function(a, [b, c]);
| source     = {{flightgear file|t=Source}}
| version    = 3.2
| text       = Returns a value or <code>'''nil'''</code>.
| param1     = a
| param1text = Mandatory argument.
| param2     = b
| param2text = Optional argument.
| param3     = c
| param3text = Optional argument.
| example1   = var variable = function("string");
| example2   = var variable = function("string", 1.234, FlightGear);


function(a, [b, c]);

Source — Version added: FG 3.2

Returns a value or nil.
Mandatory argument.
Optional argument.
Optional argument.


Example using just one parameter.
var variable = function("string");
Example of the usage of all parameters.
var variable = function("string", 1.234, FlightGear);