MediaWiki has been updated to version 1.35.1. Please report any problems here.

Talk:Properties persistent between sessions

From FlightGear wiki
Jump to navigation Jump to search

Is this example really valid? Does it not miss the save command?

 <sim>
  <!-- ... -->

  <aircraft-data>
   <path>/controls/flight/flaps</path>
   <path>/controls/lighting/nav</path>
  </aircraft-data>
 </sim>

The comment specifies this, its a bit confusing if save is mandatory, or if it will just save the properties in the instant it is called:

# data
# ==============================================================================
# class that loads and saves properties to aircraft-specific data files in
# ~/.fgfs/aircraft-data/ (Unix) or %APPDATA%\flightgear.org\aircraft-data\.
# There's no public constructor, as the only needed instance gets created
# by the system.
#
# SYNOPSIS:
#	data.add(<properties>);
#	data.save([<interval>])
#
#	properties  ... about any combination of property nodes (props.Node)
#	                or path name strings, or lists or hashes of them,
#	                lists of lists of them, etc.
#	interval    ... save in <interval> minutes intervals, or only once
#	                if 'nil' or empty (and again at reinit/exit)
#
# SIGNALS:
#	/sim/signals/save   ... set to 'true' right before saving. Can be used
#	                        to update values that are to be saved
#
# EXAMPLE:
#	var p = props.globals.getNode("/sim/model", 1);
#	var vec = [p, p];
#	var hash = {"foo": p, "bar": p};
#
#	# add properties
#	aircraft.data.add("/sim/fg-root", p, "/sim/fg-home");
#	aircraft.data.add(p, vec, hash, "/sim/fg-root");
#
#	# now save only once (and at exit/reinit, which is automatically done)
#	aircraft.data.save();
#
#	# or save now and every 30 sec (and at exit/reinit)
#	aircraft.data.save(0.5);
#

Another thing that's unclear from this is loading. Is the userarchive="y" needed to load it or not.

And how to delete a property from the save (besides go and delete the file in question)? This could be handy if previous versions of an aircraft saved some properties, that should no longer be saved or loaded.

--Necolatis (talk) 12:00, 1 December 2015 (EST)