コード例 #1
0
        private int CallFunctionIsRight(string FunctionToCall)
        {
            if (!FunctionCallInitiated)
            {
                FunctionCallInitiated = true;
                if (!FunctionToCall.StartsWith("global_", StringComparison.Ordinal))
                {
                    FunctionToCall = ScriptCaller + "_" + FunctionToCall;
                }


                int FunctionIndex = Global.Functions_Keys.IndexOf(FunctionToCall);

                if (FunctionIndex == -1)
                {
                    throw new TaiyouExecutionError(this, "Type Error!", "Cannot find function [" + FunctionToCall + "]");
                }

                List <TaiyouLine> AllCode = Global.Functions_Data[FunctionIndex];

                // Create an Script Instance
                FunctionToRun = new TaiyouScript("", true, Global.Functions_Data[FunctionIndex]);
            }

            return(FunctionToRun.Interpret());
        }
コード例 #2
0
        public override int Call()
        {
            string[] Arguments = ReplaceVarLiterals();

            if (!FunctionInited)
            {
                FunctionInited = true;

                string FunctionName = GetArgument(Arguments, 0);

                // Set the right function name
                if (!FunctionName.StartsWith("global_", StringComparison.Ordinal))
                {
                    FunctionName = ScriptCaller + "_" + FunctionName;
                }


                int FunctionIndex = Global.Functions_Keys.IndexOf(FunctionName);

                if (FunctionIndex == -1)
                {
                    throw new TaiyouExecutionError(this, "Type Error!", "Cannot find function [" + FunctionName + "]");
                }

                List <TaiyouLine> AllCode = Global.Functions_Data[FunctionIndex];

                // Create an Script Instance
                FunctionToRun = new TaiyouScript("", true, Global.Functions_Data[FunctionIndex]);
            }

            // Run the Function
            FunctionToRun.Interpret();

            return(0);
        }