List of Nasal extension functions: Difference between revisions

Jump to navigation Jump to search
m (change headings: match link's name (Nasal Core Library) and make FlightGear possessive)
Line 71: Line 71:


=== <tt>getprop()</tt> ===
=== <tt>getprop()</tt> ===
As of FlightGear 3.1, getprop()/setprop() arguments (those that form a path) can now be numeric to specify a index, so:
<syntaxhighlight lang="nasal">
getprop("canvas/by-index", "texture", 1, "name");
</syntaxhighlight>
: is now the same as:
<syntaxhighlight lang="nasal">
getprop("canvas/by-index/texture[1]/name");
</syntaxhighlight>
: (see [https://gitorious.org/fg/flightgear/commit/5eee5e42ae4f5cf56283b3bf5a3be46efc2b51c4 merge request 54] and [https://gitorious.org/fg/flightgear/commit/34ed79e5f88ffdfc5e651a1fe3e639cb8f4d3353 actual commit])
Returns the node value for a given path, or <tt>nil</tt> if the node doesn't exist or hasn't been initialized yet.  
Returns the node value for a given path, or <tt>nil</tt> if the node doesn't exist or hasn't been initialized yet.  


Line 82: Line 93:
print("The frame rate is ", getprop("/sim/frame-rate"), " FPS");
print("The frame rate is ", getprop("/sim/frame-rate"), " FPS");
</syntaxhighlight>
</syntaxhighlight>


=== <tt>setprop()</tt> ===
=== <tt>setprop()</tt> ===

Navigation menu