Scorpio.Runtime.ScriptContext.Execute C# (CSharp) Method

Execute() public method

public Execute ( ) : ScriptObject
return Scorpio.ScriptObject
        public ScriptObject Execute()
        {
            Reset();
            int iInstruction = 0;
            while (iInstruction < m_InstructionCount) {
                m_scriptInstruction = m_scriptInstructions[iInstruction++];
                ExecuteInstruction();
                if (IsExecuted) break;
            }
            return m_returnObject;
        }
        private ScriptObject Execute(ScriptExecutable executable)

Same methods

ScriptContext::Execute ( ScriptExecutable executable ) : ScriptObject

Usage Example

示例#1
0
        void ProcessCallForSimple()
        {
            CodeForSimple code        = (CodeForSimple)m_scriptInstruction.operand0;
            ScriptNumber  beginNumber = ResolveOperand(code.Begin) as ScriptNumber;

            if (beginNumber == null)
            {
                throw new ExecutionException(m_script, "forsimple 初始值必须是number");
            }
            ScriptNumber finishedNumber = ResolveOperand(code.Finished) as ScriptNumber;

            if (finishedNumber == null)
            {
                throw new ExecutionException(m_script, "forsimple 最大值必须是number");
            }
            int begin    = beginNumber.ToInt32();
            int finished = finishedNumber.ToInt32();
            int step;

            if (code.Step != null)
            {
                ScriptNumber stepNumber = ResolveOperand(code.Step) as ScriptNumber;
                if (stepNumber == null)
                {
                    throw new ExecutionException(m_script, "forsimple Step必须是number");
                }
                step = stepNumber.ToInt32();
            }
            else
            {
                step = 1;
            }
            ScriptContext context;

            for (double i = begin; i <= finished; i += step)
            {
                context = new ScriptContext(m_script, code.BlockExecutable, this, Executable_Block.For);
                context.Initialize(code.Identifier, new ScriptNumberDouble(m_script, i));
                context.Execute();
                if (context.IsOver)
                {
                    break;
                }
            }
        }
All Usage Examples Of Scorpio.Runtime.ScriptContext::Execute