Nasal Hello World

From FlightGear wiki
Revision as of 15:41, 12 January 2020 by Hooray (talk | contribs) (+canvas example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


In the programming world, a "Hello, World!" program This is a link to a Wikipedia article is used to illustrate basic syntax using a very simple program. The "Hello, World!" program in Nasal would look like this (run this in the Nasal Console):

print("Hello, World!");

This will print the string Hello, World! into the console.

To show a message inside the FlightGear window using a GUI tooltip instead, use the following snippet:

gui.popupTip("Hello, World!");

To use a Canvas GUI dialog, try the following:


# create a new InputDialog with a title, label, and a callback
canvas.InputDialog.getText("Hello World", "Please enter your name", func(btn,value) {
    if (value) gui.popupTip("You entered: "~value);
});