Nasal library/io: Difference between revisions

Jump to navigation Jump to search
(Start write_properties())
Line 366: Line 366:
{{Nasal doc
{{Nasal doc
|syntax = io.write_properties(path, prop);
|syntax = io.write_properties(path, prop);
|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.)
|text = Writes nodes from the [[Property Tree]] to an XML file in FlightGear's [[PropertyList XML files|PropertyList]] format. Returns the filename on success or <code>'''nil'''</code> on error.
|param1 = path
|param1 = path
|param1text =  
|param1text = Path of the file to write to.
|param1 = prop
|param1 = prop
|param1text =  
|param1text = Either a property path or a <code>props.Node</code> object. Note that, when the latter is used, results will be more accurate if it refers to a node in the Property Tree, otherwise the node will have to be copied, which may change the node type.
|example1 = var data = props.Node.new({ a:1, b:2, c:{ d:3, e:4 } });  
|example1 = 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);               

Navigation menu