Beispiel #1
0
		private DynValue Script_LoadFunc(string script, string funcname)
		{
			Script s1 = new Script();
			DynValue v1 = s1.DoString(script);
			DynValue func = s1.Globals.Get(funcname);

			using (MemoryStream ms = new MemoryStream())
			{
				s1.Dump(func, ms);
				ms.Seek(0, SeekOrigin.Begin);

				Script s2 = new Script();
				return s2.LoadStream(ms);
			}
		}
Beispiel #2
0
		private DynValue Script_RunString(string script)
		{
			Script s1 = new Script();
			DynValue v1 = s1.LoadString(script);

			using (MemoryStream ms = new MemoryStream())
			{
				s1.Dump(v1, ms);
				ms.Seek(0, SeekOrigin.Begin);

				Script s2 = new Script();
				DynValue func = s2.LoadStream(ms);
				return func.Function.Call();
			}
		}