Пример #1
0
        /// <summary>
        /// Gets the return value from calling a function.
        /// </summary>
        /// <param name="scope">The scope object containing variable values and function parameters.</param>
        /// <param name="result">[out] The new expression containing the function result.</param>
        /// <returns>
        ///   <c>true</c> if substitution was successful, <c>false</c> if something went wrong, in which case <paramref name="result" /> will likely be a <see cref="ParseErrorExpression" />.
        /// </returns>
        public virtual bool Evaluate(InterpreterScope scope, out ExpressionBase result)
        {
            var interpreter      = new AchievementScriptInterpreter();
            var interpreterScope = new InterpreterScope(scope)
            {
                Context = interpreter
            };

            if (!interpreter.Evaluate(Expressions, interpreterScope))
            {
                result = interpreter.Error;
                return(false);
            }

            result = interpreterScope.ReturnValue;
            return(true);
        }