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

Changes

Jump to: navigation, search

Howto:Extend Nasal

526 bytes added, 18:10, 5 November 2013
m
Status (cppbind): forum2wiki: http://forum.flightgear.org/viewtopic.php?f=66&t=21217&p=193362&hilit=cppbind#p193359
Most of the code in the Nasal subsystem itself (FGNasalSys) also still uses the legacy C APIs - this is just to explain the two approaches, to avoid unnecessary confusion.
Overall, it's a good idea to favor cppbind over the low-level approach documented here, it isn't only much more elegant, but also saves you tons of typing, too
 
The new cppbind framework makes heavy use of modern C++, so that C++ data structures and classes/methods can now be easily exposed to Nasal space and vice versa.
 
Implementation examples are to be found in $FG_SRC/Scripting.
For example, see the most recent addition, which exposes SimGear's HTTP client code to Nasal space with less than 140 lines of code in $FG_SRC/Scripting/NasalHTTP.?xx
There's still plenty of "old" code that doesn't yet use the cppbind framework - check the header inclusions at the top of the file.
Some of the more straightforward things to play with would be exposing useful SG/FG classes to Nasal space, such as the SGSubsystem interface to register scripted SGSubsystems, or the autopilot system.
18,245
edits

Navigation menu