diff --git a/Nasal/globals.nas b/Nasal/globals.nas index e296ab972..65f949171 100644 --- a/Nasal/globals.nas +++ b/Nasal/globals.nas @@ -76,6 +76,18 @@ setlistener = func { } +## +# Convenience wrapper for the _condition function. Takes a +# property path string or props.Node object as argument, +# evaluates the property as and returns 1 or 0 +# for true/false (see $FG_ROOT/Docs/README.condition). +# +condition = func(prop) { + if(isa(prop, props.Node)) { prop = prop._g; } + elsif(typeof(prop) != "scalar") { return; } + return _condition(prop); +} + ## # Returns true if the symbol name is defined in the caller, or the # caller's lexical namespace. (i.e. defined("varname") tells you if