Nasal for C++ programmers: Difference between revisions

Jump to navigation Jump to search
m
Line 43: Line 43:


Basically, Nasal scripting works exactly like JavaScript in your browser: Nasal is an embedded extension language, that is integrated into FlightGear as a conventional FlightGear subsystem (a so called "SGSubsystem") - during each frame, all subsystems, including the Nasal interpreter gets its time slice to process scripts - which is why badly written scripts may slow down the whole sim and affect frame rate/frame spacing.
Basically, Nasal scripting works exactly like JavaScript in your browser: Nasal is an embedded extension language, that is integrated into FlightGear as a conventional FlightGear subsystem (a so called "SGSubsystem") - during each frame, all subsystems, including the Nasal interpreter gets its time slice to process scripts - which is why badly written scripts may slow down the whole sim and affect frame rate/frame spacing.
Once FlightGear is up and running, most Nasal scripts will be invoked via timers and/or listeners.
Other scripts can be embedded in certain XML files, or even typed and executed via the built-in [[Nasal Console]] dialog or the new [[Canvas]] driven [[Interactive Nasal Console]].


Just imagine a bunch of FlightGear subsystems like these, which are all run sequentially:
Just imagine a bunch of FlightGear subsystems like these, which are all run sequentially:
Line 50: Line 53:
* GUI
* GUI
* Nasal Scripting Interpreter  
* Nasal Scripting Interpreter  
* timers (events)
* listeners (property tree)


The way that Nasal is integrated it doesn't really touch the core of FlightGear much at all; they just hook a new subsystem into the global list. SimGear is affected only in that it gets a new directory and a new library to build.
The way that Nasal is integrated it doesn't really touch the core of FlightGear much at all; they just hook a new subsystem into the global list with events (timers) and the property tree now having support for invoking Nasal callbacks. SimGear is affected only in that it gets a new directory and a new library to build.


There is some documentation on the language available at:
There is some documentation on the language available at:

Navigation menu