This require less interaction between Nasal and C++ and
also does not need to create a list of removed children
which was not used anyway. Now it require about 70% less
time to execute.
so n.initNode("whatever", 1 "BOOL", 1); will make node n a BOOL even
if it was "DOUBLE" before. Default: 0. An existing value will be retained,
though.
props.nas: replace some "arg[*]" by named args
aircraft.nas: load aircraft data only if the file exists (to avoid warning)
debug.nas: no space before colon & fixed comment & cosmetics
If the property has a valid value already, then the given value is ignored.
var x = props.initNode("/foo", 10);
var y = props.initNode("/bar", 1, "BOOL");
and path strings into a list of props.Nodes. It also digests lists of
properties, or lists of lists of properties etc., thus allowing things
like props.nodeList(arg), props.nodeList(n.getChildren("foo")). This is
meant for functions like aircraft.data.add() or screen.display.add().
- remove some redundant braces
- fix comment
from its property tree. The node remains accessible as long as references
to it are kept. Example:
var cow_chain = func {
var cow = geo.put_model("Models/Fauna/cow.ac", geo.aircraft_position());
settimer(func { cow.remove() }, 10);
settimer(cow_chain, 2);
}
cow_chain();
all children, vectors for multiply used names, further hashes for subtrees
etc. Meant for quickly pulling in config branches where (almost) all values
are needed.
- usage of "var" keyword and named parameters in other (but not all) funcs
This isn't only more logical, it's also how SGPropertyNode::getBoolValue()
acts. The fix has potential to break code, but so far I haven't seen any
problems. I added a debug message to my copy and will for a while check
all cases that I run into. To check yourself, just add one line:
getBoolValue : func {
val = me.getValue();
+ if(val == nil) { debug.dump(me) }
if(me.getType() == "STRING" and val == "false") { 0 }
else { val != nil and val != 0 }
}
This will output a debug message to the terminal for each case where
formerly "true" was returned, and now "false" is.
Examples:
var tied = foo.getAttribute("TIED");
foo.setAttribute("USERARCHIVE", 1);
Both methods accept attribute strings "READ", "WRITE", "ARCHIVE",
"TRACE_READ", "TRACE_WRITE", and "USERARCHIVE". getAttribute() does
additionally accept "TIED" (although this isn't an SGPropertyNode::Attribute).
Attribute "REMOVED" is not supported.