Since yesterday the SGPropertyNode methods getAttribute() and
setAttribute() are available in the Nasal props.Node class.
Nasal doesn't have bool variables, so <bool> means just values
1 and 0 in the following examples:
-----------------------------------------------------------------------
Syntax:
<bool> prop.getAttribute(<attribute:string>)
where <attribute:string> is one of "READ", "WRITE", "ARCHIVE",
"TRACE_READ", "TRACE_WRITE", "USERARCHIVE", "TIED". The function
returns the state as 0 (unset) or 1 (set), or nil in case of error
(because an invalid <attribute> was used).
Example:
var foo = props.globals.getNode("foo", 1);
if (foo.getAttribute("USERARCHIVE")) {
print("Node " ~ foo.getPath() ~ " gets written to autosave.xml");
}
-----------------------------------------------------------------------
Syntax:
<bool> props.setAttribute(<attribute:string>, <state:bool>)
where <attribute:string> is one of "READ", "WRITE", "ARCHIVE",
"TRACE_READ", "TRACE_WRITE", "USERARCHIVE". The function sets
the respective attribute and returns the old value (like
getAttribute()), or nil on error.
Example:
var foo = props.globals.getNode("foo", 1);
foo.setAttribute("TRACE_READ", 1); # turn on tracing for one minute
settimer(func { foo.setAttribute("TRACE_READ", 0) }, 60);
-----------------------------------------------------------------------
The property attributes are also shown in the property browser after
one has Ctrl-clicked on a "." entry. Here's again what they mean:
attribute browser-flag meaning
-----------------------------------------------------------------------
READ r (if unset) usually set; makes property readable
WRITE w (if unset) usually set; makes property writable
TRACE_READ R reports every read/write access with
TRACE_WRITE W --log-level=info. Example log line:
TRACE: Read node /foo[0], value "0"
ARCHIVE A property is saved with "File"->"Save"
USERARCHIVE U property is autosaved on exit to
%APPDATA%\flightgear.org\autosave.xml or
~/.fgfs/autosave.xml
TIED T property value can also be read/written
to directly from C++ code (not only via
SGPropertyNode methods), in which case
listeners aren't triggered
m.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel