public void Test_ListMethod(InteropAccessMode opt) { UserData.UnregisterType <SomeClass>(); string script = @" x = mklist(1, 4); sum = 0; for _, v in ipairs(x) do sum = sum + v; end return sum;" ; Script S = new Script(); SomeClass_NoRegister obj = new SomeClass_NoRegister(); S.Globals["mklist"] = CallbackFunction.FromDelegate(S, (Func <int, int, List <int> >)obj.MkList, opt); DynValue res = S.DoString(script); Assert.AreEqual(DataType.Number, res.Type); Assert.AreEqual(10, res.Number); }
public static StringBuilder ConcatS(int p1, string p2, IComparable p3, bool p4, List<object> p5, IEnumerable<object> p6, StringBuilder p7, Dictionary<object, object> p8, SomeClass_NoRegister p9, int p10 = 1994) { p7.Append(p1); p7.Append(p2); p7.Append(p3); p7.Append(p4); p7.Append("|"); foreach (var o in p5) p7.Append(o); p7.Append("|"); foreach (var o in p6) p7.Append(o); p7.Append("|"); foreach (var o in p8.Keys.OrderBy(x => x.ToString())) p7.Append(o); p7.Append("|"); foreach (var o in p8.Values.OrderBy(x => x.ToString())) p7.Append(o); p7.Append("|"); p7.Append(p9); p7.Append(p10); return p7; }
public static StringBuilder ConcatS(int p1, string p2, IComparable p3, bool p4, List <object> p5, IEnumerable <object> p6, StringBuilder p7, Dictionary <object, object> p8, SomeClass_NoRegister p9, int p10 = 1994) { p7.Append(p1); p7.Append(p2); p7.Append(p3); p7.Append(p4); p7.Append("|"); foreach (var o in p5) { p7.Append(o); } p7.Append("|"); foreach (var o in p6) { p7.Append(o); } p7.Append("|"); foreach (var o in p8.Keys.OrderBy(x => x.ToString())) { p7.Append(o); } p7.Append("|"); foreach (var o in p8.Values.OrderBy(x => x.ToString())) { p7.Append(o); } p7.Append("|"); p7.Append(p9); p7.Append(p10); return(p7); }
public StringBuilder ConcatI(Script s, int p1, string p2, IComparable p3, bool p4, List <object> p5, IEnumerable <object> p6, StringBuilder p7, Dictionary <object, object> p8, SomeClass_NoRegister p9, int p10 = 1912) { Assert.IsNotNull(s); return(ConcatS(p1, p2, p3, p4, p5, p6, p7, p8, this, p10)); }
public void Test_ListMethod(InteropAccessMode opt) { string script = @" x = mklist(1, 4); sum = 0; for _, v in ipairs(x) do sum = sum + v; end return sum;"; Script S = new Script(); SomeClass_NoRegister obj = new SomeClass_NoRegister(); S.Globals["mklist"] = CallbackFunction.FromDelegate(S, (Func<int, int, List<int>>)obj.MkList, opt); DynValue res = S.DoString(script); Assert.AreEqual(DataType.Number, res.Type); Assert.AreEqual(10, res.Number); }
public StringBuilder ConcatI(Script s, int p1, string p2, IComparable p3, bool p4, List<object> p5, IEnumerable<object> p6, StringBuilder p7, Dictionary<object, object> p8, SomeClass_NoRegister p9, int p10 = 1912) { Assert.IsNotNull(s); return ConcatS(p1, p2, p3, p4, p5, p6, p7, p8, this, p10); }