Howto:Extend Nasal: Difference between revisions

Jump to navigation Jump to search
m
m (moved Howto: Extend Nasal to Howto:Extend Nasal: Robot: Moved page)
Line 282: Line 282:
  naRef naNumValue(naRef n);
  naRef naNumValue(naRef n);
  naRef naStringValue(naContext c, naRef n);
  naRef naStringValue(naContext c, naRef n);
= Wrapping Classes as Nasal Objects (ghosts) =
To be written by Hooray & Zakalawe. For the time being, it's a good idea to take a look at the FGPositioned wrappers for the navdb to see how this is done in Nasal, see [https://gitorious.org/fg/flightgear/blobs/next/src/Scripting/NasalPositioned.cxx $FG_SRC/Scripting/NasalPositioned.cxx].
There's a plan to eventually unify all those helpers and provide them as part of the FGNasalSys class, so that they automatically become available to all users of the Nasal subsystem.


= Passing Pointers to Nasal scripts =
= Passing Pointers to Nasal scripts =
Line 301: Line 306:
This needs to be specifically implemented for each new "ghost" type.
This needs to be specifically implemented for each new "ghost" type.


For an example how something like this is done in the FlightGear context, you may want to check out $FG_SRC/Scripting/nasal-props.cxx, which wraps the SGPropertyNode class ([[SimGear]]) inside a nasal ghost, so that the C++ class is exposed to Nasal scripts.
For an example of how something like this is done in the FlightGear context, you may want to check out $FG_SRC/Scripting/nasal-props.cxx, which wraps the SGPropertyNode class ([[SimGear]]) inside a nasal ghost, so that the C++ class is exposed to Nasal scripts.


= Locking a Nasal context (threading) =
= Locking a Nasal context (threading) =

Navigation menu