diff --git a/Expression.cs b/Expression.cs index b35a72d..6e3f22f 100644 --- a/Expression.cs +++ b/Expression.cs @@ -31,7 +31,24 @@ namespace ln.templates return TopEval.Evaluate(context); } - + public bool IsTrue(Context context) + { + try + { + object v = Evaluate(context); + if ((v is bool) && ((bool)v)) + return true; + if ((v is string) && (!String.Empty.Equals(v))) + return true; + if ((v is int) && ((int)v != 0)) + return true; + return false; + } + catch (Exception e) + { + return false; + } + } private void Compile()