Xanathar 10 gadi atpakaļ
vecāks
revīzija
c893bff14c
33 mainītis faili ar 1243 papildinājumiem un 31 dzēšanām
  1. 1 3
      src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/MoonSharp.Interpreter.Tests.Embeddable.portable40.csproj
  2. 2 1
      src/MoonSharp.Interpreter/Interop/InteropAccessMode.cs
  3. 3 3
      src/MoonSharp.Interpreter/Loaders/EmbeddedResourcesScriptLoader.cs
  4. 3 0
      src/MoonSharp.Interpreter/Loaders/ScriptLoaderBase.cs
  5. 35 0
      src/Tutorial/Tutorials/Chapters/Chapter1.cs
  6. 36 0
      src/Tutorial/Tutorials/Chapters/Chapter10.cs
  7. 69 0
      src/Tutorial/Tutorials/Chapters/Chapter11.cs
  8. 81 0
      src/Tutorial/Tutorials/Chapters/Chapter12.cs
  9. 59 0
      src/Tutorial/Tutorials/Chapters/Chapter2.cs
  10. 62 0
      src/Tutorial/Tutorials/Chapters/Chapter3.cs
  11. 165 0
      src/Tutorial/Tutorials/Chapters/Chapter4.cs
  12. 35 0
      src/Tutorial/Tutorials/Chapters/Chapter5.cs
  13. 382 0
      src/Tutorial/Tutorials/Chapters/Chapter6.cs
  14. 50 0
      src/Tutorial/Tutorials/Chapters/Chapter7.cs
  15. 55 0
      src/Tutorial/Tutorials/Chapters/Chapter8.cs
  16. 38 0
      src/Tutorial/Tutorials/Chapters/Chapter9.cs
  17. 76 0
      src/Tutorial/Tutorials/Program.cs
  18. 6 0
      src/Tutorial/Tutorials/Scripts/Test.lua
  19. 14 0
      src/Tutorial/Tutorials/TutorialAttribute.cs
  20. 28 7
      src/Tutorial/Tutorials/Tutorials.csproj
  21. 0 5
      src/Tutorial/Tutorials/packages.config
  22. BIN
      src/Unity/UnityTestBed/Assets/Plugins/MoonSharp.Interpreter.Tests.dll
  23. BIN
      src/Unity/UnityTestBed/Assets/Plugins/MoonSharp.Interpreter.dll
  24. 28 3
      src/Unity/UnityTestBed/Assets/Plugins/MoonSharp.Interpreter.xml
  25. BIN
      src/Unity/UnityTestBed/Assets/Plugins/WSA/MoonSharp.Interpreter.Tests.dll
  26. BIN
      src/Unity/UnityTestBed/Assets/Plugins/WSA/MoonSharp.Interpreter.dll
  27. 1 0
      src/Unity/UnityTestBed/Assets/TestRunner.cs
  28. BIN
      src/Unity/UnityTestBed/Assets/Tests.unity
  29. 4 6
      src/Unity/UnityTestBed/UnityVS.UnityTestBed.CSharp.csproj
  30. 2 1
      src/Xamarin/XamarinTestBed_Android/XamarinTestBed_Android.userprefs
  31. 1 0
      src/Xamarin/XamarinTestBed_Android/XamarinTestBed_Android/Scripts/Test.lua
  32. 7 1
      src/Xamarin/XamarinTestBed_Android/XamarinTestBed_Android/XamarinTestBed_Android.csproj
  33. 0 1
      src/packages/repositories.config

+ 1 - 3
src/MoonSharp.Interpreter.Tests/_Projects/MoonSharp.Interpreter.Tests.Embeddable.portable40/MoonSharp.Interpreter.Tests.Embeddable.portable40.csproj

@@ -188,9 +188,7 @@
     <EmbeddedResource Include="TestMore\Modules\Test\Builder.lua">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </EmbeddedResource>
-    <EmbeddedResource Include="TestMore\Modules\Test\More.lua">
-      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-    </EmbeddedResource>
+    <EmbeddedResource Include="TestMore\Modules\Test\More.lua" />
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 2 - 1
src/MoonSharp.Interpreter/Interop/InteropAccessMode.cs

@@ -22,10 +22,11 @@ namespace MoonSharp.Interpreter
 		Reflection,
 		/// <summary>
 		/// Optimization is done on the fly the first time a member is accessed.
+		/// This saves memory for all members that are never accessed, at the cost of an increased script execution time.
 		/// </summary>
 		LazyOptimized,
 		/// <summary>
-		/// Optimization is done at registration time
+		/// Optimization is done at registration time.
 		/// </summary>
 		Preoptimized,
 		/// <summary>

+ 3 - 3
src/MoonSharp.Interpreter/Loaders/EmbeddedResourcesScriptLoader.cs

@@ -18,10 +18,10 @@ namespace MoonSharp.Interpreter.Loaders
 		/// <summary>
 		/// Initializes a new instance of the <see cref="EmbeddedResourcesScriptLoader"/> class.
 		/// </summary>
-		/// <param name="resourceAssembly">The assembly containing the scripts as embedded resources.</param>
-		public EmbeddedResourcesScriptLoader(Assembly resourceAssembly)
+		/// <param name="resourceAssembly">The assembly containing the scripts as embedded resources or null to use the calling assembly.</param>
+		public EmbeddedResourcesScriptLoader(Assembly resourceAssembly = null)
 		{
-			m_ResourceAssembly = resourceAssembly;
+			m_ResourceAssembly = resourceAssembly ?? Assembly.GetCallingAssembly();
 			m_Namespace = m_ResourceAssembly.FullName.Split(',').First();
 			m_ResourceNames = new HashSet<string>(m_ResourceAssembly.GetManifestResourceNames());
 		}

+ 3 - 0
src/MoonSharp.Interpreter/Loaders/ScriptLoaderBase.cs

@@ -40,6 +40,9 @@ namespace MoonSharp.Interpreter.Loaders
 		/// <returns></returns>
 		protected virtual string ResolveModuleName(string modname, string[] paths)
 		{
+			if (paths == null) 
+				return null;
+
 			modname = modname.Replace('.', '/');
 
 			foreach (string path in paths)

+ 35 - 0
src/Tutorial/Tutorials/Chapters/Chapter1.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter01
+	{
+		[Tutorial]
+		public static double MoonSharpFactorial()
+		{
+			string script = @"    
+				-- defines a factorial function
+				function fact (n)
+					if (n == 0) then
+						return 1
+					else
+						return n*fact(n - 1)
+					end
+				end
+
+				return fact(5)";
+
+			DynValue res = Script.RunString(script);
+			return res.Number;
+		}
+
+
+
+	}
+}

+ 36 - 0
src/Tutorial/Tutorials/Chapters/Chapter10.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+using MoonSharp.Interpreter.Loaders;
+using MoonSharp.Interpreter.Platforms;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter10
+	{
+		[Tutorial]
+		static void OverriddenPrint()
+		{
+			// redefine print to print in lowercase, for all new scripts
+			Script.DefaultOptions.DebugPrint = s => Console.WriteLine(s.ToLower());
+				
+			Script script = new Script();
+
+			DynValue fn = script.LoadString("print 'Hello, World!'");
+
+			fn.Function.Call(); // this prints "hello, world!"
+
+			// redefine print to print in UPPERCASE, for this script only
+			script.Options.DebugPrint = s => Console.WriteLine(s.ToUpper());
+			
+			fn.Function.Call(); // this prints "HELLO, WORLD!"
+		}
+
+
+	}
+}

+ 69 - 0
src/Tutorial/Tutorials/Chapters/Chapter11.cs

@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+using MoonSharp.Interpreter.Loaders;
+using MoonSharp.Interpreter.Platforms;
+using MoonSharp.RemoteDebugger;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter11
+	{
+		static RemoteDebuggerService remoteDebugger;
+
+		static void ActivateRemoteDebugger(Script script)
+		{
+			if (remoteDebugger == null)
+			{
+				remoteDebugger = new RemoteDebuggerService();
+
+				// the last boolean is to specify if the script is free to run 
+				// after attachment, defaults to false
+				remoteDebugger.Attach(script, "Description of the script", false);
+			}
+
+			// start the web-browser at the correct url. Replace this or just
+			// pass the url to the user in some way.
+			Process.Start(remoteDebugger.HttpUrlStringLocalHost);
+		}
+
+
+		[Tutorial]
+		static void DebuggerDemo()
+		{
+			Script script = new Script();
+
+			ActivateRemoteDebugger(script);
+
+			script.DoString(@"
+
+				function accum(n, f)
+					if (n == 0) then
+						return 1;
+					else
+						return n * f(n);
+					end
+				end
+
+
+				local sum = 0;
+
+				for i = 1, 5 do
+					-- let's use a lambda to spice things up
+					sum = sum + accum(i, | x | x - 1);
+				end
+				");
+
+			Console.WriteLine("The script has ended..");
+
+		}
+
+
+	}
+}

+ 81 - 0
src/Tutorial/Tutorials/Chapters/Chapter12.cs

@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+using MoonSharp.Interpreter.Loaders;
+using MoonSharp.Interpreter.Platforms;
+using MoonSharp.RemoteDebugger;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter12
+	{
+		[Tutorial]
+		static void CoroutinesFromCSharp()
+		{
+			string code = @"
+				return function()
+					local x = 0
+					while true do
+						x = x + 1
+						coroutine.yield(x)
+					end
+				end
+				";
+
+			// Load the code and get the returned function
+			Script script = new Script();
+			DynValue function = script.DoString(code);
+
+			// Create the coroutine in C#
+			DynValue coroutine = script.CreateCoroutine(function);
+
+			// Resume the coroutine forever and ever.. 
+			while (true)
+			{
+				DynValue x = coroutine.Coroutine.Resume();
+				Console.WriteLine("{0}", x);
+			}
+		}
+
+		[Tutorial]
+		static void CoroutinesAsCSharpIterator()
+		{
+			string code = @"
+				return function()
+					local x = 0
+					while true do
+						x = x + 1
+						coroutine.yield(x)
+						if (x > 5) then
+							return 7
+						end
+					end
+				end
+				";
+
+			// Load the code and get the returned function
+			Script script = new Script();
+			DynValue function = script.DoString(code);
+
+			// Create the coroutine in C#
+			DynValue coroutine = script.CreateCoroutine(function);
+
+			// Loop the coroutine 
+			string ret = "";
+
+			foreach (DynValue x in coroutine.Coroutine.AsTypedEnumerable())
+			{
+				ret = ret + x.ToString();
+			}
+
+			Console.WriteLine(ret);
+		}
+
+	}
+}

+ 59 - 0
src/Tutorial/Tutorials/Chapters/Chapter2.cs

@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter02
+	{
+		public static double MoonSharpFactorial()
+		{
+			string scriptCode = @"    
+		-- defines a factorial function
+		function fact (n)
+			if (n == 0) then
+				return 1
+			else
+				return n*fact(n - 1)
+			end
+		end
+
+		return fact(mynumber)";
+
+			Script script = new Script();
+
+			script.Globals["mynumber"] = 7;
+
+			DynValue res = script.DoString(scriptCode);
+			return res.Number;
+		}
+
+
+
+		[Tutorial]
+		public static double MoonSharpFactorial2()
+		{
+			string scriptCode = @"    
+		-- defines a factorial function
+		function fact (n)
+			if (n == 0) then
+				return 1
+			else
+				return n*fact(n - 1)
+			end
+		end";
+
+			Script script = new Script();
+
+			script.DoString(scriptCode);
+
+			DynValue res = script.Call(script.Globals["fact"], 4);
+
+			return res.Number;
+		}
+	}
+}

+ 62 - 0
src/Tutorial/Tutorials/Chapters/Chapter3.cs

@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter03
+	{
+		[Tutorial]
+		public static double MoonSharpFactorial()
+		{
+			string scriptCode = @"    
+		-- defines a factorial function
+		function fact (n)
+			if (n == 0) then
+				return 1
+			else
+				return n*fact(n - 1)
+			end
+		end";
+
+			Script script = new Script();
+
+			script.DoString(scriptCode);
+
+			DynValue luaFactFunction = script.Globals.Get("fact");
+
+			DynValue res = script.Call(luaFactFunction, 4);
+
+			return res.Number;
+		}
+
+		[Tutorial]
+		public static double MoonSharpFactorial2()
+		{
+			string scriptCode = @"    
+		-- defines a factorial function
+		function fact (n)
+			if (n == 0) then
+				return 1
+			else
+				return n*fact(n - 1)
+			end
+		end";
+
+			Script script = new Script();
+
+			script.DoString(scriptCode);
+
+			DynValue luaFactFunction = script.Globals.Get("fact");
+
+			DynValue res = script.Call(luaFactFunction, DynValue.NewNumber(4));
+
+			return res.Number;
+		}
+
+	}
+}

+ 165 - 0
src/Tutorial/Tutorials/Chapters/Chapter4.cs

@@ -0,0 +1,165 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter04
+	{
+		#region TableTest1
+
+		private static List<int> GetNumberList()
+		{
+			List<int> lst = new List<int>();
+
+			for (int i = 1; i <= 10; i++)
+				lst.Add(i);
+
+			return lst;
+		}
+
+		[Tutorial]
+		public static double TableTest1()
+		{
+			string scriptCode = @"    
+				total = 0;
+
+				tbl = getNumbers()
+        
+				for _, i in ipairs(tbl) do
+					total = total + i;
+				end
+
+				return total;
+			";
+
+			Script script = new Script();
+
+			script.Globals["getNumbers"] = (Func<List<int>>)GetNumberList;
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+		#endregion
+
+
+		#region TableTest2
+
+		private static Table GetNumberTable(Script script)
+		{
+			Table tbl = new Table(script);
+
+			for (int i = 1; i <= 10; i++)
+				tbl[i] = i;
+
+			return tbl;
+		}
+
+		[Tutorial]
+		public static double TableTest2()
+		{
+			string scriptCode = @"    
+				total = 0;
+
+				tbl = getNumbers()
+        
+				for _, i in ipairs(tbl) do
+					total = total + i;
+				end
+
+				return total;
+			";
+
+			Script script = new Script();
+
+			script.Globals["getNumbers"] = (Func<Script, Table>)(GetNumberTable);
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+		#endregion
+
+
+		#region TableTestReverse
+
+		[Tutorial]
+		public static double TableTestReverse()
+		{
+			string scriptCode = @"    
+				return dosum { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
+			";
+
+			Script script = new Script();
+
+			script.Globals["dosum"] = (Func<List<int>, int>)(l => l.Sum());
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+		#endregion
+
+
+		#region TableTestReverseSafer
+
+		[Tutorial]
+		public static double TableTestReverseSafer()
+		{
+			string scriptCode = @"    
+				return dosum { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
+			";
+
+			Script script = new Script();
+
+			script.Globals["dosum"] = (Func<List<object>, int>)(l => l.OfType<int>().Sum());
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+		#endregion
+
+
+		#region TableTestReverseWithTable
+
+		static double Sum(Table t)
+		{
+			var nums = from v in t.Values
+					   where v.Type == DataType.Number
+					   select v.Number;
+
+			return nums.Sum();
+		}
+
+
+		[Tutorial]
+		public static double TableTestReverseWithTable()
+		{
+			string scriptCode = @"    
+					return dosum { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
+				";
+
+			Script script = new Script();
+
+			script.Globals["dosum"] = (Func<Table, double>)Sum;
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+		#endregion
+
+
+	}
+}

+ 35 - 0
src/Tutorial/Tutorials/Chapters/Chapter5.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter05
+	{
+		static StringBuilder GetString()
+		{
+			return new StringBuilder("myString!");
+		}
+
+		[Tutorial]
+		public static void StringBuilderCustomConverter()
+		{
+			Script script = new Script();
+
+			script.Globals["getstr"] = (Func<StringBuilder>)GetString;
+
+			DynValue fn = script.LoadString("print(getstr())");
+
+			fn.Function.Call();
+
+			Script.GlobalOptions.CustomConverters.SetClrToScriptCustomConversion<StringBuilder>(
+				v => DynValue.NewString(v.ToString().ToUpper()));
+
+			fn.Function.Call();
+		}
+	}
+}

+ 382 - 0
src/Tutorial/Tutorials/Chapters/Chapter6.cs

@@ -0,0 +1,382 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter06
+	{
+		#region UserData classes
+
+		[MoonSharpUserData]
+		class MyClass
+		{
+			public double calcHypotenuse(double a, double b)
+			{
+				return Math.Sqrt(a * a + b * b);
+			}
+
+			public string ManipulateString(string input, ref string tobeconcat, out string lowercase)
+			{
+				tobeconcat = input + tobeconcat;
+				lowercase = input.ToLower();
+				return input.ToUpper();
+			}
+		}
+
+		[MoonSharpUserData]
+		class MyClassStatic
+		{
+			public static double calcHypotenuse(double a, double b)
+			{
+				return Math.Sqrt(a * a + b * b);
+			}
+		}
+
+		class IndexerTestClass
+		{
+			Dictionary<int, int> mymap = new Dictionary<int, int>();
+
+			public int this[int idx]
+			{
+				get { return mymap[idx]; }
+				set { mymap[idx] = value; }
+			}
+
+			public int this[int idx1, int idx2, int idx3]
+			{
+				get { int idx = (idx1 + idx2) * idx3; return mymap[idx]; }
+				set { int idx = (idx1 + idx2) * idx3; mymap[idx] = value; }
+			}
+		}
+
+		class ArithmOperatorsTestClass : IComparable, System.Collections.IEnumerable
+		{
+			public int Value { get; set; }
+
+			public ArithmOperatorsTestClass()
+			{
+			}
+
+			public ArithmOperatorsTestClass(int value)
+			{
+				Value = value;
+			}
+
+			public int Length { get { return 117; } }
+
+			[MoonSharpUserDataMetamethod("__concat")]
+			public static int Concat(ArithmOperatorsTestClass o, int v)
+			{
+				return o.Value + v;
+			}
+
+			[MoonSharpUserDataMetamethod("__concat")]
+			public static int Concat(int v, ArithmOperatorsTestClass o)
+			{
+				return o.Value + v;
+			}
+
+			[MoonSharpUserDataMetamethod("__concat")]
+			public static int Concat(ArithmOperatorsTestClass o1, ArithmOperatorsTestClass o2)
+			{
+				return o1.Value + o2.Value;
+			}
+
+			public static int operator +(ArithmOperatorsTestClass o, int v)
+			{
+				return o.Value + v;
+			}
+
+			public static int operator +(int v, ArithmOperatorsTestClass o)
+			{
+				return o.Value + v;
+			}
+
+			public static int operator +(ArithmOperatorsTestClass o1, ArithmOperatorsTestClass o2)
+			{
+				return o1.Value + o2.Value;
+			}
+
+			public override bool Equals(object obj)
+			{
+				if (obj is double)
+					return ((double)obj) == Value;
+
+				ArithmOperatorsTestClass other = obj as ArithmOperatorsTestClass;
+				if (other == null) return false;
+				return Value == other.Value;
+			}
+
+			public override int GetHashCode()
+			{
+				return Value.GetHashCode();
+			}
+
+			public int CompareTo(object obj)
+			{
+				if (obj is double)
+					return Value.CompareTo((int)(double)obj);
+
+				ArithmOperatorsTestClass other = obj as ArithmOperatorsTestClass;
+				if (other == null) return 1;
+				return Value.CompareTo(other.Value);
+			}
+
+			public System.Collections.IEnumerator GetEnumerator()
+			{
+				return (new List<int>() { 1, 2, 3 }).GetEnumerator();
+			}
+
+			[MoonSharpUserDataMetamethod("__call")]
+			public int DefaultMethod()
+			{
+				return -Value;
+			}
+
+			[MoonSharpUserDataMetamethod("__pairs")]
+			[MoonSharpUserDataMetamethod("__ipairs")]
+			public System.Collections.IEnumerator Pairs()
+			{
+				return (new List<DynValue>() { 
+					DynValue.NewTuple(DynValue.NewString("a"), DynValue.NewString("A")),
+					DynValue.NewTuple(DynValue.NewString("b"), DynValue.NewString("B")),
+					DynValue.NewTuple(DynValue.NewString("c"), DynValue.NewString("C")) }).GetEnumerator();
+			}
+
+
+		}
+
+
+		#endregion
+
+
+		[Tutorial]
+		public static double CallMyClass1()
+		{
+			string scriptCode = @"    
+				return obj.calcHypotenuse(3, 4);
+			";
+
+			// Automatically register all MoonSharpUserData types
+			UserData.RegisterAssembly();
+
+			Script script = new Script();
+
+			// Pass an instance of MyClass to the script in a global
+			script.Globals["obj"] = new MyClass();
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+		[Tutorial]
+		static double CallMyClass2()
+		{
+			string scriptCode = @"    
+				return obj.calcHypotenuse(3, 4);
+			";
+
+			// Register just MyClass, explicitely.
+			UserData.RegisterType<MyClass>();
+
+			Script script = new Script();
+
+			// create a userdata, again, explicitely.
+			DynValue obj = UserData.Create(new MyClass());
+
+			script.Globals.Set("obj", obj);
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+
+		[Tutorial]
+		static double MyClassStaticThroughInstance()
+		{
+			string scriptCode = @"    
+				return obj.calcHypotenuse(3, 4);
+			";
+
+			// Automatically register all MoonSharpUserData types
+			UserData.RegisterAssembly();
+
+			Script script = new Script();
+
+			script.Globals["obj"] = new MyClassStatic();
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+		[Tutorial]
+		static double MyClassStaticThroughPlaceholder()
+		{
+			string scriptCode = @"    
+				return obj.calcHypotenuse(3, 4);
+			";
+
+			// Automatically register all MoonSharpUserData types
+			UserData.RegisterAssembly();
+
+			Script script = new Script();
+
+			script.Globals["obj"] = typeof(MyClassStatic);
+
+			DynValue res = script.DoString(scriptCode);
+
+			return res.Number;
+		}
+
+
+		[Tutorial]
+		static string ByRefParams()
+		{
+			string scriptCode = @"    
+				x, y, z = myobj:manipulateString('CiAo', 'hello');
+				return x, y, z
+			";
+
+			// Automatically register all MoonSharpUserData types
+			UserData.RegisterAssembly();
+
+			Script script = new Script();
+
+			script.Globals["myobj"] = new MyClass();
+
+			DynValue res = script.DoString(scriptCode);
+
+			return string.Join(", ", res.Tuple.Select(v => v.ToPrintString()));
+		}
+
+		[Tutorial]
+		static void IndexerTests()
+		{
+			string scriptCode = @"    
+				-- sets the value of an indexer
+				o[5] = 19; 		
+				print(o[5]);
+
+				-- use the value of an indexer
+				x = 5 + o[5]; 	
+				print(x);
+
+				-- sets the value of an indexer using multiple indices (not standard Lua!)
+				o[1,2,3] = 19; 		
+				print(o[1,2,3]);
+
+				-- use the value of an indexer using multiple indices (not standard Lua!)
+				x = 5 + o[1,2,3]; 	
+				print(x);
+			";
+
+			UserData.RegisterType<IndexerTestClass>();
+
+			Script script = new Script();
+
+			script.Globals["o"] = new IndexerTestClass();
+
+			script.DoString(scriptCode);
+		}
+
+		[Tutorial]
+		static void OperatorsAndMetaMethods_WithAttributes()
+		{
+			string scriptCode = @"    
+				print( o .. 1 );
+				print( 1 .. o );
+				print( o .. o );
+			";
+
+			UserData.RegisterType<ArithmOperatorsTestClass>();
+			Script script = new Script();
+			script.Globals["o"] = new ArithmOperatorsTestClass(5);
+
+			script.DoString(scriptCode);
+		}
+
+		[Tutorial]
+		static void OperatorsAndMetaMethods_WithOperatorsOverloads()
+		{
+			string scriptCode = @"    
+				print( o + 1 );
+				print( 1 + o );
+				print( o + o );
+			";
+
+			UserData.RegisterType<ArithmOperatorsTestClass>();
+			Script script = new Script();
+			script.Globals["o"] = new ArithmOperatorsTestClass(5);
+
+			script.DoString(scriptCode);
+		}
+
+		[Tutorial]
+		static void OperatorsAndMetaMethods_Comparisons()
+		{
+			string scriptCode = @"    
+				print( 'o == 1 ?', o == 1 );
+				print( '1 == o ?', 1 == o );
+				print( 'o == 5 ?', o == 5 );
+				print( 'o != 1 ?', o != 1 );
+				print( 'o <  1 ?', o <  1 );
+				print( 'o <= 1 ?', o <= 1 );
+				print( 'o <  6 ?', o <  6 );
+				print( 'o <= 6 ?', o <= 6 );
+				print( 'o >  1 ?', o >  1 );
+				print( 'o >= 1 ?', o >= 1 );
+				print( 'o >  6 ?', o >  6 );
+				print( 'o >= 6 ?', o >= 6 );
+			";
+
+			UserData.RegisterType<ArithmOperatorsTestClass>();
+			Script script = new Script();
+			script.Globals["o"] = new ArithmOperatorsTestClass(5);
+
+			script.DoString(scriptCode);
+		}
+
+		[Tutorial]
+		static void OperatorsAndMetaMethods_Length()
+		{
+			string scriptCode = @"    
+				print( '#o + o ?', #o + o);
+			";
+
+			UserData.RegisterType<ArithmOperatorsTestClass>();
+			Script script = new Script();
+			script.Globals["o"] = new ArithmOperatorsTestClass(5);
+
+			script.DoString(scriptCode);
+		}
+
+		[Tutorial]
+		static void OperatorsAndMetaMethods_ForEach()
+		{
+			string scriptCode = @"    
+				local sum = 0
+				for i in o do
+					sum = sum + i
+				end
+
+				print (sum);
+			";
+
+			UserData.RegisterType<ArithmOperatorsTestClass>();
+			Script script = new Script();
+			script.Globals["o"] = new ArithmOperatorsTestClass(5);
+
+			script.DoString(scriptCode);
+		}
+
+
+	}
+}

+ 50 - 0
src/Tutorial/Tutorials/Chapters/Chapter7.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter07
+	{
+		[Tutorial]
+		static void ErrorHandling()
+		{
+			try
+			{
+				string scriptCode = @"    
+					return obj.calcHypotenuse(3, 4);
+				";
+
+				Script script = new Script();
+				DynValue res = script.DoString(scriptCode);
+			}
+			catch (ScriptRuntimeException ex)
+			{
+				Console.WriteLine("Doh! An error occured! {0}", ex.DecoratedMessage);
+			}
+		}
+
+		static void DoError()
+		{
+			throw new ScriptRuntimeException("This is an exceptional message, no pun intended.");
+		}
+
+		[Tutorial]
+		static string ErrorGen()
+		{
+			string scriptCode = @"    
+				local _, msg = pcall(DoError);
+				return msg;
+			";
+
+			Script script = new Script();
+			script.Globals["DoError"] = (Action)DoError;
+			DynValue res = script.DoString(scriptCode);
+			return res.String;
+		}
+	}
+}

+ 55 - 0
src/Tutorial/Tutorials/Chapters/Chapter8.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+using MoonSharp.Interpreter.Loaders;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter08
+	{
+		[Tutorial]
+		static void EmbeddedResourceScriptLoader()
+		{
+			Script script = new Script();
+			script.Options.ScriptLoader = new EmbeddedResourcesScriptLoader(Assembly.GetExecutingAssembly());
+			script.DoFile("Scripts/Test.lua");
+		}
+
+		private class MyCustomScriptLoader : ScriptLoaderBase
+		{
+			public override object LoadFile(string file, Table globalContext)
+			{
+				return string.Format("print ([[A request to load '{0}' has been made]])", file);
+			}
+
+			public override bool ScriptFileExists(string name)
+			{
+				return true;
+			}
+		}
+
+		[Tutorial]
+		static void CustomScriptLoader()
+		{
+			Script script = new Script();
+
+			script.Options.ScriptLoader = new MyCustomScriptLoader() 
+			{ 
+				ModulePaths = new string[] { "?_module.lua" } 
+			};
+
+			script.DoString(@"
+				require 'somemodule'
+				f = loadfile 'someothermodule.lua'
+				f()
+			");
+		}
+
+
+	}
+}

+ 38 - 0
src/Tutorial/Tutorials/Chapters/Chapter9.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using MoonSharp.Interpreter;
+using MoonSharp.Interpreter.Loaders;
+using MoonSharp.Interpreter.Platforms;
+
+namespace Tutorials.Chapters
+{
+	[Tutorial]
+	static class Chapter09
+	{
+		[Tutorial]
+		static void ChangePlatform()
+		{
+			// This prints "function"
+			Console.WriteLine(Script.RunString("return type(os.exit);").ToPrintString());
+
+			// Save the old platform
+			var oldplatform = Script.GlobalOptions.Platform;
+
+			// Changing platform after a script has been created is not recommended.. do not do it.
+			// We are doing it for the purpose of the walkthrough..
+			Script.GlobalOptions.Platform = new LimitedPlatformAccessor();
+
+			// This time, this prints "nil"
+			Console.WriteLine(Script.RunString("return type(os.exit);").ToPrintString());
+
+			// Restore the old platform
+			Script.GlobalOptions.Platform = oldplatform;
+		}
+
+
+	}
+}

+ 76 - 0
src/Tutorial/Tutorials/Program.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -10,6 +11,81 @@ namespace Tutorials
 	{
 		static void Main(string[] args)
 		{
+			while (true)
+			{
+				List<Tuple<string, Type>> tutorialTypes = new List<Tuple<string, Type>>();
+
+				foreach (Type t in Assembly.GetExecutingAssembly()
+					.GetTypes()
+					.Where(t => t.GetCustomAttributes(typeof(TutorialAttribute)).Any())
+					.OrderBy(t => t.Name))
+				{
+					tutorialTypes.Add(new Tuple<string, Type>(t.Name, t));
+				}
+
+				Type chosenType = DoMenu("Choose chapter", tutorialTypes);
+
+				if (chosenType == null)
+					return;
+
+				List<Tuple<string, MethodInfo>> tutorialMethods = new List<Tuple<string, MethodInfo>>();
+
+				foreach (MethodInfo mi in chosenType.GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public).Where(mi => mi.GetCustomAttributes(typeof(TutorialAttribute)).Any()))
+				{
+					tutorialMethods.Add(new Tuple<string, MethodInfo>(mi.Name, mi));
+				}
+
+				MethodInfo chosenMethod = DoMenu(string.Format("{0} - Choose tutorial", chosenType), tutorialMethods);
+
+				if (chosenMethod == null)
+					continue;
+
+				Console.Clear();
+				Banner(string.Format("{0} . {1}", chosenType.Name, chosenMethod.Name));
+
+				Object o = chosenMethod.Invoke(null, new object[0]);
+
+				if (chosenMethod.ReturnType != typeof(void))
+					Console.WriteLine(o);
+
+				Console.WriteLine();
+				Console.WriteLine("press any key...");
+
+				Console.ReadKey();
+			}
+		}
+
+		private static T DoMenu<T>(string title, List<Tuple<string, T>> choices)
+		{
+			while (true)
+			{
+				Console.Clear();
+				Banner(title);
+
+				for (int i = 0; i < choices.Count; i++)
+				{
+					Console.WriteLine("{0,2} - {1}", i + 1, choices[i].Item1);
+				}
+
+				Console.WriteLine("99 - CANCEL / EXIT");
+
+				Console.Write(" >");
+				string choice = Console.ReadLine();
+				int chosen;
+				if (int.TryParse(choice, out chosen))
+				{
+					if (chosen == 99) return default(T);
+					if (chosen >= 1 && chosen <= choices.Count) return choices[chosen-1].Item2;
+					Console.WriteLine("Invalid choice");
+				}
+			}
+		}
+
+		private static void Banner(string title)
+		{
+			Console.WriteLine("=====================================================================");
+			Console.WriteLine("  " + title.ToUpper());
+			Console.WriteLine("=====================================================================");
 		}
 	}
 }

+ 6 - 0
src/Tutorial/Tutorials/Scripts/Test.lua

@@ -0,0 +1,6 @@
+-- Sample script embedded as a resource.
+
+for i = 1, 5 do
+	print "Hello world!"
+end
+

+ 14 - 0
src/Tutorial/Tutorials/TutorialAttribute.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tutorials
+{
+	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
+	public sealed class TutorialAttribute : Attribute
+	{
+		
+	}
+}

+ 28 - 7
src/Tutorial/Tutorials/Tutorials.csproj

@@ -32,12 +32,6 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="MoonSharp.Interpreter">
-      <HintPath>..\..\packages\MoonSharp.0.9.2.0\lib\net40-client\MoonSharp.Interpreter.dll</HintPath>
-    </Reference>
-    <Reference Include="MoonSharp.RemoteDebugger">
-      <HintPath>..\..\packages\MoonSharp.Debugger.0.9.2.0\lib\net40-client\MoonSharp.RemoteDebugger.dll</HintPath>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
@@ -47,16 +41,43 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Chapters\Chapter12.cs" />
+    <Compile Include="Chapters\Chapter11.cs" />
+    <Compile Include="Chapters\Chapter7.cs" />
+    <Compile Include="Chapters\Chapter8.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Chapters\Chapter10.cs" />
+    <Compile Include="Chapters\Chapter9.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Chapters\Chapter6.cs" />
+    <Compile Include="Chapters\Chapter5.cs" />
+    <Compile Include="Chapters\Chapter1.cs" />
+    <Compile Include="Chapters\Chapter2.cs" />
+    <Compile Include="Chapters\Chapter3.cs" />
+    <Compile Include="Chapters\Chapter4.cs" />
+    <Compile Include="TutorialAttribute.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
-    <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
     <None Include="readme.md" />
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Scripts\Test.lua" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\MoonSharp.Interpreter\_Projects\MoonSharp.Interpreter.net40-client\MoonSharp.Interpreter.net40-client.csproj">
+      <Project>{88d2880c-a863-4b16-abef-f67bd1e98bd1}</Project>
+      <Name>MoonSharp.Interpreter.net40-client</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\MoonSharp.RemoteDebugger\_Projects\MoonSharp.RemoteDebugger.net40-client\MoonSharp.RemoteDebugger.net40-client.csproj">
+      <Project>{f9d383b9-2639-4738-a897-4d9f8801b8c9}</Project>
+      <Name>MoonSharp.RemoteDebugger.net40-client</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 0 - 5
src/Tutorial/Tutorials/packages.config

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MoonSharp" version="0.9.2.0" targetFramework="net45" />
-  <package id="MoonSharp.Debugger" version="0.9.2.0" targetFramework="net45" />
-</packages>

BIN
src/Unity/UnityTestBed/Assets/Plugins/MoonSharp.Interpreter.Tests.dll


BIN
src/Unity/UnityTestBed/Assets/Plugins/MoonSharp.Interpreter.dll


+ 28 - 3
src/Unity/UnityTestBed/Assets/Plugins/MoonSharp.Interpreter.xml

@@ -3839,8 +3839,8 @@
         <member name="M:MoonSharp.Interpreter.Loaders.ScriptLoaderBase.ResolveModuleName(System.String,MoonSharp.Interpreter.Table)">
             <summary>
             Resolves the name of a module to a filename (which will later be passed to OpenScriptFile).
-            The resolution happens first on paths included in the LUA_PATH global variable, and -
-            if the variable does not exist - by consulting the
+            The resolution happens first on paths included in the LUA_PATH global variable (if and only if
+            the IgnoreLuaPathGlobal is false), and - if the variable does not exist - by consulting the
             ScriptOptions.ModulesPaths array. Override to provide a different behaviour.
             </summary>
             <param name="modname">The modname.</param>
@@ -3871,6 +3871,12 @@
             environment variables etc.). 
             </summary>
         </member>
+        <member name="P:MoonSharp.Interpreter.Loaders.ScriptLoaderBase.IgnoreLuaPathGlobal">
+            <summary>
+            Gets or sets a value indicating whether the LUA_PATH global is checked or not to get the path where modules are contained.
+            If true, the LUA_PATH global is NOT checked.
+            </summary>
+        </member>
         <member name="M:MoonSharp.Interpreter.Loaders.EmbeddedResourcesScriptLoader.#ctor(System.Reflection.Assembly)">
             <summary>
             Initializes a new instance of the <see cref="T:MoonSharp.Interpreter.Loaders.EmbeddedResourcesScriptLoader"/> class.
@@ -4010,7 +4016,15 @@
         <member name="T:MoonSharp.Interpreter.REPL.ReplInterpreterScriptLoader">
             <summary>
             A script loader loading scripts directly from the file system (does not go through platform object)
-            AND starts with module paths taken from environment variables (again, not going through the platform object)
+            AND starts with module paths taken from environment variables (again, not going through the platform object).
+            
+            The paths are preconstructed using :
+            	* The MOONSHARP_PATH variable if it exists
+            	* The LUA_PATH otherwise
+            	* The '?;?.lua" path otherwise again
+            	
+            Also, everytime a module is require(d), the "LUA_PATH" global variable is checked. If it exists, those paths
+            will be used to load the module instead of the global ones.
             </summary>
         </member>
         <member name="M:MoonSharp.Interpreter.REPL.ReplInterpreterScriptLoader.#ctor">
@@ -4018,6 +4032,17 @@
             Initializes a new instance of the <see cref="T:MoonSharp.Interpreter.REPL.ReplInterpreterScriptLoader"/> class.
             </summary>
         </member>
+        <member name="M:MoonSharp.Interpreter.REPL.ReplInterpreterScriptLoader.ResolveModuleName(System.String,MoonSharp.Interpreter.Table)">
+            <summary>
+            Resolves the name of a module to a filename (which will later be passed to OpenScriptFile).
+            The resolution happens first on paths included in the LUA_PATH global variable, and -
+            if the variable does not exist - by consulting the
+            ScriptOptions.ModulesPaths array. Override to provide a different behaviour.
+            </summary>
+            <param name="modname">The modname.</param>
+            <param name="globalContext">The global context.</param>
+            <returns></returns>
+        </member>
         <member name="T:MoonSharp.Interpreter.Loaders.UnityAssetsScriptLoader">
             <summary>
             A script loader which can load scripts from assets in Unity3D.

BIN
src/Unity/UnityTestBed/Assets/Plugins/WSA/MoonSharp.Interpreter.Tests.dll


BIN
src/Unity/UnityTestBed/Assets/Plugins/WSA/MoonSharp.Interpreter.dll


+ 1 - 0
src/Unity/UnityTestBed/Assets/TestRunner.cs

@@ -14,6 +14,7 @@ public class TestRunner : MonoBehaviour
 	// Use this for initialization
 	void Start()
 	{
+		Debug.Log("STARTED!");
 		StartCoroutine(DoTests());
 	}
 

BIN
src/Unity/UnityTestBed/Assets/Tests.unity


+ 4 - 6
src/Unity/UnityTestBed/UnityVS.UnityTestBed.CSharp.csproj

@@ -16,7 +16,7 @@
     <TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile>
     <CompilerResponseFile></CompilerResponseFile>
     <UnityProjectType>Game:1</UnityProjectType>
-    <UnityBuildTarget>WSAPlayer:21</UnityBuildTarget>
+    <UnityBuildTarget>StandaloneWindows:5</UnityBuildTarget>
     <UnityVersion>5.0.0f4</UnityVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -25,7 +25,7 @@
     <OutputPath>Temp\UnityVS_bin\Debug\</OutputPath>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
-    <DefineConstants>DEBUG;TRACE;UNITY_5_0_0;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;RENDER_SOFTWARE_CURSOR;UNITY_METRO;UNITY_METRO_API;UNITY_WINRT;ENABLE_WINRT_PINVOKE;ENABLE_TEXTUREID_MAP;ENABLE_LAZY_METHOD_CACHING;ENABLE_MOVIES;UNITY_WSA;ENABLE_PROFILER;UNITY_METRO_8_0;UNITY_WSA_8_0;UNITY_WINRT_8_0;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN</DefineConstants>
+    <DefineConstants>DEBUG;TRACE;UNITY_5_0_0;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN</DefineConstants>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -33,7 +33,7 @@
     <OutputPath>Temp\UnityVS_bin\Release\</OutputPath>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
-    <DefineConstants>TRACE;UNITY_5_0_0;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;RENDER_SOFTWARE_CURSOR;UNITY_METRO;UNITY_METRO_API;UNITY_WINRT;ENABLE_WINRT_PINVOKE;ENABLE_TEXTUREID_MAP;ENABLE_LAZY_METHOD_CACHING;ENABLE_MOVIES;UNITY_WSA;ENABLE_PROFILER;UNITY_METRO_8_0;UNITY_WSA_8_0;UNITY_WINRT_8_0;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN</DefineConstants>
+    <DefineConstants>TRACE;UNITY_5_0_0;UNITY_5_0;UNITY_5;ENABLE_LICENSE_RENAME;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_NEW_HIERARCHY;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_NONPRO;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PROFILER;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN</DefineConstants>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="mscorlib" />
@@ -52,9 +52,6 @@
     <Reference Include="UnityEngine.UI">
       <HintPath>Library\UnityAssemblies\UnityEngine.UI.dll</HintPath>
     </Reference>
-    <Reference Include="UnityEngine.UI">
-      <HintPath>Library\UnityAssemblies\UnityEngine.UI.dll</HintPath>
-    </Reference>
     <Reference Include="MoonSharp.Interpreter">
       <HintPath>Assets\Plugins\MoonSharp.Interpreter.dll</HintPath>
     </Reference>
@@ -71,6 +68,7 @@
   <ItemGroup>
     <None Include="Assets\Plugins\MoonSharp.Interpreter.xml" />
     <None Include="Assets\Plugins\nunit.framework.xml" />
+    <None Include="Assets\Plugins\WSA\MoonSharp.Interpreter.xml" />
     <None Include="Assets\Resources\MoonSharp\Scripts\000-sanity.t.txt" />
     <None Include="Assets\Resources\MoonSharp\Scripts\001-if.t.txt" />
     <None Include="Assets\Resources\MoonSharp\Scripts\002-table.t.txt" />

+ 2 - 1
src/Xamarin/XamarinTestBed_Android/XamarinTestBed_Android.userprefs

@@ -1,9 +1,10 @@
 <Properties StartupItem="XamarinTestBed_Android\XamarinTestBed_Android.csproj">
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" ActiveRuntime="MS.NET" PreferredExecutionTarget="Android.3inch" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="XamarinTestBed_Android\MainActivity.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="XamarinTestBed_Android\Scripts\Test.lua">
     <Files>
       <File FileName="XamarinTestBed_Android\MainActivity.cs" Line="27" Column="27" />
       <File FileName="XamarinTestBed_Android\XamarinLoader.cs" Line="1" Column="1" />
+      <File FileName="XamarinTestBed_Android\Scripts\Test.lua" Line="1" Column="1" />
     </Files>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.Breakpoints>

+ 1 - 0
src/Xamarin/XamarinTestBed_Android/XamarinTestBed_Android/Scripts/Test.lua

@@ -0,0 +1 @@
+

+ 7 - 1
src/Xamarin/XamarinTestBed_Android/XamarinTestBed_Android/XamarinTestBed_Android.csproj

@@ -14,7 +14,7 @@
     <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
     <AndroidResgenClass>Resource</AndroidResgenClass>
     <AssemblyName>XamarinTestBed_Android</AssemblyName>
-    <TargetFrameworkVersion>v4.4</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
     <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -197,4 +197,10 @@
     </AndroidAsset>
     <AndroidAsset Include="Assets\AboutAssets.txt" />
   </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Scripts\" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Scripts\Test.lua" />
+  </ItemGroup>
 </Project>

+ 0 - 1
src/packages/repositories.config

@@ -7,5 +7,4 @@
   <repository path="..\MoonSharp.Interpreter.Tests\packages.config" />
   <repository path="..\TestRunners\ConsoleTestRunner\packages.config" />
   <repository path="..\TestRunners\Windows8TestRunner\packages.config" />
-  <repository path="..\Tutorial\Tutorials\packages.config" />
 </repositories>