1
0
Fork 0

props.Node: add remove() method that removes the node it was calleed on

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();
This commit is contained in:
mfranz 2007-08-07 11:30:30 +00:00
parent bf050c012f
commit fd20d330ba

View file

@ -32,18 +32,23 @@ Node = {
getNode : func { wrap(_getNode(me._g, arg)) }, getNode : func { wrap(_getNode(me._g, arg)) },
getPath : func { getPath : func {
name = me.getName(); var name = me.getName();
if(me.getIndex() != 0) { name = name ~ "[" ~ me.getIndex() ~ "]"; } if(me.getIndex() != 0) { name = name ~ "[" ~ me.getIndex() ~ "]"; }
if(me.getParent() != nil) { name = me.getParent().getPath() ~ "/" ~ name; } if(me.getParent() != nil) { name = me.getParent().getPath() ~ "/" ~ name; }
return name; return name;
}, },
getBoolValue : func { getBoolValue : func {
val = me.getValue(); var val = me.getValue();
if(me.getType() == "STRING" and val == "false") { 0 } if(me.getType() == "STRING" and val == "false") { 0 }
elsif (val == nil) { 0 } elsif (val == nil) { 0 }
else { val != 0 } else { val != 0 }
}, },
remove : func {
if((var p = me.getParent()) == nil) return nil;
p.removeChild(me.getName(), me.getIndex());
},
}; };
## ##