Example #1
0
        public object InvokeFunction(string _Name, object[] args)
        {
            var host = new HostFunctions();

            ((IScriptableObject)host).OnExposedToScriptCode(this);
            var del = (Delegate)host.func <object>(args.Length, Script[_Name]);

            return(del.DynamicInvoke(args));
        }
Example #2
0
        public static object[] Call(string func, params object[] p)
        {
            var ret = new List <object>();

            var host = new HostFunctions();

            ((IScriptableObject)host).OnExposedToScriptCode(_engine);
            var del = (Delegate)host.func <object>(p.Length, _engine.Script[func]);

            ret.Add(del.DynamicInvoke(p));

            return(ret.ToArray());
        }
Example #3
0
        public void HostFunctions_func_0()
        {
            var        methodInvoked = false;
            const int  retVal        = 42;
            Func <int> method        = () => { methodInvoked = true; return(retVal); };

            Assert.AreEqual(retVal, ((Func <int>)host.func <int>(0, method))());
            Assert.IsTrue(methodInvoked);
        }