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

Nasal Snippets

From FlightGear wiki
Jump to: navigation, search
This article is a stub. You can help the wiki by expanding it.

This page is meant to collect commonly used or otherwise useful Nasal snippets for use in FlightGear. Ideally, this will help new users to get started programming in Nasal more easily.

If you have any Nasal specific questions, you will want to check out Nasal FAQ. Feel free to ask new questions, help answer, refine existing ones.

Calling a function with named arguments

var sayHello = func(name) {
 print("Hello ", name);

sayHello(name: "FlightGear");

Dumping all keys in a hash

var dump_keys = func(hash) {
    if (typeof(hash) != "hash") die("dump_keys(): Error! Argument is not a hash.");
    foreach(var key; keys(hash)){
        print(key, ": ", typeof(hash[key]));