From d1c4bcea85267597433d07b2b66be69ab961adea Mon Sep 17 00:00:00 2001 From: mfranz Date: Sat, 17 Mar 2007 15:59:39 +0000 Subject: [PATCH] condition(property) wrapper for the _condition function. See $FG_ROOT/Docs/README.condition --- Nasal/globals.nas | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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