Exemplo n.º 1
0
        public static void Register(ScriptEngine engine)
        {
            {
                // string Print(...)
                FunctionValue_Host.EvaluateDelegate eval = (context, args, thisScope) => {
                    string ret = "";
                    for (int ii = 0; ii < args.Count; ++ii)
                    {
                        object val = args[ii];
                        ret += val.ToString();
                    }

                    printCache.Add(ret);

                    return(ret);
                };

                FunctionValue newValue = new FunctionValue_Host(IntrinsicTypeDefs.STRING, new List <ITypeDef> {
                    IntrinsicTypeDefs.ANY
                }, eval, true);
                engine.AddBulitInFunction(newValue, "Print");
            }
        }