Changes

Jump to navigation Jump to search
55 bytes removed ,  11:08, 6 November 2016
Start write_properties()
Line 364: Line 364:     
=== write_properties() ===
 
=== write_properties() ===
Write XML file in FlightGear's native <PropertyList> format.  
+
{{Nasal doc
Returns the filename on success or nil on error. If the source is a props.Node that refers to a node in the main tree,  
+
|syntax = io.write_properties(path, prop);
then the data are directly written from the tree, yielding a more accurate result.  
+
|text = Write XML file in FlightGear's native <PropertyList> format. Returns the filename on success or nil on error. If the source is a props.Node that refers to a node in the main tree, then the data are directly written from the tree, yielding a more accurate result. Otherwise the data need to be copied first, which may slightly change node types (FLOAT becomes DOUBLE etc.)
Otherwise the data need to be copied first, which may slightly change node types (FLOAT becomes DOUBLE etc.)
+
|param1 = path
<syntaxhighlight lang="nasal">
+
|param1text =
Usage:  io.write_properties(<filename>, <props.Node or property-path>);
+
|param1 = prop
</syntaxhighlight>
+
|param1text =  
Examples:
+
|example1 = var data = props.Node.new({ a:1, b:2, c:{ d:3, e:4 } });  
<syntaxhighlight lang="nasal">
  −
var data = props.Node.new({ a:1, b:2, c:{ d:3, e:4 } });  
   
io.write_properties("/tmp/foo.xml", data);               
 
io.write_properties("/tmp/foo.xml", data);               
io.write_properties("/tmp/foo.xml", "/sim/model");      
+
io.write_properties("/tmp/foo.xml", "/sim/model");  
</syntaxhighlight>
+
}}
    
=== writexml() ===
 
=== writexml() ===

Navigation menu