Browse Source

Unity package & support

Xanathar 9 years ago
parent
commit
e9e9fbbf27
100 changed files with 14529 additions and 3316 deletions
  1. 1 0
      src/DevTools/VsCodeDebugger_Testbed/Program.cs
  2. 5 3
      src/MoonSharp.Interpreter.Tests/EmbeddableNUnitWrapper.cs
  3. 1 1
      src/MoonSharp.Interpreter.Tests/EndToEnd/StructAssignmentTechnique.cs
  4. 2 1
      src/MoonSharp.Interpreter.Tests/EndToEnd/UserDataOverloadsTests.cs
  5. 2 4
      src/MoonSharp.Interpreter.Tests/EndToEnd/VtUserDataOverloadsTests.cs
  6. 1 1
      src/MoonSharp.Interpreter.Tests/_Hardwired.cs
  7. 1 1
      src/MoonSharp.Interpreter/IO/BinDumpBinaryReader.cs
  8. 1 1
      src/MoonSharp.Interpreter/IO/BinDumpBinaryWriter.cs
  9. 1 1
      src/MoonSharp.Interpreter/IO/UndisposableStream.cs
  10. 28 1
      src/MoonSharp.Interpreter/Loaders/UnityAssetsScriptLoader.cs
  11. 15 3
      src/MoonSharp.Interpreter/Platforms/PlatformAccessorBase.cs
  12. 19 2
      src/MoonSharp.Interpreter/Platforms/PlatformAutoDetector.cs
  13. 45 4
      src/Unity/MoonSharp/Assembly-CSharp-firstpass.csproj
  14. 87 2
      src/Unity/MoonSharp/Assembly-CSharp.csproj
  15. 0 3132
      src/Unity/MoonSharp/Assets/NewScript.cs
  16. 0 60
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerKit/BlockingQueue.cs
  17. 45 36
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerLogic/AsyncDebugger.cs
  18. 200 0
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerLogic/EmptyDebugSession.cs
  19. 2 1
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerLogic/IAsyncDebuggerClient.cs
  20. 49 4
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerLogic/MoonSharpDebugSession.cs
  21. 241 24
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/MoonSharpVsCodeDebugServer.cs
  22. 23 2
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/SDK/DebugSession.cs
  23. 23 2
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/SDK/Protocol.cs
  24. 24 3
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/SDK/Utilities.cs
  25. 9 6
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/AsyncExtensions.cs
  26. 11 0
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Debugging/SourceRef.cs
  27. 2 0
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Execution/VM/Processor/Processor_Debugger.cs
  28. 1 1
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/IO/BinDumpBinaryReader.cs
  29. 1 1
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/IO/BinDumpBinaryWriter.cs
  30. 1 1
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/IO/UndisposableStream.cs
  31. 4 0
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/DescriptorHelpers.cs
  32. 12 9
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/StandardUserDataDescriptor.cs
  33. 28 1
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/UnityAssetsScriptLoader.cs
  34. 15 3
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/PlatformAccessorBase.cs
  35. 19 2
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/PlatformAutoDetector.cs
  36. 1 1
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Script.cs
  37. 8 2
      src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Tree/Statements/FunctionCallStatement.cs
  38. 54 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/000-sanity.t.txt
  39. 87 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/001-if.t.txt
  40. 67 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/002-table.t.txt
  41. 80 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/011-while.t.txt
  42. 78 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/012-repeat.t.txt
  43. 136 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/014-fornum.t.txt
  44. 99 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/015-forlist.t.txt
  45. 120 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/101-boolean.t.txt
  46. 199 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/102-function.t.txt
  47. 120 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/103-nil.t.txt
  48. 190 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/104-number.t.txt
  49. 183 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/105-string.t.txt
  50. 125 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/106-table.t.txt
  51. 128 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/107-thread.t.txt
  52. 125 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/108-userdata.t.txt
  53. 104 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/200-examples.t.txt
  54. 125 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/201-assign.t.txt
  55. 111 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/202-expr.t.txt
  56. 122 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/203-lexico.t.txt
  57. 106 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/204-grammar.t.txt
  58. 83 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/211-scope.t.txt
  59. 268 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/212-function.t.txt
  60. 98 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/213-closure.t.txt
  61. 193 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/214-coroutine.t.txt
  62. 112 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/221-table.t.txt
  63. 85 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/222-constructor.t.txt
  64. 196 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/223-iterator.t.txt
  65. 533 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/231-metatable.t.txt
  66. 307 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/232-object.t.txt
  67. 391 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/301-basic.t.txt
  68. 318 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/304-string.t.txt
  69. 253 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/305-table.t.txt
  70. 153 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/306-math.t.txt
  71. 94 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/307-bit.t.txt
  72. 258 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/308-io.t.txt
  73. 198 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/309-os.t.txt
  74. 183 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/310-debug.t.txt
  75. 346 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/314-regex.t.txt
  76. 124 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/320-stdin.t.txt
  77. 392 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/Modules/Test/Builder.lua.txt
  78. 383 0
      src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/Modules/Test/More.lua.txt
  79. 229 0
      src/Unity/MoonSharp/Assets/TestRunnerBehaviour.cs
  80. 97 0
      src/Unity/MoonSharp/Assets/Tests/EmbeddableNUnitWrapper.cs
  81. 335 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/BinaryDumpTests.cs
  82. 326 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/ClosureTests.cs
  83. 355 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/CollectionsBaseGenRegisteredTests.cs
  84. 300 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/CollectionsBaseInterfGenRegisteredTests.cs
  85. 328 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/CollectionsRegisteredTests.cs
  86. 105 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/ConfigPropertyAssignerTests.cs
  87. 293 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/CoroutineTests.cs
  88. 105 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/DynamicTests.cs
  89. 131 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/ErrorHandlingTests.cs
  90. 220 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/GotoTests.cs
  91. 136 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/JsonSerializationTests.cs
  92. 171 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/LuaTestSuiteExtract.cs
  93. 301 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/MetatableTests.cs
  94. 47 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/ProxyObjectsTests.cs
  95. 1536 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/SimpleTests.cs
  96. 262 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/StringLibTests.cs
  97. 114 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/StructAssignmentTechnique.cs
  98. 567 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/TableTests.cs
  99. 127 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/TailCallTests.cs
  100. 189 0
      src/Unity/MoonSharp/Assets/Tests/EndToEnd/UserDataEnumsTest.cs

+ 1 - 0
src/DevTools/VsCodeDebugger_Testbed/Program.cs

@@ -16,6 +16,7 @@ namespace VsCodeDebugger_Testbed
 		public static void Main(string[] argv)
 		{
 			MoonSharpVsCodeDebugServer server = new MoonSharpVsCodeDebugServer();
+			server.Logger = s => Console.WriteLine(s);
 			server.Start();
 
 			Script script1 = new Script();

+ 5 - 3
src/MoonSharp.Interpreter.Tests/EmbeddableNUnitWrapper.cs

@@ -1,4 +1,4 @@
-#if EMBEDTEST
+#if EMBEDTEST || UNITY_5
 
 using System;
 using System.Collections.Generic;
@@ -28,14 +28,16 @@ namespace NUnit.Framework
 
 	public static class Assert
 	{
-		public static void AreEqual(int expected, double other, string message = null)
+		public static void AreEqualNum(int expected, double other, string message = null)
 		{
 			Assert.IsTrue((double)expected == other, message ?? string.Format("{0} was expected, {1} was returned", expected, other));
 		}
 
 		public static void AreEqual(object expected, object other, string message = null)
 		{
-			if (expected != null)
+			if (expected is int && other is double) 
+				AreEqualNum((int)expected, (double)other, message);
+			else if (expected != null)
 				Assert.IsTrue(expected.Equals(other), message ?? string.Format("{0} was expected, {1} was returned", expected, other));
 			else
 				Assert.IsTrue(other == null, message ?? string.Format("null was expected, {0} was returned", other));

+ 1 - 1
src/MoonSharp.Interpreter.Tests/EndToEnd/StructAssignmentTechnique.cs

@@ -97,7 +97,7 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 
 			S.DoString("transform.position.X = 15;");
 
-			Assert.AreEqual(3, T.position.X);
+			Assert.AreEqual(3, (int)T.position.X);
 			UserData.UnregisterType<Transform>();
 			UserData.UnregisterType<Vector3>();
 		}

+ 2 - 1
src/MoonSharp.Interpreter.Tests/EndToEnd/UserDataOverloadsTests.cs

@@ -18,7 +18,8 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 
 		public static string Method3(this UserDataOverloadsTests.OverloadsTestClass obj)
 		{
-			return "X" + obj.Method1(0.17);
+			obj.Method1();
+			return "X3";
 		}
 	}
 	public static class OverloadsExtMethods2

+ 2 - 4
src/MoonSharp.Interpreter.Tests/EndToEnd/VtUserDataOverloadsTests.cs

@@ -15,7 +15,8 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 
 		public static string Method3(this VtUserDataOverloadsTests.OverloadsTestClass obj)
 		{
-			return "X" + obj.Method1(0.17);
+			obj.Method1();
+			return "X3";
 		}
 	}
 
@@ -30,9 +31,6 @@ namespace MoonSharp.Interpreter.Tests.EndToEnd
 				var otc = new OverloadsTestClass();
 				otc.Method1();
 				OverloadsTestClass.Method1(false);
-				otc.Method1(0);
-				otc.Method1(0.0);
-				otc.Method1(0.0, "");
 			}
 
 			public string MethodV(string fmt, params object[] args)

+ 1 - 1
src/MoonSharp.Interpreter.Tests/_Hardwired.cs

@@ -1,4 +1,4 @@
-#if !PCL
+#if !PCL && !UNITY_5
 
 //------------------------------------------------------------------------------
 // <auto-generated>

+ 1 - 1
src/MoonSharp.Interpreter/IO/BinDumpBinaryReader.cs

@@ -7,7 +7,7 @@ namespace MoonSharp.Interpreter.IO
 	/// <summary>
 	/// "Optimized" BinaryReader which shares strings and use a dumb compression for integers
 	/// </summary>
-	internal class BinDumpBinaryReader : BinaryReader
+	public class BinDumpBinaryReader : BinaryReader
 	{
 		public BinDumpBinaryReader(Stream s) : base(s) { }
 		public BinDumpBinaryReader(Stream s, Encoding e) : base(s, e) { }

+ 1 - 1
src/MoonSharp.Interpreter/IO/BinDumpBinaryWriter.cs

@@ -7,7 +7,7 @@ namespace MoonSharp.Interpreter.IO
 	/// <summary>
 	/// "Optimized" BinaryWriter which shares strings and use a dumb compression for integers
 	/// </summary>
-	internal class BinDumpBinaryWriter : BinaryWriter
+	public class BinDumpBinaryWriter : BinaryWriter
 	{
 		Dictionary<string, int> m_StringMap = new Dictionary<string, int>();
 

+ 1 - 1
src/MoonSharp.Interpreter/IO/UndisposableStream.cs

@@ -8,7 +8,7 @@ namespace MoonSharp.Interpreter.IO
 	/// Used to work around the pesky wrappers .NET has over Stream (BinaryReader, StreamWriter, etc.) which think they
 	/// own the Stream and close them when they shouldn't. Damn.
 	/// </summary>
-	internal class UndisposableStream : Stream
+	public class UndisposableStream : Stream
 	{
 		Stream m_Stream;
 

+ 28 - 1
src/MoonSharp.Interpreter/Loaders/UnityAssetsScriptLoader.cs

@@ -30,10 +30,14 @@ namespace MoonSharp.Interpreter.Loaders
 		public UnityAssetsScriptLoader(string assetsPath = null)
 		{
 			assetsPath = assetsPath ?? DEFAULT_PATH;
+#if UNITY_5
+                LoadResourcesUnityNative(assetsPath);
+#else
 			LoadResourcesWithReflection(assetsPath);
+#endif
 		}
 
-		 
+
 		/// <summary>
 		/// Initializes a new instance of the <see cref="UnityAssetsScriptLoader"/> class.
 		/// </summary>
@@ -43,6 +47,29 @@ namespace MoonSharp.Interpreter.Loaders
 			m_Resources = scriptToCodeMap;
 		}
 
+#if UNITY_5
+        void LoadResourcesUnityNative(string assetsPath)
+        {
+            try
+            {
+                UnityEngine.Object[] array = UnityEngine.Resources.LoadAll(assetsPath, typeof(UnityEngine.TextAsset));
+
+                for (int i = 0; i < array.Length; i++)
+                {
+                    UnityEngine.TextAsset o = (UnityEngine.TextAsset)array[i];
+
+                    string name = o.name;
+                    string text = o.text;
+
+                    m_Resources.Add(name, text);
+                }
+            }
+            catch (Exception ex)
+            {
+                UnityEngine.Debug.LogErrorFormat("Error initializing UnityScriptLoader : {0}", ex);
+            }
+        }
+#endif
 
 		void LoadResourcesWithReflection(string assetsPath)
 		{

+ 15 - 3
src/MoonSharp.Interpreter/Platforms/PlatformAccessorBase.cs

@@ -27,10 +27,22 @@ namespace MoonSharp.Interpreter.Platforms
 
 			if (PlatformAutoDetector.IsRunningOnUnity)
 			{
-				if (PlatformAutoDetector.IsRunningOnMono)
-					suffix = "unity.mono";
+				if (PlatformAutoDetector.IsUnityNative)
+				{
+					if (PlatformAutoDetector.IsUnityIL2CPP)
+						suffix = "unity5.il2cpp";
+					else if (PlatformAutoDetector.IsRunningOnMono)
+						suffix = "unity5.mono";
+					else
+						suffix = "unity5.webp";
+				}
 				else
-					suffix = "unity.webp";
+				{
+					if (PlatformAutoDetector.IsRunningOnMono)
+						suffix = "unity.dll.mono";
+					else
+						suffix = "unity.dll.webp";
+				}
 			}
 			else if (PlatformAutoDetector.IsRunningOnMono)
 				suffix = "mono";

+ 19 - 2
src/MoonSharp.Interpreter/Platforms/PlatformAutoDetector.cs

@@ -30,6 +30,14 @@ namespace MoonSharp.Interpreter.Platforms
 		/// Gets a value indicating whether this instance has been built as a Portable Class Library
 		/// </summary>
 		public static bool IsPortableFramework { get; private set; }
+		/// <summary>
+		/// Gets a value indicating whether this instance has been compiled natively in Unity (as opposite to importing a DLL).
+		/// </summary>
+		public static bool IsUnityNative { get; private set; }
+		/// <summary>
+		/// Gets a value indicating whether this instance has been compiled natively in Unity AND is using IL2CPP
+		/// </summary>
+		public static bool IsUnityIL2CPP { get; private set; }
 
 
 		/// <summary>
@@ -41,8 +49,8 @@ namespace MoonSharp.Interpreter.Platforms
 			// We do a lazy eval here, so we can wire out this code by not calling it, if necessary..
 			get
 			{
-#if UNITY_WEBGL
-				return false;
+#if UNITY_WEBGL || UNITY_IOS || UNITY_TVOS || ENABLE_IL2CPP
+				return true;
 #else
 
 				if (!m_IsRunningOnAOT.HasValue)
@@ -71,11 +79,20 @@ namespace MoonSharp.Interpreter.Platforms
 				return;
 #if PCL
 			IsPortableFramework = true;
+#else
+#if UNITY_5
+			IsRunningOnUnity = true;
+			IsUnityNative = true;
+
+			#if ENABLE_IL2CPP
+				IsUnityIL2CPP = true;
+			#endif
 #else
 			IsRunningOnUnity = AppDomain.CurrentDomain
 				.GetAssemblies()
 				.SelectMany(a => a.SafeGetTypes())
 				.Any(t => t.FullName.StartsWith("UnityEngine."));
+#endif
 #endif
 
 			IsRunningOnMono = (Type.GetType("Mono.Runtime") != null);

+ 45 - 4
src/Unity/MoonSharp/Assembly-CSharp-firstpass.csproj

@@ -45,10 +45,10 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
-     <Compile Include="Assets\Plugins\MoonSharp\Debugger\DebuggerKit\AsyncDebugger.cs" />
-     <Compile Include="Assets\Plugins\MoonSharp\Debugger\DebuggerKit\BlockingQueue.cs" />
-     <Compile Include="Assets\Plugins\MoonSharp\Debugger\DebuggerKit\IAsyncDebuggerClient.cs" />
-     <Compile Include="Assets\Plugins\MoonSharp\Debugger\MoonSharpDebugSession.cs" />
+     <Compile Include="Assets\Plugins\MoonSharp\Debugger\DebuggerLogic\AsyncDebugger.cs" />
+     <Compile Include="Assets\Plugins\MoonSharp\Debugger\DebuggerLogic\EmptyDebugSession.cs" />
+     <Compile Include="Assets\Plugins\MoonSharp\Debugger\DebuggerLogic\IAsyncDebuggerClient.cs" />
+     <Compile Include="Assets\Plugins\MoonSharp\Debugger\DebuggerLogic\MoonSharpDebugSession.cs" />
      <Compile Include="Assets\Plugins\MoonSharp\Debugger\MoonSharpVsCodeDebugServer.cs" />
      <Compile Include="Assets\Plugins\MoonSharp\Debugger\SDK\DebugSession.cs" />
      <Compile Include="Assets\Plugins\MoonSharp\Debugger\SDK\Protocol.cs" />
@@ -297,6 +297,47 @@
      <Compile Include="Assets\Plugins\MoonSharp\Interpreter\Tree\Statements\ReturnStatement.cs" />
      <Compile Include="Assets\Plugins\MoonSharp\Interpreter\Tree\Statements\ScopeBlockStatement.cs" />
      <Compile Include="Assets\Plugins\MoonSharp\Interpreter\Tree\Statements\WhileStatement.cs" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\105-string.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\310-debug.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\212-function.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\204-grammar.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\305-table.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\101-boolean.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\106-table.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\203-lexico.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\202-expr.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\320-stdin.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\000-sanity.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\309-os.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\223-iterator.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\221-table.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\314-regex.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\107-thread.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\015-forlist.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\231-metatable.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\308-io.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\211-scope.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\222-constructor.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\012-repeat.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\104-number.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\Modules\Test\More.lua.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\232-object.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\301-basic.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\306-math.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\001-if.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\102-function.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\108-userdata.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\Modules\Test\Builder.lua.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\201-assign.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\213-closure.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\014-fornum.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\304-string.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\307-bit.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\002-table.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\011-while.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\200-examples.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\214-coroutine.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\103-nil.t.txt" />
  <Reference Include="UnityEngine.UI">
  <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
  </Reference>

+ 87 - 2
src/Unity/MoonSharp/Assembly-CSharp.csproj

@@ -45,8 +45,93 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
-     <Compile Include="Assets\NewScript.cs" />
-     <Compile Include="Assets\UnityTests.cs" />
+     <Compile Include="Assets\TestRunnerBehaviour.cs" />
+     <Compile Include="Assets\Tests\EmbeddableNUnitWrapper.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\BinaryDumpTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\ClosureTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\CollectionsBaseGenRegisteredTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\CollectionsBaseInterfGenRegisteredTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\CollectionsRegisteredTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\ConfigPropertyAssignerTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\CoroutineTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\DynamicTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\ErrorHandlingTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\GotoTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\JsonSerializationTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\LuaTestSuiteExtract.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\MetatableTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\ProxyObjectsTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\SimpleTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\StringLibTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\StructAssignmentTechnique.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\TableTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\TailCallTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataEnumsTest.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataEventsTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataFieldsTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataIndexerTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataMetaTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataMethodsTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataNestedTypesTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataOverloadsTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\UserDataPropertiesTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\Utils.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\VarargsTupleTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\VtUserDataFieldsTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\VtUserDataIndexerTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\VtUserDataMetaTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\VtUserDataMethodsTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\VtUserDataOverloadsTests.cs" />
+     <Compile Include="Assets\Tests\EndToEnd\VtUserDataPropertiesTests.cs" />
+     <Compile Include="Assets\Tests\TapRunner.cs" />
+     <Compile Include="Assets\Tests\TestMoreTests.cs" />
+     <Compile Include="Assets\Tests\TestRunner.cs" />
+     <Compile Include="Assets\Tests\Units\BinDumpStreamTests.cs" />
+     <Compile Include="Assets\Tests\Units\FastStackTests.cs" />
+     <Compile Include="Assets\Tests\Units\InteropTests.cs" />
+     <Compile Include="Assets\Tests\_Hardwired.cs" />
+     <Compile Include="Assets\Tests\_Projects\MoonSharp.Interpreter.Tests.Embeddable.portable40\_NUnitWrapper.cs" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\105-string.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\310-debug.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\212-function.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\204-grammar.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\305-table.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\101-boolean.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\106-table.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\203-lexico.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\202-expr.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\320-stdin.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\000-sanity.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\309-os.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\223-iterator.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\221-table.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\314-regex.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\107-thread.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\015-forlist.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\231-metatable.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\308-io.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\211-scope.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\222-constructor.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\012-repeat.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\104-number.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\Modules\Test\More.lua.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\232-object.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\301-basic.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\306-math.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\001-if.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\102-function.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\108-userdata.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\Modules\Test\Builder.lua.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\201-assign.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\213-closure.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\014-fornum.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\304-string.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\307-bit.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\002-table.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\011-while.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\200-examples.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\214-coroutine.t.txt" />
+     <None Include="Assets\Resources\MoonSharp\Scripts\103-nil.t.txt" />
  <Reference Include="UnityEngine.UI">
  <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
  </Reference>

+ 0 - 3132
src/Unity/MoonSharp/Assets/NewScript.cs

@@ -1,3132 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:2.0.50727.8670
-//
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-// ----------------------------------------------------------
-// Generated by MoonSharp.Hardwire v.1.0.6127.24829
-// Compatible with MoonSharp v.1.8.5.0 or equivalent
-// ----------------------------------------------------------
-// Code generated on 2016-10-10T14:05:20.9500294+02:00
-// ----------------------------------------------------------
-// 
-// 
-// 
-namespace HardwiredClasses {
-
-
-    public abstract class HardwireTypes {
-
-        private HardwireTypes() {
-        }
-
-        public static void Initialize() {
-            MoonSharp.Interpreter.UserData.RegisterType(new TYPE_32db315b87c247f0bdff90df5bdd21e5());
-            MoonSharp.Interpreter.UserData.RegisterType(new TYPE_2242d363382349749f593d3d8f6f5c8b());
-            MoonSharp.Interpreter.UserData.RegisterType(new TYPE_1bd70872139149caa525f036e4400e7a());
-            MoonSharp.Interpreter.UserData.RegisterType(new TYPE_acbdba46cb404506a3036ddb131896d5());
-            MoonSharp.Interpreter.UserData.RegisterType(new TYPE_d83df02b7f084c149270d4d297f23161());
-            MoonSharp.Interpreter.UserData.RegisterType(new TYPE_7251c34e0fa746ed86831c4418103b31());
-        }
-
-        #region Descriptor of UnityEngine.GUI+WindowFunction
-        // Descriptor of UnityEngine.GUI+WindowFunction
-        private sealed class TYPE_32db315b87c247f0bdff90df5bdd21e5 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredUserDataDescriptor {
-
-            internal TYPE_32db315b87c247f0bdff90df5bdd21e5() : 
-            base(typeof(UnityEngine.GUI.WindowFunction)) {
-                this.AddMember("__new", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("__new", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_10702cec7ef140af8aaefb0264a170f9()}));
-                this.AddMember("Invoke", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Invoke", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_024b9b7763f04b58bb0c135c4f55d4d8()}));
-                this.AddMember("BeginInvoke", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("BeginInvoke", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_7c00675ef0d64e51803fa694c4464488()}));
-                this.AddMember("EndInvoke", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("EndInvoke", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_944947b9b74942c0b341b98a08910811()}));
-                this.AddMember("GetObjectData", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetObjectData", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_d4d76729737b48b0a58ae6efe44564fc()}));
-                this.AddMember("Equals", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Equals", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_f6cbfb7856dd414d88665727fc219d18()}));
-                this.AddMember("GetHashCode", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetHashCode", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_ff7a3651b5484e3d9123e814584ba104()}));
-                this.AddMember("GetInvocationList", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetInvocationList", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_86b29826c0264c02a44d9e04f0c06067()}));
-                this.AddMember("get_Method", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_Method", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_4fbc9b4f53044ea0a6e71a864c7ec5c4()}));
-                this.AddMember("get_Target", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_Target", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_08b9e51547334130a70374d7e30cde8b()}));
-                this.AddMember("DynamicInvoke", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("DynamicInvoke", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_73f850046cd2416588cef06890adee16()}));
-                this.AddMember("Clone", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Clone", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_d78896bd6cd344d99c75b86e9e2b03a0()}));
-                this.AddMember("GetType", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetType", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_c06b44f4ca2141b9a55988f45255b9e2()}));
-                this.AddMember("ToString", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ToString", typeof(UnityEngine.GUI.WindowFunction), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_83c74b155e1b48bb8a59b63541cfa8ea()}));
-                this.AddMember("Method", new PROP_e253dfd99f5f4390bc34aaadd2bce5b7());
-                this.AddMember("Target", new PROP_02162017154b48acb2f7cd8a5fd513c6());
-            }
-
-            private sealed class MTHD_10702cec7ef140af8aaefb0264a170f9 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_10702cec7ef140af8aaefb0264a170f9() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("object", typeof(object), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("method", typeof(System.IntPtr), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.WindowFunction(((object)(pars[0])), ((System.IntPtr)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_024b9b7763f04b58bb0c135c4f55d4d8 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_024b9b7763f04b58bb0c135c4f55d4d8() {
-                    this.Initialize("Invoke", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    ((UnityEngine.GUI.WindowFunction)(obj)).Invoke(((int)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_7c00675ef0d64e51803fa694c4464488 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_7c00675ef0d64e51803fa694c4464488() {
-                    this.Initialize("BeginInvoke", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("callback", typeof(System.AsyncCallback), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("object", typeof(object), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((UnityEngine.GUI.WindowFunction)(obj)).BeginInvoke(((int)(pars[0])), ((System.AsyncCallback)(pars[1])), ((object)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_944947b9b74942c0b341b98a08910811 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_944947b9b74942c0b341b98a08910811() {
-                    this.Initialize("EndInvoke", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("result", typeof(System.IAsyncResult), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    ((UnityEngine.GUI.WindowFunction)(obj)).EndInvoke(((System.IAsyncResult)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_d4d76729737b48b0a58ae6efe44564fc : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_d4d76729737b48b0a58ae6efe44564fc() {
-                    this.Initialize("GetObjectData", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("info", typeof(System.Runtime.Serialization.SerializationInfo), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("context", typeof(System.Runtime.Serialization.StreamingContext), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    ((System.MulticastDelegate)(obj)).GetObjectData(((System.Runtime.Serialization.SerializationInfo)(pars[0])), ((System.Runtime.Serialization.StreamingContext)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_f6cbfb7856dd414d88665727fc219d18 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_f6cbfb7856dd414d88665727fc219d18() {
-                    this.Initialize("Equals", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("obj", typeof(object), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((System.MulticastDelegate)(obj)).Equals(((object)(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_ff7a3651b5484e3d9123e814584ba104 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_ff7a3651b5484e3d9123e814584ba104() {
-                    this.Initialize("GetHashCode", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((System.MulticastDelegate)(obj)).GetHashCode();
-                }
-            }
-
-            private sealed class MTHD_86b29826c0264c02a44d9e04f0c06067 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_86b29826c0264c02a44d9e04f0c06067() {
-                    this.Initialize("GetInvocationList", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((System.MulticastDelegate)(obj)).GetInvocationList();
-                }
-            }
-
-            private sealed class MTHD_4fbc9b4f53044ea0a6e71a864c7ec5c4 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_4fbc9b4f53044ea0a6e71a864c7ec5c4() {
-                    this.Initialize("get_Method", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((System.Delegate)(obj)).Method;
-                }
-            }
-
-            private sealed class MTHD_08b9e51547334130a70374d7e30cde8b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_08b9e51547334130a70374d7e30cde8b() {
-                    this.Initialize("get_Target", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((System.Delegate)(obj)).Target;
-                }
-            }
-
-            private sealed class MTHD_73f850046cd2416588cef06890adee16 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_73f850046cd2416588cef06890adee16() {
-                    this.Initialize("DynamicInvoke", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("args", typeof(object[]), false, null, false, false, true)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((System.Delegate)(obj)).DynamicInvoke(((object[])(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_d78896bd6cd344d99c75b86e9e2b03a0 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_d78896bd6cd344d99c75b86e9e2b03a0() {
-                    this.Initialize("Clone", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((System.Delegate)(obj)).Clone();
-                }
-            }
-
-            private sealed class MTHD_c06b44f4ca2141b9a55988f45255b9e2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_c06b44f4ca2141b9a55988f45255b9e2() {
-                    this.Initialize("GetType", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetType();
-                }
-            }
-
-            private sealed class MTHD_83c74b155e1b48bb8a59b63541cfa8ea : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_83c74b155e1b48bb8a59b63541cfa8ea() {
-                    this.Initialize("ToString", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).ToString();
-                }
-            }
-
-            private sealed class PROP_e253dfd99f5f4390bc34aaadd2bce5b7 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_e253dfd99f5f4390bc34aaadd2bce5b7() : 
-                base(typeof(System.Reflection.MethodInfo), "Method", false, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(1))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return ((System.Delegate)(obj)).Method;
-                }
-            }
-
-            private sealed class PROP_02162017154b48acb2f7cd8a5fd513c6 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_02162017154b48acb2f7cd8a5fd513c6() : 
-                base(typeof(object), "Target", false, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(1))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return ((System.Delegate)(obj)).Target;
-                }
-            }
-        }
-        #endregion
-
-        #region Descriptor of UnityEngine.GUI+ClipScope
-        // Descriptor of UnityEngine.GUI+ClipScope
-        private sealed class TYPE_2242d363382349749f593d3d8f6f5c8b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredUserDataDescriptor {
-
-            internal TYPE_2242d363382349749f593d3d8f6f5c8b() : 
-            base(typeof(UnityEngine.GUI.ClipScope)) {
-                this.AddMember("__new", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("__new", typeof(UnityEngine.GUI.ClipScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_5868a183363d44c2b8f785c932a33d55()}));
-                this.AddMember("Dispose", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Dispose", typeof(UnityEngine.GUI.ClipScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_62476ff28ed944ed8cf13acf89d6b6e4()}));
-                this.AddMember("Equals", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Equals", typeof(UnityEngine.GUI.ClipScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_3c4673ee416d4d0f85bda35cc188df13()}));
-                this.AddMember("GetHashCode", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetHashCode", typeof(UnityEngine.GUI.ClipScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_3d6ff0ecde2f4aeeac56b8fe9d7f7043()}));
-                this.AddMember("GetType", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetType", typeof(UnityEngine.GUI.ClipScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_8f1271d178ad46129cfc557e74240b4e()}));
-                this.AddMember("ToString", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ToString", typeof(UnityEngine.GUI.ClipScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_9c3989021ef046e893d39edc34fe8f18()}));
-            }
-
-            private sealed class MTHD_5868a183363d44c2b8f785c932a33d55 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_5868a183363d44c2b8f785c932a33d55() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.ClipScope(((UnityEngine.Rect)(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_62476ff28ed944ed8cf13acf89d6b6e4 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_62476ff28ed944ed8cf13acf89d6b6e4() {
-                    this.Initialize("Dispose", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    ((UnityEngine.GUI.Scope)(obj)).Dispose();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_3c4673ee416d4d0f85bda35cc188df13 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_3c4673ee416d4d0f85bda35cc188df13() {
-                    this.Initialize("Equals", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("obj", typeof(object), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).Equals(((object)(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_3d6ff0ecde2f4aeeac56b8fe9d7f7043 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_3d6ff0ecde2f4aeeac56b8fe9d7f7043() {
-                    this.Initialize("GetHashCode", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetHashCode();
-                }
-            }
-
-            private sealed class MTHD_8f1271d178ad46129cfc557e74240b4e : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_8f1271d178ad46129cfc557e74240b4e() {
-                    this.Initialize("GetType", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetType();
-                }
-            }
-
-            private sealed class MTHD_9c3989021ef046e893d39edc34fe8f18 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_9c3989021ef046e893d39edc34fe8f18() {
-                    this.Initialize("ToString", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).ToString();
-                }
-            }
-        }
-        #endregion
-
-        #region Descriptor of UnityEngine.GUI+ScrollViewScope
-        // Descriptor of UnityEngine.GUI+ScrollViewScope
-        private sealed class TYPE_1bd70872139149caa525f036e4400e7a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredUserDataDescriptor {
-
-            internal TYPE_1bd70872139149caa525f036e4400e7a() : 
-            base(typeof(UnityEngine.GUI.ScrollViewScope)) {
-                this.AddMember("__new", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("__new", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_3dfe7b7c53544b0cb25728d6747eb449(),
-                    new MTHD_491a781b2f0544cb908be0ee8d8b7e98(),
-                    new MTHD_fcc062345d9f47dc93ea3e09dc0435e4(),
-                    new MTHD_ecaea5a555724565bf586344c3c72cc4()}));
-                this.AddMember("get_scrollPosition", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_scrollPosition", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_e6491f3cd2bd4d83b005bed7e3edc6d2()}));
-                this.AddMember("get_handleScrollWheel", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_handleScrollWheel", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_312e0ea30b114ae0a323202ba38ace76()}));
-                this.AddMember("set_handleScrollWheel", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_handleScrollWheel", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_4827131a635848fabb6f705f8a8ed4e3()}));
-                this.AddMember("Dispose", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Dispose", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_4a1ca2f7e8f648b296c703e552379998()}));
-                this.AddMember("Equals", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Equals", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_a7c24b0741534f0c9d842988d5196a1d()}));
-                this.AddMember("GetHashCode", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetHashCode", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_44e1976843814773896ba4bf6cf409b7()}));
-                this.AddMember("GetType", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetType", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_0ef4656fb53b41db8ee68c737660673b()}));
-                this.AddMember("ToString", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ToString", typeof(UnityEngine.GUI.ScrollViewScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_f7add05d67404c2986db5d1831d3eb39()}));
-                this.AddMember("scrollPosition", new PROP_ffe8013fdc0c4ce1b874429011519a5b());
-                this.AddMember("handleScrollWheel", new PROP_443ecd57c4974d6cade0d1f653654c82());
-            }
-
-            private sealed class MTHD_3dfe7b7c53544b0cb25728d6747eb449 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_3dfe7b7c53544b0cb25728d6747eb449() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollPosition", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("viewRect", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.ScrollViewScope(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Rect)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_491a781b2f0544cb908be0ee8d8b7e98 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_491a781b2f0544cb908be0ee8d8b7e98() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollPosition", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("viewRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alwaysShowHorizontal", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alwaysShowVertical", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.ScrollViewScope(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Rect)(pars[2])), ((bool)(pars[3])), ((bool)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_fcc062345d9f47dc93ea3e09dc0435e4 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_fcc062345d9f47dc93ea3e09dc0435e4() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollPosition", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("viewRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("horizontalScrollbar", typeof(UnityEngine.GUIStyle), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("verticalScrollbar", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.ScrollViewScope(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Rect)(pars[2])), ((UnityEngine.GUIStyle)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_ecaea5a555724565bf586344c3c72cc4 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_ecaea5a555724565bf586344c3c72cc4() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollPosition", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("viewRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alwaysShowHorizontal", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alwaysShowVertical", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("horizontalScrollbar", typeof(UnityEngine.GUIStyle), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("verticalScrollbar", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.ScrollViewScope(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Rect)(pars[2])), ((bool)(pars[3])), ((bool)(pars[4])), ((UnityEngine.GUIStyle)(pars[5])), ((UnityEngine.GUIStyle)(pars[6])));
-                }
-            }
-
-            private sealed class MTHD_e6491f3cd2bd4d83b005bed7e3edc6d2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_e6491f3cd2bd4d83b005bed7e3edc6d2() {
-                    this.Initialize("get_scrollPosition", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((UnityEngine.GUI.ScrollViewScope)(obj)).scrollPosition;
-                }
-            }
-
-            private sealed class MTHD_312e0ea30b114ae0a323202ba38ace76 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_312e0ea30b114ae0a323202ba38ace76() {
-                    this.Initialize("get_handleScrollWheel", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((UnityEngine.GUI.ScrollViewScope)(obj)).handleScrollWheel;
-                }
-            }
-
-            private sealed class MTHD_4827131a635848fabb6f705f8a8ed4e3 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_4827131a635848fabb6f705f8a8ed4e3() {
-                    this.Initialize("set_handleScrollWheel", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.ScrollViewScope tmp = ((UnityEngine.GUI.ScrollViewScope)(obj));
-                    tmp.handleScrollWheel = ((bool)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_4a1ca2f7e8f648b296c703e552379998 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_4a1ca2f7e8f648b296c703e552379998() {
-                    this.Initialize("Dispose", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    ((UnityEngine.GUI.Scope)(obj)).Dispose();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_a7c24b0741534f0c9d842988d5196a1d : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_a7c24b0741534f0c9d842988d5196a1d() {
-                    this.Initialize("Equals", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("obj", typeof(object), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).Equals(((object)(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_44e1976843814773896ba4bf6cf409b7 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_44e1976843814773896ba4bf6cf409b7() {
-                    this.Initialize("GetHashCode", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetHashCode();
-                }
-            }
-
-            private sealed class MTHD_0ef4656fb53b41db8ee68c737660673b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_0ef4656fb53b41db8ee68c737660673b() {
-                    this.Initialize("GetType", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetType();
-                }
-            }
-
-            private sealed class MTHD_f7add05d67404c2986db5d1831d3eb39 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_f7add05d67404c2986db5d1831d3eb39() {
-                    this.Initialize("ToString", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).ToString();
-                }
-            }
-
-            private sealed class PROP_ffe8013fdc0c4ce1b874429011519a5b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_ffe8013fdc0c4ce1b874429011519a5b() : 
-                base(typeof(UnityEngine.Vector2), "scrollPosition", false, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(1))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return ((UnityEngine.GUI.ScrollViewScope)(obj)).scrollPosition;
-                }
-            }
-
-            private sealed class PROP_443ecd57c4974d6cade0d1f653654c82 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_443ecd57c4974d6cade0d1f653654c82() : 
-                base(typeof(bool), "handleScrollWheel", false, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return ((UnityEngine.GUI.ScrollViewScope)(obj)).handleScrollWheel;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.ScrollViewScope tmp = ((UnityEngine.GUI.ScrollViewScope)(obj));
-                    tmp.handleScrollWheel = ((bool)(value));
-                }
-            }
-        }
-        #endregion
-
-        #region Descriptor of UnityEngine.GUI+GroupScope
-        // Descriptor of UnityEngine.GUI+GroupScope
-        private sealed class TYPE_acbdba46cb404506a3036ddb131896d5 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredUserDataDescriptor {
-
-            internal TYPE_acbdba46cb404506a3036ddb131896d5() : 
-            base(typeof(UnityEngine.GUI.GroupScope)) {
-                this.AddMember("__new", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("__new", typeof(UnityEngine.GUI.GroupScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_1d5b628451ef4286ace1f9c42414cda2(),
-                    new MTHD_be9413b3928040f6ba1fccb003197066(),
-                    new MTHD_b9987c405fb34588b62da3f480cfdda2(),
-                    new MTHD_624f9f1c3765419cba55b64f447ed5ca(),
-                    new MTHD_397d18ea7719460fb9b5fa03262ea2ec(),
-                    new MTHD_667ca40c62774d4ba8167271d9c9eb61(),
-                    new MTHD_db30afea479a432f8be8f79b83a66d05()}));
-                this.AddMember("Dispose", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Dispose", typeof(UnityEngine.GUI.GroupScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_824c424b4a7e4de09e2f8075ce1be81b()}));
-                this.AddMember("Equals", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Equals", typeof(UnityEngine.GUI.GroupScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_eb215cea29294e838d338f0a6bf2db39()}));
-                this.AddMember("GetHashCode", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetHashCode", typeof(UnityEngine.GUI.GroupScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_f80d7f3e0f4e41d89d7e8bea141008f9()}));
-                this.AddMember("GetType", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetType", typeof(UnityEngine.GUI.GroupScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_1ca2cd40f1294e2b8fab42559d04f635()}));
-                this.AddMember("ToString", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ToString", typeof(UnityEngine.GUI.GroupScope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_5f2c31108df24b4fb4fc5c4b49c93514()}));
-            }
-
-            private sealed class MTHD_1d5b628451ef4286ace1f9c42414cda2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1d5b628451ef4286ace1f9c42414cda2() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.GroupScope(((UnityEngine.Rect)(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_be9413b3928040f6ba1fccb003197066 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_be9413b3928040f6ba1fccb003197066() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.GroupScope(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_b9987c405fb34588b62da3f480cfdda2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_b9987c405fb34588b62da3f480cfdda2() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.GroupScope(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_624f9f1c3765419cba55b64f447ed5ca : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_624f9f1c3765419cba55b64f447ed5ca() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.GroupScope(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_397d18ea7719460fb9b5fa03262ea2ec : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_397d18ea7719460fb9b5fa03262ea2ec() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.GroupScope(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIStyle)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_667ca40c62774d4ba8167271d9c9eb61 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_667ca40c62774d4ba8167271d9c9eb61() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.GroupScope(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_db30afea479a432f8be8f79b83a66d05 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_db30afea479a432f8be8f79b83a66d05() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI.GroupScope(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_824c424b4a7e4de09e2f8075ce1be81b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_824c424b4a7e4de09e2f8075ce1be81b() {
-                    this.Initialize("Dispose", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    ((UnityEngine.GUI.Scope)(obj)).Dispose();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_eb215cea29294e838d338f0a6bf2db39 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_eb215cea29294e838d338f0a6bf2db39() {
-                    this.Initialize("Equals", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("obj", typeof(object), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).Equals(((object)(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_f80d7f3e0f4e41d89d7e8bea141008f9 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_f80d7f3e0f4e41d89d7e8bea141008f9() {
-                    this.Initialize("GetHashCode", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetHashCode();
-                }
-            }
-
-            private sealed class MTHD_1ca2cd40f1294e2b8fab42559d04f635 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1ca2cd40f1294e2b8fab42559d04f635() {
-                    this.Initialize("GetType", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetType();
-                }
-            }
-
-            private sealed class MTHD_5f2c31108df24b4fb4fc5c4b49c93514 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_5f2c31108df24b4fb4fc5c4b49c93514() {
-                    this.Initialize("ToString", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).ToString();
-                }
-            }
-        }
-        #endregion
-
-        #region Descriptor of UnityEngine.GUI+Scope
-        // Descriptor of UnityEngine.GUI+Scope
-        private sealed class TYPE_d83df02b7f084c149270d4d297f23161 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredUserDataDescriptor {
-
-            internal TYPE_d83df02b7f084c149270d4d297f23161() : 
-            base(typeof(UnityEngine.GUI.Scope)) {
-                this.AddMember("Dispose", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Dispose", typeof(UnityEngine.GUI.Scope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_b02fac03c268476e9ec2279c8f50d09c()}));
-                this.AddMember("Equals", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Equals", typeof(UnityEngine.GUI.Scope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_b490720beca94583a6b4cb622e395062()}));
-                this.AddMember("GetHashCode", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetHashCode", typeof(UnityEngine.GUI.Scope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_316a5ed8576b4291a946cecea2054c07()}));
-                this.AddMember("GetType", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetType", typeof(UnityEngine.GUI.Scope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_03ec881228924631b34102e22c5fed1c()}));
-                this.AddMember("ToString", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ToString", typeof(UnityEngine.GUI.Scope), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_e2352ab254904dcea9127056fca302df()}));
-            }
-
-            private sealed class MTHD_b02fac03c268476e9ec2279c8f50d09c : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_b02fac03c268476e9ec2279c8f50d09c() {
-                    this.Initialize("Dispose", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    ((UnityEngine.GUI.Scope)(obj)).Dispose();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_b490720beca94583a6b4cb622e395062 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_b490720beca94583a6b4cb622e395062() {
-                    this.Initialize("Equals", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("obj", typeof(object), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).Equals(((object)(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_316a5ed8576b4291a946cecea2054c07 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_316a5ed8576b4291a946cecea2054c07() {
-                    this.Initialize("GetHashCode", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetHashCode();
-                }
-            }
-
-            private sealed class MTHD_03ec881228924631b34102e22c5fed1c : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_03ec881228924631b34102e22c5fed1c() {
-                    this.Initialize("GetType", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetType();
-                }
-            }
-
-            private sealed class MTHD_e2352ab254904dcea9127056fca302df : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_e2352ab254904dcea9127056fca302df() {
-                    this.Initialize("ToString", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).ToString();
-                }
-            }
-        }
-        #endregion
-
-        #region Descriptor of UnityEngine.GUI
-        // Descriptor of UnityEngine.GUI
-        private sealed class TYPE_7251c34e0fa746ed86831c4418103b31 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredUserDataDescriptor {
-
-            internal TYPE_7251c34e0fa746ed86831c4418103b31() : 
-            base(typeof(UnityEngine.GUI)) {
-                this.AddMember("__new", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("__new", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_7997b672ae2243f9af29ef7443cbaf9f()}));
-                this.AddMember("set_skin", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_skin", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_482527bcce2d4b0c99df694b2d847b1a()}));
-                this.AddMember("get_skin", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_skin", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_01a8f7d5c26041f7be6fcd0f46af6ef3()}));
-                this.AddMember("get_matrix", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_matrix", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_da173dd5b2cd43d1b0f4fadff96963b4()}));
-                this.AddMember("set_matrix", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_matrix", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_db14dc6f3c2f411fbec8ead6ba9ff9d4()}));
-                this.AddMember("get_tooltip", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_tooltip", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_418bfd26124a4eef859c67d2086c1c66()}));
-                this.AddMember("set_tooltip", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_tooltip", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_980323184af242f182df20b76e93d367()}));
-                this.AddMember("Label", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Label", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_371e865f066941d991239e6b419065af(),
-                    new MTHD_3ebc8001f3404e25871a3883bcfc1068(),
-                    new MTHD_9fe0969a16774acab206e42731f158c6(),
-                    new MTHD_374cd47a425447a2954399ad2c77735a(),
-                    new MTHD_d6af57e2925e40a08046f8eb72428f41(),
-                    new MTHD_66b5f0f9189349e2a11ede327292e11f()}));
-                this.AddMember("DrawTexture", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("DrawTexture", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_93853540c86549409a1da79cca4710fc(),
-                    new MTHD_2cd2066364e147b88b807161c9df86e1(),
-                    new MTHD_39cd6b7c84ce46678e62384a184ee826(),
-                    new MTHD_cba5b81ce5474cda8dfb406018f63728()}));
-                this.AddMember("DrawTextureWithTexCoords", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("DrawTextureWithTexCoords", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_4e9ff4eb3e0e47d089c59997e28cb3e0(),
-                    new MTHD_679121755742435fabbefe7cd9e941dd()}));
-                this.AddMember("Box", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Box", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_014d6a93ec924efe8abcebd1b8fb7f44(),
-                    new MTHD_68ebe35d2fbe48cc85ee77b31cddfa3d(),
-                    new MTHD_ad50e0d763214013bea3e633681eec54(),
-                    new MTHD_0fa73ba9fd584136b4fabf88827879b7(),
-                    new MTHD_2afa847f94f8409882f03b79a7377b24(),
-                    new MTHD_b1c0f5bb2fdb45409eeead77db5a7c2b()}));
-                this.AddMember("Button", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Button", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_1e4d374389cf4847b490435bffffa71c(),
-                    new MTHD_713ac9b0e8044596a63ce6a28e5fcd46(),
-                    new MTHD_5f3e195d7b3244ee9ccd5c2565f6f573(),
-                    new MTHD_812a0f12d92f4eaba8a8d727316c924a(),
-                    new MTHD_ac42a6bbbd814ac3a60f41b0db88230a(),
-                    new MTHD_a4b2f06761c647d984f7bca008ed4f5a()}));
-                this.AddMember("RepeatButton", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("RepeatButton", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_01b1f46d33154c5dbb4f29f35ae00863(),
-                    new MTHD_8a42c2141f8f4e3dbbc1007495738053(),
-                    new MTHD_51d61dbeed6e42c0ab4a2494aae38fd9(),
-                    new MTHD_07faaf9bd94f48edb8d01a354072c06f(),
-                    new MTHD_350941a72b734ea7bf5009e935939677(),
-                    new MTHD_86afc20f3551492896e699e4db0d12a5()}));
-                this.AddMember("TextField", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("TextField", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_10612ffff3d449bba4571c7163e9aeb8(),
-                    new MTHD_1bbcedbe6be341689fc410f2f581c472(),
-                    new MTHD_8a718b675a154960b4fddfdadf161524(),
-                    new MTHD_fef18e910be24dc993450e458bf0c6f8()}));
-                this.AddMember("PasswordField", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("PasswordField", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_58cbe1aba1594db9bfa13746abc92a4f(),
-                    new MTHD_1da593bbb8bd49c0a276db5b63ee1ebc(),
-                    new MTHD_cadda8f5b94644bf91c3e439e45d6ed6(),
-                    new MTHD_de22060361ab4912bdc8f539cbd07dc2()}));
-                this.AddMember("TextArea", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("TextArea", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_c06699379e94414d887109a3cbedfe24(),
-                    new MTHD_2c34ea08598647e88f0a899f042c1030(),
-                    new MTHD_79487df64f8f4e4cb8b96a7a8e748126(),
-                    new MTHD_815b77cf0d35474c80d092630d7c1726()}));
-                this.AddMember("Toggle", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Toggle", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_a47a8179511642f7b28574bd73d50ddd(),
-                    new MTHD_846d5da676a446e496f952120cd6d3fb(),
-                    new MTHD_6fd22d5d1f03471bbe556aec22c89459(),
-                    new MTHD_490f8eaa16b4493da64b173fb390abd2(),
-                    new MTHD_f1a04075f5a24e69a5663d5ac09fc167(),
-                    new MTHD_084c1d85bfad40b783a9cb0d3941dc76(),
-                    new MTHD_44784ac946e24c58b9c3ea512ad4273e()}));
-                this.AddMember("Toolbar", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Toolbar", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_a0b525366b8542c9ad031af0bcfdc07a(),
-                    new MTHD_c9a2b4caa123412293ef3a19e0c226c6(),
-                    new MTHD_80cceea885624fd2b977d5e5d65b7f08(),
-                    new MTHD_b915a0c08fd4429092a6f1bfc02726d5(),
-                    new MTHD_9a956e17f07b4ac5860ea59c463f53d2(),
-                    new MTHD_56d76581a40f4b98b724c7b2d8403087()}));
-                this.AddMember("SelectionGrid", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("SelectionGrid", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_35b98725b8834009b1955ef269281842(),
-                    new MTHD_1e9213be4c744a9aa8bebadc02f9245e(),
-                    new MTHD_5e4eeef74288481d9367f34eb8a39427(),
-                    new MTHD_b1d28b8974874a188c61f3134dbaad54(),
-                    new MTHD_0730241806f242519b22037a25b891ed(),
-                    new MTHD_341b1b0bd21b4773ac41814f45097363()}));
-                this.AddMember("HorizontalSlider", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("HorizontalSlider", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_e0e74162e6764cedad3f20fa753c08ca(),
-                    new MTHD_1e095b5e28084788adea54a3d0b23fc2()}));
-                this.AddMember("VerticalSlider", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("VerticalSlider", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_475f6593b37d4c7184211133c34645fd(),
-                    new MTHD_815e6db23a184602937e0ee12f94df2e()}));
-                this.AddMember("Slider", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Slider", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_739a9a7937714d1a9e298f035dcba87b()}));
-                this.AddMember("HorizontalScrollbar", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("HorizontalScrollbar", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_023f3df61bf34dd9896b37cdf79e6874(),
-                    new MTHD_eab4aed4d4f0497d954a2c7221034fd0()}));
-                this.AddMember("VerticalScrollbar", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("VerticalScrollbar", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_7c5eec5c3104400dac39e8779e0a0cd2(),
-                    new MTHD_06bfc96502a1485b8f3cbf7276d9e0d2()}));
-                this.AddMember("BeginClip", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("BeginClip", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_ff978986f0cb48e5a47a4a368976c4cd(),
-                    new MTHD_a95ee5d08682442e8ebe9463b87d5e17()}));
-                this.AddMember("BeginGroup", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("BeginGroup", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_87c81c196d9d44bfa00721c94d106e97(),
-                    new MTHD_dce5ffc11bb745b5bb4eaa3482907b19(),
-                    new MTHD_1939e0b331ba41eda62eab89ca616310(),
-                    new MTHD_46f0c00c4e74481cbf0916ca17dd7315(),
-                    new MTHD_04796f7c887d497f8b921150cc93cde1(),
-                    new MTHD_11f993e4b5234e6f8a851f602e70975d(),
-                    new MTHD_cd3d484048a74ee6a43b0df783c1ea7e(),
-                    new MTHD_0ff20f3249634665bcf62b4147b5e78c()}));
-                this.AddMember("EndGroup", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("EndGroup", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_1e45011a7e7e4f57b948440b78aa03c0()}));
-                this.AddMember("EndClip", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("EndClip", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_fb86c8e1a2c548b98004c1814a6492de()}));
-                this.AddMember("BeginScrollView", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("BeginScrollView", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_65e3322b2a86472f9ce144b0a90ed87e(),
-                    new MTHD_bb61398922d54f048a117f9a223bd464(),
-                    new MTHD_6589159e62124cd7a48ef56b0fc5eedc(),
-                    new MTHD_8c5d541e1d2340c7abca47e6b863e097()}));
-                this.AddMember("EndScrollView", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("EndScrollView", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_7498814a79aa46039dc490488cb31525(),
-                    new MTHD_945922530bc04a529dfb6e79c06e2811()}));
-                this.AddMember("ScrollTo", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ScrollTo", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_e3cd615b021c483cb7a89af87adf7ae2()}));
-                this.AddMember("ScrollTowards", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ScrollTowards", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_9f70601e84884eabbc3a83da7065a547()}));
-                this.AddMember("Window", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Window", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_81a6f7bace2f4780a6b83c6e3ddcac38(),
-                    new MTHD_2d5bb2dece4c42b2bcf76cb2bff65620(),
-                    new MTHD_a5a1fe71dd1846f0a043b6f7d3dc34a8(),
-                    new MTHD_eabc977a56a24d0d81d09ecc9411cdc6(),
-                    new MTHD_d3f7a360655a4500922b91efd68cc069(),
-                    new MTHD_f4186922da46409bad2d687365d2433c()}));
-                this.AddMember("ModalWindow", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ModalWindow", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_791b52b2126241cbaec2a40216d19e6f(),
-                    new MTHD_e5d0879924164123b30f9fbe82e8062b(),
-                    new MTHD_cbb2123feb914f188f9afda01c0feee6(),
-                    new MTHD_f8a745054544463cab93f7c047edf82e(),
-                    new MTHD_8d56c006f8524735a219aef715e2915b(),
-                    new MTHD_366db9c481654c1893289fdadbfc9ce9()}));
-                this.AddMember("DragWindow", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("DragWindow", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_a015deb83c6a460e99e7b23d30a9ce27(),
-                    new MTHD_d95a420f18b24caebe4804203772a93c()}));
-                this.AddMember("get_color", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_color", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_5cfde365fc9a44d5ab5f9004c9eb3e1c()}));
-                this.AddMember("set_color", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_color", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_840ff4ed96944868b48e507d417d79c2()}));
-                this.AddMember("get_backgroundColor", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_backgroundColor", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_61263c7112ba46b0b377738c002b51ba()}));
-                this.AddMember("set_backgroundColor", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_backgroundColor", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_c8b70b1393494308bcba2ff9f0988064()}));
-                this.AddMember("get_contentColor", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_contentColor", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_9e9b42a01e0d4879946b5d57e1db3263()}));
-                this.AddMember("set_contentColor", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_contentColor", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_a4974c93dfae4a6ca9da3b7564481ad0()}));
-                this.AddMember("get_changed", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_changed", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_771c817c019841ba8892aa7d54a3e1e6()}));
-                this.AddMember("set_changed", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_changed", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_3273e7ef715342789f8dfeca0642a4ba()}));
-                this.AddMember("get_enabled", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_enabled", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_b0df5693f5734b9499876ed298632842()}));
-                this.AddMember("set_enabled", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_enabled", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_72945c5471a74395ab60d3cb8f2cef6c()}));
-                this.AddMember("get_depth", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("get_depth", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_ff2c95a623d84a608757fe2131de5877()}));
-                this.AddMember("set_depth", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("set_depth", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_dd21937d0dff4e79af1708e7feff39b4()}));
-                this.AddMember("SetNextControlName", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("SetNextControlName", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_01fdfe2e21124bacb6eb24c117a7316a()}));
-                this.AddMember("GetNameOfFocusedControl", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetNameOfFocusedControl", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_291e7ed7478749498c7890f35ff4e62a()}));
-                this.AddMember("FocusControl", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("FocusControl", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_ddb6755d593b4b05a7cd3749b818ec7d()}));
-                this.AddMember("BringWindowToFront", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("BringWindowToFront", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_05c99b347bb3451f9b20f0420482cd6a()}));
-                this.AddMember("BringWindowToBack", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("BringWindowToBack", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_0c577fc0b47a4f588ee2c487684d1035()}));
-                this.AddMember("FocusWindow", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("FocusWindow", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_51d72fda1df640c58247a268cc3bbd3a()}));
-                this.AddMember("UnfocusWindow", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("UnfocusWindow", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_00e803db927e425aa2159fdf4e5fb782()}));
-                this.AddMember("Equals", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("Equals", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_5e43395d91764cd39ee7b9fba2d80d99()}));
-                this.AddMember("GetHashCode", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetHashCode", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_93eb0210233f4b28838e1e44d9898352()}));
-                this.AddMember("GetType", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("GetType", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_334c503a9f294ea3a7aff047a149abd8()}));
-                this.AddMember("ToString", new MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor("ToString", typeof(UnityEngine.GUI), new MoonSharp.Interpreter.Interop.BasicDescriptors.IOverloadableMemberDescriptor[] {
-                    new MTHD_3404a64c4d9445acad1db0c4116f9940()}));
-                this.AddMember("skin", new PROP_1244d4bee629451db132939e7a8dee6a());
-                this.AddMember("matrix", new PROP_4755d560350549ab96aa54660289d298());
-                this.AddMember("tooltip", new PROP_2d11a077e6ae413da43eb536bf3565b4());
-                this.AddMember("color", new PROP_909cadd017534d238886e8fd78cf0f64());
-                this.AddMember("backgroundColor", new PROP_2e23193897654920bf43e67f13e1dbf2());
-                this.AddMember("contentColor", new PROP_6a0e176046064c8c91484932d15948e8());
-                this.AddMember("changed", new PROP_6beff381ad5e4b3f957076f284eedd0b());
-                this.AddMember("enabled", new PROP_edebaa910ff64a87abc5adc14da6f65e());
-                this.AddMember("depth", new PROP_a74b469170cb41df87613a1694efbb79());
-                this.AddMember("WindowFunction", new DVAL_8390f89f8dc24a968beccaf7bdb2711e());
-                this.AddMember("ClipScope", new DVAL_5c13a88bf4c4402f9a1b0479b8d29829());
-                this.AddMember("ScrollViewScope", new DVAL_5c20d0af4a7e453f9932f8b9e69dc22a());
-                this.AddMember("GroupScope", new DVAL_b0c95be5b473405cb271f71cb80f2797());
-                this.AddMember("Scope", new DVAL_cda7b47dadb640fbb5e4a1ebba04bceb());
-            }
-
-            private sealed class MTHD_7997b672ae2243f9af29ef7443cbaf9f : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_7997b672ae2243f9af29ef7443cbaf9f() {
-                    this.Initialize(".ctor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return new UnityEngine.GUI();
-                }
-            }
-
-            private sealed class MTHD_482527bcce2d4b0c99df694b2d847b1a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_482527bcce2d4b0c99df694b2d847b1a() {
-                    this.Initialize("set_skin", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(UnityEngine.GUISkin), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.skin = ((UnityEngine.GUISkin)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_01a8f7d5c26041f7be6fcd0f46af6ef3 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_01a8f7d5c26041f7be6fcd0f46af6ef3() {
-                    this.Initialize("get_skin", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.skin;
-                }
-            }
-
-            private sealed class MTHD_da173dd5b2cd43d1b0f4fadff96963b4 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_da173dd5b2cd43d1b0f4fadff96963b4() {
-                    this.Initialize("get_matrix", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.matrix;
-                }
-            }
-
-            private sealed class MTHD_db14dc6f3c2f411fbec8ead6ba9ff9d4 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_db14dc6f3c2f411fbec8ead6ba9ff9d4() {
-                    this.Initialize("set_matrix", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(UnityEngine.Matrix4x4), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.matrix = ((UnityEngine.Matrix4x4)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_418bfd26124a4eef859c67d2086c1c66 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_418bfd26124a4eef859c67d2086c1c66() {
-                    this.Initialize("get_tooltip", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.tooltip;
-                }
-            }
-
-            private sealed class MTHD_980323184af242f182df20b76e93d367 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_980323184af242f182df20b76e93d367() {
-                    this.Initialize("set_tooltip", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.tooltip = ((string)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_371e865f066941d991239e6b419065af : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_371e865f066941d991239e6b419065af() {
-                    this.Initialize("Label", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Label(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_3ebc8001f3404e25871a3883bcfc1068 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_3ebc8001f3404e25871a3883bcfc1068() {
-                    this.Initialize("Label", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Label(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_9fe0969a16774acab206e42731f158c6 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_9fe0969a16774acab206e42731f158c6() {
-                    this.Initialize("Label", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Label(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_374cd47a425447a2954399ad2c77735a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_374cd47a425447a2954399ad2c77735a() {
-                    this.Initialize("Label", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Label(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_d6af57e2925e40a08046f8eb72428f41 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_d6af57e2925e40a08046f8eb72428f41() {
-                    this.Initialize("Label", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Label(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_66b5f0f9189349e2a11ede327292e11f : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_66b5f0f9189349e2a11ede327292e11f() {
-                    this.Initialize("Label", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Label(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_93853540c86549409a1da79cca4710fc : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_93853540c86549409a1da79cca4710fc() {
-                    this.Initialize("DrawTexture", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.DrawTexture(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_2cd2066364e147b88b807161c9df86e1 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_2cd2066364e147b88b807161c9df86e1() {
-                    this.Initialize("DrawTexture", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scaleMode", typeof(UnityEngine.ScaleMode), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.DrawTexture(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.ScaleMode)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_39cd6b7c84ce46678e62384a184ee826 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_39cd6b7c84ce46678e62384a184ee826() {
-                    this.Initialize("DrawTexture", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scaleMode", typeof(UnityEngine.ScaleMode), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alphaBlend", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.DrawTexture(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.ScaleMode)(pars[2])), ((bool)(pars[3])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_cba5b81ce5474cda8dfb406018f63728 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_cba5b81ce5474cda8dfb406018f63728() {
-                    this.Initialize("DrawTexture", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scaleMode", typeof(UnityEngine.ScaleMode), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alphaBlend", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("imageAspect", typeof(float), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.DrawTexture(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.ScaleMode)(pars[2])), ((bool)(pars[3])), ((float)(pars[4])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_4e9ff4eb3e0e47d089c59997e28cb3e0 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_4e9ff4eb3e0e47d089c59997e28cb3e0() {
-                    this.Initialize("DrawTextureWithTexCoords", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("texCoords", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.DrawTextureWithTexCoords(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.Rect)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_679121755742435fabbefe7cd9e941dd : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_679121755742435fabbefe7cd9e941dd() {
-                    this.Initialize("DrawTextureWithTexCoords", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("texCoords", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alphaBlend", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.DrawTextureWithTexCoords(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.Rect)(pars[2])), ((bool)(pars[3])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_014d6a93ec924efe8abcebd1b8fb7f44 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_014d6a93ec924efe8abcebd1b8fb7f44() {
-                    this.Initialize("Box", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Box(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_68ebe35d2fbe48cc85ee77b31cddfa3d : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_68ebe35d2fbe48cc85ee77b31cddfa3d() {
-                    this.Initialize("Box", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Box(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_ad50e0d763214013bea3e633681eec54 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_ad50e0d763214013bea3e633681eec54() {
-                    this.Initialize("Box", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Box(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_0fa73ba9fd584136b4fabf88827879b7 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_0fa73ba9fd584136b4fabf88827879b7() {
-                    this.Initialize("Box", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Box(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_2afa847f94f8409882f03b79a7377b24 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_2afa847f94f8409882f03b79a7377b24() {
-                    this.Initialize("Box", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Box(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_b1c0f5bb2fdb45409eeead77db5a7c2b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_b1c0f5bb2fdb45409eeead77db5a7c2b() {
-                    this.Initialize("Box", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.Box(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_1e4d374389cf4847b490435bffffa71c : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1e4d374389cf4847b490435bffffa71c() {
-                    this.Initialize("Button", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Button(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_713ac9b0e8044596a63ce6a28e5fcd46 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_713ac9b0e8044596a63ce6a28e5fcd46() {
-                    this.Initialize("Button", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Button(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_5f3e195d7b3244ee9ccd5c2565f6f573 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_5f3e195d7b3244ee9ccd5c2565f6f573() {
-                    this.Initialize("Button", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Button(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_812a0f12d92f4eaba8a8d727316c924a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_812a0f12d92f4eaba8a8d727316c924a() {
-                    this.Initialize("Button", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Button(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_ac42a6bbbd814ac3a60f41b0db88230a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_ac42a6bbbd814ac3a60f41b0db88230a() {
-                    this.Initialize("Button", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Button(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_a4b2f06761c647d984f7bca008ed4f5a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_a4b2f06761c647d984f7bca008ed4f5a() {
-                    this.Initialize("Button", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Button(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_01b1f46d33154c5dbb4f29f35ae00863 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_01b1f46d33154c5dbb4f29f35ae00863() {
-                    this.Initialize("RepeatButton", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.RepeatButton(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_8a42c2141f8f4e3dbbc1007495738053 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_8a42c2141f8f4e3dbbc1007495738053() {
-                    this.Initialize("RepeatButton", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.RepeatButton(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_51d61dbeed6e42c0ab4a2494aae38fd9 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_51d61dbeed6e42c0ab4a2494aae38fd9() {
-                    this.Initialize("RepeatButton", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.RepeatButton(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_07faaf9bd94f48edb8d01a354072c06f : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_07faaf9bd94f48edb8d01a354072c06f() {
-                    this.Initialize("RepeatButton", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.RepeatButton(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_350941a72b734ea7bf5009e935939677 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_350941a72b734ea7bf5009e935939677() {
-                    this.Initialize("RepeatButton", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.RepeatButton(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_86afc20f3551492896e699e4db0d12a5 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_86afc20f3551492896e699e4db0d12a5() {
-                    this.Initialize("RepeatButton", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.RepeatButton(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_10612ffff3d449bba4571c7163e9aeb8 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_10612ffff3d449bba4571c7163e9aeb8() {
-                    this.Initialize("TextField", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.TextField(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_1bbcedbe6be341689fc410f2f581c472 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1bbcedbe6be341689fc410f2f581c472() {
-                    this.Initialize("TextField", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maxLength", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.TextField(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((int)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_8a718b675a154960b4fddfdadf161524 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_8a718b675a154960b4fddfdadf161524() {
-                    this.Initialize("TextField", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.TextField(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_fef18e910be24dc993450e458bf0c6f8 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_fef18e910be24dc993450e458bf0c6f8() {
-                    this.Initialize("TextField", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maxLength", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.TextField(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((int)(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_58cbe1aba1594db9bfa13746abc92a4f : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_58cbe1aba1594db9bfa13746abc92a4f() {
-                    this.Initialize("PasswordField", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("password", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maskChar", typeof(char), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.PasswordField(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((char)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_1da593bbb8bd49c0a276db5b63ee1ebc : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1da593bbb8bd49c0a276db5b63ee1ebc() {
-                    this.Initialize("PasswordField", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("password", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maskChar", typeof(char), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maxLength", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.PasswordField(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((char)(pars[2])), ((int)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_cadda8f5b94644bf91c3e439e45d6ed6 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_cadda8f5b94644bf91c3e439e45d6ed6() {
-                    this.Initialize("PasswordField", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("password", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maskChar", typeof(char), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.PasswordField(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((char)(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_de22060361ab4912bdc8f539cbd07dc2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_de22060361ab4912bdc8f539cbd07dc2() {
-                    this.Initialize("PasswordField", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("password", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maskChar", typeof(char), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maxLength", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.PasswordField(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((char)(pars[2])), ((int)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_c06699379e94414d887109a3cbedfe24 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_c06699379e94414d887109a3cbedfe24() {
-                    this.Initialize("TextArea", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.TextArea(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_2c34ea08598647e88f0a899f042c1030 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_2c34ea08598647e88f0a899f042c1030() {
-                    this.Initialize("TextArea", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maxLength", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.TextArea(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((int)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_79487df64f8f4e4cb8b96a7a8e748126 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_79487df64f8f4e4cb8b96a7a8e748126() {
-                    this.Initialize("TextArea", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.TextArea(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_815b77cf0d35474c80d092630d7c1726 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_815b77cf0d35474c80d092630d7c1726() {
-                    this.Initialize("TextArea", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maxLength", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.TextArea(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((int)(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_a47a8179511642f7b28574bd73d50ddd : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_a47a8179511642f7b28574bd73d50ddd() {
-                    this.Initialize("Toggle", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toggle(((UnityEngine.Rect)(pars[0])), ((bool)(pars[1])), ((string)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_846d5da676a446e496f952120cd6d3fb : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_846d5da676a446e496f952120cd6d3fb() {
-                    this.Initialize("Toggle", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toggle(((UnityEngine.Rect)(pars[0])), ((bool)(pars[1])), ((UnityEngine.Texture)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_6fd22d5d1f03471bbe556aec22c89459 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_6fd22d5d1f03471bbe556aec22c89459() {
-                    this.Initialize("Toggle", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toggle(((UnityEngine.Rect)(pars[0])), ((bool)(pars[1])), ((UnityEngine.GUIContent)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_490f8eaa16b4493da64b173fb390abd2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_490f8eaa16b4493da64b173fb390abd2() {
-                    this.Initialize("Toggle", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toggle(((UnityEngine.Rect)(pars[0])), ((bool)(pars[1])), ((string)(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_f1a04075f5a24e69a5663d5ac09fc167 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_f1a04075f5a24e69a5663d5ac09fc167() {
-                    this.Initialize("Toggle", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toggle(((UnityEngine.Rect)(pars[0])), ((bool)(pars[1])), ((UnityEngine.Texture)(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_084c1d85bfad40b783a9cb0d3941dc76 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_084c1d85bfad40b783a9cb0d3941dc76() {
-                    this.Initialize("Toggle", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toggle(((UnityEngine.Rect)(pars[0])), ((bool)(pars[1])), ((UnityEngine.GUIContent)(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_44784ac946e24c58b9c3ea512ad4273e : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_44784ac946e24c58b9c3ea512ad4273e() {
-                    this.Initialize("Toggle", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toggle(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((bool)(pars[2])), ((UnityEngine.GUIContent)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_a0b525366b8542c9ad031af0bcfdc07a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_a0b525366b8542c9ad031af0bcfdc07a() {
-                    this.Initialize("Toolbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("texts", typeof(string[]), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toolbar(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((string[])(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_c9a2b4caa123412293ef3a19e0c226c6 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_c9a2b4caa123412293ef3a19e0c226c6() {
-                    this.Initialize("Toolbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("images", typeof(UnityEngine.Texture[]), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toolbar(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((UnityEngine.Texture[])(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_80cceea885624fd2b977d5e5d65b7f08 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_80cceea885624fd2b977d5e5d65b7f08() {
-                    this.Initialize("Toolbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent[]), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toolbar(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((UnityEngine.GUIContent[])(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_b915a0c08fd4429092a6f1bfc02726d5 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_b915a0c08fd4429092a6f1bfc02726d5() {
-                    this.Initialize("Toolbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("texts", typeof(string[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toolbar(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((string[])(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_9a956e17f07b4ac5860ea59c463f53d2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_9a956e17f07b4ac5860ea59c463f53d2() {
-                    this.Initialize("Toolbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("images", typeof(UnityEngine.Texture[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toolbar(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((UnityEngine.Texture[])(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_56d76581a40f4b98b724c7b2d8403087 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_56d76581a40f4b98b724c7b2d8403087() {
-                    this.Initialize("Toolbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("contents", typeof(UnityEngine.GUIContent[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Toolbar(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((UnityEngine.GUIContent[])(pars[2])), ((UnityEngine.GUIStyle)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_35b98725b8834009b1955ef269281842 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_35b98725b8834009b1955ef269281842() {
-                    this.Initialize("SelectionGrid", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("texts", typeof(string[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("xCount", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.SelectionGrid(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((string[])(pars[2])), ((int)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_1e9213be4c744a9aa8bebadc02f9245e : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1e9213be4c744a9aa8bebadc02f9245e() {
-                    this.Initialize("SelectionGrid", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("images", typeof(UnityEngine.Texture[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("xCount", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.SelectionGrid(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((UnityEngine.Texture[])(pars[2])), ((int)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_5e4eeef74288481d9367f34eb8a39427 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_5e4eeef74288481d9367f34eb8a39427() {
-                    this.Initialize("SelectionGrid", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("xCount", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.SelectionGrid(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((UnityEngine.GUIContent[])(pars[2])), ((int)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_b1d28b8974874a188c61f3134dbaad54 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_b1d28b8974874a188c61f3134dbaad54() {
-                    this.Initialize("SelectionGrid", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("texts", typeof(string[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("xCount", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.SelectionGrid(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((string[])(pars[2])), ((int)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_0730241806f242519b22037a25b891ed : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_0730241806f242519b22037a25b891ed() {
-                    this.Initialize("SelectionGrid", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("images", typeof(UnityEngine.Texture[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("xCount", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.SelectionGrid(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((UnityEngine.Texture[])(pars[2])), ((int)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_341b1b0bd21b4773ac41814f45097363 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_341b1b0bd21b4773ac41814f45097363() {
-                    this.Initialize("SelectionGrid", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("selected", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("contents", typeof(UnityEngine.GUIContent[]), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("xCount", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.SelectionGrid(((UnityEngine.Rect)(pars[0])), ((int)(pars[1])), ((UnityEngine.GUIContent[])(pars[2])), ((int)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_e0e74162e6764cedad3f20fa753c08ca : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_e0e74162e6764cedad3f20fa753c08ca() {
-                    this.Initialize("HorizontalSlider", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("leftValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("rightValue", typeof(float), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.HorizontalSlider(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_1e095b5e28084788adea54a3d0b23fc2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1e095b5e28084788adea54a3d0b23fc2() {
-                    this.Initialize("HorizontalSlider", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("leftValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("rightValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("slider", typeof(UnityEngine.GUIStyle), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("thumb", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.HorizontalSlider(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])), ((UnityEngine.GUIStyle)(pars[5])));
-                }
-            }
-
-            private sealed class MTHD_475f6593b37d4c7184211133c34645fd : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_475f6593b37d4c7184211133c34645fd() {
-                    this.Initialize("VerticalSlider", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("topValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("bottomValue", typeof(float), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.VerticalSlider(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_815e6db23a184602937e0ee12f94df2e : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_815e6db23a184602937e0ee12f94df2e() {
-                    this.Initialize("VerticalSlider", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("topValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("bottomValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("slider", typeof(UnityEngine.GUIStyle), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("thumb", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.VerticalSlider(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])), ((UnityEngine.GUIStyle)(pars[5])));
-                }
-            }
-
-            private sealed class MTHD_739a9a7937714d1a9e298f035dcba87b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_739a9a7937714d1a9e298f035dcba87b() {
-                    this.Initialize("Slider", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("size", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("start", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("end", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("slider", typeof(UnityEngine.GUIStyle), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("thumb", typeof(UnityEngine.GUIStyle), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("horiz", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Slider(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])), ((float)(pars[4])), ((UnityEngine.GUIStyle)(pars[5])), ((UnityEngine.GUIStyle)(pars[6])), ((bool)(pars[7])), ((int)(pars[8])));
-                }
-            }
-
-            private sealed class MTHD_023f3df61bf34dd9896b37cdf79e6874 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_023f3df61bf34dd9896b37cdf79e6874() {
-                    this.Initialize("HorizontalScrollbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("size", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("leftValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("rightValue", typeof(float), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.HorizontalScrollbar(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])), ((float)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_eab4aed4d4f0497d954a2c7221034fd0 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_eab4aed4d4f0497d954a2c7221034fd0() {
-                    this.Initialize("HorizontalScrollbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("size", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("leftValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("rightValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.HorizontalScrollbar(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])), ((float)(pars[4])), ((UnityEngine.GUIStyle)(pars[5])));
-                }
-            }
-
-            private sealed class MTHD_7c5eec5c3104400dac39e8779e0a0cd2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_7c5eec5c3104400dac39e8779e0a0cd2() {
-                    this.Initialize("VerticalScrollbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("size", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("topValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("bottomValue", typeof(float), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.VerticalScrollbar(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])), ((float)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_06bfc96502a1485b8f3cbf7276d9e0d2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_06bfc96502a1485b8f3cbf7276d9e0d2() {
-                    this.Initialize("VerticalScrollbar", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("size", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("topValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("bottomValue", typeof(float), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.VerticalScrollbar(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])), ((float)(pars[2])), ((float)(pars[3])), ((float)(pars[4])), ((UnityEngine.GUIStyle)(pars[5])));
-                }
-            }
-
-            private sealed class MTHD_ff978986f0cb48e5a47a4a368976c4cd : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_ff978986f0cb48e5a47a4a368976c4cd() {
-                    this.Initialize("BeginClip", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollOffset", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("renderOffset", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("resetOffset", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginClip(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Vector2)(pars[2])), ((bool)(pars[3])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_a95ee5d08682442e8ebe9463b87d5e17 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_a95ee5d08682442e8ebe9463b87d5e17() {
-                    this.Initialize("BeginClip", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginClip(((UnityEngine.Rect)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_87c81c196d9d44bfa00721c94d106e97 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_87c81c196d9d44bfa00721c94d106e97() {
-                    this.Initialize("BeginGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginGroup(((UnityEngine.Rect)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_dce5ffc11bb745b5bb4eaa3482907b19 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_dce5ffc11bb745b5bb4eaa3482907b19() {
-                    this.Initialize("BeginGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginGroup(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_1939e0b331ba41eda62eab89ca616310 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1939e0b331ba41eda62eab89ca616310() {
-                    this.Initialize("BeginGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginGroup(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_46f0c00c4e74481cbf0916ca17dd7315 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_46f0c00c4e74481cbf0916ca17dd7315() {
-                    this.Initialize("BeginGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginGroup(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_04796f7c887d497f8b921150cc93cde1 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_04796f7c887d497f8b921150cc93cde1() {
-                    this.Initialize("BeginGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginGroup(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIStyle)(pars[1])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_11f993e4b5234e6f8a851f602e70975d : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_11f993e4b5234e6f8a851f602e70975d() {
-                    this.Initialize("BeginGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginGroup(((UnityEngine.Rect)(pars[0])), ((string)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_cd3d484048a74ee6a43b0df783c1ea7e : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_cd3d484048a74ee6a43b0df783c1ea7e() {
-                    this.Initialize("BeginGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginGroup(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Texture)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_0ff20f3249634665bcf62b4147b5e78c : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_0ff20f3249634665bcf62b4147b5e78c() {
-                    this.Initialize("BeginGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BeginGroup(((UnityEngine.Rect)(pars[0])), ((UnityEngine.GUIContent)(pars[1])), ((UnityEngine.GUIStyle)(pars[2])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_1e45011a7e7e4f57b948440b78aa03c0 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_1e45011a7e7e4f57b948440b78aa03c0() {
-                    this.Initialize("EndGroup", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.EndGroup();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_fb86c8e1a2c548b98004c1814a6492de : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_fb86c8e1a2c548b98004c1814a6492de() {
-                    this.Initialize("EndClip", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.EndClip();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_65e3322b2a86472f9ce144b0a90ed87e : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_65e3322b2a86472f9ce144b0a90ed87e() {
-                    this.Initialize("BeginScrollView", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollPosition", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("viewRect", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.BeginScrollView(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Rect)(pars[2])));
-                }
-            }
-
-            private sealed class MTHD_bb61398922d54f048a117f9a223bd464 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_bb61398922d54f048a117f9a223bd464() {
-                    this.Initialize("BeginScrollView", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollPosition", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("viewRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alwaysShowHorizontal", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alwaysShowVertical", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.BeginScrollView(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Rect)(pars[2])), ((bool)(pars[3])), ((bool)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_6589159e62124cd7a48ef56b0fc5eedc : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_6589159e62124cd7a48ef56b0fc5eedc() {
-                    this.Initialize("BeginScrollView", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollPosition", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("viewRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("horizontalScrollbar", typeof(UnityEngine.GUIStyle), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("verticalScrollbar", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.BeginScrollView(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Rect)(pars[2])), ((UnityEngine.GUIStyle)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_8c5d541e1d2340c7abca47e6b863e097 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_8c5d541e1d2340c7abca47e6b863e097() {
-                    this.Initialize("BeginScrollView", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("scrollPosition", typeof(UnityEngine.Vector2), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("viewRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alwaysShowHorizontal", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("alwaysShowVertical", typeof(bool), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("horizontalScrollbar", typeof(UnityEngine.GUIStyle), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("verticalScrollbar", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.BeginScrollView(((UnityEngine.Rect)(pars[0])), ((UnityEngine.Vector2)(pars[1])), ((UnityEngine.Rect)(pars[2])), ((bool)(pars[3])), ((bool)(pars[4])), ((UnityEngine.GUIStyle)(pars[5])), ((UnityEngine.GUIStyle)(pars[6])));
-                }
-            }
-
-            private sealed class MTHD_7498814a79aa46039dc490488cb31525 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_7498814a79aa46039dc490488cb31525() {
-                    this.Initialize("EndScrollView", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.EndScrollView();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_945922530bc04a529dfb6e79c06e2811 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_945922530bc04a529dfb6e79c06e2811() {
-                    this.Initialize("EndScrollView", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("handleScrollWheel", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.EndScrollView(((bool)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_e3cd615b021c483cb7a89af87adf7ae2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_e3cd615b021c483cb7a89af87adf7ae2() {
-                    this.Initialize("ScrollTo", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.ScrollTo(((UnityEngine.Rect)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_9f70601e84884eabbc3a83da7065a547 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_9f70601e84884eabbc3a83da7065a547() {
-                    this.Initialize("ScrollTowards", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("maxDelta", typeof(float), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.ScrollTowards(((UnityEngine.Rect)(pars[0])), ((float)(pars[1])));
-                }
-            }
-
-            private sealed class MTHD_81a6f7bace2f4780a6b83c6e3ddcac38 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_81a6f7bace2f4780a6b83c6e3ddcac38() {
-                    this.Initialize("Window", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Window(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((string)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_2d5bb2dece4c42b2bcf76cb2bff65620 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_2d5bb2dece4c42b2bcf76cb2bff65620() {
-                    this.Initialize("Window", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Window(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((UnityEngine.Texture)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_a5a1fe71dd1846f0a043b6f7d3dc34a8 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_a5a1fe71dd1846f0a043b6f7d3dc34a8() {
-                    this.Initialize("Window", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Window(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((UnityEngine.GUIContent)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_eabc977a56a24d0d81d09ecc9411cdc6 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_eabc977a56a24d0d81d09ecc9411cdc6() {
-                    this.Initialize("Window", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Window(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((string)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_d3f7a360655a4500922b91efd68cc069 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_d3f7a360655a4500922b91efd68cc069() {
-                    this.Initialize("Window", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Window(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((UnityEngine.Texture)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_f4186922da46409bad2d687365d2433c : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_f4186922da46409bad2d687365d2433c() {
-                    this.Initialize("Window", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("title", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.Window(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((UnityEngine.GUIContent)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_791b52b2126241cbaec2a40216d19e6f : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_791b52b2126241cbaec2a40216d19e6f() {
-                    this.Initialize("ModalWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.ModalWindow(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((string)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_e5d0879924164123b30f9fbe82e8062b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_e5d0879924164123b30f9fbe82e8062b() {
-                    this.Initialize("ModalWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.ModalWindow(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((UnityEngine.Texture)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_cbb2123feb914f188f9afda01c0feee6 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_cbb2123feb914f188f9afda01c0feee6() {
-                    this.Initialize("ModalWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.ModalWindow(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((UnityEngine.GUIContent)(pars[3])));
-                }
-            }
-
-            private sealed class MTHD_f8a745054544463cab93f7c047edf82e : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_f8a745054544463cab93f7c047edf82e() {
-                    this.Initialize("ModalWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("text", typeof(string), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.ModalWindow(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((string)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_8d56c006f8524735a219aef715e2915b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_8d56c006f8524735a219aef715e2915b() {
-                    this.Initialize("ModalWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("image", typeof(UnityEngine.Texture), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.ModalWindow(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((UnityEngine.Texture)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_366db9c481654c1893289fdadbfc9ce9 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_366db9c481654c1893289fdadbfc9ce9() {
-                    this.Initialize("ModalWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("id", typeof(int), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("clientRect", typeof(UnityEngine.Rect), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("func", typeof(UnityEngine.GUI.WindowFunction), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("content", typeof(UnityEngine.GUIContent), false, null, false, false, false),
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("style", typeof(UnityEngine.GUIStyle), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.ModalWindow(((int)(pars[0])), ((UnityEngine.Rect)(pars[1])), ((UnityEngine.GUI.WindowFunction)(pars[2])), ((UnityEngine.GUIContent)(pars[3])), ((UnityEngine.GUIStyle)(pars[4])));
-                }
-            }
-
-            private sealed class MTHD_a015deb83c6a460e99e7b23d30a9ce27 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_a015deb83c6a460e99e7b23d30a9ce27() {
-                    this.Initialize("DragWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.DragWindow();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_d95a420f18b24caebe4804203772a93c : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_d95a420f18b24caebe4804203772a93c() {
-                    this.Initialize("DragWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("position", typeof(UnityEngine.Rect), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.DragWindow(((UnityEngine.Rect)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_5cfde365fc9a44d5ab5f9004c9eb3e1c : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_5cfde365fc9a44d5ab5f9004c9eb3e1c() {
-                    this.Initialize("get_color", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.color;
-                }
-            }
-
-            private sealed class MTHD_840ff4ed96944868b48e507d417d79c2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_840ff4ed96944868b48e507d417d79c2() {
-                    this.Initialize("set_color", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(UnityEngine.Color), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.color = ((UnityEngine.Color)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_61263c7112ba46b0b377738c002b51ba : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_61263c7112ba46b0b377738c002b51ba() {
-                    this.Initialize("get_backgroundColor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.backgroundColor;
-                }
-            }
-
-            private sealed class MTHD_c8b70b1393494308bcba2ff9f0988064 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_c8b70b1393494308bcba2ff9f0988064() {
-                    this.Initialize("set_backgroundColor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(UnityEngine.Color), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.backgroundColor = ((UnityEngine.Color)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_9e9b42a01e0d4879946b5d57e1db3263 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_9e9b42a01e0d4879946b5d57e1db3263() {
-                    this.Initialize("get_contentColor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.contentColor;
-                }
-            }
-
-            private sealed class MTHD_a4974c93dfae4a6ca9da3b7564481ad0 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_a4974c93dfae4a6ca9da3b7564481ad0() {
-                    this.Initialize("set_contentColor", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(UnityEngine.Color), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.contentColor = ((UnityEngine.Color)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_771c817c019841ba8892aa7d54a3e1e6 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_771c817c019841ba8892aa7d54a3e1e6() {
-                    this.Initialize("get_changed", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.changed;
-                }
-            }
-
-            private sealed class MTHD_3273e7ef715342789f8dfeca0642a4ba : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_3273e7ef715342789f8dfeca0642a4ba() {
-                    this.Initialize("set_changed", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.changed = ((bool)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_b0df5693f5734b9499876ed298632842 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_b0df5693f5734b9499876ed298632842() {
-                    this.Initialize("get_enabled", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.enabled;
-                }
-            }
-
-            private sealed class MTHD_72945c5471a74395ab60d3cb8f2cef6c : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_72945c5471a74395ab60d3cb8f2cef6c() {
-                    this.Initialize("set_enabled", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(bool), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.enabled = ((bool)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_ff2c95a623d84a608757fe2131de5877 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_ff2c95a623d84a608757fe2131de5877() {
-                    this.Initialize("get_depth", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.depth;
-                }
-            }
-
-            private sealed class MTHD_dd21937d0dff4e79af1708e7feff39b4 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_dd21937d0dff4e79af1708e7feff39b4() {
-                    this.Initialize("set_depth", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("value", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.depth = ((int)(pars[0]));
-                    return null;
-                }
-            }
-
-            private sealed class MTHD_01fdfe2e21124bacb6eb24c117a7316a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_01fdfe2e21124bacb6eb24c117a7316a() {
-                    this.Initialize("SetNextControlName", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("name", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.SetNextControlName(((string)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_291e7ed7478749498c7890f35ff4e62a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_291e7ed7478749498c7890f35ff4e62a() {
-                    this.Initialize("GetNameOfFocusedControl", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return UnityEngine.GUI.GetNameOfFocusedControl();
-                }
-            }
-
-            private sealed class MTHD_ddb6755d593b4b05a7cd3749b818ec7d : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_ddb6755d593b4b05a7cd3749b818ec7d() {
-                    this.Initialize("FocusControl", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("name", typeof(string), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.FocusControl(((string)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_05c99b347bb3451f9b20f0420482cd6a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_05c99b347bb3451f9b20f0420482cd6a() {
-                    this.Initialize("BringWindowToFront", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("windowID", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BringWindowToFront(((int)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_0c577fc0b47a4f588ee2c487684d1035 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_0c577fc0b47a4f588ee2c487684d1035() {
-                    this.Initialize("BringWindowToBack", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("windowID", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.BringWindowToBack(((int)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_51d72fda1df640c58247a268cc3bbd3a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_51d72fda1df640c58247a268cc3bbd3a() {
-                    this.Initialize("FocusWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("windowID", typeof(int), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.FocusWindow(((int)(pars[0])));
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_00e803db927e425aa2159fdf4e5fb782 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_00e803db927e425aa2159fdf4e5fb782() {
-                    this.Initialize("UnfocusWindow", true, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    UnityEngine.GUI.UnfocusWindow();
-                    return MoonSharp.Interpreter.DynValue.Void;
-                }
-            }
-
-            private sealed class MTHD_5e43395d91764cd39ee7b9fba2d80d99 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_5e43395d91764cd39ee7b9fba2d80d99() {
-                    this.Initialize("Equals", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[] {
-                        new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor("obj", typeof(object), false, null, false, false, false)}, false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).Equals(((object)(pars[0])));
-                }
-            }
-
-            private sealed class MTHD_93eb0210233f4b28838e1e44d9898352 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_93eb0210233f4b28838e1e44d9898352() {
-                    this.Initialize("GetHashCode", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetHashCode();
-                }
-            }
-
-            private sealed class MTHD_334c503a9f294ea3a7aff047a149abd8 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_334c503a9f294ea3a7aff047a149abd8() {
-                    this.Initialize("GetType", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).GetType();
-                }
-            }
-
-            private sealed class MTHD_3404a64c4d9445acad1db0c4116f9940 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMethodMemberDescriptor {
-
-                internal MTHD_3404a64c4d9445acad1db0c4116f9940() {
-                    this.Initialize("ToString", false, new MoonSharp.Interpreter.Interop.BasicDescriptors.ParameterDescriptor[0], false);
-                }
-
-                protected override object Invoke(MoonSharp.Interpreter.Script script, object obj, object[] pars, int argscount) {
-                    return ((object)(obj)).ToString();
-                }
-            }
-
-            private sealed class PROP_1244d4bee629451db132939e7a8dee6a : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_1244d4bee629451db132939e7a8dee6a() : 
-                base(typeof(UnityEngine.GUISkin), "skin", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.skin;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.skin = ((UnityEngine.GUISkin)(value));
-                }
-            }
-
-            private sealed class PROP_4755d560350549ab96aa54660289d298 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_4755d560350549ab96aa54660289d298() : 
-                base(typeof(UnityEngine.Matrix4x4), "matrix", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.matrix;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.matrix = ((UnityEngine.Matrix4x4)(value));
-                }
-            }
-
-            private sealed class PROP_2d11a077e6ae413da43eb536bf3565b4 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_2d11a077e6ae413da43eb536bf3565b4() : 
-                base(typeof(string), "tooltip", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.tooltip;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.tooltip = ((string)(value));
-                }
-            }
-
-            private sealed class PROP_909cadd017534d238886e8fd78cf0f64 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_909cadd017534d238886e8fd78cf0f64() : 
-                base(typeof(UnityEngine.Color), "color", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.color;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.color = ((UnityEngine.Color)(value));
-                }
-            }
-
-            private sealed class PROP_2e23193897654920bf43e67f13e1dbf2 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_2e23193897654920bf43e67f13e1dbf2() : 
-                base(typeof(UnityEngine.Color), "backgroundColor", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.backgroundColor;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.backgroundColor = ((UnityEngine.Color)(value));
-                }
-            }
-
-            private sealed class PROP_6a0e176046064c8c91484932d15948e8 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_6a0e176046064c8c91484932d15948e8() : 
-                base(typeof(UnityEngine.Color), "contentColor", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.contentColor;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.contentColor = ((UnityEngine.Color)(value));
-                }
-            }
-
-            private sealed class PROP_6beff381ad5e4b3f957076f284eedd0b : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_6beff381ad5e4b3f957076f284eedd0b() : 
-                base(typeof(bool), "changed", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.changed;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.changed = ((bool)(value));
-                }
-            }
-
-            private sealed class PROP_edebaa910ff64a87abc5adc14da6f65e : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_edebaa910ff64a87abc5adc14da6f65e() : 
-                base(typeof(bool), "enabled", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.enabled;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.enabled = ((bool)(value));
-                }
-            }
-
-            private sealed class PROP_a74b469170cb41df87613a1694efbb79 : MoonSharp.Interpreter.Interop.StandardDescriptors.HardwiredDescriptors.HardwiredMemberDescriptor {
-
-                internal PROP_a74b469170cb41df87613a1694efbb79() : 
-                base(typeof(int), "depth", true, ((MoonSharp.Interpreter.Interop.BasicDescriptors.MemberDescriptorAccess)(3))) {
-                }
-
-                protected override object GetValueImpl(MoonSharp.Interpreter.Script script, object obj) {
-                    return UnityEngine.GUI.depth;
-                }
-
-                protected override void SetValueImpl(MoonSharp.Interpreter.Script script, object obj, object value) {
-                    UnityEngine.GUI.depth = ((int)(value));
-                }
-            }
-
-            private sealed class DVAL_8390f89f8dc24a968beccaf7bdb2711e : MoonSharp.Interpreter.Interop.DynValueMemberDescriptor {
-
-                internal DVAL_8390f89f8dc24a968beccaf7bdb2711e() : 
-                base("WindowFunction") {
-                }
-
-                public override MoonSharp.Interpreter.DynValue Value {
-                    get {
-                        return MoonSharp.Interpreter.UserData.CreateStatic(typeof(UnityEngine.GUI.WindowFunction));
-                    }
-                }
-            }
-
-            private sealed class DVAL_5c13a88bf4c4402f9a1b0479b8d29829 : MoonSharp.Interpreter.Interop.DynValueMemberDescriptor {
-
-                internal DVAL_5c13a88bf4c4402f9a1b0479b8d29829() : 
-                base("ClipScope") {
-                }
-
-                public override MoonSharp.Interpreter.DynValue Value {
-                    get {
-                        return MoonSharp.Interpreter.UserData.CreateStatic(typeof(UnityEngine.GUI.ClipScope));
-                    }
-                }
-            }
-
-            private sealed class DVAL_5c20d0af4a7e453f9932f8b9e69dc22a : MoonSharp.Interpreter.Interop.DynValueMemberDescriptor {
-
-                internal DVAL_5c20d0af4a7e453f9932f8b9e69dc22a() : 
-                base("ScrollViewScope") {
-                }
-
-                public override MoonSharp.Interpreter.DynValue Value {
-                    get {
-                        return MoonSharp.Interpreter.UserData.CreateStatic(typeof(UnityEngine.GUI.ScrollViewScope));
-                    }
-                }
-            }
-
-            private sealed class DVAL_b0c95be5b473405cb271f71cb80f2797 : MoonSharp.Interpreter.Interop.DynValueMemberDescriptor {
-
-                internal DVAL_b0c95be5b473405cb271f71cb80f2797() : 
-                base("GroupScope") {
-                }
-
-                public override MoonSharp.Interpreter.DynValue Value {
-                    get {
-                        return MoonSharp.Interpreter.UserData.CreateStatic(typeof(UnityEngine.GUI.GroupScope));
-                    }
-                }
-            }
-
-            private sealed class DVAL_cda7b47dadb640fbb5e4a1ebba04bceb : MoonSharp.Interpreter.Interop.DynValueMemberDescriptor {
-
-                internal DVAL_cda7b47dadb640fbb5e4a1ebba04bceb() : 
-                base("Scope") {
-                }
-
-                public override MoonSharp.Interpreter.DynValue Value {
-                    get {
-                        return MoonSharp.Interpreter.UserData.CreateStatic(typeof(UnityEngine.GUI.Scope));
-                    }
-                }
-            }
-        }
-        #endregion
-    }
-}

+ 0 - 60
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerKit/BlockingQueue.cs

@@ -1,60 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-
-namespace MoonSharp.DebuggerKit
-{
-	// Taken from http://element533.blogspot.it/2010/01/stoppable-blocking-queue-for-net.html
-	internal class BlockingQueue<T>
-	{
-		private readonly Queue<T> _queue = new Queue<T>();
-		private bool _stopped;
-
-		public bool Enqueue(T item)
-		{
-			if (_stopped)
-				return false;
-			lock (_queue)
-			{
-				if (_stopped)
-					return false;
-				_queue.Enqueue(item);
-				Monitor.Pulse(_queue);
-			}
-			return true;
-		}
-
-		public T Dequeue()
-		{
-			if (_stopped)
-				return default(T);
-			lock (_queue)
-			{
-				if (_stopped)
-					return default(T);
-				while (_queue.Count == 0)
-				{
-					Monitor.Wait(_queue);
-					if (_stopped)
-						return default(T);
-				}
-				return _queue.Dequeue();
-			}
-		}
-
-		public void Stop()
-		{
-			if (_stopped)
-				return;
-			lock (_queue)
-			{
-				if (_stopped)
-					return;
-				_stopped = true;
-				Monitor.PulseAll(_queue);
-			}
-		}
-	}
-}

+ 45 - 36
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerKit/AsyncDebugger.cs → src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerLogic/AsyncDebugger.cs

@@ -7,15 +7,16 @@ using System.Text.RegularExpressions;
 using System.Threading;
 using MoonSharp.Interpreter;
 using MoonSharp.Interpreter.Debugging;
+using MoonSharp.VsCodeDebugger;
 using MoonSharp.VsCodeDebugger.SDK;
 
-namespace MoonSharp.DebuggerKit
+namespace MoonSharp.VsCodeDebugger.DebuggerLogic
 {
 	internal class AsyncDebugger : IDebugger
 	{
-		public bool PauseRequested { get; set; }
+		private static object s_AsyncDebuggerIdLock = new object();
+		private static int s_AsyncDebuggerIdCounter = 0;
 
-		Script m_Script;
 		object m_Lock = new object();
 		private IAsyncDebuggerClient m_Client__;
 		DebuggerAction m_PendingAction = null;
@@ -31,12 +32,25 @@ namespace MoonSharp.DebuggerKit
 
 		public Regex ErrorRegex { get; set; }
 
-		public AsyncDebugger(Script script, Func<SourceCode, string> sourceFinder)
+		public Script Script { get; private set; }
+
+		public bool PauseRequested { get; set; }
+
+		public string Name { get; set; }
+
+		public int Id { get; private set; }
+
+
+		public AsyncDebugger(Script script, Func<SourceCode, string> sourceFinder, string name)
 		{
+			lock (s_AsyncDebuggerIdLock)
+				Id = s_AsyncDebuggerIdCounter++;
+
 			m_SourceFinder = sourceFinder;
 			ErrorRegex = new Regex(@"\A.*\Z");
-			m_Script = script;
+			Script = script;
 			m_WatchItems = new List<WatchItem>[(int)WatchType.MaxValue];
+			Name = name;
 
 			for (int i = 0; i < m_WatchItems.Length; i++)
 				m_WatchItems[i] = new List<WatchItem>(64);
@@ -50,9 +64,14 @@ namespace MoonSharp.DebuggerKit
 			{
 				lock (m_Lock)
 				{
+					if (m_Client__ != null && m_Client__ != value)
+					{
+						m_Client__.Unbind();
+					}
+
 					if (value != null)
 					{
-						for (int i = 0; i < m_Script.SourceCodeCount; i++)
+						for (int i = 0; i < Script.SourceCodeCount; i++)
 							if (m_SourcesMap.ContainsKey(i))
 								value.OnSourceCodeChanged(i);
 					}
@@ -64,46 +83,36 @@ namespace MoonSharp.DebuggerKit
 
 		DebuggerAction IDebugger.GetAction(int ip, SourceRef sourceref)
 		{
-			try
-			{
-				lock (m_Lock)
-					m_InGetActionLoop = true;
+			PauseRequested = false;
 
-				PauseRequested = false;
+			lock (m_Lock)
+				if (Client != null)
+				{
+					Client.SendStopEvent();
+				}
 
+			while (true)
+			{
 				lock (m_Lock)
-					if (Client != null)
+				{
+					if (Client == null)
 					{
-						Client.SendStopEvent();
+						return new DebuggerAction() { Action = DebuggerAction.ActionType.Run };
 					}
 
-				while (true)
-				{
-					lock (m_Lock)
+					if (m_PendingAction != null)
 					{
-						if (Client == null)
-						{
-							return new DebuggerAction() { Action = DebuggerAction.ActionType.Run };
-						}
-
-						if (m_PendingAction != null)
-						{
-							var action = m_PendingAction;
-							m_PendingAction = null;
-							return action;
-						}
+						var action = m_PendingAction;
+						m_PendingAction = null;
+						return action;
 					}
-
-					System.Threading.Thread.Sleep(10);
 				}
-			}
-			finally
-			{
-				lock (m_Lock)
-					m_InGetActionLoop = false;
+
+				System.Threading.Thread.Sleep(10);
 			}
 		}
 
+
 		public void QueueAction(DebuggerAction action)
 		{
 			while (true)
@@ -123,11 +132,11 @@ namespace MoonSharp.DebuggerKit
 		{
 			try
 			{
-				return m_Script.CreateDynamicExpression(code);
+				return Script.CreateDynamicExpression(code);
 			}
 			catch (Exception ex)
 			{
-				return m_Script.CreateConstantDynamicExpression(code, DynValue.NewString(ex.Message));
+				return Script.CreateConstantDynamicExpression(code, DynValue.NewString(ex.Message));
 			}
 		}
 

+ 200 - 0
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerLogic/EmptyDebugSession.cs

@@ -0,0 +1,200 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter;
+using MoonSharp.VsCodeDebugger.SDK;
+
+namespace MoonSharp.VsCodeDebugger.DebuggerLogic
+{
+	internal class EmptyDebugSession : DebugSession
+	{
+		MoonSharpVsCodeDebugServer m_Server;
+
+		internal EmptyDebugSession(MoonSharpVsCodeDebugServer server)
+			: base(true, false)
+		{
+			m_Server = server;
+		}
+
+		public override void Initialize(Response response, Table args)
+		{
+			SendText("Connected to MoonSharp {0} [{1}] on process {2} (PID {3})",
+					 Script.VERSION,
+					 Script.GlobalOptions.Platform.GetPlatformName(),
+					 System.Diagnostics.Process.GetCurrentProcess().ProcessName,
+					 System.Diagnostics.Process.GetCurrentProcess().Id);
+
+			SendText("No script is set as default for debugging; use the debug console to select the script to debug.\n");
+
+			SendList();
+
+			SendResponse(response, new Capabilities()
+			{
+				// This debug adapter does not need the configurationDoneRequest.
+				supportsConfigurationDoneRequest = false,
+
+				// This debug adapter does not support function breakpoints.
+				supportsFunctionBreakpoints = false,
+
+				// This debug adapter doesn't support conditional breakpoints.
+				supportsConditionalBreakpoints = false,
+
+				// This debug adapter does not support a side effect free evaluate request for data hovers.
+				supportsEvaluateForHovers = false,
+
+				// This debug adapter does not support exception breakpoint filters
+				exceptionBreakpointFilters = new object[0]
+			});
+
+			// Debugger is ready to accept breakpoints immediately
+			SendEvent(new InitializedEvent());
+		}
+
+		private void SendList()
+		{
+			int currId = m_Server.CurrentId ?? -1000;
+
+			SendText("==========================================================");
+
+			foreach (var pair in m_Server.GetAttachedDebuggersByIdAndName())
+			{
+				string isdef = (pair.Key == currId) ? " (default)" : "";
+				SendText("{0} : {1}{2}", pair.Key.ToString().PadLeft(9), pair.Value, isdef);
+			}
+			SendText("");
+			SendText("Type the number of the script to debug, or '!' to refresh");
+		}
+
+		public override void Attach(Response response, Table arguments)
+		{
+			SendResponse(response);
+		}
+
+		public override void Continue(Response response, Table arguments)
+		{
+			SendList();
+			SendResponse(response);
+		}
+
+		public override void Disconnect(Response response, Table arguments)
+		{
+			SendResponse(response);
+		}
+
+		private static string getString(Table args, string property, string dflt = null)
+		{
+			var s = (string)args[property];
+			if (s == null)
+			{
+				return dflt;
+			}
+			s = s.Trim();
+			if (s.Length == 0)
+			{
+				return dflt;
+			}
+			return s;
+		}
+
+		public override void Evaluate(Response response, Table args)
+		{
+			var expression = getString(args, "expression");
+			var context = getString(args, "context") ?? "hover";
+
+			if (context == "repl")
+				ExecuteRepl(expression);
+
+			SendResponse(response);
+		}
+
+		private void ExecuteRepl(string cmd)
+		{
+			int id = 0;
+			if (int.TryParse(cmd, out id))
+			{
+				m_Server.CurrentId = id;
+
+				SendText("Re-attach the debugger to debug the selected script.");
+
+				Unbind();
+			}
+			else
+			{
+				SendList();
+			}
+		}
+
+
+		public override void Launch(Response response, Table arguments)
+		{
+			SendResponse(response);
+		}
+
+		public override void Next(Response response, Table arguments)
+		{
+			SendList();
+			SendResponse(response);
+		}
+
+		public override void Pause(Response response, Table arguments)
+		{
+			SendList();
+			SendResponse(response);
+		}
+
+		public override void Scopes(Response response, Table arguments)
+		{
+			SendResponse(response);
+		}
+
+		public override void SetBreakpoints(Response response, Table args)
+		{
+			SendResponse(response);
+		}
+
+		public override void StackTrace(Response response, Table args)
+		{
+			SendResponse(response);
+		}
+
+
+		public override void StepIn(Response response, Table arguments)
+		{
+			SendList();
+			SendResponse(response);
+		}
+
+		public override void StepOut(Response response, Table arguments)
+		{
+			SendList();
+			SendResponse(response);
+		}
+
+		public override void Threads(Response response, Table arguments)
+		{
+			var threads = new List<Thread>() { new Thread(0, "Main Thread") };
+			SendResponse(response, new ThreadsResponseBody(threads));
+		}
+
+
+		public override void Variables(Response response, Table arguments)
+		{
+			SendResponse(response);
+		}
+
+
+		private void SendText(string msg, params object[] args)
+		{
+			msg = string.Format(msg, args);
+			SendEvent(new OutputEvent("console", msg + "\n"));
+		}
+
+
+		public void Unbind()
+		{
+			SendText("Bye.");
+			SendEvent(new TerminatedEvent());
+		}
+	}
+}

+ 2 - 1
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerKit/IAsyncDebuggerClient.cs → src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerLogic/IAsyncDebuggerClient.cs

@@ -5,7 +5,7 @@ using System.Text;
 using MoonSharp.Interpreter;
 using MoonSharp.Interpreter.Debugging;
 
-namespace MoonSharp.DebuggerKit
+namespace MoonSharp.VsCodeDebugger.DebuggerLogic
 {
 	internal interface IAsyncDebuggerClient
 	{
@@ -14,5 +14,6 @@ namespace MoonSharp.DebuggerKit
 		void OnSourceCodeChanged(int sourceID);
 		void OnExecutionEnded();
 		void OnException(ScriptRuntimeException ex);
+		void Unbind();
 	}
 }

+ 49 - 4
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/MoonSharpDebugSession.cs → src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/DebuggerLogic/MoonSharpDebugSession.cs

@@ -4,17 +4,17 @@ using System.IO;
 using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
-using MoonSharp.DebuggerKit;
 using MoonSharp.Interpreter;
 using MoonSharp.Interpreter.Debugging;
 using MoonSharp.VsCodeDebugger.SDK;
 
 
-namespace MoonSharp.VsCodeDebugger
+namespace MoonSharp.VsCodeDebugger.DebuggerLogic
 {
 	internal class MoonSharpDebugSession : DebugSession, IAsyncDebuggerClient
 	{
 		AsyncDebugger m_Debug;
+		MoonSharpVsCodeDebugServer m_Server;
 		List<DynValue> m_Variables = new List<DynValue>();
 		bool m_NotifyExecutionEnd = false;
 
@@ -22,9 +22,10 @@ namespace MoonSharp.VsCodeDebugger
 		const int SCOPE_SELF = 65537;
 
 
-		internal MoonSharpDebugSession(AsyncDebugger debugger)
+		internal MoonSharpDebugSession(MoonSharpVsCodeDebugServer server, AsyncDebugger debugger)
 			: base(true, false)
 		{
+			m_Server = server;
 			m_Debug = debugger;
 		}
 
@@ -36,6 +37,8 @@ namespace MoonSharp.VsCodeDebugger
 					 System.Diagnostics.Process.GetCurrentProcess().ProcessName,
 					 System.Diagnostics.Process.GetCurrentProcess().Id);
 
+			SendText("Debugging script '{0}'; use the debug console to debug another script.", m_Debug.Name);
+
 			SendText("Type '!help' in the Debug Console for available commands.");
 
 			SendResponse(response, new Capabilities()
@@ -163,6 +166,37 @@ namespace MoonSharp.VsCodeDebugger
 
 				SendText("Notifications of execution end are : {0}", m_NotifyExecutionEnd ? "enabled" : "disabled");
 			}
+			else if (cmd == "list")
+			{
+				int currId = m_Server.CurrentId ?? -1000;
+
+				foreach (var pair in m_Server.GetAttachedDebuggersByIdAndName())
+				{
+					string isthis = (pair.Key == m_Debug.Id) ? " (this)" : "";
+					string isdef = (pair.Key == currId) ? " (default)" : "";
+
+					SendText("{0} : {1}{2}{3}", pair.Key.ToString().PadLeft(9), pair.Value, isdef, isthis);
+				}
+			}
+			else if (cmd.StartsWith("select") || cmd.StartsWith("switch"))
+			{
+				string arg = cmd.Substring("switch".Length).Trim();
+
+				try
+				{
+					int id = int.Parse(arg);
+					m_Server.CurrentId = id;
+
+					if (cmd.StartsWith("switch"))
+						Unbind();
+					else
+						SendText("Next time you'll attach the debugger, it will be atteched to script #{0}", id);
+				}
+				catch (Exception ex)
+				{
+					SendText("Error setting regex: {0}", ex.Message);
+				}
+			}
 			else
 			{
 				SendText("Syntax error : {0}\n", cmd);
@@ -173,6 +207,9 @@ namespace MoonSharp.VsCodeDebugger
 			{
 				SendText("Available commands : ");
 				SendText("    !help - gets this help");
+				SendText("    !list - lists the other scripts which can be debugged");
+				SendText("    !select <id> - select another script for future sessions");
+				SendText("    !switch <id> - switch to another script (same as select + disconnect)");
 				SendText("    !seterror <regex> - sets the regex which tells which errors to trap");
 				SendText("    !geterror - gets the current value of the regex which tells which errors to trap");
 				SendText("    !execendnotify [on|off] - sets the notification of end of execution on or off (default = off)");
@@ -395,12 +432,20 @@ namespace MoonSharp.VsCodeDebugger
 		private void SendText(string msg, params object[] args)
 		{
 			msg = string.Format(msg, args);
-			SendEvent(new OutputEvent("console", DateTime.Now.ToString("u") + ": " + msg + "\n"));
+			// SendEvent(new OutputEvent("console", DateTime.Now.ToString("u") + ": " + msg + "\n"));
+			SendEvent(new OutputEvent("console", msg + "\n"));
 		}
 
 		public void OnException(ScriptRuntimeException ex)
 		{
 			SendText("runtime error : {0}", ex.DecoratedMessage);
 		}
+
+		public void Unbind()
+		{
+			SendText("Debug session has been closed by the hosting process.");
+			SendText("Bye.");
+			SendEvent(new TerminatedEvent());
+		}
 	}
 }

+ 241 - 24
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/MoonSharpVsCodeDebugServer.cs

@@ -5,7 +5,8 @@ using System.Linq;
 using System.Net;
 using System.Net.Sockets;
 using System.Text;
-using MoonSharp.DebuggerKit;
+using System.Threading;
+using MoonSharp.VsCodeDebugger.DebuggerLogic;
 using MoonSharp.Interpreter;
 using MoonSharp.Interpreter.Debugging;
 using MoonSharp.VsCodeDebugger.SDK;
@@ -15,76 +16,292 @@ namespace MoonSharp.VsCodeDebugger
 	/// <summary>
 	/// Class implementing a debugger allowing attaching from a Visual Studio Code debugging session.
 	/// </summary>
-	public class MoonSharpVsCodeDebugServer
+	public class MoonSharpVsCodeDebugServer : IDisposable
 	{
+		object m_Lock = new object();
+		List<AsyncDebugger> m_DebuggerList = new List<AsyncDebugger>();
+		AsyncDebugger m_Current = null;
+		ManualResetEvent m_StopEvent = new ManualResetEvent(false);
+		bool m_Started = false;
 		int m_Port;
-		AsyncDebugger m_Debugger;
 
 		/// <summary>
 		/// Initializes a new instance of the <see cref="MoonSharpVsCodeDebugServer" /> class.
 		/// </summary>
+		/// <param name="port">The port on which the debugger listens. It's recommended to use 41912.</param>
+		public MoonSharpVsCodeDebugServer(int port = 41912)
+		{
+			m_Port = port;
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="MoonSharpVsCodeDebugServer" /> class with a default script.
+		/// Note that for this specific script, it will NOT attach the debugger to the script.
+		/// </summary>
 		/// <param name="script">The script object to debug.</param>
 		/// <param name="port">The port on which the debugger listens. It's recommended to use 41912 unless you are going to keep more than one script object around.</param>
 		/// <param name="sourceFinder">A function which gets in input a source code and returns the path to
 		/// source file to use. It can return null and in that case (or if the file cannot be found)
 		/// a temporary file will be generated on the fly.</param>
+		[Obsolete("Use the constructor taking only a port, and the 'Attach' method instead.")]
 		public MoonSharpVsCodeDebugServer(Script script, int port, Func<SourceCode, string> sourceFinder = null)
 		{
 			m_Port = port;
-			m_Debugger = new AsyncDebugger(script, sourceFinder ?? (s => s.Name));
+			m_Current = new AsyncDebugger(script, sourceFinder ?? (s => s.Name), "Default script");
+			m_DebuggerList.Add(m_Current);
+		}
+
+		/// <summary>
+		/// Attaches the specified script to the debugger
+		/// </summary>
+		/// <param name="script">The script.</param>
+		/// <param name="name">The name of the script.</param>
+		/// <param name="sourceFinder">A function which gets in input a source code and returns the path to
+		/// source file to use. It can return null and in that case (or if the file cannot be found)
+		/// a temporary file will be generated on the fly.</param>
+		/// <exception cref="ArgumentException">If the script has already been attached to this debugger.</exception>
+		public void AttachToScript(Script script, string name, Func<SourceCode, string> sourceFinder = null)
+		{
+			lock (m_Lock)
+			{
+				if (m_DebuggerList.Any(d => d.Script == script))
+					throw new ArgumentException("Script already attached to this debugger.");
+
+				var debugger = new AsyncDebugger(script, sourceFinder ?? (s => s.Name), name);
+				script.AttachDebugger(debugger);
+				m_DebuggerList.Add(debugger);
+
+				if (m_Current == null)
+					m_Current = debugger;
+			}
+		}
+
+		/// <summary>
+		/// Gets a list of the attached debuggers by id and name
+		/// </summary>
+		public IEnumerable<KeyValuePair<int, string>> GetAttachedDebuggersByIdAndName()
+		{
+			lock (m_Lock)
+				return m_DebuggerList
+					.OrderBy(d => d.Id)
+					.Select(d => new KeyValuePair<int, string>(d.Id, d.Name))
+					.ToArray();
 		}
 
 
 		/// <summary>
-		/// Gets the debugger object (to register it).
+		/// Gets or sets the current script by ID (see GetAttachedDebuggersByIdAndName). 
+		/// New vscode connections will attach to this debugger ID. Changing the current ID does NOT disconnect
+		/// connected clients.
 		/// </summary>
+		public int? CurrentId
+		{
+			get { lock (m_Lock) return m_Current != null ? m_Current.Id : (int?)null; }
+			set
+			{
+				lock (m_Lock)
+				{
+					if (value == null)
+					{
+						m_Current = null;
+						return;
+					}
+
+					var current = (m_DebuggerList.FirstOrDefault(d => d.Id == value));
+
+					if (current == null)
+						throw new ArgumentException("Cannot find debugger with given Id.");
+
+					m_Current = current;
+				}
+			}
+		}
+
+
+		/// <summary>
+		/// Gets or sets the current script. New vscode connections will attach to this script. Changing the current script does NOT disconnect
+		/// connected clients.
+		/// </summary>
+		public Script Current
+		{
+			get { lock(m_Lock) return m_Current != null ? m_Current.Script : null; }
+			set
+			{
+				lock (m_Lock)
+				{
+					if (value == null)
+					{
+						m_Current = null;
+						return;
+					}
+
+					var current = (m_DebuggerList.FirstOrDefault(d => d.Script == value));
+
+					if (current == null)
+						throw new ArgumentException("Cannot find debugger with given script associated.");
+
+					m_Current = current;
+				}
+			}
+		}
+
+		/// <summary>
+		/// Detaches the specified script. The debugger attached to that script will get disconnected.
+		/// </summary>
+		/// <param name="script">The script.</param>
+		/// <exception cref="ArgumentException">Thrown if the script cannot be found.</exception>
+		public void Detach(Script script)
+		{
+			lock (m_Lock)
+			{
+				var removed = m_DebuggerList.FirstOrDefault(d => d.Script == script);
+
+				if (removed == null)
+					throw new ArgumentException("Cannot detach script - not found.");
+
+				removed.Client = null;
+
+				m_DebuggerList.Remove(removed);
+
+				if (m_Current == removed)
+				{
+					if (m_DebuggerList.Count > 0)
+						m_Current = m_DebuggerList[m_DebuggerList.Count - 1];
+					else
+						m_Current = null;
+				}
+
+			}
+		}
+
+		/// <summary>
+		/// Gets or sets a delegate which will be called when logging messages are generated
+		/// </summary>
+		public Action<string> Logger { get; set; }
+
+		
+		/// <summary>
+		/// Gets the debugger object. Obsolete, use the new interface using the Attach method instead.
+		/// </summary>
+		[Obsolete("Use the Attach method instead.")]
 		public IDebugger GetDebugger()
 		{
-			return m_Debugger;
+			lock(m_Lock)
+				return m_Current;
 		}
 
-		private void RunSession(Stream inputStream, Stream outputStream)
+		/// <summary>
+		/// Stops listening
+		/// </summary>
+		/// <exception cref="InvalidOperationException">Cannot stop; server was not started.</exception>
+		public void Dispose()
 		{
-			MoonSharpDebugSession debugSession = new MoonSharpDebugSession(m_Debugger);
-			//debugSession.TRACE = trace_requests;
-			//debugSession.TRACE_RESPONSE = trace_responses;
-			debugSession.ProcessLoop(inputStream, outputStream);
+			m_StopEvent.Set();
 		}
 
 		/// <summary>
 		/// Starts listening on the localhost for incoming connections.
 		/// </summary>
-		public void Start()
+		public MoonSharpVsCodeDebugServer Start()
 		{
-			TcpListener serverSocket = new TcpListener(IPAddress.Parse("127.0.0.1"), m_Port);
-			serverSocket.Start();
+			lock (m_Lock)
+			{
+				if (m_Started)
+					throw new InvalidOperationException("Cannot start; server has already been started.");
+
+				m_StopEvent.Reset();
 
-			new System.Threading.Thread(() => {
-				while (true)
+				TcpListener serverSocket = null;
+				serverSocket = new TcpListener(IPAddress.Parse("127.0.0.1"), m_Port);
+				serverSocket.Start();
+
+				SpawnThread("VsCodeDebugServer_" + m_Port.ToString(), () => ListenThread(serverSocket));
+
+				m_Started = true;
+
+				return this;
+			}
+		}
+
+
+		private void ListenThread(TcpListener serverSocket)
+		{
+			try
+			{
+				while (!m_StopEvent.WaitOne(0))
 				{
 					var clientSocket = serverSocket.AcceptSocket();
 					if (clientSocket != null)
 					{
-						Console.Error.WriteLine(">> accepted connection from client");
+						string sessionId = Guid.NewGuid().ToString("N");
+						Log("[{0}] : Accepted connection from client {1}", sessionId, clientSocket.RemoteEndPoint);
 
-						new System.Threading.Thread(() => {
+						SpawnThread("VsCodeDebugSession_" + sessionId, () =>
+						{
 							using (var networkStream = new NetworkStream(clientSocket))
 							{
 								try
 								{
-									RunSession(networkStream, networkStream);
+									RunSession(sessionId, networkStream);
 								}
-								catch (Exception e)
+								catch (Exception ex)
 								{
-									Console.Error.WriteLine("Exception: " + e);
+									Log("[{0}] : Error : {1}", ex.Message);
 								}
 							}
 							clientSocket.Close();
-							Console.Error.WriteLine(">> client connection closed");
-						}).Start();
+							Log("[{0}] : Client connection closed", sessionId);
+						});
 					}
 				}
-			}).Start();
+			}
+			catch (Exception e)
+			{
+				Log("Fatal error in listening thread : {0}", e.Message);
+			}
+			finally
+			{
+				if (serverSocket != null)
+					serverSocket.Stop();
+			}
+		}
+
+
+		private void RunSession(string sessionId, NetworkStream stream)
+		{
+			DebugSession debugSession = null;
+
+			lock (m_Lock)
+			{
+				if (m_Current != null)
+					debugSession = new MoonSharpDebugSession(this, m_Current);
+				else
+					debugSession = new EmptyDebugSession(this);
+			}
+
+			debugSession.ProcessLoop(stream, stream);
+		}
+
+		private void Log(string format, params object[] args)
+		{
+			Action<string> logger = Logger;
+
+			if (logger != null)
+			{
+				string msg = string.Format(format, args);
+				logger(msg);
+			}
+		}
+
+
+		private static void SpawnThread(string name, Action threadProc)
+		{
+			new System.Threading.Thread(() => threadProc())
+			{
+				IsBackground = true,
+				Name = name
+			}
+			.Start();
 		}
 	}
 }

+ 23 - 2
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/SDK/DebugSession.cs

@@ -1,6 +1,27 @@
 /*---------------------------------------------------------------------------------------------
- *  Copyright (c) Microsoft Corporation. All rights reserved.
- *  Licensed under the MIT License. See License.txt in the project root for license information.
+Copyright (c) Microsoft Corporation
+
+All rights reserved. 
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
  *--------------------------------------------------------------------------------------------*/
 using System;
 using System.Collections.Generic;

+ 23 - 2
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/SDK/Protocol.cs

@@ -1,6 +1,27 @@
 /*---------------------------------------------------------------------------------------------
- *  Copyright (c) Microsoft Corporation. All rights reserved.
- *  Licensed under the MIT License. See License.txt in the project root for license information.
+Copyright (c) Microsoft Corporation
+
+All rights reserved. 
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
  *--------------------------------------------------------------------------------------------*/
 using System;
 using System.Text;

+ 24 - 3
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Debugger/SDK/Utilities.cs

@@ -1,6 +1,27 @@
 /*---------------------------------------------------------------------------------------------
- *  Copyright (c) Microsoft Corporation. All rights reserved.
- *  Licensed under the MIT License. See License.txt in the project root for license information.
+Copyright (c) Microsoft Corporation
+
+All rights reserved. 
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
  *--------------------------------------------------------------------------------------------*/
 using System;
 using System.Net;
@@ -11,7 +32,7 @@ using System.Reflection;
 
 namespace MoonSharp.VsCodeDebugger.SDK
 {
-	public class Utilities
+	internal class Utilities
 	{
 		private static readonly Regex VARIABLE = new Regex(@"\{(\w+)\}");
 

+ 9 - 6
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/AsyncExtensions.cs

@@ -79,12 +79,13 @@ namespace MoonSharp.Interpreter
 		/// <param name="script">The script.</param>
 		/// <param name="code">The code.</param>
 		/// <param name="globalContext">The global context.</param>
+		/// <param name="codeFriendlyName">Name of the code - used to report errors, etc. Also used by debuggers to locate the original source file.</param>
 		/// <returns>
 		/// A DynValue containing the result of the processing of the loaded chunk.
 		/// </returns>
-		public static Task<DynValue> DoString(this Script script, string code, Table globalContext = null)
+		public static Task<DynValue> DoStringAsync(this Script script, string code, Table globalContext = null, string codeFriendlyName = null)
 		{
-			return ExecAsync(() => script.DoString(code, globalContext));
+			return ExecAsync(() => script.DoString(code, globalContext, codeFriendlyName));
 		}
 
 
@@ -96,12 +97,13 @@ namespace MoonSharp.Interpreter
 		/// <param name="script">The script.</param>
 		/// <param name="stream">The stream.</param>
 		/// <param name="globalContext">The global context.</param>
+		/// <param name="codeFriendlyName">Name of the code - used to report errors, etc. Also used by debuggers to locate the original source file.</param>
 		/// <returns>
 		/// A DynValue containing the result of the processing of the loaded chunk.
 		/// </returns>
-		public static Task<DynValue> DoStreamAsync(this Script script, Stream stream, Table globalContext = null)
+		public static Task<DynValue> DoStreamAsync(this Script script, Stream stream, Table globalContext = null, string codeFriendlyName = null)
 		{
-			return ExecAsync(() => script.DoStream(stream, globalContext));
+			return ExecAsync(() => script.DoStream(stream, globalContext, codeFriendlyName));
 		}
 
 
@@ -113,12 +115,13 @@ namespace MoonSharp.Interpreter
 		/// <param name="script">The script.</param>
 		/// <param name="filename">The filename.</param>
 		/// <param name="globalContext">The global context.</param>
+		/// <param name="codeFriendlyName">Name of the code - used to report errors, etc. Also used by debuggers to locate the original source file.</param>
 		/// <returns>
 		/// A DynValue containing the result of the processing of the loaded chunk.
 		/// </returns>
-		public static Task<DynValue> DoFile(this Script script, string filename, Table globalContext = null)
+		public static Task<DynValue> DoFileAsync(this Script script, string filename, Table globalContext = null, string codeFriendlyName = null)
 		{
-			return ExecAsync(() => script.DoFile(filename, globalContext));
+			return ExecAsync(() => script.DoFile(filename, globalContext, codeFriendlyName));
 		}
 
 		/// <summary>

+ 11 - 0
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Debugging/SourceRef.cs

@@ -51,6 +51,17 @@ namespace MoonSharp.Interpreter.Debugging
 			return new SourceRef(0, 0, 0, 0, 0, false) { IsClrLocation = true };
 		}
 
+		public SourceRef(SourceRef src, bool isStepStop)
+		{
+			SourceIdx = src.SourceIdx;
+			FromChar = src.FromChar;
+			ToChar = src.ToChar;
+			FromLine = src.FromLine;
+			ToLine = src.ToLine;
+			IsStepStop = isStepStop;
+		}
+
+
 		public SourceRef(int sourceIdx, int from, int to, int fromline, int toline, bool isStepStop)
 		{
 			SourceIdx = sourceIdx;

+ 2 - 0
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Execution/VM/Processor/Processor_Debugger.cs

@@ -74,6 +74,8 @@ namespace MoonSharp.Interpreter.Execution.VM
 			switch (m_Debug.DebuggerCurrentAction)
 			{
 				case DebuggerAction.ActionType.Run:
+					if (m_Debug.LineBasedBreakPoints)
+						m_Debug.LastHlRef = instr.SourceCodeRef;
 					return;
 				case DebuggerAction.ActionType.ByteCodeStepOver:
 					if (m_Debug.DebuggerCurrentActionTarget != instructionPtr) return;

+ 1 - 1
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/IO/BinDumpBinaryReader.cs

@@ -7,7 +7,7 @@ namespace MoonSharp.Interpreter.IO
 	/// <summary>
 	/// "Optimized" BinaryReader which shares strings and use a dumb compression for integers
 	/// </summary>
-	internal class BinDumpBinaryReader : BinaryReader
+	public class BinDumpBinaryReader : BinaryReader
 	{
 		public BinDumpBinaryReader(Stream s) : base(s) { }
 		public BinDumpBinaryReader(Stream s, Encoding e) : base(s, e) { }

+ 1 - 1
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/IO/BinDumpBinaryWriter.cs

@@ -7,7 +7,7 @@ namespace MoonSharp.Interpreter.IO
 	/// <summary>
 	/// "Optimized" BinaryWriter which shares strings and use a dumb compression for integers
 	/// </summary>
-	internal class BinDumpBinaryWriter : BinaryWriter
+	public class BinDumpBinaryWriter : BinaryWriter
 	{
 		Dictionary<string, int> m_StringMap = new Dictionary<string, int>();
 

+ 1 - 1
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/IO/UndisposableStream.cs

@@ -8,7 +8,7 @@ namespace MoonSharp.Interpreter.IO
 	/// Used to work around the pesky wrappers .NET has over Stream (BinaryReader, StreamWriter, etc.) which think they
 	/// own the Stream and close them when they shouldn't. Damn.
 	/// </summary>
-	internal class UndisposableStream : Stream
+	public class UndisposableStream : Stream
 	{
 		Stream m_Stream;
 

+ 4 - 0
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/DescriptorHelpers.cs

@@ -41,6 +41,10 @@ namespace MoonSharp.Interpreter.Interop
 				return null;
 		}
 
+		public static bool IsDelegateType(this Type t)
+		{
+			return typeof(Delegate).IsAssignableFrom(t);
+		}
 
 		/// <summary>
 		/// Gets the visibility of the type as a string

+ 12 - 9
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Interop/StandardDescriptors/StandardUserDataDescriptor.cs

@@ -56,18 +56,21 @@ namespace MoonSharp.Interpreter.Interop
 			if (AccessMode == InteropAccessMode.HideMembers)
 				return;
 
-			// add declared constructors
-			foreach (ConstructorInfo ci in type.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
+			if (!type.IsDelegateType())
 			{
-				if (membersToIgnore.Contains("__new"))
-					continue;
+				// add declared constructors
+				foreach (ConstructorInfo ci in type.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
+				{
+					if (membersToIgnore.Contains("__new"))
+						continue;
 
-				AddMember("__new", MethodMemberDescriptor.TryCreateIfVisible(ci, this.AccessMode));
-			}
+					AddMember("__new", MethodMemberDescriptor.TryCreateIfVisible(ci, this.AccessMode));
+				}
 
-			// valuetypes don't reflect their empty ctor.. actually empty ctors are a perversion, we don't care and implement ours
-			if (type.IsValueType && !membersToIgnore.Contains("__new"))
-				AddMember("__new", new ValueTypeDefaultCtorMemberDescriptor(type));
+				// valuetypes don't reflect their empty ctor.. actually empty ctors are a perversion, we don't care and implement ours
+				if (type.IsValueType && !membersToIgnore.Contains("__new"))
+					AddMember("__new", new ValueTypeDefaultCtorMemberDescriptor(type));
+			}
 
 
 			// add methods to method list and metamethods

+ 28 - 1
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Loaders/UnityAssetsScriptLoader.cs

@@ -30,10 +30,14 @@ namespace MoonSharp.Interpreter.Loaders
 		public UnityAssetsScriptLoader(string assetsPath = null)
 		{
 			assetsPath = assetsPath ?? DEFAULT_PATH;
+#if UNITY_5
+                LoadResourcesUnityNative(assetsPath);
+#else
 			LoadResourcesWithReflection(assetsPath);
+#endif
 		}
 
-		 
+
 		/// <summary>
 		/// Initializes a new instance of the <see cref="UnityAssetsScriptLoader"/> class.
 		/// </summary>
@@ -43,6 +47,29 @@ namespace MoonSharp.Interpreter.Loaders
 			m_Resources = scriptToCodeMap;
 		}
 
+#if UNITY_5
+        void LoadResourcesUnityNative(string assetsPath)
+        {
+            try
+            {
+                UnityEngine.Object[] array = UnityEngine.Resources.LoadAll(assetsPath, typeof(UnityEngine.TextAsset));
+
+                for (int i = 0; i < array.Length; i++)
+                {
+                    UnityEngine.TextAsset o = (UnityEngine.TextAsset)array[i];
+
+                    string name = o.name;
+                    string text = o.text;
+
+                    m_Resources.Add(name, text);
+                }
+            }
+            catch (Exception ex)
+            {
+                UnityEngine.Debug.LogErrorFormat("Error initializing UnityScriptLoader : {0}", ex);
+            }
+        }
+#endif
 
 		void LoadResourcesWithReflection(string assetsPath)
 		{

+ 15 - 3
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/PlatformAccessorBase.cs

@@ -27,10 +27,22 @@ namespace MoonSharp.Interpreter.Platforms
 
 			if (PlatformAutoDetector.IsRunningOnUnity)
 			{
-				if (PlatformAutoDetector.IsRunningOnMono)
-					suffix = "unity.mono";
+				if (PlatformAutoDetector.IsUnityNative)
+				{
+					if (PlatformAutoDetector.IsUnityIL2CPP)
+						suffix = "unity5.il2cpp";
+					else if (PlatformAutoDetector.IsRunningOnMono)
+						suffix = "unity5.mono";
+					else
+						suffix = "unity5.webp";
+				}
 				else
-					suffix = "unity.webp";
+				{
+					if (PlatformAutoDetector.IsRunningOnMono)
+						suffix = "unity.dll.mono";
+					else
+						suffix = "unity.dll.webp";
+				}
 			}
 			else if (PlatformAutoDetector.IsRunningOnMono)
 				suffix = "mono";

+ 19 - 2
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Platforms/PlatformAutoDetector.cs

@@ -30,6 +30,14 @@ namespace MoonSharp.Interpreter.Platforms
 		/// Gets a value indicating whether this instance has been built as a Portable Class Library
 		/// </summary>
 		public static bool IsPortableFramework { get; private set; }
+		/// <summary>
+		/// Gets a value indicating whether this instance has been compiled natively in Unity (as opposite to importing a DLL).
+		/// </summary>
+		public static bool IsUnityNative { get; private set; }
+		/// <summary>
+		/// Gets a value indicating whether this instance has been compiled natively in Unity AND is using IL2CPP
+		/// </summary>
+		public static bool IsUnityIL2CPP { get; private set; }
 
 
 		/// <summary>
@@ -41,8 +49,8 @@ namespace MoonSharp.Interpreter.Platforms
 			// We do a lazy eval here, so we can wire out this code by not calling it, if necessary..
 			get
 			{
-#if UNITY_WEBGL
-				return false;
+#if UNITY_WEBGL || UNITY_IOS || UNITY_TVOS || ENABLE_IL2CPP
+				return true;
 #else
 
 				if (!m_IsRunningOnAOT.HasValue)
@@ -71,11 +79,20 @@ namespace MoonSharp.Interpreter.Platforms
 				return;
 #if PCL
 			IsPortableFramework = true;
+#else
+#if UNITY_5
+			IsRunningOnUnity = true;
+			IsUnityNative = true;
+
+			#if ENABLE_IL2CPP
+				IsUnityIL2CPP = true;
+			#endif
 #else
 			IsRunningOnUnity = AppDomain.CurrentDomain
 				.GetAssemblies()
 				.SelectMany(a => a.SafeGetTypes())
 				.Any(t => t.FullName.StartsWith("UnityEngine."));
+#endif
 #endif
 
 			IsRunningOnMono = (Type.GetType("Mono.Runtime") != null);

+ 1 - 1
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Script.cs

@@ -22,7 +22,7 @@ namespace MoonSharp.Interpreter
 		/// <summary>
 		/// The version of the MoonSharp engine
 		/// </summary>
-		public const string VERSION = "1.8.0.0";
+		public const string VERSION = "1.8.5.0";
 
 		/// <summary>
 		/// The Lua version being supported

+ 8 - 2
src/Unity/MoonSharp/Assets/Plugins/MoonSharp/Interpreter/Tree/Statements/FunctionCallStatement.cs

@@ -1,4 +1,5 @@
-using MoonSharp.Interpreter.Execution;
+using System;
+using MoonSharp.Interpreter.Execution;
 using MoonSharp.Interpreter.Execution.VM;
 using MoonSharp.Interpreter.Tree.Expressions;
 
@@ -21,8 +22,13 @@ namespace MoonSharp.Interpreter.Tree.Statements
 			using (bc.EnterSource(m_FunctionCallExpression.SourceRef))
 			{
 				m_FunctionCallExpression.Compile(bc);
-				bc.Emit_Pop();
+				RemoveBreakpointStop(bc.Emit_Pop());
 			}
 		}
+
+		private void RemoveBreakpointStop(Instruction instruction)
+		{
+			instruction.SourceCodeRef = null;
+		}
 	}
 }

+ 54 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/000-sanity.t.txt

@@ -0,0 +1,54 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua test suite
+
+=head2 Synopsis
+
+    % prove 000-sanity.t
+
+=head2 Description
+
+=cut
+
+]]
+
+function f (n)
+    return n + 1
+end
+
+function g (m, p)
+    return m + p
+end
+
+print('1..9')
+print("ok 1 -")
+print('ok', 2, "- list")
+print("ok " .. 3 .. " - concatenation")
+i = 4
+print("ok " .. i .. " - var")
+i = i + 1
+print("ok " .. i .. " - var incr")
+print("ok " .. i+1 .. " - expr")
+j = f(i + 1)
+print("ok " .. j .. " - call f")
+k = g(i, 3)
+print("ok " .. k .. " - call g")
+local print = print
+print("ok 9 - local")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 87 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/001-if.t.txt

@@ -0,0 +1,87 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua if statement
+
+=head2 Synopsis
+
+    % prove 001-if.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..6")
+
+if true then
+    print("ok 1")
+else
+    print("not ok 1")
+end
+
+if not true then
+    print("not ok 2")
+else
+    print("ok 2")
+end
+
+a = 12
+b = 34
+if a < b then
+    print("ok 3")
+else
+    print("not ok 3")
+end
+
+a = 0
+b = 4
+if a < b then
+    print("ok 4")
+elseif a == b then
+    print("not ok 4")
+else
+    print("not ok 4")
+end
+
+a = 5
+b = 5
+if a < b then
+    print("not ok 5")
+elseif a == b then
+    print("ok 5")
+else
+    print("not ok 5")
+end
+
+a = 10
+b = 6
+if a < b then
+    print("not ok 6")
+elseif a == b then
+    print("not ok 6")
+else
+    print("ok 6")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 67 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/002-table.t.txt

@@ -0,0 +1,67 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua table
+
+=head2 Synopsis
+
+    % prove 002-table.t
+
+=head2 Description
+
+See "Programming in Lua", section 2.5 "Tables".
+
+=cut
+
+]]
+
+print("1..8")
+
+a = {"ok 1", "ok 2", "ok 3"}
+print(a[1])
+i = 2
+print(a[i])
+print(a[i+1])
+if #a == 3 then
+    print("ok 4 - len")
+else
+    print("not ok 4")
+end
+if a[7] == nil then
+    print("ok 5")
+else
+    print("not ok 5")
+end
+
+t = {a=10, b=100}
+if t['a'] == 10 then
+    print("ok 6")
+else
+    print("not ok 6")
+end
+if t.b == 100 then
+    print("ok 7")
+else
+    print("not ok 7")
+end
+if t.z == nil then
+    print("ok 8")
+else
+    print("not ok 8")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 80 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/011-while.t.txt

@@ -0,0 +1,80 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua while statement
+
+=head2 Synopsis
+
+    % prove 011-while.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..11")
+
+a = {}
+local i = 1
+while a[i] do
+    i = i + 1
+end
+if i == 1 then
+    print("ok 1 - while empty")
+else
+    print("not ok 1 - " .. i)
+end
+
+a = {"ok 2 - while ", "ok 3", "ok 4"}
+local i = 1
+while a[i] do
+    print(a[i])
+    i = i + 1
+end
+
+a = {"ok 5 - with break", "ok 6", "stop", "more"}
+local i = 1
+while a[i] do
+    if a[i] == 'stop' then break end
+    print(a[i])
+    i = i + 1
+end
+if i == 3 then
+    print("ok 7 - break")
+else
+    print("not ok 7 - " .. i)
+end
+
+x = 3
+local i = 1
+while i<=x do
+    print("ok " .. 7+i)
+    i = i + 1
+end
+if i == 4 then
+    print("ok 11")
+else
+    print("not ok 11 - " .. i)
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 78 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/012-repeat.t.txt

@@ -0,0 +1,78 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua repeat statement
+
+=head2 Synopsis
+
+    % prove 012-repeat.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.4 "Control Structures",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.4>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+]]
+
+print("1..8")
+
+a = {"ok 1 - repeat", "ok 2", "ok 3"}
+local i = 0
+repeat
+    i = i + 1
+    if a[i] then
+        print(a[i])
+    end
+until not a[i]
+if i == 4 then
+    print("ok 4")
+else
+    print("not ok 4 - " .. i)
+end
+
+a = {"ok 5 - with break", "ok 6", 'stop', 'more'}
+local i = 0
+repeat
+    i = i + 1
+    if a[i] == 'stop' then break end
+    print(a[i])
+until not a[i]
+if a[i] == 'stop' then
+    print("ok 7 - break")
+else
+    print("not ok 7 - " .. a[i])
+end
+
+function f () return true end
+
+local i = 1
+repeat
+    local v = f()
+    if i == 1 then
+        print("ok 8 - scope")
+    else
+        print("not ok")
+        break
+    end
+    i = i + 1
+until v
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 136 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/014-fornum.t.txt

@@ -0,0 +1,136 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua for statement
+
+=head2 Synopsis
+
+    % prove 014-fornum.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.5 "For Statement",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.5>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+--]]
+
+print("1..36")
+
+for i = 1, 10, 2 do
+    print("ok " .. (i+1)/2 .. " - for 1, 10, 2")
+end
+
+for i = 1, 10, 2 do
+    function f ()
+        print("ok " .. (i+11)/2 .. " - for 1, 10, 2 lex")
+    end
+    f()
+end
+
+function f (i)
+    print("ok " .. (i+21)/2 .. " - for 1, 10, 2 !lex")
+end
+for i = 1, 10, 2 do
+    f(i)
+end
+
+for i = 3, 5 do
+    print("ok " .. 13+i .. " - for 3, 5")
+    i = i + 1
+end
+
+for i = 5, 1, -1 do
+    print("ok " .. 24-i .. " - for 5, 1, -1")
+end
+
+for i = 5, 5 do
+    print("ok " .. 19+i .. " - for 5, 5")
+end
+
+for i = 5, 5, -1 do
+    print("ok " .. 20+i .. " - for 5, 5, -1")
+end
+
+v = false
+for i = 5, 3 do
+    v = true
+end
+if v then
+    print("not ok 26 - for 5, 3")
+else
+    print("ok 26 - for 5, 3")
+end
+
+v = false
+for i = 5, 7, -1 do
+    v = true
+end
+if v then
+    print("not ok 27 - for 5, 7, -1")
+else
+    print("ok 27 - for 5, 7, -1")
+end
+
+v = false
+for i = 5, 7, 0 do
+    v = true
+    break -- avoid infinite loop with luajit
+end
+if jit then
+    print("not ok 28 - for 5, 7, 0 # TODO # LuaJIT intentional.")
+elseif v then
+    print("not ok 28 - for 5, 7, 0")
+else
+    print("ok 28 - for 5, 7, 0")
+end
+
+v = nil
+for i = 1, 10, 2 do
+    if i > 4 then break end
+    print("ok " .. (i+57)/2 .. " - for break")
+    v = i
+end
+if v == 3 then
+    print("ok 31 - break")
+else
+    print("not ok 31 - " .. v)
+end
+
+local function first() return 1 end
+local function limit() return 8 end
+local function step()  return 2 end
+for i = first(), limit(), step() do
+    print("ok " .. (i+63)/2 .. " - with functions")
+end
+
+local a = {}
+for i = 1, 10 do
+    a[i] = function () return i end
+end
+local v = a[5]()
+if v == 5 then
+    print("ok 36 - for & upval")
+else
+    print("not ok 36 - for & upval")
+    print("#", v)
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 99 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/015-forlist.t.txt

@@ -0,0 +1,99 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua for statement
+
+=head2 Synopsis
+
+    % prove 015-forlist.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.5 "For Statement",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.5>.
+
+See "Programming in Lua", section 4.3 "Control Structures".
+
+=cut
+
+--]]
+
+print("1..18")
+
+a = {"ok 1 - for ipairs", "ok 2 - for ipairs", "ok 3 - for ipairs"}
+for _, v in ipairs(a) do
+    print(v)
+end
+for i, v in ipairs(a) do
+    print("ok " .. 3+i .. " - for ipairs")
+end
+
+r = false
+t = {a=10, b=100}
+for i, v in ipairs(t) do
+    print(i, v)
+    r = true
+end
+if r then
+    print("not ok 7 - for ipairs (hash)")
+else
+    print("ok 7 - for ipairs (hash)")
+end
+
+for k in pairs(a) do
+    print("ok " .. 7+k .. " - for pairs")
+end
+
+local i = 1
+for k in pairs(t) do
+    if k == 'a' or k == 'b' then
+        print("ok " .. 10+i .. " - for pairs (hash)")
+    else
+        print("not ok " .. 10+i .. " - " .. k)
+    end
+    i = i + 1
+end
+
+a = {"ok 13 - for break", "ok 14 - for break", "stop", "more"}
+local i
+for _, v in ipairs(a) do
+    if v == "stop" then break end
+    print(v)
+    i = _
+end
+if i == 2 then
+    print("ok 15 - break")
+else
+    print("not ok 15 - " .. i)
+end
+
+local a = {"ok 16 - for & upval", "ok 17 - for & upval", "ok 18 - for & upval"}
+local b = {}
+for i, v in ipairs(a) do
+    b[i] = function () return v end
+end
+for i, v in ipairs(a) do
+    local r = b[i]()
+    if r == a[i] then
+        print(r)
+    else
+        print("not " .. a[i])
+        print("#", r)
+    end
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 120 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/101-boolean.t.txt

@@ -0,0 +1,120 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1  Lua boolean & coercion
+
+=head2 Synopsis
+
+    % prove 101-boolean.t
+
+=head2 Description
+
+=cut
+
+]]
+
+require 'Test.More'
+
+plan(24)
+
+error_like(function () return -true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a %w+ value",
+           "-true")
+
+error_like(function () return #true end,
+           "^[^:]+:%d+: attempt to get length of a boolean value",
+           "#true")
+
+is(not false, true, "not false")
+
+error_like(function () return true + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true + 10")
+
+error_like(function () return true - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true - 2")
+
+error_like(function () return true * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true * 3.14")
+
+error_like(function () return true / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true / -7")
+
+error_like(function () return true % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true % 4")
+
+error_like(function () return true ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "true ^ 3")
+
+error_like(function () return true .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate a boolean value",
+           "true .. 'end'")
+
+is(true == true, true, "true == true")
+
+is(true ~= false, true, "true ~= false")
+
+is(true == 1, false, "true == 1")
+
+is(true ~= 1, true, "true ~= 1")
+
+error_like(function () return true < false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true < false")
+
+error_like(function () return true <= false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true <= false")
+
+error_like(function () return true > false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true > false")
+
+error_like(function () return true >= false end,
+           "^[^:]+:%d+: attempt to compare two boolean values",
+           "true >= false")
+
+error_like(function () return true < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true < 0")
+
+error_like(function () return true <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true <= 0")
+
+error_like(function () return true > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true > 0")
+
+error_like(function () return true >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "true >= 0")
+
+error_like(function () a = true; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = true; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 199 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/102-function.t.txt

@@ -0,0 +1,199 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua function & coercion
+
+=head2 Synopsis
+
+    % prove 102-function.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(51)
+
+f = function () return 1 end
+
+error_like(function () return -f end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-f")
+
+error_like(function () f = print; return -f end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return #f end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#f")
+
+error_like(function () f = print; return #f end,
+           "^[^:]+:%d+: attempt to get length of")
+
+is(not f, false, "not f")
+
+is(not print, false)
+
+error_like(function () return f + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f + 10")
+
+error_like(function () f = print; return f + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f - 2")
+
+error_like(function () f = print; return f - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f * 3.14")
+
+error_like(function () f = print; return f * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f / -7")
+
+error_like(function () f = print; return f / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f % 4")
+
+error_like(function () f = print; return f % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "f ^ 3")
+
+error_like(function () f = print; return f ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on")
+
+error_like(function () return f .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "f .. 'end'")
+
+error_like(function () f = print; return f .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate")
+
+g = f
+is(f == g, true, "f == f")
+
+g = print
+is(g == print, true)
+
+g = function () return 2 end
+is(f ~= g, true, "f ~= g")
+h = type
+is(f ~= h, true)
+
+is(print ~= g, true)
+is(print ~= h, true)
+
+is(f == 1, false, "f == 1")
+
+is(print == 1, false)
+
+is(f ~= 1, true, "f ~= 1")
+
+is(print ~= 1, true)
+
+error_like(function () return f < g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f < g")
+
+error_like(function () f = print; g = type; return f < g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f <= g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f <= g")
+
+error_like(function () f = print; g = type; return f <= g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f > g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f > g")
+
+error_like(function () f = print; g = type; return f > g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f >= g end,
+           "^[^:]+:%d+: attempt to compare two function values",
+           "f >= g")
+
+error_like(function () f = print; g = type; return f >= g end,
+           "^[^:]+:%d+: attempt to compare two function values")
+
+error_like(function () return f < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f < 0")
+
+error_like(function () f = print; return f < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f <= 0")
+
+error_like(function () f = print; return f <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f > 0")
+
+error_like(function () f = print; return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () return f > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "f >= 0")
+
+error_like(function () f = print; return f >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+")
+
+error_like(function () a = f; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = print; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index")
+
+error_like(function () a = f; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = print; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index")
+
+t = {}
+t[print] = true
+ok(t[print])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 120 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/103-nil.t.txt

@@ -0,0 +1,120 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua nil & coercion
+
+=head2 Synopsis
+
+    % prove 103-nil.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(24)
+
+error_like(function () return -nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "-nil")
+
+error_like(function () return #nil end,
+           "^[^:]+:%d+: attempt to get length of a nil value",
+           "#nil")
+
+is(not nil, true, "not nil")
+
+error_like(function () return nil + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil + 10")
+
+error_like(function () return nil - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil - 2")
+
+error_like(function () return nil * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil * 3.14")
+
+error_like(function () return nil / -7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil / -7")
+
+error_like(function () return nil % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil % 4")
+
+error_like(function () return nil ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "nil ^ 3")
+
+error_like(function () return nil .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate a nil value",
+           "nil .. 'end'")
+
+is(nil == nil, true, "nil == nil")
+
+is(nil ~= nil, false, "nil ~= nil")
+
+is(nil == 1, false, "nil == 1")
+
+is(nil ~= 1, true, "nil ~= 1")
+
+error_like(function () return nil < nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil < nil")
+
+error_like(function () return nil <= nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil <= nil")
+
+error_like(function () return nil > nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil > nil")
+
+error_like(function () return nil > nil end,
+           "^[^:]+:%d+: attempt to compare two nil values",
+           "nil >= nil")
+
+error_like(function () return nil < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil < 0")
+
+error_like(function () return nil <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil <= 0")
+
+error_like(function () return nil > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil > 0")
+
+error_like(function () return nil >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "nil >= 0")
+
+error_like(function () a = nil; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = nil; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 190 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/104-number.t.txt

@@ -0,0 +1,190 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua number & coercion
+
+=head2 Synopsis
+
+    % prove 104-number.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(54)
+
+is(-1, -(1), "-1")
+
+error_like(function () return #1 end,
+           "^[^:]+:%d+: attempt to get length of a number value",
+           "#1")
+
+is(not 1, false, "not 1")
+
+is(10 + 2, 12, "10 + 2")
+
+is(2 - 10, -8, "2 - 10")
+
+is(3.14 * 1, 3.14, "3.14 * 1")
+
+is(-7 / 0.5, -14, "-7 / 0.5")
+
+type_ok(1 / 0, 'number', "1 / 0")
+
+is(-25 % 3, 2, "-25 % 3")
+
+type_ok(1 % 0, 'number', "1 % 0")
+
+error_like(function () return 10 + true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "10 + true")
+
+error_like(function () return 2 - nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "2 - nil")
+
+error_like(function () return 3.14 * false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "3.14 * false")
+
+error_like(function () return -7 / {} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a table value",
+           "-7 / {}")
+
+error_like(function () return 3 ^ true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "3 ^ true")
+
+error_like(function () return -25 % false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "-25 % false")
+
+error_like(function () return 10 + 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "10 + 'text'")
+
+error_like(function () return 2 - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "2 - 'text'")
+
+error_like(function () return 3.14 * 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "3.14 * 'text'")
+
+error_like(function () return -7 / 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "-7 / 'text'")
+
+error_like(function () return 25 % 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "25 % 'text'")
+
+error_like(function () return 3 ^ 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "3 ^ 'text'")
+
+is(10 + '2', 12, "10 + '2'")
+
+is(2 - '10', -8, "2 - '10'")
+
+is(3.14 * '1', 3.14, "3.14 * '1'")
+
+is(-7 / '0.5', -14, "-7 / '0.5'")
+
+is(-25 % '3', 2, "-25 % '3'")
+
+is(3 ^ '3', 27, "3 ^ '3'")
+
+is(1 .. 'end', '1end', "1 .. 'end'")
+
+is(1 .. 2, '12', "1 .. 2")
+
+error_like(function () return 1 .. true end,
+           "^[^:]+:%d+: attempt to concatenate a %w+ value",
+           "1 .. true")
+
+is(1.0 == 1, true, "1.0 == 1")
+
+is(1 ~= 2, true, "1 ~= 2")
+
+is(1 == true, false, "1 == true")
+
+is(1 ~= nil, true, "1 ~= nil")
+
+is(1 == '1', false, "1 == '1'")
+
+is(1 ~= '1', true, "1 ~= '1'")
+
+is(1 < 0, false, "1 < 0")
+
+is(1 <= 0, false, "1 <= 0")
+
+is(1 > 0, true, "1 > 0")
+
+is(1 >= 0, true, "1 >= 0")
+
+error_like(function () return 1 < false end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 < false")
+
+error_like(function () return 1 <= nil end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 <= nil")
+
+error_like(function () return 1 > true end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 > true")
+
+error_like(function () return 1 >= {} end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 >= {}")
+
+error_like(function () return 1 < '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 < '0'")
+
+error_like(function () return 1 <= '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 <= '0'")
+
+error_like(function () return 1 > '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 > '0'")
+
+error_like(function () return 1 >= '0' end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "1 >= '0'")
+
+is(tostring(1000000000), '1000000000', "number 1000000000")
+
+is(tostring(1e9), '1000000000', "number 1e9")
+
+is(tostring(1.0e+9), '1000000000', "number 1.0e+9")
+
+error_like(function () a= 3.14; b = a[1]; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () a = 3.14; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 183 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/105-string.t.txt

@@ -0,0 +1,183 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua string & coercion
+
+=head2 Synopsis
+
+    % prove 105-string.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(51)
+
+is(- '1', -1, "-'1'")
+
+error_like(function () return - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on .- string value",
+           "-'text'")
+
+is(# 'text', 4, "#'text'")
+
+is(not 'text', false, "not 'text'")
+
+is('10' + 2, 12, "'10' + 2")
+
+is('2' - 10, -8, "'2' - 10")
+
+is('3.14' * 1, 3.14, "'3.14' * 1")
+
+is('-7' / 0.5, -14, "'-7' / 0.5")
+
+is('-25' % 3, 2, "'-25' % 3")
+
+is('3' ^ 3, 27, "'3' ^ 3")
+
+error_like(function () return '10' + true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'10' + true")
+
+error_like(function () return '2' - nil end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a nil value",
+           "'2' - nil")
+
+error_like(function () return '3.14' * false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'3.14' * false")
+
+error_like(function () return '-7' / {} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a table value",
+           "'-7' / {}")
+
+error_like(function () return '-25' % false end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'-25' % false")
+
+error_like(function () return '3' ^ true end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a boolean value",
+           "'3' ^ true")
+
+error_like(function () return '10' + 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'10' + 'text'")
+
+error_like(function () return '2' - 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'2' - 'text'")
+
+error_like(function () return '3.14' * 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'3.14' * 'text'")
+
+error_like(function () return '-7' / 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'-7' / 'text'")
+
+error_like(function () return '-25' % 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'-25' % 'text'")
+
+error_like(function () return '3' ^ 'text' end,
+           "^[^:]+:%d+: attempt to perform arithmetic on a string value",
+           "'3' ^ 'text'")
+
+is('10' + '2', 12, "'10' + '2'")
+
+is('2' - '10', -8, "'2' - '10'")
+
+is('3.14' * '1', 3.14, "'3.14' * '1'")
+
+is('-7' / '0.5', -14, "'-7' / '0.5'")
+
+is('-25' % '3', 2, "'-25' % '3'")
+
+is('3' ^ '3', 27, "'3' ^ '3'")
+
+is('1' .. 'end', '1end', "'1' .. 'end'")
+
+is('1' .. 2, '12', "'1' .. 2")
+
+error_like(function () return '1' .. true end,
+           "^[^:]+:%d+: attempt to concatenate a boolean value",
+           "'1' .. true")
+
+is('1.0' == '1', false, "'1.0' == '1'")
+
+is('1' ~= '2', true, "'1' ~= '2'")
+
+is('1' == true, false, "'1' == true")
+
+is('1' ~= nil, true, "'1' ~= nil")
+
+is('1' == 1, false, "'1' == 1")
+
+is('1' ~= 1, true, "'1' ~= 1")
+
+is('1' < '0', false, "'1' < '0'")
+
+is('1' <= '0', false, "'1' <= '0'")
+
+is('1' > '0', true, "'1' > '0'")
+
+is('1' >= '0', true, "'1' >= '0'")
+
+error_like(function () return '1' < false end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' < false")
+
+error_like(function () return '1' <= nil end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' <= nil")
+
+error_like(function () return '1' > true end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' > true")
+
+error_like(function () return '1' >= {} end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' >= {}")
+
+error_like(function () return '1' < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' < 0")
+
+error_like(function () return '1' <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' <= 0")
+
+error_like(function () return '1' > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' > 0")
+
+error_like(function () return '1' > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "'1' >== 0")
+
+a = 'text'
+is(a[1], nil, "index")
+
+error_like(function () a = 'text'; a[1] = 1; end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/106-table.t.txt

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua table & coercion
+
+=head2 Synopsis
+
+    % prove 106-table.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(28)
+
+error_like(function () return -{} end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-{}")
+
+is(# {}, 0, "#{}")
+is(# {4,5,6}, 3)
+
+is(not {}, false, "not {}")
+
+error_like(function () return {} + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} + 10")
+
+error_like(function () return {} - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} - 2")
+
+error_like(function () return {} * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} * 3.14")
+
+error_like(function () return {} / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} / 7")
+
+error_like(function () return {} % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} % 4")
+
+error_like(function () return {} ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "{} ^ 3")
+
+error_like(function () return {} .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "{} .. 'end'")
+
+is({} == {}, false, "{} == {}")
+
+t1 = {}
+t2 = {}
+is(t1 == t1, true, "t1 == t1")
+is(t1 == t2, false, "t1 == t2")
+is(t1 ~= t2, true, "t1 ~= t2")
+
+is({} == 1, false, "{} == 1")
+
+is({} ~= 1, true, "{} ~= 1")
+
+error_like(function () return t1 < t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 < t2")
+
+error_like(function () return t1 <= t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 <= t2")
+
+error_like(function () return t1 > t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 > t2")
+
+error_like(function () return t1 >= t2 end,
+           "^[^:]+:%d+: attempt to compare two table values",
+           "t1 >= t2")
+
+error_like(function () return {} < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} < 0")
+
+error_like(function () return {} <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} <= 0")
+
+error_like(function () return {} > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} > 0")
+
+error_like(function () return {} >= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "{} >= 0")
+
+t = {}
+is( t[1], nil, "index" )
+t[1] = 42
+is( t[1], 42, "index" )
+
+error_like(function () t = {}; t[nil] = 42 end,
+           "^[^:]+:%d+: table index is nil",
+           "table index is nil")
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 128 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/107-thread.t.txt

@@ -0,0 +1,128 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua thread & coercion
+
+=head2 Synopsis
+
+    % prove 107-thread.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(25)
+
+co = coroutine.create(function () return 1 end)
+
+error_like(function () return -co end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-co")
+
+error_like(function () return #co end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#co")
+
+is(not co, false, "not co")
+
+error_like(function () return co + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co + 10")
+
+error_like(function () return co - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co - 2")
+
+error_like(function () return co * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co * 3.14")
+
+error_like(function () return co / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co / 7")
+
+error_like(function () return co % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co % 4")
+
+error_like(function () return co ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "co ^ 3")
+
+error_like(function () return co .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "co .. 'end'")
+
+is(co == co, true, "co == co")
+
+co1 = coroutine.create(function () return 1 end)
+co2 = coroutine.create(function () return 2 end)
+is(co1 ~= co2, true, "co1 ~= co2")
+
+is(co == 1, false, "co == 1")
+
+is(co ~= 1, true, "co ~= 1")
+
+error_like(function () return co1 < co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 < co2")
+
+error_like(function () return co1 <= co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 <= co2")
+
+error_like(function () return co1 > co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 > co2")
+
+error_like(function () return co1 >= co2 end,
+           "^[^:]+:%d+: attempt to compare two thread values",
+           "co1 >= co2")
+
+error_like(function () return co < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co < 0")
+
+error_like(function () return co <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co <= 0")
+
+error_like(function () return co > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co > 0")
+
+error_like(function () return co > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "co >= 0")
+
+error_like(function () a = co[1] end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+error_like(function () co[1] = 1 end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+t = {}
+t[co] = true
+ok(t[co])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/108-userdata.t.txt

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua userdata & coercion
+
+=head2 Synopsis
+
+    % prove 108-userdata.t
+
+=head2 Description
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(25)
+
+u = io.stdin
+
+error_like(function () return -u end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "-u")
+
+error_like(function () return #u end,
+           "^[^:]+:%d+: attempt to get length of",
+           "#u")
+
+is(not u, false, "not u")
+
+error_like(function () return u + 10 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u + 10")
+
+error_like(function () return u - 2 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u - 2")
+
+error_like(function () return u * 3.14 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u * 3.14")
+
+error_like(function () return u / 7 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u / 7")
+
+error_like(function () return u % 4 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u % 4")
+
+error_like(function () return u ^ 3 end,
+           "^[^:]+:%d+: attempt to perform arithmetic on",
+           "u ^ 3")
+
+error_like(function () return u .. 'end' end,
+           "^[^:]+:%d+: attempt to concatenate",
+           "u .. 'end'")
+
+is(u == u, true, "u == u")
+
+v = io.stdout
+is(u ~= v, true, "u ~= v")
+
+is(u == 1, false, "u == 1")
+
+is(u ~= 1, true, "u ~= 1")
+
+error_like(function () return u < v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u < v")
+
+error_like(function () return u <= v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u <= v")
+
+error_like(function () return u > v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u > v")
+
+error_like(function () return u >= v end,
+           "^[^:]+:%d+: attempt to compare two userdata values",
+           "u >= v")
+
+error_like(function () return u < 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u < 0")
+
+error_like(function () return u <= 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u <= 0")
+
+error_like(function () return u > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u > 0")
+
+error_like(function () return u > 0 end,
+           "^[^:]+:%d+: attempt to compare %w+ with %w+",
+           "u >= 0")
+
+is(u[1], nil, "index")
+
+error_like(function () u[1] = 1 end,
+           "^[^:]+:%d+: attempt to index",
+           "index")
+
+t = {}
+t[u] = true
+ok(t[u])
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 104 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/200-examples.t.txt

@@ -0,0 +1,104 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 some Lua code examples
+
+=head2 Synopsis
+
+    % prove 200-examples.t
+
+=head2 Description
+
+First tests in order to check infrastructure.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(5)
+
+function factorial (n)
+    if n == 0 then
+        return 1
+    else
+        return n * factorial(n-1)
+    end
+end
+is(factorial(7), 5040, "factorial (recursive)")
+
+local function local_factorial (n)
+    if n == 0 then
+        return 1
+    else
+        return n * local_factorial(n-1)
+    end
+end
+is(local_factorial(7), 5040, "factorial (recursive)")
+
+function loop_factorial (n)
+    local a = 1
+    for i = 1, n, 1 do
+        a = a*i
+    end
+    return a
+end
+is(loop_factorial(7), 5040, "factorial (loop)")
+
+function iter_factorial (n)
+    local function iter (product, counter)
+        if counter > n then
+            return product
+        else
+            return iter(counter*product, counter+1)
+        end
+    end
+    return iter(1, 1)
+end
+is(iter_factorial(7), 5040, "factorial (iter)")
+
+--[[
+
+  Knuth's "man or boy" test.
+  See http://en.wikipedia.org/wiki/Man_or_boy_test
+
+]]
+
+local function A (k, x1, x2, x3, x4, x5)
+    local function B ()
+        k = k - 1
+        return A(k, B, x1, x2, x3, x4)
+    end
+    if k <= 0 then
+        return x4() + x5()
+    else
+        return B()
+    end
+end
+
+is(A(10,
+        function () return 1 end,
+        function () return -1 end,
+        function () return -1 end,
+        function () return 1 end,
+        function () return 0 end),
+   -67,
+   "man or boy"
+)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 125 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/201-assign.t.txt

@@ -0,0 +1,125 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua assignment
+
+=head2 Synopsis
+
+    % prove 201-assign.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.3.3 "Assignment",
+L<http://www.lua.org/manual/5.2/manual.html#3.3.3>.
+
+See "Programming in Lua", section 4.1 "Assignment".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(38)
+
+is(b, nil, "global variable")
+b = 10
+is(b, 10)
+if jit then
+    skip("LuaJIT intentional. _ENV.", 3)
+else
+    is(_ENV.b, 10, "_ENV")
+    is(_G, _ENV, "_G")
+    error_like([[ _ENV = nil; b = 20 ]],
+               "^[^:]+:%d+: attempt to index a nil value")
+end
+b = nil
+is(b, nil)
+
+a = {}
+i = 3
+i, a[i] = i+1, 20
+-- this behavior is undefined
+-- see http://lua-users.org/lists/lua-l/2006-06/msg00378.html
+-- is(i, 4, "check eval")
+-- is(a[3], 20)
+
+x = 1.
+y = 2.
+x, y = y, x -- swap
+is(x, 2, "check swap")
+is(y, 1)
+
+a, b, c = 0, 1
+is(a, 0, "check padding")
+is(b, 1)
+is(c, nil)
+a, b = a+1, b+1, a+b
+is(a, 1)
+is(b, 2)
+a, b, c = 0
+is(a, 0)
+is(b, nil)
+is(c, nil)
+
+function f() return 1, 2 end
+a, b, c, d = f()
+is(a, 1, "adjust with function")
+is(b, 2)
+is(c, nil)
+is(d, nil)
+
+function f() print('# f') end
+a = 2
+a, b, c = f(), 3
+is(a, nil, "padding with function")
+is(b, 3)
+is(c, nil)
+
+local my_i = 1
+is(my_i, 1, "local variable")
+local my_i = 2
+is(my_i, 2)
+
+local i = 1
+local j = i
+is(i, 1, "local variable")
+is(j, 1)
+j = 2
+is(i, 1)
+is(j, 2)
+
+local function f(x) return 2*x end
+is(f(2), 4, "param & result of function")
+a = 2
+a = f(a)
+is(a, 4)
+local b = 2
+b = f(b)
+is(b, 4)
+
+local n1 = 1
+local n2 = 2
+local n3 = 3
+local n4 = 4
+n1,n2,n3,n4 = n4,n3,n2,n1
+is(n1, 4, "assignment list swap values")
+is(n2, 3)
+is(n3, 2)
+is(n4, 1)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 111 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/202-expr.t.txt

@@ -0,0 +1,111 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua expression
+
+=head2 Synopsis
+
+    % prove 202-expr.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.4 "Expressions",
+L<http://www.lua.org/manual/5.2/manual.html#3.4>.
+
+See "Programming in Lua", section 3 "Expressions".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(39)
+
+x = math.pi
+is(x - x%0.01, 3.14, "modulo")
+
+a = {}; a.x = 1; a.y = 0;
+b = {}; b.x = 1; b.y = 0;
+c = a
+is(a == c, true, "relational op (by reference)")
+is(a ~= b, true)
+
+is('0' == 0, false, "relational op")
+is(2 < 15, true)
+is('2' < '15', false)
+
+error_like(function () return 2 < '15' end,
+           "compare",
+           "relational op")
+
+error_like(function () return '2' < 15 end,
+           "compare",
+           "relational op")
+
+is(4 and 5, 5, "logical op")
+is(nil and 13, nil)
+is(false and 13, false)
+is(4 or 5, 4)
+is(false or 5, 5)
+is(false or 'text', 'text')
+
+is(10 or 20, 10, "logical op")
+is(10 or error(), 10)
+is(nil or 'a', 'a')
+is(nil and 10, nil)
+is(false and error(), false)
+is(false and nil, false)
+is(false or nil, nil)
+is(10 and 20, 20)
+
+is(not nil, true, "logical not")
+is(not false, true)
+is(not 0, false)
+is(not not nil, false)
+is(not 'text', false)
+a = {}
+is(not a, false)
+
+is("Hello " .. "World", "Hello World", "concatenation")
+is(0 .. 1, '01')
+a = "Hello"
+is(a .. " World", "Hello World")
+is(a, "Hello")
+
+is('10' + 1, 11, "coercion")
+is('-5.3' * '2', -10.6)
+is(10 .. 20, '1020')
+is(tostring(10), '10')
+is(10 .. '', '10')
+
+error_like(function () return 'hello' + 1 end,
+           "perform arithmetic",
+           "no coercion")
+
+error_like(function ()
+                local function first() return 1 end
+                local function limit() return end
+                local function step()  return 2 end
+                for i = first(), limit(), step() do
+                    print(i)
+                end
+           end,
+           "^[^:]+:%d+: 'for' limit must be a number",
+           "for tonumber")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 122 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/203-lexico.t.txt

@@ -0,0 +1,122 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Lexicography
+
+=head2 Synopsis
+
+    % prove 203-lexico.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.1 "Lexical Conventions",
+L<http://www.lua.org/manual/5.2/manual.html#3.1>.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(40)
+
+is("\65", "A")
+is("\065", "A")
+is("\x41", "A")
+is("\x3d", "=")
+is("\x3D", "=")
+
+is(string.byte("\a"), 7)
+is(string.byte("\b"), 8)
+is(string.byte("\f"), 12)
+is(string.byte("\n"), 10)
+is(string.byte("\r"), 13)
+is(string.byte("\t"), 9)
+is(string.byte("\v"), 11)
+is(string.byte("\\"), 92)
+
+is(string.len("A\0B"), 3)
+
+f, msg = load [[a = "A\300"]]
+like(msg, "^[^:]+:%d+: .- escape .- near")
+
+f, msg = load [[a = "A\xyz"]]
+like(msg, "^[^:]+:%d+: .- near")
+
+f, msg = load [[a = "A\Z"]]
+like(msg, "^[^:]+:%d+: .- escape .- near")
+
+f, msg = load [[a = " unfinished string ]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string
+]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string \
+]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load [[a = " unfinished string \]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+f, msg = load "a = [[ unfinished long string "
+like(msg, "^[^:]+:%d+: unfinished long string near")
+
+f, msg = load "a = [== invalid long string delimiter "
+like(msg, "^[^:]+:%d+: invalid long string delimiter near")
+
+a = 'alo\n123"'
+is('alo\n123"', a)
+is("alo\n123\"", a)
+is('\97lo\10\04923"', a)
+is([[alo
+123"]], a)
+is([==[
+alo
+123"]==], a)
+is("alo\n\z
+123\"", a)
+
+f, msg = load [[a = " escape \z unauthorized
+new line" ]]
+like(msg, "^[^:]+:%d+: unfinished string near")
+
+is(3.0, 3)
+is(314.16e-2, 3.1416)
+is(0.31416E1, 3.1416)
+is(0xff, 255)
+is(0x56, 86)
+is(0x0.1E, 0x1E / 0x100)        -- 0.1171875
+is(0xA23p-4, 0xA23 / (2^4))     -- 162.1875
+is(0X1.921FB54442D18P+1, (1 + 0x921FB54442D18/0x10000000000000) * 2)
+
+f, msg = load [[a = 12e34e56]]
+like(msg, "^[^:]+:%d+: malformed number near")
+
+--[===[
+--[[
+--[=[
+    nested long comments
+--]=]
+--]]
+--]===]
+
+f, msg = load "  --[[ unfinished long comment "
+like(msg, "^[^:]+:%d+: unfinished long comment near")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 106 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/204-grammar.t.txt

@@ -0,0 +1,106 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2010-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Grammar
+
+=head2 Synopsis
+
+    % prove 204-grammar.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 9 "The Complete Syntax of Lua",
+L<http://www.lua.org/manual/5.2/manual.html#9>.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(6)
+
+--[[ empty statement ]]
+f, msg = load [[; a = 1]]
+type_ok(f, 'function', "empty statement")
+
+--[[ orphan break ]]
+f, msg = load [[
+function f()
+    print "before"
+    do
+        print "inner"
+        break
+    end
+    print "after"
+end
+]]
+if jit then
+    like(msg, "^[^:]+:%d+: no loop to break", "orphan break")
+else
+    like(msg, "^[^:]+:%d+: <break> at line 5 not inside a loop", "orphan break")
+end
+
+--[[ break anywhere ]]
+lives_ok( [[
+function f()
+    print "before"
+    while true do
+        print "inner"
+        break
+        print "break"
+    end
+    print "after"
+end
+]], "break anywhere")
+
+--[[ goto ]]
+f, msg = load [[
+::label::
+goto unknown
+]]
+if jit then
+    like(msg, ":%d+: undefined label 'unknown'", "unknown goto")
+else
+    like(msg, ":%d+: no visible label 'unknown' for <goto> at line %d+", "unknown goto")
+end
+
+f, msg = load [[
+::label::
+goto label
+::label::
+]]
+if jit then
+    like(msg, ":%d+: duplicate label 'label'", "duplicate label")
+else
+    like(msg, ":%d+: label 'label' already defined on line %d+", "duplicate label")
+end
+
+f, msg = load [[
+::e::
+goto f
+local x
+::f::
+goto e
+]]
+if jit then
+    like(msg, ":%d+: <goto f> jumps into the scope of local 'x'", "bad goto")
+else
+    like(msg, ":%d+: <goto f> at line %d+ jumps into the scope of local 'x'", "bad goto")
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 83 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/211-scope.t.txt

@@ -0,0 +1,83 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua scope
+
+=head2 Synopsis
+
+    % prove 211-scope.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.5 "Visibility Rules",
+L<http://www.lua.org/manual/5.2/manual.html#3.5>.
+
+See "Programming in Lua", section 4.2 "Local Variables and Blocks".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(10)
+
+--[[ scope ]]
+x = 10
+do
+    local x = x
+    is(x, 10, "scope")
+    x = x + 1
+    do
+        local x = x + 1
+        is(x, 12)
+    end
+    is(x, 11)
+end
+is(x, 10)
+
+--[[ scope ]]
+x = 10
+local i = 1
+
+while i<=x do
+    local x = i*2
+--    print(x)
+    i = i + 1
+end
+
+if i > 20 then
+    local x
+    x = 20
+    nok("scope")
+else
+    is(x, 10, "scope")
+end
+
+is(x, 10)
+
+--[[ scope ]]
+local a, b = 1, 10
+if a < b then
+    is(a, 1, "scope")
+    local a
+    is(a, nil)
+end
+is(a, 1)
+is(b, 10)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 268 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/212-function.t.txt

@@ -0,0 +1,268 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua functions
+
+=head2 Synopsis
+
+    % prove 212-function.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.4.10 "Function Definitions",
+L<http://www.lua.org/manual/5.2/manual.html#3.4.10>.
+
+See "Programming in Lua", section 5 "Functions".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(63)
+
+--[[ add ]]
+function add (a)
+    local sum = 0
+    for i,v in ipairs(a) do
+        sum = sum + v
+    end
+    return sum
+end
+
+t = { 10, 20, 30, 40 }
+is(add(t), 100, "add")
+
+--[[ f ]]
+function f(a, b) return a or b end
+
+is(f(3), 3, "f")
+is(f(3, 4), 3)
+is(f(3, 4, 5), 3)
+
+--[[ incCount ]]
+count = 0
+
+function incCount (n)
+    n = n or 1
+    count = count + n
+end
+
+is(count, 0, "inCount")
+incCount()
+is(count, 1)
+incCount(2)
+is(count, 3)
+incCount(1)
+is(count, 4)
+
+--[[ maximum ]]
+function maximum (a)
+    local mi = 1                -- maximum index
+    local m = a[mi]             -- maximum value
+    for i,val in ipairs(a) do
+        if val > m then
+            mi = i
+            m = val
+        end
+    end
+    return m, mi
+end
+
+local m, mi = maximum({8,10,23,12,5})
+is(m, 23, "maximum")
+is(mi, 3)
+
+--[[ call by value ]]
+function f (n)
+    n = n - 1
+    return n
+end
+
+a = 12
+is(a, 12, "call by value")
+b = f(a)
+is(b, 11)
+is(a, 12)
+c = f(12)
+is(c, 11)
+is(a, 12)
+
+--[[ call by ref ]]
+function f (t)
+    t[#t+1] = 'end'
+    return t
+end
+
+a = { 'a', 'b', 'c' }
+is(table.concat(a, ','), 'a,b,c', "call by ref")
+b = f(a)
+is(table.concat(b, ','), 'a,b,c,end')
+is(table.concat(a, ','), 'a,b,c,end')
+
+--[[ var args ]]
+local function g(a, b, ...)
+    local arg = {...}
+    is(a, 3, "vararg")
+    is(b, nil)
+    is(#arg, 0)
+    is(arg[1], nil)
+end
+g(3)
+
+local function g(a, b, ...)
+    local arg = {...}
+    is(a, 3)
+    is(b, 4)
+    is(#arg, 0)
+    is(arg[1], nil)
+end
+g(3, 4)
+
+local function g(a, b, ...)
+    local arg = {...}
+    is(a, 3)
+    is(b, 4)
+    is(#arg, 2)
+    is(arg[1], 5)
+    is(arg[2], 8)
+end
+g(3, 4, 5, 8)
+
+--[[ var args ]]
+local function g(a, b, ...)
+    local c, d, e = ...
+    is(a, 3, "var args")
+    is(b, nil)
+    is(c, nil)
+    is(d, nil)
+    is(e, nil)
+end
+g(3)
+
+local function g(a, b, ...)
+    local c, d, e = ...
+    is(a, 3)
+    is(b, 4)
+    is(c, nil)
+    is(d, nil)
+    is(e, nil)
+end
+g(3, 4)
+
+local function g(a, b, ...)
+    local c, d, e = ...
+    is(a, 3)
+    is(b, 4)
+    is(c, 5)
+    is(d, 8)
+    is(e, nil)
+end
+
+--[[ var args ]]
+local function g(a, b, ...)
+    is(#{a, b, ...}, 1, "varargs")
+end
+g(3)
+
+local function g(a, b, ...)
+    is(#{a, b, ...}, 2)
+end
+g(3, 4)
+
+local function g(a, b, ...)
+    is(#{a, b, ...}, 4)
+end
+g(3, 4, 5, 8)
+
+--[[ var args ]]
+function f() return 1, 2 end
+function g() return 'a', f() end
+function h() return f(), 'b' end
+function k() return 'c', (f()) end
+
+x, y = f()
+is(x, 1, "var args")
+is(y, 2)
+x, y, z = g()
+is(x, 'a')
+is(y, 1)
+is(z, 2)
+x, y = h()
+is(x, 1)
+is(y, 'b')
+x, y, z = k()
+is(x, 'c')
+is(y, 1)
+is(z, nil)
+
+
+--[[ invalid var args ]]
+f, msg = load [[
+function f ()
+    print(...)
+end
+]]
+like(msg, "^[^:]+:%d+: cannot use '...' outside a vararg function", "invalid var args")
+
+--[[ tail call ]]
+output = {}
+local function foo (n)
+    output[#output+1] = n
+    if n > 0 then
+        return foo(n -1)
+    end
+    return 'end', 0
+end
+
+eq_array({foo(3)}, {'end', 0}, "tail call")
+eq_array(output, {3, 2, 1, 0})
+
+--[[ no tail call ]]
+output = {}
+local function foo (n)
+    output[#output+1] = n
+    if n > 0 then
+        return (foo(n -1))
+    end
+    return 'end', 0
+end
+
+is(foo(3), 'end', "no tail call")
+eq_array(output, {3, 2, 1, 0})
+
+--[[ no tail call ]]
+output = {}
+local function foo (n)
+    output[#output+1] = n
+    if n > 0 then
+        foo(n -1)
+    end
+end
+
+is(foo(3), nil, "no tail call")
+eq_array(output, {3, 2, 1, 0})
+
+--[[ sub name ]]
+local function f () return 1 end
+is(f(), 1, "sub name")
+
+local function f () return 2 end
+is(f(), 2)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 98 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/213-closure.t.txt

@@ -0,0 +1,98 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua closures
+
+=head2 Synopsis
+
+    % prove 213-closure.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.5 "Visibility Rules",
+L<http://www.lua.org/manual/5.2/manual.html#3.5>.
+
+See "Programming in Lua", section 6.1 "Closures".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(15)
+
+--[[ inc ]]
+local counter = 0
+
+function inc (x)
+    counter = counter + x
+    return counter
+end
+
+is(inc(1), 1, "inc")
+is(inc(2), 3)
+
+--[[ newCounter ]]
+function newCounter ()
+    local i = 0
+    return function ()  -- anonymous function
+               i = i + 1
+               return i
+           end
+end
+
+c1 = newCounter()
+is(c1(), 1, "newCounter")
+is(c1(), 2)
+
+c2 = newCounter()
+is(c2(), 1)
+is(c1(), 3)
+is(c2(), 2)
+
+--[[
+The loop creates ten closures (that is, ten instances of the anonymous
+function). Each of these closures uses a different y variable, while all
+of them share the same x.
+]]
+a = {}
+local x = 20
+for i=1,10 do
+    local y = 0
+    a[i] = function () y=y+1; return x+y end
+end
+
+is(a[1](), 21, "ten closures")
+is(a[1](), 22)
+is(a[2](), 21)
+
+
+--[[ add ]]
+function add(x)
+    return function (y) return (x + y) end
+end
+
+f = add(2)
+type_ok(f, 'function', "add")
+is(f(10), 12)
+g = add(5)
+is(g(1), 6)
+is(g(10), 15)
+is(f(1), 3)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 193 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/214-coroutine.t.txt

@@ -0,0 +1,193 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua coroutines
+
+=head2 Synopsis
+
+    % prove 214-coroutine.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 2.6 "Coroutines",
+L<http://www.lua.org/manual/5.2/manual.html#2.6>.
+
+See "Programming in Lua", section 9 "Coroutines".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(30)
+
+--[[ ]]
+output = {}
+
+function foo1 (a)
+    output[#output+1] = "foo " .. a
+    return coroutine.yield(2*a)
+end
+
+co = coroutine.create(function (a,b)
+        output[#output+1] = "co-body " .. a .." " .. b
+        local r = foo1(a+1)
+        output[#output+1] = "co-body " .. r
+        local r, s = coroutine.yield(a+b, a-b)
+        output[#output+1] = "co-body " .. r .. " " .. s
+        return b, 'end'
+    end)
+
+eq_array({coroutine.resume(co, 1, 10)}, {true, 4}, "foo1")
+eq_array({coroutine.resume(co, 'r')}, {true, 11, -9})
+eq_array({coroutine.resume(co, "x", "y")}, {true, 10, 'end'})
+eq_array({coroutine.resume(co, "x", "y")}, {false, "cannot resume dead coroutine"})
+eq_array(output, {
+    'co-body 1 10',
+    'foo 2',
+    'co-body r',
+    'co-body x y',
+})
+
+--[[ ]]
+co = coroutine.create(function ()
+        output = 'hi'
+    end)
+like(co, '^thread: 0?[Xx]?%x+$', "basics")
+
+is(coroutine.status(co), 'suspended')
+output = ''
+coroutine.resume(co)
+is(output, 'hi')
+is(coroutine.status(co), 'dead')
+
+error_like(function () coroutine.create(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'create' %(function expected, got boolean%)")
+
+error_like(function () coroutine.resume(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'resume' %(coroutine expected, got boolean%)")
+
+error_like(function () coroutine.status(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'status' %(coroutine expected, got boolean%)")
+
+--[[ ]]
+output = {}
+co = coroutine.create(function ()
+        for i=1,10 do
+            output[#output+1] = i
+            coroutine.yield()
+        end
+    end)
+
+coroutine.resume(co)
+thr, ismain = coroutine.running(co)
+type_ok(thr, 'thread', "running")
+is(ismain, true, "running")
+is(coroutine.status(co), 'suspended', "basics")
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+coroutine.resume(co)
+eq_array({coroutine.resume(co)}, {false, 'cannot resume dead coroutine'})
+eq_array(output, {1,2,3,4,5,6,7,8,9,10})
+
+--[[ ]]
+co = coroutine.create(function (a,b)
+        coroutine.yield(a + b, a - b)
+    end)
+
+eq_array({coroutine.resume(co, 20, 10)}, {true, 30, 10}, "basics")
+
+--[[ ]]
+co = coroutine.create(function ()
+        return 6, 7
+    end)
+
+eq_array({coroutine.resume(co)}, {true, 6, 7}, "basics")
+
+--[[ ]]
+co = coroutine.wrap(function(...)
+  return pcall(function(...)
+    return coroutine.yield(...)
+  end, ...)
+end)
+eq_array({co("Hello")}, {"Hello"})
+eq_array({co("World")}, {true, "World"})
+
+--[[ ]]
+co = coroutine.wrap(function(...)
+  function backtrace ()
+    return 'not a back trace'
+  end
+  return xpcall(function(...)
+    return coroutine.yield(...)
+  end, backtrace, ...)
+end)
+eq_array({co("Hello")}, {"Hello"})
+eq_array({co("World")}, {true, "World"})
+
+
+--[[ ]]
+local output = {}
+co = coroutine.wrap(function()
+  while true do
+    local t = setmetatable({}, {
+      __eq = function(...)
+        return coroutine.yield(...)
+      end}
+    )
+    local t2 = setmetatable({}, getmetatable(t))
+    output[#output+1] = t == t2
+  end
+end)
+co()
+co(true)
+co(false)
+eq_array(output, {true, false})
+
+--[[ ]]
+co = coroutine.wrap(print)
+type_ok(co, 'function')
+
+error_like(function () coroutine.wrap(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'wrap' %(function expected, got boolean%)")
+
+co = coroutine.wrap(function () error"in coro" end)
+error_like(function () co() end,
+           "^[^:]+:%d+: in coro$")
+
+--[[ ]]
+co = coroutine.create(function ()
+        error "in coro"
+    end)
+r, msg = coroutine.resume(co)
+is(r, false)
+like(msg, "in coro$")
+
+--[[ ]]
+error_like(function () coroutine.yield() end,
+           "attempt to yield")
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 112 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/221-table.t.txt

@@ -0,0 +1,112 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua tables
+
+=head2 Synopsis
+
+    % prove 221-table.t
+
+=head2 Description
+
+See "Programming in Lua", section 2.5 "Tables".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(25)
+
+--[[ ]]
+a = {}
+k = 'x'
+a[k] = 10
+a[20] = 'great'
+is(a['x'], 10)
+k = 20
+is(a[k], 'great')
+a['x'] = a ['x'] + 1
+is(a['x'], 11)
+
+--[[ ]]
+a = {}
+a['x'] = 10
+b = a
+is(b['x'], 10)
+b['x'] = 20
+is(a['x'], 20)
+a = nil
+b = nil
+
+--[[ ]]
+a = {}
+for i=1,1000 do a[i] = i*2 end
+is(a[9], 18)
+a['x'] = 10
+is(a['x'], 10)
+is(a['y'], nil)
+
+--[[ ]]
+a = {}
+x = 'y'
+a[x] = 10
+is(a[x], 10)
+is(a.x, nil)
+is(a.y, 10)
+
+--[[ ]]
+i = 10; j = '10'; k = '+10'
+a = {}
+a[i] = "one value"
+a[j] = "another value"
+a[k] = "yet another value"
+is(a[j], "another value")
+is(a[k], "yet another value")
+is(a[tonumber(j)], "one value")
+is(a[tonumber(k)], "one value")
+
+t = { {'a','b','c'}, 10 }
+is(t[2], 10)
+is(t[1][3], 'c')
+t[1][1] = 'A'
+is(table.concat(t[1],','), 'A,b,c')
+
+--[[ ]]
+local tt
+tt = { {'a','b','c'}, 10 }
+is(tt[2], 10)
+is(tt[1][3], 'c')
+tt[1][1] = 'A'
+is(table.concat(tt[1],','), 'A,b,c')
+
+--[[ ]]
+a = {}
+error_like(function () a() end,
+           "^[^:]+:%d+: attempt to call")
+
+--[[ ]]
+local tt
+tt = { {'a','b','c'}, 10 }
+is((tt)[2], 10)
+is((tt[1])[3], 'c');
+(tt)[1][2] = 'B'
+(tt[1])[3] = 'C'
+is(table.concat(tt[1],','), 'a,B,C')
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 85 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/222-constructor.t.txt

@@ -0,0 +1,85 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Table Constructors
+
+=head2 Synopsis
+
+    % prove 222-constructor.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 3.4.8 "Table Constructors",
+L<http://www.lua.org/manual/5.2/manual.html#3.4.8>.
+
+See "Programming in Lua", section 3.6 "Table Constructors".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(14)
+
+--[[ list-style init ]]
+days = {'Sunday', 'Monday', 'Tuesday', 'Wednesday',
+        'Thursday', 'Friday', 'Saturday'}
+is(days[4], 'Wednesday', "list-style init")
+is(#days, 7)
+
+--[[ record-style init ]]
+a = {x=0, y=0}
+is(a.x, 0, "record-style init")
+is(a.y, 0)
+
+--[[ ]]
+w = {x=0, y=0, label='console'}
+x = {0, 1, 2}
+w[1] = "another field"
+x.f = w
+is(w['x'], 0, "ctor")
+is(w[1], "another field")
+is(x.f[1], "another field")
+w.x = nil
+
+--[[ mix record-style and list-style init ]]
+polyline = {color='blue', thickness=2, npoints=4,
+             {x=0,   y=0},
+             {x=-10, y=0},
+             {x=-10, y=1},
+             {x=0,   y=1}
+           }
+is(polyline[2].x, -10, "mix record-style and list-style init")
+
+--[[ ]]
+opnames = {['+'] = 'add', ['-'] = 'sub',
+           ['*'] = 'mul', ['/'] = 'div'}
+i = 20; s = '-'
+a = {[i+0] = s, [i+1] = s..s, [i+2] = s..s..s}
+is(opnames[s], 'sub', "ctor")
+is(a[22], '---')
+
+--[[ ]]
+local function f() return 10, 20 end
+
+eq_array({f()}, {10, 20}, "ctor")
+eq_array({'a', f()}, {'a', 10, 20})
+eq_array({f(), 'b'}, {10, 'b'})
+eq_array({'c', (f())}, {'c', 10})
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 196 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/223-iterator.t.txt

@@ -0,0 +1,196 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2010, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua iterators
+
+=head2 Synopsis
+
+    % prove 223-iterator.t
+
+=head2 Description
+
+See "Programming in Lua", section 7 "Iterators and the Generic for" and
+section 9.3 "Coroutines as Iterators".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(8)
+
+--[[ list_iter ]]
+function list_iter (t)
+    local i = 0
+    local n = #t
+    return function ()
+               i = i + 1
+               if i <= n then
+                   return t[i]
+               else
+                   return nil
+               end
+           end
+end
+
+t = {10, 20, 30}
+output = {}
+for element in list_iter(t) do
+    output[#output+1] = element
+end
+eq_array(output, t, "list_iter")
+
+--[[ values ]]
+function values (t)
+    local i = 0
+    return function ()
+               i = i + 1
+               return t[i]
+           end
+end
+
+t = {10, 20, 30}
+output = {}
+for element in values(t) do
+    output[#output+1] = element
+end
+eq_array(output, t, "values")
+
+--[[ emul ipairs ]]
+local function iter (a, i)
+    i = i + 1
+    local v = a[i]
+    if v then
+        return i, v
+    end
+end
+
+local function my_ipairs (a)
+    return iter, a, 0
+end
+
+a = {'one', 'two', 'three'}
+output = {}
+for i, v in my_ipairs(a) do
+    output[#output+1] = i
+    output[#output+1] = v
+end
+eq_array(output, {1, 'one', 2, 'two', 3, 'three'}, "emul ipairs")
+
+--[[ emul pairs ]]
+local function my_pairs (t)
+    return next, t, nil
+end
+
+a = {'one', 'two', 'three'}
+output = {}
+for k, v in my_pairs(a) do
+    output[#output+1] = k
+    output[#output+1] = v
+end
+eq_array(output, {1, 'one', 2, 'two', 3, 'three'}, "emul ipairs")
+
+--[[ with next ]]
+t = {'one', 'two', 'three'}
+output = {}
+for k, v in next, t do
+    output[#output+1] = k
+    output[#output+1] = v
+end
+eq_array(output, {1, 'one', 2, 'two', 3, 'three'}, "with next")
+
+--[[ permutations ]]
+function permgen (a, n)
+    n = n or #a         -- default for 'n' is size of 'a'
+    if n <= 1 then      -- nothing to change?
+        coroutine.yield(a)
+    else
+        for i=1,n do
+            -- put i-th element as the last one
+            a[n], a[i] = a[i], a[n]
+            -- generate all permutations of the other elements
+            permgen(a, n - 1)
+            -- restore i-th element
+            a[n], a[i] = a[i], a[n]
+        end
+    end
+end
+
+function permutations (a)
+    local co = coroutine.create(function () permgen(a) end)
+    return function ()  -- iterator
+               local code, res = coroutine.resume(co)
+               return res
+           end
+end
+
+output = {}
+for p in permutations{'a', 'b', 'c'} do
+    output[#output+1] = table.concat(p, ' ')
+end
+eq_array(output, {'b c a','c b a','c a b','a c b','b a c','a b c'}, "permutations")
+
+
+--[[ permutations with wrap ]]
+function permgen (a, n)
+    n = n or #a         -- default for 'n' is size of 'a'
+    if n <= 1 then      -- nothing to change?
+        coroutine.yield(a)
+    else
+        for i=1,n do
+            -- put i-th element as the last one
+            a[n], a[i] = a[i], a[n]
+            -- generate all permutations of the other elements
+            permgen(a, n - 1)
+            -- restore i-th element
+            a[n], a[i] = a[i], a[n]
+        end
+    end
+end
+
+function permutations (a)
+    return coroutine.wrap(function () permgen(a) end)
+end
+
+output = {}
+for p in permutations{'a', 'b', 'c'} do
+    output[#output+1] = table.concat(p, ' ')
+end
+eq_array(output, {'b c a','c b a','c a b','a c b','b a c','a b c'}, "permutations with wrap")
+
+--[[ fibo ]]
+function fibogen ()
+    local x, y = 0, 1
+    while true do
+        coroutine.yield(x)
+        x, y = y, x + y
+    end
+end
+
+function fibo ()
+    return coroutine.wrap(function () fibogen() end)
+end
+
+output = {}
+for n in fibo() do
+    output[#output+1] = n
+    if n > 30 then break end
+end
+eq_array(output, {0, 1, 1, 2, 3, 5, 8, 13, 21, 34}, "fibo")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 533 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/231-metatable.t.txt

@@ -0,0 +1,533 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua metatables
+
+=head2 Synopsis
+
+    % prove 231-metatable.t
+
+=head2 Description
+
+See "Lua 5.2 Reference Manual", section 2.4 "Metatables and Metamethods",
+L<http://www.lua.org/manual/5.2/manual.html#2.4>.
+
+See "Programming in Lua", section 13 "Metatables and Metamethods".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(96)
+
+t = {}
+is(getmetatable(t), nil, "metatable")
+t1 = {}
+is(setmetatable(t, t1), t)
+is(getmetatable(t), t1)
+is(setmetatable(t, nil), t)
+error_like(function () setmetatable(t, true) end,
+           "^[^:]+:%d+: bad argument #2 to 'setmetatable' %(nil or table expected.+%)")
+
+mt = {}
+mt.__metatable = "not your business"
+setmetatable(t, mt)
+is(getmetatable(t), "not your business", "protected metatable")
+error_like(function () setmetatable(t, {}) end,
+           "^[^:]+:%d+: cannot change a protected metatable")
+
+is(getmetatable('').__index, string, "metatable for string")
+
+is(getmetatable(nil), nil, "metatable for nil")
+is(getmetatable(false), nil, "metatable for boolean")
+is(getmetatable(2), nil, "metatable for number")
+is(getmetatable(print), nil, "metatable for function")
+
+t = {}
+mt = { __tostring=function () return '__TABLE__' end }
+setmetatable(t, mt)
+is(tostring(t), '__TABLE__', "__tostring")
+
+mt = {}
+a = nil
+function mt.__tostring () a = "return nothing" end
+setmetatable(t, mt)
+is(tostring(t), nil, "__tostring no-output")
+is(a, "return nothing")
+error_like(function () print(t) end,
+           "^[^:]+:%d+: 'tostring' must return a string to 'print'")
+
+mt.__tostring = function () return '__FIRST__', 2 end
+setmetatable(t, mt)
+is(tostring(t), '__FIRST__', "__tostring too-many-output")
+
+t = {}
+t.mt = {}
+setmetatable(t, t.mt)
+t.mt.__tostring = "not a function"
+error_like(function () tostring(t) end,
+           "attempt to call",
+           "__tostring invalid")
+
+t = {}
+mt = { __len=function () return 42 end }
+setmetatable(t, mt)
+is(#t, 42, "__len")
+
+t = {}
+mt = { __len=function () return nil end }
+setmetatable(t, mt)
+if jit then
+    todo("LuaJIT TODO. __len.", 1)
+end
+error_like(function () print(table.concat(t)) end,
+           "object length is not a number",
+           "__len invalid")
+
+t = {}
+mt = {
+  __tostring=function () return 't' end,
+  __concat=function (op1, op2)
+        return tostring(op1) .. '|' .. tostring(op2)
+  end,
+}
+setmetatable(t, mt)
+is(t .. t .. t .. 4 ..'end', "t|t|t|4end", "__concatx")
+
+
+--[[ Cplx ]]
+Cplx = {}
+Cplx.mt = {}
+
+function Cplx.new (re, im)
+    local c = {}
+    setmetatable(c, Cplx.mt)
+    c.re = tonumber(re)
+    if im == nil then
+        c.im = 0.0
+    else
+        c.im = tonumber(im)
+    end
+    return c
+end
+
+function Cplx.mt.__tostring (c)
+    return '(' .. c.re .. ',' .. c.im .. ')'
+end
+
+function Cplx.mt.__add (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local r = Cplx.new(a.re + b.re, a.im + b.im)
+    return r
+end
+
+c1 = Cplx.new(1, 3)
+c2 = Cplx.new(2, -1)
+
+is(tostring(c1 + c2), '(3,2)', "cplx __add")
+is(tostring(c1 + 3), '(4,3)')
+is(tostring(-2 + c1), '(-1,3)')
+is(tostring(c1 + '3'), '(4,3)')
+is(tostring('-2' + c1), '(-1,3)')
+
+function Cplx.mt.__sub (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local r = Cplx.new(a.re - b.re, a.im - b.im)
+    return r
+end
+
+is(tostring(c1 - c2), '(-1,4)', "cplx __sub")
+is(tostring(c1 - 3), '(-2,3)')
+is(tostring(-2 - c1), '(-3,-3)')
+is(tostring(c1 - '3'), '(-2,3)')
+is(tostring('-2' - c1), '(-3,-3)')
+
+function Cplx.mt.__mul (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local r = Cplx.new(a.re*b.re - a.im*b.im,
+        a.re*b.im + a.im*b.re)
+    return r
+end
+
+is(tostring(c1 * c2), '(5,5)', "cplx __mul")
+is(tostring(c1 * 3), '(3,9)')
+is(tostring(-2 * c1), '(-2,-6)')
+is(tostring(c1 * '3'), '(3,9)')
+is(tostring('-2' * c1), '(-2,-6)')
+
+function Cplx.mt.__div (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local n = b.re*b.re + b.im*b.im
+    local inv = Cplx.new(b.re/n, b.im/n)
+    local r = Cplx.new(a.re*inv.re - a.im*inv.im,
+        a.re*inv.im + a.im*inv.re)
+    return r
+end
+
+c1 = Cplx.new(2, 6)
+c2 = Cplx.new(2, 0)
+
+is(tostring(c1 / c2), '(1,3)', "cplx __div")
+is(tostring(c1 / 2), '(1,3)')
+is(tostring(-4 / c2), '(-2,0)')
+is(tostring(c1 / '2'), '(1,3)')
+is(tostring('-4' / c2), '(-2,0)')
+
+function Cplx.mt.__unm (a)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    local r = Cplx.new(-a.re, -a.im)
+    return r
+end
+
+c1 = Cplx.new(1, 3)
+is(tostring(- c1), '(-1,-3)', "cplx __unm")
+
+function Cplx.mt.__len (a)
+    return math.sqrt(a.re*a.re + a.im*a.im)
+end
+
+c1 = Cplx.new(3, 4)
+is( #c1, 5, "cplx __len")
+
+function Cplx.mt.__eq (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    return (a.re == b.re) and (b.im == b.im)
+end
+
+c1 = Cplx.new(2, 0)
+c2 = Cplx.new(1, 3)
+c3 = Cplx.new(2, 0)
+
+is(c1 ~= c2, true, "cplx __eq")
+is(c1 == c3, true)
+is(c1 == 2, false)
+is(Cplx.mt.__eq(c1, 2), true)
+
+function Cplx.mt.__lt (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local ra = a.re*a.re + a.im*a.im
+    local rb = b.re*b.re + b.im*b.im
+    return ra < rb
+end
+
+is(c1 < c2, true, "cplx __lt")
+is(c1 < c3, false)
+is(c1 <= c3, true)
+is(c1 < 1, false)
+is(c1 < 4, true)
+
+function Cplx.mt.__le (a, b)
+    if type(a) ~= 'table' then
+        a = Cplx.new(a, 0)
+    end
+    if type(b) ~= 'table' then
+        b = Cplx.new(b, 0)
+    end
+    local ra = a.re*a.re + a.im*a.im
+    local rb = b.re*b.re + b.im*b.im
+    return ra <= rb
+end
+
+is(c1 < c2, true, "cplx __lt __le")
+is(c1 < c3, false)
+is(c1 <= c3, true)
+
+function Cplx.mt.__call (obj)
+    a = "Cplx.__call " .. tostring(obj)
+    return true
+end
+
+c1 = Cplx.new(2, 0)
+a = nil
+r = c1()
+is(r, true, "cplx __call (without args)")
+is(a, "Cplx.__call (2,0)")
+
+function Cplx.mt.__call (obj, ...)
+    a = "Cplx.__call " .. tostring(obj) .. ", " .. table.concat({...}, ", ")
+    return true
+end
+
+is(c1(), true, "cplx __call (with args)")
+is(a, "Cplx.__call (2,0), ")
+is(c1('a'), true)
+is(a, "Cplx.__call (2,0), a")
+is(c1('a', 'b', 'c'), true)
+is(a, "Cplx.__call (2,0), a, b, c")
+
+--[[ delegate ]]
+
+local t = {
+    _VALUES = {
+        a = 1,
+        b = 'text',
+        c = true,
+    }
+}
+local mt = {
+    __pairs = function (op)
+        return next, op._VALUES
+    end
+}
+setmetatable(t, mt)
+
+r = {}
+for k in pairs(t) do
+    r[#r+1] = k
+end
+table.sort(r)
+is( table.concat(r, ','), 'a,b,c', "__pairs" )
+
+local t = {
+    _VALUES = { 'a', 'b', 'c' }
+}
+local mt = {
+    __ipairs = function (op)
+        return ipairs(op._VALUES)
+    end
+}
+setmetatable(t, mt)
+
+r = ''
+for i, v in ipairs(t) do
+    r = r .. v
+end
+is( r, 'abc', "__ipairs" )
+
+--[[ Window ]]
+
+-- create a namespace
+Window = {}
+-- create a prototype with default values
+Window.prototype = {x=0, y=0, width=100, heigth=100, }
+-- create a metatable
+Window.mt = {}
+-- declare the constructor function
+function Window.new (o)
+    setmetatable(o, Window.mt)
+    return o
+end
+
+Window.mt.__index = function (table, key)
+    return Window.prototype[key]
+end
+
+w = Window.new{x=10, y=20}
+is(w.x, 10, "table-access")
+is(w.width, 100)
+is(rawget(w, 'x'), 10)
+is(rawget(w, 'width'), nil)
+
+Window.mt.__index = Window.prototype  -- just a table
+w = Window.new{x=10, y=20}
+is(w.x, 10, "table-access")
+is(w.width, 100)
+is(rawget(w, 'x'), 10)
+is(rawget(w, 'width'), nil)
+
+--[[ tables with default values ]]
+function setDefault_1 (t, d)
+    local mt = {__index = function () return d end}
+    setmetatable (t, mt)
+end
+
+tab = {x=10, y=20}
+is(tab.x, 10, "tables with default values")
+is(tab.z, nil)
+setDefault_1(tab, 0)
+is(tab.x, 10)
+is(tab.z, 0)
+
+--[[ tables with default values ]]
+local mt = {__index = function (t) return t.___ end}
+function setDefault_2 (t, d)
+    t.___ = d
+    setmetatable (t, mt)
+end
+
+tab = {x=10, y=20}
+is(tab.x, 10, "tables with default values")
+is(tab.z, nil)
+setDefault_2(tab, 0)
+is(tab.x, 10)
+is(tab.z, 0)
+
+--[[ tables with default values ]]
+local key = {}
+local mt = {__index = function (t) return t[key] end}
+function setDefault_3 (t, d)
+    t[key] = d
+    setmetatable (t, mt)
+end
+
+tab = {x=10, y=20}
+is(tab.x, 10, "tables with default values")
+is(tab.z, nil)
+setDefault_3(tab, 0)
+is(tab.x, 10)
+is(tab.z, 0)
+
+--[[ private access ]]
+t = {}  -- original table
+-- keep a private access to original table
+local _t = t
+-- create proxy
+t = {}
+-- create metatable
+local mt = {
+    __index = function (t,k)
+        r = "*access to element " .. tostring(k)
+        return _t[k]  -- access the original table
+    end,
+
+    __newindex = function (t,k,v)
+        w = "*update of element " .. tostring(k) ..
+                           " to " .. tostring(v)
+        _t[k] = v  -- update original table
+    end
+}
+setmetatable(t, mt)
+
+w = nil
+r = nil
+t[2] = 'hello'
+is(t[2], 'hello', "tracking table accesses")
+is(w, "*update of element 2 to hello")
+is(r, "*access to element 2")
+
+--[[ private access ]]
+-- create private index
+local index = {}
+-- create metatable
+local mt = {
+    __index = function (t,k)
+        r = "*access to element " .. tostring(k)
+        return t[index][k]  -- access the original table
+    end,
+
+    __newindex = function (t,k,v)
+        w = "*update of element " .. tostring(k) ..
+                           " to " .. tostring(v)
+        t[index][k] = v  -- update original table
+    end
+}
+function track (t)
+    local proxy = {}
+    proxy[index] = t
+    setmetatable(proxy, mt)
+    return proxy
+end
+
+t = {}
+t = track(t)
+
+w = nil
+r = nil
+t[2] = 'hello'
+is(t[2], 'hello', "tracking table accesses")
+is(w, "*update of element 2 to hello")
+is(r, "*access to element 2")
+
+--[[ read-only table ]]
+function readOnly (t)
+    local proxy = {}
+    local mt = {
+        __index = t,
+        __newindex = function (t,k,v)
+            error("attempt to update a read-only table", 2)
+        end
+    }
+    setmetatable(proxy, mt)
+    return proxy
+end
+
+days = readOnly{'Sunday', 'Monday', 'Tuesday', 'Wednesday',
+        'Thurday', 'Friday', 'Saturday'}
+
+is(days[1], 'Sunday', "read-only tables")
+
+error_like(function () days[2] = 'Noday' end,
+           "^[^:]+:%d+: attempt to update a read%-only table")
+
+--[[ declare global ]]
+function declare (name, initval)
+    rawset(_G, name, initval or false)
+end
+
+setmetatable(_G, {
+    __newindex = function (_, n)
+        error("attempt to write to undeclared variable " .. n, 2)
+    end,
+    __index = function (_, n)
+        error("attempt to read undeclared variable" .. n, 2)
+    end,
+})
+
+error_like(function () new_a = 1 end,
+           "^[^:]+:%d+: attempt to write to undeclared variable new_a",
+           "declaring global variables")
+
+declare 'new_a'
+new_a = 1
+is(new_a, 1)
+
+--[[ ]]
+local newindex = {}
+-- create metatable
+local mt = {
+    __newindex = newindex
+}
+local t = setmetatable({}, mt)
+t[1] = 42
+is(newindex[1], 42, "__newindex")
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 307 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/232-object.t.txt

@@ -0,0 +1,307 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua object
+
+=head2 Synopsis
+
+    % prove 232-object.t
+
+=head2 Description
+
+See "Programming in Lua", section 16 "Object-Oriented Programming".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(18)
+
+--[[ object ]]
+Account = {balance = 0}
+
+function Account.withdraw (self, v)
+    self.balance = self.balance - v
+end
+
+a1 = Account; Account = nil
+a1.withdraw(a1, 100.00)
+is(a1.balance, -100, "object")
+
+a2 = {balance = 0, withdraw = a1.withdraw}
+a2.withdraw(a2, 260.00)
+is(a2.balance, -260)
+
+--[[ object ]]
+Account = {balance = 0}
+
+function Account:withdraw (v)
+    self.balance = self.balance - v
+end
+
+a = Account
+a:withdraw(100.00)
+is(a.balance, -100, "object")
+
+Account = { balance = 0,
+            withdraw = function (self, v)
+                           self.balance = self.balance -v
+                       end
+          }
+function Account:deposit (v)
+    self.balance = self.balance + v
+end
+
+Account.deposit(Account, 200.00)
+is(Account.balance, 200, "object")
+Account:withdraw(100.00)
+is(Account.balance, 100)
+
+--[[ classe ]]
+Account = {balance = 0}
+
+function Account:new (o)
+    o = o or {}
+    setmetatable(o, self)
+    self.__index = self
+    return o
+end
+
+function Account:deposit (v)
+    self.balance = self.balance + v
+end
+
+function Account:withdraw (v)
+    self.balance = self.balance - v
+end
+
+a = Account:new{balance = 0}
+a:deposit(100.00)
+is(a.balance, 100, "classe")
+
+b = Account:new()
+is(b.balance, 0)
+b:deposit(200.00)
+is(b.balance, 200)
+
+--[[ inheritance ]]
+Account = {balance = 0}
+
+function Account:new (o)
+--    print "Account:new"
+    o = o or {}
+    setmetatable(o, self)
+    self.__index = self
+    return o
+end
+
+function Account:deposit (v)
+--    print "Account:deposit"
+    self.balance = self.balance + v
+end
+
+function Account:withdraw (v)
+--    print "Account:withdraw"
+    if v > self.balance then error"insuficient funds" end
+    self.balance = self.balance - v
+end
+
+a = Account:new()
+is(a.balance, 0, "inheritance")
+-- r, msg = pcall(Account.withdraw, a, 100)
+-- print(msg)
+
+SpecialAccount = Account:new()
+
+function SpecialAccount:withdraw (v)
+--    print "SpecialAccount:withdraw"
+    if self.balance - v <= -self:getLimit() then
+        error"insuficient funds"
+    end
+    self.balance = self.balance - v
+end
+
+function SpecialAccount:getLimit ()
+--    print "SpecialAccount:getLimit"
+    return self.limit or 0
+end
+
+s = SpecialAccount:new{limit=1000.00}
+
+s:deposit(100.00)
+is(s.balance, 100)
+
+s:withdraw(200.00)
+is(s.balance, -100)
+
+--[[ multiple inheritance ]]
+-- look up for 'k' in list of tables 'plist'
+local function search (k, plist)
+    for i=1, #plist do
+        local v = plist[i][k]  -- try 'i'-th superclass
+        if v then return v end
+    end
+end
+
+function createClass (...)
+    local c = {}  -- new class
+    local arg = {...}
+
+    -- class will search for each method in the list of its
+    -- parents ('arg' is the list of parents)
+    setmetatable(c, {__index = function (t, k)
+        return search(k, arg)
+    end})
+
+    -- prepare 'c' to be the metatable of its instance
+    c.__index = c
+
+    -- define a new constructor for this new class
+    function c:new (o)
+        o = o or {}
+        setmetatable(o, c)
+        return o
+    end
+
+    -- return new class
+    return c
+end
+
+Account = {balance = 0}
+function Account:deposit (v)
+    self.balance = self.balance + v
+end
+function Account:withdraw (v)
+    self.balance = self.balance - v
+end
+
+Named = {}
+function Named:getname ()
+    return self.name
+end
+function Named:setname (n)
+    self.name = n
+end
+
+NamedAccount = createClass(Account, Named)
+
+account = NamedAccount:new{name = "Paul"}
+is(account:getname(), 'Paul', "multiple inheritance")
+account:deposit(100.00)
+is(account.balance, 100)
+
+
+--[[ multiple inheritance (patched) ]]
+-- look up for 'k' in list of tables 'plist'
+local function search (k, plist)
+    for i=1, #plist do
+        local v = plist[i][k]  -- try 'i'-th superclass
+        if v then return v end
+    end
+end
+
+function createClass (...)
+    local c = {}  -- new class
+    local arg = {...}
+
+    -- class will search for each method in the list of its
+    -- parents ('arg' is the list of parents)
+    setmetatable(c, {__index = function (t, k)
+        -- return search(k, arg)
+        return (search(k, arg))
+    end})
+
+    -- prepare 'c' to be the metatable of its instance
+    c.__index = c
+
+    -- define a new constructor for this new class
+    function c:new (o)
+        o = o or {}
+        setmetatable(o, c)
+        return o
+    end
+
+    -- return new class
+    return c
+end
+
+Account = {balance = 0}
+function Account:deposit (v)
+    self.balance = self.balance + v
+end
+function Account:withdraw (v)
+    self.balance = self.balance - v
+end
+
+Named = {}
+function Named:getname ()
+    return self.name
+end
+function Named:setname (n)
+    self.name = n
+end
+
+NamedAccount = createClass(Account, Named)
+
+account = NamedAccount:new{name = "Paul"}
+is(account:getname(), 'Paul', "multiple inheritance (patched)")
+account:deposit(100.00)
+is(account.balance, 100)
+
+--[[ privacy ]]
+function newAccount (initialBalance)
+    local self = {balance = initialBalance}
+
+    local withdraw = function (v)
+                         self.balance = self.balance - v
+                     end
+
+    local deposit = function (v)
+                        self.balance = self.balance + v
+                    end
+
+    local getBalance = function () return self.balance end
+
+    return {
+        withdraw = withdraw,
+        deposit = deposit,
+        getBalance = getBalance
+    }
+end
+
+acc1 = newAccount(100.00)
+acc1.withdraw(40.00)
+is(acc1.getBalance(), 60, "privacy")
+
+--[[ single-method approach ]]
+function newObject (value)
+    return function (action, v)
+        if action == 'get' then return value
+        elseif action == 'set' then value = v
+        else error("invalid action")
+        end
+    end
+end
+
+d = newObject(0)
+is(d('get'), 0, "single-method approach")
+d('set', 10)
+is(d('get'), 10)
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 391 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/301-basic.t.txt

@@ -0,0 +1,391 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Basic Library
+
+=head2 Synopsis
+
+    % prove 301-basic.t
+
+=head2 Description
+
+Tests Lua Basic Library
+
+See "Lua 5.2 Reference Manual", section 6.1 "Basic Functions",
+L<http://www.lua.org/manual/5.2/manual.html#6.1>.
+
+=cut
+
+--]]
+
+-- MoonSharp note : THIS SUITE WAS HEAVILY CUT FOR NOT APPLIABLE TESTS
+
+
+require 'Test.More'
+
+plan(168)
+
+--[[
+if jit then
+    like(_VERSION, '^Lua 5%.1$', "variable _VERSION")
+else
+    like(_VERSION, '^Lua 5%.2$', "variable _VERSION")
+end
+-- ]]
+
+v, msg = assert('text', "assert string")
+is(v, 'text', "function assert")
+is(msg, "assert string")
+v, msg = assert({}, "assert table")
+is(msg, "assert table")
+
+error_like(function () assert(false, "ASSERTION TEST") end,
+           "^[^:]+:%d+: ASSERTION TEST",
+           "function assert(false, msg)")
+
+error_like(function () assert(false) end,
+           "^[^:]+:%d+: assertion failed!",
+           "function assert(false)")
+
+error_like(function () assert(false, nil) end,
+           "^[^:]+:%d+: assertion failed!",
+           "function assert(false, nil)")
+
+
+a = {'a','b','c'}
+local f, v, s = ipairs(a)
+type_ok(f, 'function', "function ipairs")
+type_ok(v, 'table')
+is(s, 0)
+s, v = f(a, s)
+is(s, 1)
+is(v, 'a')
+s, v = f(a, s)
+is(s, 2)
+is(v, 'b')
+s, v = f(a, s)
+is(s, 3)
+is(v, 'c')
+s, v = f(a, s)
+is(s, nil)
+is(v, nil)
+
+t = { [[
+function bar (x)
+    return x
+end
+]] }
+i = 0
+function reader ()
+    i = i + 1
+    return t[i]
+end
+f, msg = load(reader)
+if msg then
+    diag(msg)
+end
+type_ok(f, 'function', "function load(reader)")
+is(bar, nil)
+f()
+is(bar('ok'), 'ok')
+bar = nil
+
+t = { [[
+function baz (x)
+    return x
+end
+]] }
+i = -1
+function reader ()
+    i = i + 1
+    return t[i]
+end
+f, msg = load(reader)
+if msg then
+    diag(msg)
+end
+type_ok(f, 'function', "function load(pathological reader)")
+f()
+is(baz, nil)
+
+t = { [[?syntax error?]] }
+i = 0
+f, msg = load(reader, "errorchunk")
+is(f, nil, "function load(syntax error)")
+--like(msg, "^%[string \"errorchunk\"%]:%d+:") -- ERRORMSG
+
+f = load(function () return nil end)
+type_ok(f, 'function', "when reader returns nothing")
+
+f, msg = load(function () return {} end)
+is(f, nil, "reader function must return a string")
+like(msg, "reader function must return a string")
+
+f = load([[
+function bar (x)
+    return x
+end
+]])
+is(bar, nil, "function load(str)")
+f()
+is(bar('ok'), 'ok')
+bar = nil
+
+env = {}
+f = load([[
+function bar (x)
+    return x
+end
+]], "from string", 't', env)
+is(env.bar, nil, "function load(str)")
+f()
+is(env.bar('ok'), 'ok')
+
+
+-- ...
+
+
+f = load([[i = i + 1]])
+i = 0
+f()
+is(i, 1, "function loadstring")
+f()
+is(i, 2)
+
+i = 32
+local i = 0
+f = load([[i = i + 1; return i]])
+g = function () i = i + 1; return i end
+is(f(), 33, "function loadstring")
+is(g(), 1)
+
+f, msg = load([[?syntax error?]])
+is(f, nil, "function loadstring (syntax error)")
+-- like(msg, '^%[string "%?syntax error%?"%]:%d+:') -- ERRORMSG
+
+t = {'a','b','c'}
+a = next(t, nil)
+is(a, 1, "function next (array)")
+a = next(t, 1)
+is(a, 2)
+a = next(t, 2)
+is(a, 3)
+a = next(t, 3)
+is(a, nil)
+
+error_like(function () a = next() end,
+           "^[^:]+:%d+: bad argument #1 to 'next' %(table expected, got no value%)",
+           "function next (no arg)")
+
+error_like(function () a = next(t, 6) end,
+           "invalid key to 'next'",
+           "function next (invalid key)")
+
+t = {'a','b','c'}
+a = next(t, 2)
+is(a, 3, "function next (unorderer)")
+a = next(t, 1)
+is(a, 2)
+a = next(t, 3)
+is(a, nil)
+
+t = {}
+a = next(t, nil)
+is(a, nil, "function next (empty table)")
+
+a = {'a','b','c'}
+local f, v, s = pairs(a)
+type_ok(f, 'function', "function pairs")
+type_ok(v, 'table')
+is(s, nil)
+s = f(v, s)
+is(s, 1)
+s = f(v, s)
+is(s, 2)
+s = f(v, s)
+is(s, 3)
+s = f(v, s)
+is(s, nil)
+
+r = pcall(assert, true)
+is(r, true, "function pcall")
+r, msg = pcall(assert, false, 'catched')
+is(r, false)
+is(msg, 'catched')
+r = pcall(assert)
+is(r, false)
+
+t = {}
+a = t
+is(rawequal(nil, nil), true, "function rawequal -> true")
+is(rawequal(false, false), true)
+is(rawequal(3, 3), true)
+is(rawequal('text', 'text'), true)
+is(rawequal(t, a), true)
+is(rawequal(print, print), true)
+
+is(rawequal(nil, 2), false, "function rawequal -> false")
+is(rawequal(false, true), false)
+is(rawequal(false, 2), false)
+is(rawequal(3, 2), false)
+is(rawequal(3, '2'), false)
+is(rawequal('text', '2'), false)
+is(rawequal('text', 2), false)
+is(rawequal(t, {}), false)
+is(rawequal(t, 2), false)
+is(rawequal(print, format), false)
+is(rawequal(print, 2), false)
+
+is(rawlen("text"), 4, "function rawlen (string)")
+is(rawlen({ 'a', 'b', 'c'}), 3, "function rawlen (table)")
+error_like(function () a = rawlen(true) end,
+           "^[^:]+:%d+: bad argument #1 to 'rawlen' %(table ",
+           "function rawlen (bad arg)")
+
+t = {a = 'letter a', b = 'letter b'}
+is(rawget(t, 'a'), 'letter a', "function rawget")
+
+t = {}
+is(rawset(t, 'a', 'letter a'), t, "function rawset")
+is(t.a, 'letter a')
+
+error_like(function () t = {}; rawset(t, nil, 42) end,
+           "^[^:]+:%d+: table index is nil",   -- changed this for MoonSharp, but we stay as it is!
+           "function rawset (table index is nil)")
+
+is(select('#'), 0, "function select")
+is(select('#','a','b','c'), 3)
+eq_array({select(1,'a','b','c')}, {'a','b','c'})
+eq_array({select(3,'a','b','c')}, {'c'})
+eq_array({select(5,'a','b','c')}, {})
+eq_array({select(-1,'a','b','c')}, {'c'})
+eq_array({select(-2,'a','b','c')}, {'b', 'c'})
+eq_array({select(-3,'a','b','c')}, {'a', 'b', 'c'})
+
+error_like(function () select(0,'a','b','c') end,
+           "^[^:]+:%d+: bad argument #1 to 'select' %(index out of range%)",
+           "function select (out of range)")
+
+error_like(function () select(-4,'a','b','c') end,
+           "^[^:]+:%d+: bad argument #1 to 'select' %(index out of range%)",
+           "function select (out of range)")
+
+is(type("Hello world"), 'string', "function type")
+is(type(10.4*3), 'number')
+is(type(print), 'function')
+is(type(type), 'function')
+is(type(true), 'boolean')
+is(type(nil), 'nil')
+-- is(type(io.stdin), 'userdata') -- no stdin in MoonSharp so far 
+is(type(type(X)), 'string')
+
+a = nil
+is(type(a), 'nil', "function type")
+a = 10
+is(type(a), 'number')
+a = "a string!!"
+is(type(a), 'string')
+a = print
+is(type(a), 'function')
+is(type(function () end), 'function')
+
+error_like(function () type() end,
+           "^[^:]+:%d+: bad argument #1 to 'type' %(value expected%)",
+           "function type (no arg)")
+
+is(tonumber('text12'), nil, "function tonumber")
+is(tonumber('12text'), nil)
+is(tonumber(3.14), 3.14)
+is(tonumber('3.14'), 3.14)
+is(tonumber('  3.14  '), 3.14)
+is(tonumber(111, 2), 7)
+is(tonumber('111', 2), 7)
+is(tonumber('  111  ', 2), 7)
+is(tonumber('78', 9), 71)
+is(tonumber('111  ', 3), 13)
+is(tonumber('111', 4), 21)
+is(tonumber('1234', 5), 194)
+is(tonumber('54321', 6), 7465)
+
+a = {}
+is(tonumber(a), nil)
+
+error_like(function () tonumber() end,
+           "^[^:]+:%d+: bad argument #1 to 'tonumber' %(value expected%)",
+           "function tonumber (no arg)")
+
+error_like(function () tonumber('111', 200) end,
+           "^[^:]+:%d+: bad argument #2 to 'tonumber' %(base out of range%)",
+           "function tonumber (bad base)")
+
+error_like(function () tonumber('17', 6) end,
+           "^[^:]+:%d+: bad argument #1 to 'tonumber' %(invalid character%)",
+           "function tonumber (bad base)")
+
+is(tostring('text'), 'text', "function tostring")
+is(tostring(3.14), '3.14')
+is(tostring(nil), 'nil')
+is(tostring(true), 'true')
+is(tostring(false), 'false')
+like(tostring({}), '^table: 0?[Xx]?%x+$')
+like(tostring(print), '^function: 0?[Xx]?[builtin]*#?%x+$')
+
+error_like(function () tostring() end,
+           "^[^:]+:%d+: bad argument #1 to 'tostring' %(value expected%)",
+           "function tostring (no arg)")
+
+--[[ MoonSharp : this is intentional - we support pack and unpack outside the table namespace (or whatever they are) 
+if (platform and platform.compat) or jit then
+    type_ok(unpack, 'function', "function unpack")
+else
+    is(unpack, nil, "function unpack (removed)")
+end
+]]
+
+
+if jit then
+    error_like(function () xpcall(assert, nil) end,
+               "bad argument #2 to 'xpcall' %(function expected, got nil%)",
+               "function xpcall")
+    error_like(function () xpcall(assert) end,
+               "bad argument #2 to 'xpcall' %(function expected, got no value%)",
+               "function xpcall")
+    diag("LuaJIT intentional. xpcall")
+else
+    is(xpcall(assert, nil), false, "function xpcall")
+    error_like(function () xpcall(assert) end,
+               "^[^:]+:%d+: bad argument #2 to 'xpcall' %(function expected, got no value%)",
+               "function xpcall (no arg)")
+end
+
+function backtrace ()
+    return 'not a back trace'
+end
+r, msg = xpcall(assert, backtrace)
+is(r, false, "function xpcall (backtrace)")
+is(msg, 'not a back trace')
+
+r, msg = xpcall(function() assert(); end, backtrace)
+is(r, false, "function xpcall (backtrace)")
+is(msg, 'not a back trace')
+
+r = xpcall(assert, backtrace, true)
+is(r, true, "function xpcall")
+
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 318 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/304-string.t.txt

@@ -0,0 +1,318 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua String Library
+
+=head2 Synopsis
+
+    % prove 304-string.t
+
+=head2 Description
+
+Tests Lua String Library
+
+See "Lua 5.2 Reference Manual", section 6.4 "String Manipulation",
+L<http://www.lua.org/manual/5.2/manual.html#6.4>.
+
+See "Programming in Lua", section 20 "The String Library".
+
+=cut
+
+]]
+
+require 'Test.More'
+
+plan(115)
+
+is(string.byte('ABC'), 65, "function byte")
+is(string.byte('ABC', 2), 66)
+is(string.byte('ABC', -1), 67)
+is(string.byte('ABC', 4), nil)
+is(string.byte('ABC', 0), nil)
+eq_array({string.byte('ABC', 1, 3)}, {65, 66, 67})
+eq_array({string.byte('ABC', 1, 4)}, {65, 66, 67})
+
+type_ok(getmetatable('ABC'), 'table', "literal string has metatable")
+
+s = "ABC"
+is(s:byte(2), 66, "method s:byte")
+
+is(string.char(65, 66, 67), 'ABC', "function char")
+is(string.char(), '')
+
+error_like(function () string.char(0, 'bad') end,
+           "^[^:]+:%d+: bad argument #2 to 'char' %(number expected, got string%)",
+           "function char (bad arg)")
+
+		   
+--[[		   
+MoonSharp intentional : 
+
+1) unicode chars supported!
+2) plan has upvalues, and by Lua spec it shouldn't be supported!
+		   
+error_like(function () string.char(0, 9999) end,
+           "^[^:]+:%d+: bad argument #2 to 'char' %(.-value.-%)",
+           "function char (invalid)")
+
+d = string.dump(plan)
+type_ok(d, 'string', "function dump")
+
+error_like(function () string.dump(print) end,
+           "^[^:]+:%d+: unable to dump given function",
+           "function dump (C function)")
+		   
+]]
+
+s = "hello world"
+eq_array({string.find(s, "hello")}, {1, 5}, "function find (mode plain)")
+eq_array({string.find(s, "hello", 1, true)}, {1, 5})
+eq_array({string.find(s, "hello", 1)}, {1, 5})
+is(string.sub(s, 1, 5), "hello")
+eq_array({string.find(s, "world")}, {7, 11})
+eq_array({string.find(s, "l")}, {3, 3})
+is(string.find(s, "lll"), nil)
+is(string.find(s, "hello", 2, true), nil)
+eq_array({string.find(s, "world", 2, true)}, {7, 11})
+is(string.find(s, "hello", 20), nil)
+
+s = "hello world"
+eq_array({string.find(s, "^h.ll.")}, {1, 5}, "function find (with regex & captures)")
+eq_array({string.find(s, "w.rld", 2)}, {7, 11})
+is(string.find(s, "W.rld"), nil)
+eq_array({string.find(s, "^(h.ll.)")}, {1, 5, 'hello'})
+eq_array({string.find(s, "^(h.)l(l.)")}, {1, 5, 'he', 'lo'})
+s = "Deadline is 30/05/1999, firm"
+date = "%d%d/%d%d/%d%d%d%d"
+is(string.sub(s, string.find(s, date)), "30/05/1999")
+date = "%f[%S]%d%d/%d%d/%d%d%d%d"
+is(string.sub(s, string.find(s, date)), "30/05/1999")
+
+error_like(function () string.find(s, '%f') end,
+           "^[^:]+:%d+: missing '%[' after '%%f' in pattern",
+           "function find (invalid frontier)")
+
+is(string.format("pi = %.4f", math.pi), 'pi = 3.1416', "function format")
+d = 5; m = 11; y = 1990
+is(string.format("%02d/%02d/%04d", d, m, y), "05/11/1990")
+is(string.format("%X %x", 126, 126), "7E 7e")
+tag, title = "h1", "a title"
+is(string.format("<%s>%s</%s>", tag, title, tag), "<h1>a title</h1>")
+
+-- moonsharp : this commented out as it might fail mostly because of CRLF in windows than because of 
+-- a moonsharp bug I think. Will see, surely not a blocking issue now.
+--[==[ 
+is(string.format('%q', 'a string with "quotes" and \n new line'), [["a string with \"quotes\" and \
+ new line"]], "function format %q") 
+--]==]
+
+is(string.format('%q', 'a string with \b and \b2'), [["a string with \8 and \0082"]], "function format %q")
+
+is(string.format("%s %s", 1, 2, 3), '1 2', "function format (too many arg)")
+
+is(string.format("%% %c %%", 65), '% A %', "function format (%%)")
+
+r = string.rep("ab", 100)
+is(string.format("%s %d", r, r:len()), r .. " 200")
+
+error_like(function () string.format("%s %s", 1) end,
+           "^[^:]+:%d+: bad argument #3 to 'format' %(.-no value%)",
+           "function format (too few arg)")
+
+error_like(function () string.format('%d', 'toto') end,
+           "^[^:]+:%d+: bad argument #2 to 'format' %(number expected, got string%)",
+           "function format (bad arg)")
+
+error_like(function () string.format('%k', 'toto') end,
+           "^[^:]+:%d+: invalid option '%%k' to 'format'",
+           "function format (invalid option)")
+
+if jit and jit.version_num >= 20100 then
+    todo("LuaJIT TODO. format.", 1)
+end
+error_like(function () string.format('%------s', 'toto') end,
+           "^[^:]+:%d+: invalid format %(repeated flags%)",
+           "function format (invalid format)")
+
+error_like(function () string.format('pi = %.123f', math.pi) end,
+           "^[^:]+:%d+: invalid ",
+           "function format (invalid format)")
+
+error_like(function () string.format('% 123s', 'toto') end,
+           "^[^:]+:%d+: invalid ",
+           "function format (invalid format)")
+
+s = "hello"
+output = {}
+for c in string.gmatch(s, '..') do
+    table.insert(output, c)
+end
+eq_array(output, {'he', 'll'}, "function gmatch")
+output = {}
+for c1, c2 in string.gmatch(s, '(.)(.)') do
+    table.insert(output, c1)
+    table.insert(output, c2)
+end
+eq_array(output, {'h', 'e', 'l', 'l'})
+s = "hello world from Lua"
+output = {}
+for w in string.gmatch(s, '%a+') do
+    table.insert(output, w)
+end
+eq_array(output, {'hello', 'world', 'from', 'Lua'})
+s = "from=world, to=Lua"
+output = {}
+for k, v in string.gmatch(s, '(%w+)=(%w+)') do
+    table.insert(output, k)
+    table.insert(output, v)
+end
+eq_array(output, {'from', 'world', 'to', 'Lua'})
+
+is(string.gsub("hello world", "(%w+)", "%1 %1"), "hello hello world world", "function gsub")
+is(string.gsub("hello world", "%w+", "%0 %0", 1), "hello hello world")
+
+
+is(string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1"), "world hello Lua from")
+
+
+if jit then
+    todo("LuaJIT TODO. gsub.", 1)
+end
+
+error_like(function () string.gsub("hello world", "%w+", "%e") end,
+           "^[^:]+:%d+: invalid use of '%%' in replacement string",
+           "function gsub (invalid replacement string)")
+		   
+is(string.gsub("home = $HOME, user = $USER", "%$(%w+)", string.reverse), "home = EMOH, user = RESU")
+is(string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s) return load(s)() end), "4+5 = 9")
+local t = {name='lua', version='5.1'}
+is(string.gsub("$name-$version.tar.gz", "%$(%w+)", t), "lua-5.1.tar.gz")
+is(string.gsub("Lua is cute", 'cute', 'great'), "Lua is great")
+is(string.gsub("all lii", 'l', 'x'), "axx xii")
+is(string.gsub("Lua is great", '^Sol', 'Sun'), "Lua is great")
+is(string.gsub("all lii", 'l', 'x', 1), "axl lii")
+is(string.gsub("all lii", 'l', 'x', 2), "axx lii")
+is(select(2, string.gsub("string with 3 spaces", ' ', ' ')), 3)
+
+eq_array({string.gsub("hello, up-down!", '%A', '.')}, {"hello..up.down.", 4})
+text = "hello world"
+nvow = select(2, string.gsub(text, '[AEIOUaeiou]', ''))
+is(nvow, 3)
+eq_array({string.gsub("one, and two; and three", '%a+', 'word')}, {"word, word word; word word", 5})
+test = "int x; /* x */  int y; /* y */"
+eq_array({string.gsub(test, "/%*.*%*/", '<COMMENT>')}, {"int x; <COMMENT>", 1})
+eq_array({string.gsub(test, "/%*.-%*/", '<COMMENT>')}, {"int x; <COMMENT>  int y; <COMMENT>", 2})
+s = "a (enclosed (in) parentheses) line"
+eq_array({string.gsub(s, '%b()', '')}, {"a  line", 1})
+
+error_like(function () string.gsub(s, '%b(', '') end,
+           "^[^:]+:%d+: .- pattern",
+           "function gsub (malformed pattern)")
+
+eq_array({string.gsub("hello Lua!", "%a", "%0-%0")}, {"h-he-el-ll-lo-o L-Lu-ua-a!", 8})
+eq_array({string.gsub("hello Lua", "(.)(.)", "%2%1")}, {"ehll ouLa", 4})
+
+function expand (s)
+    return (string.gsub(s, '$(%w+)', _G))
+end
+name = 'Lua'; status= 'great'
+is(expand("$name is $status, isn't it?"), "Lua is great, isn't it?")
+is(expand("$othername is $status, isn't it?"), "$othername is great, isn't it?")
+
+function expand (s)
+    return (string.gsub(s, '$(%w+)', function (n)
+                                          return tostring(_G[n]), 1
+                                     end))
+end
+like(expand("print = $print; a = $a"), "^print = function: [0]?[Xx]?[builtin]*#?%x+; a = nil")
+
+error_like(function () string.gsub("hello world", '(%w+)', '%2 %2') end,
+           "^[^:]+:%d+: invalid capture index",
+           "function gsub (invalid index)")
+
+error_like(function () string.gsub("hello world", '(%w+)', true) end,
+           "^[^:]+:%d+: bad argument #3 to 'gsub' %(string/function/table expected%)",
+           "function gsub (bad type)")
+
+error_like(function ()
+    function expand (s)
+        return (string.gsub(s, '$(%w+)', _G))
+    end
+
+    name = 'Lua'; status= true
+    expand("$name is $status, isn't it?")
+           end,
+           "^[^:]+:%d+: invalid replacement value %(a boolean%)",
+           "function gsub (invalid value)")
+
+is(string.len(''), 0, "function len")
+is(string.len('test'), 4)
+is(string.len("a\000b\000c"), 5)
+is(string.len('"'), 1)
+
+is(string.lower('Test'), 'test', "function lower")
+is(string.lower('TeSt'), 'test')
+
+s = "hello world"
+is(string.match(s, '^hello'), 'hello', "function match")
+is(string.match(s, 'world', 2), 'world')
+is(string.match(s, 'World'), nil)
+eq_array({string.match(s, '^(h.ll.)')}, {'hello'})
+eq_array({string.match(s, '^(h.)l(l.)')}, {'he', 'lo'})
+date = "Today is 17/7/1990"
+is(string.match(date, '%d+/%d+/%d+'), '17/7/1990')
+eq_array({string.match(date, '(%d+)/(%d+)/(%d+)')}, {'17', '7', '1990'})
+is(string.match("The number 1298 is even", '%d+'), '1298')
+pair = "name = Anna"
+eq_array({string.match(pair, '(%a+)%s*=%s*(%a+)')}, {'name', 'Anna'})
+
+s = [[then he said: "it's all right"!]]
+eq_array({string.match(s, "([\"'])(.-)%1")}, {'"', "it's all right"}, "function match (back ref)")
+p = "%[(=*)%[(.-)%]%1%]"
+s = "a = [=[[[ something ]] ]==]x]=]; print(a)"
+eq_array({string.match(s, p)}, {'=', '[[ something ]] ]==]x'})
+
+is(string.match(s, "%g"), "a", "match graphic char")
+
+error_like(function () string.match("hello world", "%1") end,
+           "^[^:]+:%d+: invalid capture index",
+           "function match invalid capture")
+
+error_like(function () string.match("hello world", "%w)") end,
+           "^[^:]+:%d+: invalid pattern capture",
+           "function match invalid capture")
+
+is(string.rep('ab', 3), 'ababab', "function rep")
+is(string.rep('ab', 0), '')
+is(string.rep('ab', -1), '')
+is(string.rep('', 5), '')
+is(string.rep('ab', 3, ','), 'ab,ab,ab', "with sep")
+
+is(string.reverse('abcde'), 'edcba', "function reverse")
+is(string.reverse('abcd'), 'dcba')
+is(string.reverse(''), '')
+
+is(string.sub('abcde', 1, 2), 'ab', "function sub")
+is(string.sub('abcde', 3, 4), 'cd')
+is(string.sub('abcde', -2), 'de')
+is(string.sub('abcde', 3, 2), '')
+
+is(string.upper('Test'), 'TEST', "function upper")
+is(string.upper('TeSt'), 'TEST')
+is(string.upper(string.rep('Test', 10000)), string.rep('TEST', 10000))
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 253 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/305-table.t.txt

@@ -0,0 +1,253 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Table Library
+
+=head2 Synopsis
+
+    % prove 305-table.t
+
+=head2 Description
+
+Tests Lua Table Library
+
+See "Lua 5.2 Reference Manual", section 6.5 "Table Manipulation",
+L<http://www.lua.org/manual/5.2/manual.html#6.5>.
+
+See "Programming in Lua", section 19 "The Table Library".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(44)
+
+t = {'a','b','c','d','e'}
+is(table.concat(t), 'abcde', "function concat")
+is(table.concat(t, ','), 'a,b,c,d,e')
+is(table.concat(t, ',',2), 'b,c,d,e')
+is(table.concat(t, ',', 2, 4), 'b,c,d')
+is(table.concat(t, ',', 4, 2), '')
+
+t = {'a','b',3,'d','e'}
+is(table.concat(t,','), 'a,b,3,d,e', "function concat (number)")
+
+t = {'a','b','c','d','e'}
+error_like(function () table.concat(t, ',', 2, 7) end,
+           "^[^:]+:%d+: invalid value %(nil%) at index 6 in table for 'concat'",
+           "function concat (out of range)")
+
+t = {'a','b',true,'d','e'}
+error_like(function () table.concat(t, ',') end,
+           "^[^:]+:%d+: invalid value %(boolean%) at index 3 in table for 'concat'",
+           "function concat (non-string)")
+
+a = {10, 20, 30}
+table.insert(a, 1, 15)
+is(table.concat(a,','), '15,10,20,30', "function insert")
+t = {}
+table.insert(t, 'a')
+is(table.concat(t, ','), 'a')
+table.insert(t, 'b')
+is(table.concat(t, ','), 'a,b')
+table.insert(t, 1, 'c')
+is(table.concat(t, ','), 'c,a,b')
+table.insert(t, 2, 'd')
+is(table.concat(t, ','), 'c,d,a,b')
+table.insert(t, 5, 'e')
+is(table.concat(t, ','), 'c,d,a,b,e')
+
+if jit then
+    todo("LuaJIT TODO. table.insert.", 2)
+end
+error_like(function () table.insert(t, 7, 'f') end,
+           "^[^:]+:%d+: bad argument #2 to 'insert' %(position out of bounds%)",
+           "function insert (out of bounds)")
+
+error_like(function () table.insert(t, -9, 'f') end,
+           "^[^:]+:%d+: bad argument #2 to 'insert' %(position out of bounds%)",
+           "function insert (out of bounds)")
+
+error_like(function () table.insert(t, 2, 'g', 'h')  end,
+           "^[^:]+:%d+: wrong number of arguments to 'insert'",
+           "function insert (too many arg)")
+
+if (platform and platform.compat) or jit then
+    t = {}
+    is(table.maxn(t), 0, "function maxn")
+    t[1] = 'a'
+    t[2] = 'b'
+    is(table.maxn(t), 2)
+    t[6] = 'g'
+    is(table.maxn(t), 6)
+    a = {}
+    a[10000] = 1
+    is(table.maxn(a), 10000)
+else
+    is(table.maxn, nil, "maxn (removed)")
+    skip("maxn (removed)", 3)
+end
+
+t = table.pack("abc", "def", "ghi")
+eq_array(t, {
+    "abc",
+    "def",
+    "ghi"
+}, "function pack")
+is(t.n, 3)
+
+t = table.pack()
+eq_array(t, {}, "function pack (no element)")
+is(t.n, 0)
+
+t = {}
+a = table.remove(t)
+is(a, nil, "function remove")
+t = {'a','b','c','d','e'}
+a = table.remove(t)
+is(a, 'e')
+is(table.concat(t, ','), 'a,b,c,d')
+a = table.remove(t,3)
+is(a, 'c')
+is(table.concat(t, ','), 'a,b,d')
+a = table.remove(t,1)
+is(a, 'a')
+is(table.concat(t, ','), 'b,d')
+
+if jit then
+    todo("LuaJIT TODO. table.remove.", 1)
+end
+error_like(function () table.remove(t,7) end,
+           "^[^:]+:%d+: bad argument #1 to 'remove' %(position out of bounds%)",
+           "function remove (out of bounds)")
+
+lines = {
+    luaH_set = 10,
+    luaH_get = 24,
+    luaH_present = 48,
+}
+a = {}
+for n in pairs(lines) do a[#a + 1] = n end
+table.sort(a)
+output = {}
+for _, n in ipairs(a) do
+    table.insert(output, n)
+end
+eq_array(output, {'luaH_get', 'luaH_present', 'luaH_set'}, "function sort")
+
+function pairsByKeys (t, f)
+    local a = {}
+    for n in pairs(t) do a[#a + 1] = n end
+    table.sort(a, f)
+    local i = 0     -- iterator variable
+    return function ()  -- iterator function
+        i = i + 1
+        return a[i], t[a[i]]
+    end
+end
+
+output = {}
+for name, line in pairsByKeys(lines) do
+    table.insert(output, name)
+    table.insert(output, line)
+end
+eq_array(output, {'luaH_get', 24, 'luaH_present', 48, 'luaH_set', 10}, "function sort")
+
+output = {}
+for name, line in pairsByKeys(lines, function (a, b) return a < b end) do
+    table.insert(output, name)
+    table.insert(output, line)
+end
+eq_array(output, {'luaH_get', 24, 'luaH_present', 48, 'luaH_set', 10}, "function sort")
+
+
+
+function permgen (a, n)
+    n = n or #a
+    if n <= 1 then
+        coroutine.yield(a)
+    else
+        for i=1,n do
+            a[n], a[i] = a[i], a[n]
+            permgen(a, n - 1)
+            a[n], a[i] = a[i], a[n]
+        end
+    end
+end
+
+function permutations (a)
+    local co = coroutine.create(function () permgen(a) end)
+    return function ()
+               local code, res = coroutine.resume(co)
+               return res
+           end
+end
+
+local t = {}
+output = {}
+for _, v in ipairs{'a', 'b', 'c', 'd', 'e', 'f', 'g'} do
+    table.insert(t, v)
+    local ref = table.concat(t, ' ')
+    table.insert(output, ref)
+    local n = 0
+    for p in permutations(t) do
+        local c = {}
+        for i, v in ipairs(p) do
+            c[i] = v
+        end
+        table.sort(c)
+        assert(ref == table.concat(c, ' '), table.concat(p, ' '))
+        n = n + 1
+    end
+    table.insert(output, n)
+end
+
+eq_array(output, {
+    'a', 1,
+    'a b', 2,
+    'a b c', 6,
+    'a b c d', 24,
+    'a b c d e', 120,
+    'a b c d e f', 720,
+    'a b c d e f g', 5040,
+}, "function sort (all permutations)")
+
+--[[
+
+MoonSharp: Sort callbacks work --]]
+
+
+error_like(function ()
+    local t = { 1 }
+    table.sort( { t, t, t, t, }, function (a, b) return a[1] == b[1] end )
+           end,
+           "^[^:]+:%d+: invalid order function for sorting",
+           "function sort (bad func)")
+
+
+eq_array({table.unpack({})}, {}, "function unpack")
+eq_array({table.unpack({'a'})}, {'a'})
+eq_array({table.unpack({'a','b','c'})}, {'a','b','c'})
+eq_array({(table.unpack({'a','b','c'}))}, {'a'})
+eq_array({table.unpack({'a','b','c','d','e'},2,4)}, {'b','c','d'})
+eq_array({table.unpack({'a','b','c'},2,4)}, {'b','c'})
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:
+
+

+ 153 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/306-math.t.txt

@@ -0,0 +1,153 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Mathematic Library
+
+=head2 Synopsis
+
+    % prove 306-math.t
+
+=head2 Description
+
+Tests Lua Mathematic Library
+
+See "Lua 5.2 Reference Manual", section 6.6 "Mathematical Functions",
+L<http://www.lua.org/manual/5.2/manual.html#6.6>.
+
+See "Programming in Lua", section 18 "The Mathematical Library".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(47)
+
+like(tostring(math.pi), '^3%.14', "variable pi")
+
+type_ok(math.huge, 'number', "variable huge")
+
+is(math.abs(-12.34), 12.34, "function abs")
+is(math.abs(12.34), 12.34)
+
+like(math.acos(0.5), '^1%.047', "function acos")
+
+like(math.asin(0.5), '^0%.523', "function asin")
+
+like(math.atan(0.5), '^0%.463', "function atan")
+
+like(math.atan2(1, 2), '^0%.463', "function atan2")
+
+is(math.ceil(12.34), 13, "function ceil")
+is(math.ceil(-12.34), -12)
+
+like(math.cos(0), '^1$', "function cos")
+
+like(math.cosh(0), '^1$', "function cosh")
+
+is(math.deg(math.pi), 180, "function deg")
+
+like(math.exp(1.0), '^2%.718', "function exp")
+
+is(math.floor(12.34), 12, "function floor")
+is(math.floor(-12.34), -13)
+
+is(math.fmod(7, 3), 1, "function fmod")
+is(math.fmod(-7, 3), -1)
+
+eq_array({math.frexp(1.5)}, {0.75, 1}, "function frexp")
+
+is(math.ldexp(1.2, 3), 9.6, "function ldexp")
+
+like(math.log(47), '^3%.85', "function log")
+like(math.log(47, 2), '^5%.554', "function log (base 2)")
+like(math.log(47, 10), '^1%.672', "function log (base 10)")
+
+if (platform and platform.compat) or jit then
+    like(math.log10(47), '^1%.672', "function log10")
+else
+    is(math.log10, nil, "function log10 (removed)")
+end
+
+error_like(function () math.max() end,
+           "^[^:]+:%d+: bad argument #1 to 'max' %(number expected, got no value%)",
+           "function max 0")
+
+is(math.max(1), 1, "function max")
+is(math.max(1, 2), 2)
+is(math.max(1, 2, 3, -4), 3)
+
+error_like(function () math.min() end,
+           "^[^:]+:%d+: bad argument #1 to 'min' %(number expected, got no value%)",
+           "function min 0")
+
+is(math.min(1), 1, "function min")
+is(math.min(1, 2), 1)
+is(math.min(1, 2, 3, -4), -4)
+
+eq_array({math.modf(2.25)}, {2, 0.25}, "function modf")
+
+is(math.pow(-2, 3), -8, "function pow")
+
+like(math.rad(180), '^3%.14', "function rad")
+
+like(math.random(), '^%d%.%d+', "function random no arg")
+
+like(math.random(9), '^%d$', "function random 1 arg")
+
+like(math.random(10, 19), '^1%d$', "function random 2 arg")
+
+--[[
+MoonSharp : math.random normalizes inputs, and we are happy with that
+
+if jit then
+    todo("LuaJIT intentional. Don't check empty interval.", 2)
+end
+error_like(function () math.random(0) end,
+           "^[^:]+:%d+: bad argument #1 to 'random' %(interval is empty%)",
+           "function random empty interval")
+
+error_like(function () math.random(19, 10) end,
+           "^[^:]+:%d+: bad argument #2 to 'random' %(interval is empty%)",
+           "function random empty interval")
+
+if jit then
+    todo("LuaJIT intentional. Don't care about extra arguments.")
+end
+error_like(function () math.random(1, 2, 3) end,
+           "^[^:]+:%d+: wrong number of arguments",
+           "function random too many arg")
+		   --]]
+
+math.randomseed(12)
+a = math.random()
+math.randomseed(12)
+b = math.random()
+is(a, b, "function randomseed")
+
+like(math.sin(math.pi/2), '^1$', "function sin")
+
+like(math.sinh(1), '^1%.175', "function sinh")
+
+like(math.sqrt(2), '^1%.414', "function sqrt")
+
+like(math.tan(math.pi/3), '^1%.732', "function tan")
+
+like(math.tanh(1), '^0%.761', "function sinh")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 94 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/307-bit.t.txt

@@ -0,0 +1,94 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2010-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Bitwise Library
+
+=head2 Synopsis
+
+    % prove 307-bit.t
+
+=head2 Description
+
+Tests Lua Bitwise Library
+
+See "Lua 5.2 Reference Manual", section 6.7 "Bitwise operations",
+L<http://www.lua.org/manual/5.2/manual.html#6.7>.
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+if jit then
+    skip_all("LuaJIT. bit32")
+end
+
+plan(20)
+
+is(bit32.band(0x01, 0x03, 0x07), 0x01, "function band")
+
+is(bit32.bnot(0x03), (-1 - 0x03) % 2^32, "function bnot")
+
+is(bit32.bor(0x01, 0x03, 0x07), 0x07, "function bor")
+
+is(bit32.btest(0x01), true, "function btest")
+is(bit32.btest(0x00), false, "function btest")
+
+is(bit32.bxor(0x01, 0x03, 0x07), 0x05, "function bxor")
+
+is(bit32.lrotate(0x03, 2), 0x0C, "function lrotate")
+
+is(bit32.rrotate(0x06, 1), 0x03, "function rrotate")
+
+is(bit32.arshift(0x06, 1), 0x03, "function arshift")
+
+is(bit32.arshift(-3, 1), bit32.arshift(-6, 2), "function arshift")
+
+is(bit32.lshift(0x03, 2), 0x0C, "function lshift")
+
+is(bit32.rshift(0x06, 1), 0x03, "function rshift")
+
+is(bit32.extract(0xFFFF, 3, 3), 0x07, "function extract")
+
+error_like(function () bit32.extract(0xFFFF, 99) end,
+           "^[^:]+:%d+: trying to access non%-existent bits",
+           "function extract (non-existent bits)")
+
+error_like(function () bit32.extract(0xFFFF, -3) end,
+           "^[^:]+:%d+: bad argument #2 to 'extract' %(field cannot be negative%)",
+           "function extract (negatif field)")
+
+error_like(function () bit32.extract(0xFFFF, 3, -3) end,
+           "^[^:]+:%d+: bad argument #3 to 'extract' %(width must be positive%)",
+           "function extract (negative width)")
+
+is(bit32.replace(0x0000, 0xFFFF, 3, 3), 0x38, "function replace")
+
+error_like(function () bit32.replace(0x0000, 0xFFFF, 99) end,
+           "^[^:]+:%d+: trying to access non%-existent bits",
+           "function replace (non-existent bits)")
+
+error_like(function () bit32.replace(0x0000, 0xFFFF, -3) end,
+           "^[^:]+:%d+: bad argument #3 to 'replace' %(field cannot be negative%)",
+           "function replace (negatif field)")
+
+error_like(function () bit32.replace(0x0000, 0xFFFF, 3, -3) end,
+           "^[^:]+:%d+: bad argument #4 to 'replace' %(width must be positive%)",
+           "function replace (negative width)")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 258 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/308-io.t.txt

@@ -0,0 +1,258 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Input/Output Library
+
+=head2 Synopsis
+
+    % prove 308-io.t
+
+=head2 Description
+
+Tests Lua Input/Output Library
+
+See "Lua 5.2 Reference Manual", section 6.8 "Input and Output Facilities",
+L<http://www.lua.org/manual/5.2/manual.html#6.8>.
+
+See "Programming in Lua", section 21 "The I/O Library".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+local lua = [[\git\moonsharp\src\Tools\lua52.exe]]
+
+plan(67)
+
+like(io.stdin, '^file %(0?[Xx]?%x+%)$', "variable stdin")
+
+like(io.stdout, '^file %(0?[Xx]?%x+%)$', "variable stdout")
+
+like(io.stderr, '^file %(0?[Xx]?%x+%)$', "variable stderr")
+
+r, msg = io.close(io.stderr)
+is(r, nil, "close (std)")
+is(msg, "cannot close standard file")
+
+is(io.flush(), true, "function flush")
+
+os.remove('file.no')
+f, msg = io.open("file.no")
+is(f, nil, "function open")
+is(msg, "file.no: No such file or directory")
+
+os.remove('file.txt')
+f = io.open('file.txt', 'w')
+f:write("file with text\n")
+f:close()
+f = io.open('file.txt')
+like(f, '^file %(0?[Xx]?%x+%)$', "function open")
+
+
+is(io.close(f), true, "function close")
+
+error_like(function () io.close(f) end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "function close (closed)")
+
+if jit then
+    todo("LuaJIT TODO. open mode")
+end
+error_like(function () io.open('file.txt', 'baz') end,
+           "^[^:]+:%d+: bad argument #2 to 'open' %(invalid mode%)",
+           "function open (bad mode)")
+
+		   
+is(io.type("not a file"), nil, "function type")
+f = io.open('file.txt')
+is(io.type(f), 'file')
+like(tostring(f), '^file %(0?[Xx]?%x+%)$')
+io.close(f)
+is(io.type(f), 'closed file')
+is(tostring(f), 'file (closed)')
+
+is(io.stdin, io.input(), "function input")
+is(io.stdin, io.input(nil))
+f = io.stdin
+
+like(io.input('file.txt'), '^file %(0?[Xx]?%x+%)$')
+is(f, io.input(f))
+
+is(io.output(), io.stdout, "function output")
+is(io.output(nil), io.stdout)
+f = io.stdout
+like(io.output('output.new'), '^file %(0?[Xx]?%x+%)$')
+is(f, io.output(f))
+os.remove('output.new')
+
+r, f = pcall(io.popen, lua .. [[ -e "print 'standard output'"]])
+if r then
+    is(io.type(f), 'file', "popen (read)")
+    is(f:read(), "standard output")
+    is(io.close(f), true)
+else
+    skip("io.popen not supported", 3)
+end
+
+r, f = pcall(io.popen, lua .. [[ -e "for line in io.lines() do print((line:gsub('e', 'a'))) end"]], 'w')
+if r then
+    is(io.type(f), 'file', "popen (write)")
+    f:write("# hello\n") -- not tested : hallo
+    is(io.close(f), true)
+else
+    skip("io.popen not supported", 2)
+end
+
+for line in io.lines('file.txt') do
+    is(line, "file with text", "function lines(filename)")
+end
+
+error_like(function () io.lines('file.no') end,
+           "No such file or directory",
+           "function lines(no filename)")
+
+f = io.tmpfile()
+is(io.type(f), 'file', "function tmpfile")
+f:write("some text")
+f:close()
+
+io.write() -- not tested
+io.write('# text', 12, "\n") -- not tested :  # text12
+
+r, msg = io.stderr:close()
+is(r, nil, "method close (std)")
+is(msg, "cannot close standard file")
+
+f = io.open('file.txt')
+is(f:close(), true, "method close")
+
+is(io.stderr:flush(), true, "method flush")
+
+error_like(function () f:flush() end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "method flush (closed)")
+
+error_like(function () f:read() end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "method read (closed)")
+
+f = io.open('file.txt')
+s = f:read()
+is(s:len(), 14, "method read")
+is(s, "file with text")
+s = f:read()
+is(s, nil)
+f:close()
+
+f = io.open('file.txt')
+error_like(function () f:read('*z') end,
+           "^[^:]+:%d+: bad argument #1 to 'read' %(invalid %w+%)",
+           "method read (invalid)")
+f:close()
+
+f = io.open('file.txt')
+s1, s2 = f:read('*l', '*l')
+is(s1:len(), 14, "method read *l")
+is(s1, "file with text")
+is(s2, nil)
+f:close()
+
+f = io.open('file.txt')
+s1, s2 = f:read('*L', '*L')
+is(s1:len(), 15, "method read *L")
+is(s1, "file with text\n")
+is(s2, nil)
+f:close()
+
+f = io.open('file.txt')
+n1, n2 = f:read('*n', '*n')
+is(n1, nil, "method read *n")
+is(n2, nil)
+f:close()
+
+f = io.open('file.txt')
+s = f:read('*a')
+is(s:len(), 15, "method read *a")
+is(s, "file with text\n")
+f:close()
+
+f = io.open('file.txt')
+is(f:read(0), '', "method read number")
+eq_array({f:read(5, 5, 15)}, {'file ', 'with ', "text\n"})
+-- print(f:read(0))
+f:close()
+
+f = io.open('file.txt')
+for line in f:lines() do
+    is(line, "file with text", "method lines")
+end
+is(io.type(f), 'file')
+f:close()
+is(io.type(f), 'closed file')
+
+f = io.open('file.txt')
+for two_char in f:lines(2) do
+    is(two_char, "fi", "method lines (with read option)")
+    break
+end
+f:close()
+
+error_like(function () f:seek('end', 0) end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "method seek (closed)")
+
+f = io.open('file.txt')
+error_like(function () f:seek('bad', 0) end,
+           "^[^:]+:%d+: bad argument #1 to 'seek' %(invalid option 'bad'%)",
+           "method seek (invalid)")
+
+f = io.open('file.txt')
+if platform and platform.osname == 'MSWin32' then
+    is(f:seek('end', 0), 16, "method seek")
+else
+    is(f:seek('end', 0), 15, "method seek")
+end
+f:close()
+
+f = io.open('file.txt')
+is(f:setvbuf('no'), true, "method setvbuf 'no'")
+
+is(f:setvbuf('full', 4096), true, "method setvbuf 'full'")
+
+is(f:setvbuf('line', 132), true, "method setvbuf 'line'")
+f:close()
+
+os.remove('file.txt') -- clean up
+
+f = io.open('file.out', 'w')
+f:close()
+error_like(function () f:write('end') end,
+           "^[^:]+:%d+: attempt to use a closed file",
+           "method write (closed)")
+
+f = io.open('file.out', 'w')
+is(f:write('end'), f, "method write")
+f:close()
+
+os.remove('file.out') --clean up
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:
+
+--]==]
+

+ 198 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/309-os.t.txt

@@ -0,0 +1,198 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Operating System Library
+
+=head2 Synopsis
+
+    % prove 309-os.t
+
+=head2 Description
+
+Tests Lua Operating System Library
+
+See "Lua 5.2 Reference Manual", section 6.9 "Operating System Facilities",
+L<http://www.lua.org/manual/5.2/manual.html#6.9>.
+
+See "Programming in Lua", section 22 "The Operating System Library".
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+plan(54)
+
+local lua = "lua.exe"
+
+clk = os.clock()
+type_ok(clk, 'number', "function clock")
+ok(clk <= os.clock())
+
+d = os.date('!*t', 0)
+is(d.year, 1970, "function date")
+is(d.month, 1)
+is(d.day, 1)
+is(d.hour, 0)
+is(d.min, 0)
+is(d.sec, 0)
+is(d.wday, 5)
+is(d.yday, 1)
+is(d.isdst, false)
+
+is(os.date('!%d/%m/%y %H:%M:%S', 0), '01/01/70 00:00:00', "function date")
+
+like(os.date('%H:%M:%S'), '^%d%d:%d%d:%d%d', "function date")
+
+if jit and jit.version_num < 20100 then
+    todo("LuaJIT TODO. invalid strftime.", 1)
+end
+is(os.date('%Oy', 0), '70')
+if jit then
+    todo("LuaJIT TODO. invalid strftime.", 1)
+end
+
+
+
+error_like(function () os.date('%Ja', 0) end,
+           "^[^:]+:%d+: bad argument #1 to 'date' %(invalid conversion specifier '%%Ja'%)",
+           "function date (invalid)")
+
+is(os.difftime(1234, 1200), 34, "function difftime")
+is(os.difftime(1234), 1234)
+
+r = os.execute()
+is(r, true, "function execute")
+
+r, s, n = os.execute('__IMPROBABLE__')
+is(r, nil, "function execute")
+is(s, 'exit')
+type_ok(n, 'number')
+
+cmd = lua .. [[ -e "print '# hello from external Lua'; os.exit(2)"]]
+r, s, n = os.execute(cmd)
+is(r, nil)
+is(s, 'exit', "function execute & exit")
+is(n, 2, "exit value")
+
+cmd = lua .. [[ -e "print '# hello from external Lua'; os.exit(false)"]]
+r, s, n = os.execute(cmd)
+is(r, nil)
+is(s, 'exit', "function execute & exit")
+is(n, 1, "exit value")
+
+-- cmd = lua .. [[ -e "print '# hello from external Lua'; os.exit(true, true)"]]
+-- is(os.execute(cmd), true, "function execute & exit")
+
+cmd = lua .. [[ -e "print 'reached'; os.exit(); print 'not reached';"]]
+r, f = pcall(io.popen, cmd)
+if r then
+    is(f:read'*l', 'reached', "function exit")
+    is(f:read'*l', nil)
+    code = f:close()
+    is(code, true, "exit code")
+else
+    skip("io.popen not supported", 3)
+end
+
+cmd = lua .. [[ -e "print 'reached'; os.exit(3); print 'not reached';"]]
+r, f = pcall(io.popen, cmd)
+if r then
+    is(f:read'*l', 'reached', "function exit")
+    is(f:read'*l', nil)
+    r, s, n = f:close()
+    is(r, nil)
+    is(s, 'exit', "exit code")
+    is(n, 3, "exit value")
+else
+    skip("io.popen not supported", 5)
+end
+
+is(os.getenv('__IMPROBABLE__'), nil, "function getenv")
+
+user = os.getenv('LOGNAME') or os.getenv('USERNAME')
+type_ok(user, 'string', "function getenv")
+
+local f = io.open('file.rm', 'w')
+f:write("file to remove")
+f:close()
+r = os.remove("file.rm")
+is(r, true, "function remove")
+
+r, msg = os.remove('file.rm')
+is(r, nil, "function remove")
+like(msg, '^file.rm: No such file or directory')
+
+local f = io.open('file.old', 'w')
+f:write("file to rename")
+f:close()
+os.remove('file.new')
+r = os.rename('file.old', 'file.new')
+is(r, true, "function rename")
+os.remove('file.new') -- clean up
+
+r, msg = os.rename('file.old', 'file.new')
+is(r, nil, "function rename")
+like(msg, 'No such file or directory')
+
+--[[  setlocale NOT supported!
+is(os.setlocale('C', 'all'), 'C', "function setlocale")
+is(os.setlocale(), 'C')
+
+is(os.setlocale('unk_loc', 'all'), nil, "function setlocale (unknown locale)")
+
+]]
+
+like(os.time(), '^%d+%.?%d*$', "function time")
+
+like(os.time(nil), '^%d+%.?%d*$', "function time")
+
+like(os.time({
+    sec = 0,
+    min = 0,
+    hour = 0,
+    day = 1,
+    month = 1,
+    year = 2000,
+    isdst = 0,
+}), '^946%d+$', "function time")
+
+if platform and platform.intsize == 8 then
+    todo("pb on 64bit platforms")
+    -- os.time returns nil when C mktime returns < 0
+    -- this test needs a out of range value on any platform
+end
+is(os.time({
+    sec = 0,
+    min = 0,
+    hour = 0,
+    day = 1,
+    month = 1,
+    year = 1000,
+    isdst = 0,
+}), nil, "function time -> nil")
+
+error_like(function () os.time{} end,
+           "^[^:]+:%d+: field 'day' missing in date table",
+           "function time (missing field)")
+
+fname = os.tmpname()
+type_ok(fname, 'string', "function tmpname")
+ok(fname ~= os.tmpname())
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 183 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/310-debug.t.txt

@@ -0,0 +1,183 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Debug Library
+
+=head2 Synopsis
+
+    % prove 310-debug.t
+
+=head2 Description
+
+Tests Lua Debug Library
+
+See "Lua 5.2 Reference Manual", section 6.10 "The Debug Library",
+L<http://www.lua.org/manual/5.2/manual.html#6.10>.
+
+See "Programming in Lua", section 23 "The Debug Library".
+
+=cut
+
+]]
+
+require 'Test.More'
+
+plan(51)
+
+debug = require 'debug'
+
+info = debug.getinfo(is)
+type_ok(info, 'table', "function getinfo (function)")
+is(info.func, is, " .func")
+
+info = debug.getinfo(is, 'L')
+type_ok(info, 'table', "function getinfo (function, opt)")
+type_ok(info.activelines, 'table')
+
+info = debug.getinfo(1)
+type_ok(info, 'table', "function getinfo (level)")
+like(info.func, "^function: [0]?[Xx]?%x+", " .func")
+
+is(debug.getinfo(12), nil, "function getinfo (too depth)")
+
+error_like(function () debug.getinfo('bad') end,
+           "bad argument #1 to 'getinfo' %(function or level expected%)",
+           "function getinfo (bad arg)")
+
+error_like(function () debug.getinfo(is, 'X') end,
+           "bad argument #2 to 'getinfo' %(invalid option%)",
+           "function getinfo (bad opt)")
+
+local name, value = debug.getlocal(0, 1)
+type_ok(name, 'string', "function getlocal (level)")
+is(value, 0)
+
+error_like(function () debug.getlocal(42, 1) end,
+           "bad argument #1 to 'getlocal' %(level out of range%)",
+           "function getlocal (out of range)")
+
+local name, value = debug.getlocal(like, 1)
+type_ok(name, 'string', "function getlocal (func)")
+is(value, nil)
+
+t = {}
+is(debug.getmetatable(t), nil, "function getmetatable")
+t1 = {}
+debug.setmetatable(t, t1)
+is(debug.getmetatable(t), t1)
+
+a = true
+is(debug.getmetatable(a), nil)
+debug.setmetatable(a, t1)
+is(debug.getmetatable(t), t1)
+
+a = 3.14
+is(debug.getmetatable(a), nil)
+debug.setmetatable(a, t1)
+is(debug.getmetatable(t), t1)
+
+local reg = debug.getregistry()
+type_ok(reg, 'table', "function getregistry")
+type_ok(reg._LOADED, 'table')
+
+local name = debug.getupvalue(plan, 1)
+type_ok(name, 'string', "function getupvalue")
+
+debug.sethook()
+hook, mask, count = debug.gethook()
+is(hook, nil, "function gethook")
+is(mask, '')
+is(count, 0)
+local function f () end
+debug.sethook(f, 'c', 42)
+hook , mask, count = debug.gethook()
+is(hook, f, "function gethook")
+is(mask, 'c')
+is(count, 42)
+
+co = coroutine.create(function () print "thread" end)
+hook = debug.gethook(co)
+if jit then
+    todo("LuaJIT TODO. debug.gethook(thread)", 1)
+end
+is(hook, nil, "function gethook(thread)")
+
+local name = debug.setlocal(0, 1, 0)
+type_ok(name, 'string', "function setlocal (level)")
+
+local name = debug.setlocal(0, 42, 0)
+is(name, nil, "function setlocal (level)")
+
+error_like(function () debug.setlocal(42, 1, true) end,
+           "bad argument #1 to 'setlocal' %(level out of range%)",
+           "function getlocal (out of range)")
+
+t = {}
+t1 = {}
+is(debug.setmetatable(t, t1), t, "function setmetatable")
+is(getmetatable(t), t1)
+
+error_like(function () debug.setmetatable(t, true) end,
+           "^[^:]+:%d+: bad argument #2 to 'setmetatable' %(nil or table expected%)")
+
+local name = debug.setupvalue(plan, 1, require 'Test.Builder':new())
+type_ok(name, 'string', "function setupvalue")
+
+local name = debug.setupvalue(plan, 42, true)
+is(name, nil)
+
+local u = io.tmpfile()
+local old = debug.getuservalue(u)
+if jit then
+    type_ok(old, 'table', "function getuservalue")
+else
+    is(old, nil, "function getuservalue")
+end
+is(debug.getuservalue(true), nil)
+local data = {}
+r = debug.setuservalue(u, data)
+is(r, u, "function setuservalue")
+is(debug.getuservalue(u), data)
+r = debug.setuservalue(u, old)
+is(debug.getuservalue(u), old)
+
+error_like(function () debug.setuservalue({}, data) end,
+           "^[^:]+:%d+: bad argument #1 to 'setuservalue' %(userdata expected, got table%)")
+
+error_like(function () debug.setuservalue(u, true) end,
+           "^[^:]+:%d+: bad argument #2 to 'setuservalue' %(table expected, got boolean%)")
+
+like(debug.traceback(), "^stack traceback:\n", "function traceback")
+
+like(debug.traceback("message\n"), "^message\n\nstack traceback:\n", "function traceback with message")
+
+like(debug.traceback(false), "false", "function traceback")
+
+local id = debug.upvalueid(plan, 1)
+type_ok(id, 'userdata', "function upvalueid")
+
+debug.upvaluejoin (pass, 1, fail, 1)
+
+error_like(function () debug.upvaluejoin(true, 1, nil, 1) end,
+           "bad argument #1 to 'upvaluejoin' %(function expected, got boolean%)",
+           "function upvaluejoin (bad arg)")
+
+error_like(function () debug.upvaluejoin(pass, 1, true, 1) end,
+           "bad argument #3 to 'upvaluejoin' %(function expected, got boolean%)",
+           "function upvaluejoin (bad arg)")
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 346 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/314-regex.t.txt

@@ -0,0 +1,346 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2013, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Regex Compiler
+
+=head2 Synopsis
+
+    % prove 314-regex.t
+
+=head2 Description
+
+Tests Lua Regex
+
+Individual tests are stored in the C<rx_*> files in the same directory;
+There is one test per line: each test consists of the following
+columns (separated by one *or more* tabs):
+
+=over 4
+
+=item pattern
+
+The Lua regex to test.
+
+=item target
+
+The string that will be matched against the pattern. Use '' to indicate
+an empty string.
+
+=item result
+
+The expected result of the match.
+
+=item description
+
+Description of the test.
+
+=back
+
+=cut
+
+--]]
+
+local test_patterns = {
+	[===[(a.)..(..)		zzzabcdefzzz	ab\tef			basic match]===], 
+	[===[(a(b(c))(d))		abcd		abcd\tbc\tc\td		nested match]===], 
+	[===[((%w+))			abcd		abcd\tabcd		nested match]===], 
+	[===[(a*(.)%w(%s*))		aa!b c		aa!b \t!\t 		nested match]===], 
+	[===[(a?)..			abcd		a			opt]===], 
+	[===[(A?)..			abcd		''			opt]===], 
+	[===[()aa()			flaaap		3\t5			empty capture]===], 
+	[===[(.)%1			bookkeeper	o			backreference]===], 
+	[===[(%w+)%s+%1		hello hello	hello			backreference]===], 
+	[===[(.*)x			123x		123			repeated dot capture]===], 
+	[===[$(%w+)			$abc=		abc			not escaped]===], 
+	[===[[c]			abcdef		c		character class]===], 
+	[===[^[a]			abcdef		a		anchored character class]===], 
+	[===[[^e]			abcdef		a		negated character class]===], 
+	[===[^[a]?			abcdef		a		anchored optional character class]===], 
+	[===[[^e]?			abcdef		a		negated optional character class]===], 
+	[===[^[^e]			abcdef		a		anchored negated character class]===], 
+	[===[^[^a]			abcdef		nil		anchored negated character class]===], 
+	[===[[b-d]			abcdef		b		character range]===], 
+	[===[[b-d]			abxxef		b		character range]===], 
+	[===[[b-d]			axcxef		c		character range]===], 
+	[===[[b-d]			axxdef		d		character range]===], 
+	[===[[b-d]			axxxef		nil		character range]===], 
+	[===[[^b-d]			abcdef		a		negated character range]===], 
+	[===[[^b-d]			bbccdd		nil		negated character range]===], 
+	[===[[-]			ab-def		-		unescaped hyphen]===], 
+	[===[[%-]			ab-def		-		escaped hyphen]===], 
+	[===[[%-]			abcdef		nil		escaped hyphen]===], 
+	[===[[^%-]			---x--		x		negated escaped hyphen]===], 
+	[===[[^%-]			------		nil		negated escaped hyphen]===], 
+	[===[[%-+]			ab-def		-		escaped hyphen in range]===], 
+	[===[[%-+]			ab+def		+		escaped hyphen in range]===], 
+	[===[[%-+]			abcdef		nil		escaped hyphen in range]===], 
+	[===[[+%-]			ab-def		-		escaped hyphen in range]===], 
+	[===[[+%-]			ab+def		+		escaped hyphen in range]===], 
+	[===[[+%-]			abcdef		nil		escaped hyphen in range]===], 
+	[===[[^%-+]			---x--		x		negated escaped hyphen in range]===], 
+	[===[[^%-+]			------		nil		negated escaped hyphen in range]===], 
+	[===[[^+%-]			---x--		x		negated escaped hyphen in range]===], 
+	[===[[^+%-]			------		nil		negated escaped hyphen in range]===], 
+	[===[["\\]			\\		\		escaped backslash]===], 
+	[===[[%]]			]		]		escaped close bracket]===], 
+	[===[[%]			\\]]		/malformed pattern %(missing ']'%)/	unescaped backslash (or no closing brace)]===], 
+	[===[ab\\cd			ab\092cd	ab\cd		literal match with backslash]===], 
+	[===[%?			ab<?		?		literal match with question mark]===], 
+	[===[[A-Z0-9]		abcdef		nil		two enumerated ranges]===], 
+	[===[[A-Z0-9]		abcDef		D		two enumerated ranges]===], 
+	[===[.			a		a		dot (.)]===], 
+	[===[.			\n		\n		dot (.)]===], 
+	[===[.			''		nil		dot (.)]===], 
+	[===[a%s+f			abcdef		nil		whitespace (%s)]===], 
+	[===[ab%s+cdef		ab  cdef	ab  cdef	whitespace (%s)]===], 
+	[===[a%S+f			abcdef		abcdef		not whitespace (%S)]===], 
+	[===[a%S+f			ab cdef		nil		not whitespace (%S)]===], 
+	[===[^abc			abcdef		abc		start and end of string (^)]===], 
+	[===[^abc			abc\ndef	abc		start and end of string (^)]===], 
+	[===[^abc			def\nabc	nil		start and end of string (^)]===], 
+	[===[def\n^abc		def\nabc	nil		start and end of string (^)]===], 
+	[===[def$			abcdef		def		start and end of string ($)]===], 
+	[===[def$			abc\ndef	def		start and end of string ($)]===], 
+	[===[def$			def\nabc	nil		start and end of string ($)]===], 
+	[===[def$\nabc		def\nabc	nil		start and end of string (^)]===], 
+	[===[abc\n$			abc\n		abc\n		end of string ($)]===], 
+	[===[abc$			abc\n		nil		end of string ($)]===], 
+	[===[c\nd			abc\ndef	c\nd		newline (\n)]===], 
+	[===[c\nd			abc\010def	c\nd		newline (\n)]===], 
+	[===[c\n+d			abc\n\ndef	c\n\nd		newline (\n)]===], 
+	[===[a\n+f			abcdef		nil		newline (\n)]===], 
+	[===[b\nc			abc\ndef	nil		newline (\n)]===], 
+	[===[c\td			abc\tdef	c\td		horizontal tab (\t)]===], 
+	[===[c\td			abc\09def	c\td		horizontal tab (\t)]===], 
+	[===[c\t+d			abc\t\tdef	c\t\td		horizontal tab (\t)]===], 
+	[===[a\t+f			abcdef		nil		horizontal tab (\t)]===], 
+	[===[b\tc			abc\tdef	nil		horizontal tab (\t)]===], 
+	[===[c\rd			abc\rdef	c\rd		return (\r)]===], 
+	[===[c\rd			abc\013def	c\rd		return (\r)]===], 
+	[===[c\r+d			abc\r\rdef	c\r\rd		return (\r)]===], 
+	[===[a\r+f			abcdef		nil		return (\r)]===], 
+	[===[b\rc			abc\rdef	nil		return (\r)]===], 
+	[===[c\fd			abc\fdef	c\fd		formfeed (\f)]===], 
+	[===[c\fd			abc\012def	c\fd		formfeed (\f)]===], 
+	[===[c\f+d			abc\f\fdef	c\f\fd		formfeed (\f)]===], 
+	[===[a\f+f			abcdef		nil		formfeed (\f)]===], 
+	[===[b\fc			abc\fdef	nil		formfeed (\f)]===], 
+	[===[c\033d			abc!def		c!d		dec (\0)]===], 
+	[===[c\033d			abc\033def	c!d		dec (\0)]===], 
+	[===[c\033+d			abc!!def	c!!d		dec (\0)]===], 
+	[===[a\033+f			abcdef		nil		dec (\0)]===], 
+	[===[b\033c			abc!def		nil		dec (\0)]===], 
+	[===[a%^d			a^d		a^d		escaped (useless)]===], 
+	[===[a^d			a^d		a^d		not escaped]===], 
+	[===[%^d			^d		^d		escaped]===], 
+	[===[a%$d			a$d		a$d		escaped (useless)]===], 
+	[===[a$d			a$d		a$d		not escaped]===], 
+	[===[a%$			a$		a$		escaped]===], 
+	[===[a%(d			a(d		a(d		escaped]===], 
+	[===[a%)d			a)d		a)d		escaped]===], 
+	[===[a%%d			a%d		a%d		escaped]===], 
+	[===[a%			a%		/malformed pattern %(ends with '%%'%)/	not escaped]===], 
+	[===[a%.d			a.d		a.d		escaped]===], 
+	[===[a%.d			abd		nil		escaped]===], 
+	[===[a%[d			a[d		a[d		escaped]===], 
+	[===[a%]d			a]d		a]d		escaped]===], 
+	[===[a%*d			a*d		a*d		escaped]===], 
+	[===[*ad			*ad		*ad		not escaped]===], 
+	[===[a%+d			a+d		a+d		escaped]===], 
+	[===[a%-d			a-d		a-d		escaped]===], 
+	[===[a%?d			a?d		a?d		escaped]===], 
+	[===[a%yd			ayd		ayd		escaped]===], 
+	[===[a%w+f			a=[ *f		nil		word character]===], 
+	[===[a%w+f			abcdef		abcdef		word character]===], 
+	[===[a%W+f			a&%- f		a&%- f		not word character]===], 
+	[===[a%W+f			abcdef		nil		not word character]===], 
+	[===[a%d+f			abcdef		nil		digit]===], 
+	[===[ab%d+cdef		ab42cdef	ab42cdef	digit]===], 
+	[===[a%D+f			abcdef		abcdef		not digit]===], 
+	[===[a%D+f			ab0cdef		nil		not digit]===], 
+	[===[a%l+f			aBCDEf		nil		lowercase letter]===], 
+	[===[a%l+f			abcdef		abcdef		lowercase letter]===], 
+	[===[a%L+f			a&2D f		a&2D f		not lowercase letter]===], 
+	[===[a%L+f			aBCdEf		nil		not lowercase letter]===], 
+	[===[a%u+f			abcdef		nil		uppercase letter]===], 
+	[===[a%u+f			aBCDEf		aBCDEf		uppercase letter]===], 
+	[===[a%U+f			a&2d f		a&2d f		not uppercase letter]===], 
+	[===[a%U+f			a&2D f		nil		not uppercase letter]===], 
+	[===[a%a+f			aBcDef		aBcDef		all letter]===], 
+	[===[a%a+f			a=[ *f		nil		all letter]===], 
+	[===[a%A+f			a&%- f		a&%- f		not all letter]===], 
+	[===[a%A+f			abcdef		nil		not all letter]===], 
+	[===[a%g+f			aBcDef		aBcDef		printable]===], 
+	[===[a%g+f			a=[ *f		nil		printable]===], 
+	[===[a%G+f			a \nf		a \nf		not printable]===], 
+	[===[a%G+f			abcdef		nil		not printable]===], 
+	[===[a%p+f			abcdef		nil		ponctuation]===], 
+	[===[a%p+f			a,;:!f		a,;:!f		ponctuation]===], 
+	[===[a%P+f			abcdef		abcdef		not ponctuation]===], 
+	[===[a%P+f			adc:ef		nil		not ponctuation]===], 
+	[===[a%c+f			abcdef		nil		control character]===], 
+	[===[a%c+f			a\04\03\02f	a\04\03\02f	control character]===], 
+	[===[a%C+f			abcdef		abcdef		not control character]===], 
+	[===[a%C+f			abc\01ef	nil		not control character]===], 
+	[===[a%x+f			axyzef		nil		hexadecimal]===], 
+	[===[a%x+f			ab3Def		ab3Def		hexadecimal]===], 
+	[===[a%X+f			abcdef		nil		not hexadecimal]===], 
+	[===[a%X+f			axy;Zf		axy;Zf		not hexadecimal]===], 
+	[===[a%z+f			abcdef		nil		zero (deprecated)]===], 
+	[===[a\0+f			abcdef		nil		zero]===], 
+	[===[a%z+f			a\0f		a\0f		zero (deprecated)]===], 
+	[===[a\0+f			a\0f		a\0f		zero]===], 
+	[===[a%Z+f			abcdef		abcdef		not zero (deprecated)]===], 
+	[===[a[^\0]+f		abcdef		abcdef		not zero]===], 
+	[===[a%Z+f			abc\0ef		nil		not zero (deprecated)]===], 
+	[===[a[^\0]+f		abc\0ef		nil		not zero]===], 
+	[===[a%b()f			a(bcde)f	a(bcde)f	balanced]===], 
+	[===[a%b()f			a(b(de)f	nil		balanced]===], 
+	[===[a%b()f			a(b(d)e)f	a(b(d)e)f	balanced]===], 
+	[===[a%b''f			a'bcde'f	a'bcde'f	balanced]===], 
+	[===[a%b""f			a"bcde"f	a"bcde"f	balanced]===], 
+	[===[%f[b]bc			abcdef		bc		frontier]===], 
+	[===[%f[b]c			abcdef		nil		frontier]===], 
+	[===[%f[^ab]c		abacdef		c		frontier]===], 
+	[===[%f[^ab]d		abacdef		nil		frontier]===]
+}	
+
+require 'Test.More'
+
+plan(162)
+
+
+local function split (line)
+    local pattern, target, result, desc = '', '', '', ''
+    local idx = 1
+    local c = line:sub(idx, idx)
+    while (c ~= '' and c ~= "\t") do
+        if (c == '"') then
+            pattern = pattern .. "\\\""
+        else
+            pattern = pattern .. c
+        end
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    if pattern == "''" then
+        pattern = ''
+    end
+    while (c ~= '' and c == "\t") do
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    while (c ~= '' and c ~= "\t") do
+        if (c == '"') then
+            target = target .. "\\\""
+        else
+            target = target .. c
+        end
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    if target == "''" then
+        target = ''
+    end
+    while (c ~= '' and c == "\t") do
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    while (c ~= '' and c ~= "\t") do
+        if c == "\\" then
+            idx = idx + 1
+            c = line:sub(idx, idx)
+            if     c == 'f' then
+                result = result .. "\f"
+            elseif c == 'n' then
+                result = result .. "\n"
+            elseif c == 'r' then
+                result = result .. "\r"
+            elseif c == 't' then
+                result = result .. "\t"
+            elseif c == '0' then
+                idx = idx + 1
+                c = line:sub(idx, idx)
+                if     c == '1' then
+                    result = result .. "\01"
+                elseif c == '2' then
+                    result = result .. "\02"
+                elseif c == '3' then
+                    result = result .. "\03"
+                elseif c == '4' then
+                    result = result .. "\04"
+                else
+                    result = result .. "\0" .. c
+                end
+            elseif c == "\t" then
+                result = result .. "\\"
+            else
+                result = result .. "\\" .. c
+            end
+        else
+            result = result .. c
+        end
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    if result == "''" then
+        result = ''
+    end
+    while (c ~= '' and c == "\t") do
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    while (c ~= '' and c ~= "\t") do
+        desc = desc .. c
+        idx = idx + 1
+        c = line:sub(idx, idx)
+    end
+    return pattern, target, result, desc
+end
+
+local test_number = 0
+
+for _, line in ipairs(test_patterns) do
+    if line:len() == 0 then
+        break
+    end
+    local pattern, target, result, desc = split(line)
+    test_number = test_number + 1
+
+    local code = [[
+            local t = {string.match("]] .. target .. [[", "]] .. pattern .. [[")}
+            if #t== 0 then
+                return 'nil'
+            else
+                return table.concat(t, "\t")
+            end
+    ]]
+    local compiled, msg = load(code)
+    if not compiled then
+        error("can't compile : " .. code .. "\n" .. msg)
+    end
+    if result:sub(1, 1) == '/' then
+        local pattern = result:sub(2, result:len() - 1)
+        error_like(compiled, pattern, desc)
+    else
+        local out
+        pcall(function () out = compiled() end)
+        is(out, result, desc)
+    end
+end
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 124 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/320-stdin.t.txt

@@ -0,0 +1,124 @@
+#! /usr/bin/lua
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+-- Copyright (C) 2009-2011, Perrad Francois
+--
+-- This code is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--
+
+--[[
+
+=head1 Lua Library
+
+=head2 Synopsis
+
+    % prove 320-stdin.t
+
+=head2 Description
+
+Tests Lua Basic & IO Libraries with stdin
+
+=cut
+
+--]]
+
+require 'Test.More'
+
+local lua = (platform and platform.lua) or arg[-1]
+
+if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
+    skip_all "io.popen not supported"
+end
+
+plan(12)
+
+f = io.open('lib1.lua', 'w')
+f:write[[
+function norm (x, y)
+    return (x^2 + y^2)^0.5
+end
+
+function twice (x)
+    return 2*x
+end
+]]
+f:close()
+
+cmd = lua .. [[ -e "dofile(); n = norm(3.4, 1.0); print(twice(n))" < lib1.lua]]
+f = io.popen(cmd)
+like(f:read'*l', '^7%.088', "function dofile (stdin)")
+f:close()
+
+os.remove('lib1.lua') -- clean up
+
+f = io.open('foo.lua', 'w')
+f:write[[
+function foo (x)
+    return x
+end
+]]
+f:close()
+
+cmd = lua .. [[ -e "f = loadfile(); print(foo); f(); print(foo('ok'))" < foo.lua]]
+f = io.popen(cmd)
+is(f:read'*l', 'nil', "function loadfile (stdin)")
+is(f:read'*l', 'ok')
+f:close()
+
+os.remove('foo.lua') -- clean up
+
+f = io.open('file.txt', 'w')
+f:write("file with text\n")
+f:close()
+
+cmd = lua .. [[ -e "print(io.read'*l'); print(io.read'*l'); print(io.type(io.stdin))" < file.txt]]
+f = io.popen(cmd)
+is(f:read'*l', 'file with text', "function io.read *l")
+is(f:read'*l', 'nil')
+is(f:read'*l', 'file')
+f:close()
+
+f = io.open('number.txt', 'w')
+f:write("6.0     -3.23   15e12\n")
+f:write("4.3     234     1000001\n")
+f:close()
+
+cmd = lua .. [[ -e "while true do local n1, n2, n3 = io.read('*number', '*number', '*number'); if not n1 then break end; print(math.max(n1, n2, n3)) end" < number.txt]]
+f = io.popen(cmd)
+is(f:read'*l', '15000000000000', "function io:read *number")
+is(f:read'*l', '1000001')
+f:close()
+
+os.remove('number.txt') -- clean up
+
+cmd = lua .. [[ -e "for line in io.lines() do print(line) end" < file.txt]]
+f = io.popen(cmd)
+is(f:read'*l', 'file with text', "function io.lines")
+is(f:read'*l', nil)
+f:close()
+
+os.remove('file.txt') -- clean up
+
+f = io.open('dbg.txt', 'w')
+f:write("print 'ok'\n")
+f:write("error 'dbg'\n")
+f:write("cont\n")
+f:close()
+
+cmd = lua .. [[ -e "debug.debug()" < dbg.txt]]
+f = io.popen(cmd)
+is(f:read'*l', 'ok', "function debug.debug")
+is(f:read'*l', nil)
+f:close()
+
+os.remove('dbg.txt') -- clean up
+
+
+-- Local Variables:
+--   mode: lua
+--   lua-indent-level: 4
+--   fill-column: 100
+-- End:
+-- vim: ft=lua expandtab shiftwidth=4:

+ 392 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/Modules/Test/Builder.lua.txt

@@ -0,0 +1,392 @@
+
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+
+local debug = nil; -- require 'debug'
+local io = nil; -- require 'io'
+local os = nil; -- require 'os'
+local error = error
+local gsub = require 'string'.gsub
+local match = require 'string'.match
+local pairs = pairs
+local pcall = pcall
+local print = print
+local rawget = rawget
+local setmetatable = setmetatable
+local tconcat = require 'table'.concat
+local tonumber = tonumber
+local tostring = tostring
+local type = type
+
+_ENV = nil
+local m = {}
+
+local testout = io and io.stdout
+local testerr = io and (io.stderr or io.stdout)
+
+function m.puts (f, str)
+    f:write(str)
+end
+
+local function _print_to_fh (self, f, ...)
+   -- if f then
+   --     local msg = tconcat({...})
+   --     gsub(msg, "\n", "\n" .. self.indent)
+   --     m.puts(f, self.indent .. msg .. "\n")
+   -- else
+        print(self.indent, ...)
+   -- end
+end
+
+local function _print (self, ...)
+    _print_to_fh(self, self:output(), ...)
+end
+
+local function print_comment (self, f, ...)
+    local arg = {...}
+    for k, v in pairs(arg) do
+        arg[k] = tostring(v)
+    end
+    local msg = tconcat(arg)
+    msg = gsub(msg, "\n", "\n# ")
+    msg = gsub(msg, "\n# \n", "\n#\n")
+    msg = gsub(msg, "\n# $", '')
+    _print_to_fh(self, f, "# ", msg)
+end
+
+function m.create ()
+    local o = {
+        data = setmetatable({}, { __index = m }),
+    }
+    setmetatable(o, {
+        __index = function (t, k)
+                        return rawget(t, 'data')[k]
+                  end,
+        __newindex = function (t, k, v)
+                        rawget(o, 'data')[k] = v
+                  end,
+    })
+    o:reset()
+    return o
+end
+
+local test
+function m.new ()
+    test = test or m.create()
+    return test
+end
+
+local function in_todo (self)
+    return self.todo_upto >= self.curr_test
+end
+
+function m:child (name)
+    if self.child_name then
+        error("You already have a child named (" .. self.child_name .. " running")
+    end
+    local child = m.create()
+    child.indent    = self.indent .. '    '
+    child.out_file  = self.out_file
+    child.fail_file = in_todo(self) and self.todo_file or self.fail_file
+    child.todo_file = self.todo_file
+    child.parent    = self
+    self.child_name = name
+    return child
+end
+
+local function plan_handled (self)
+    return self.have_plan or self.no_plan or self._skip_all
+end
+
+function m:subtest (name, func)
+    if type(func) ~= 'function' then
+        error("subtest()'s second argument must be a function")
+    end
+    self:diag('Subtest: ' .. name)
+    local child = self:child(name)
+    local parent = self.data
+    self.data = child.data
+    local r, msg = pcall(func)
+    child.data = self.data
+    self.data = parent
+    if not r and not child._skip_all then
+        error(msg, 0)
+    end
+    if not plan_handled(child) then
+        child:done_testing()
+    end
+    child:finalize()
+end
+
+function m:finalize ()
+    if not self.parent then
+        return
+    end
+    if self.child_name then
+        error("Can't call finalize() with child (" .. self.child_name .. " active")
+    end
+    local parent = self.parent
+    local name = parent.child_name
+    parent.child_name = nil
+    if self._skip_all then
+        parent:skip(self._skip_all)
+    elseif self.curr_test == 0 then
+        parent:ok(false, "No tests run for subtest \"" .. name .. "\"", 2)
+    else
+        parent:ok(self.is_passing, name, 2)
+    end
+    self.parent = nil
+end
+
+function m:reset ()
+    self.curr_test = 0
+    self._done_testing = false
+    self.expected_tests = 0
+    self.is_passing = true
+    self.todo_upto = -1
+    self.todo_reason = nil
+    self.have_plan = false
+    self.no_plan = false
+    self._skip_all = false
+    self.have_output_plan = false
+    self.indent = ''
+    self.parent = false
+    self.child_name = false
+    self:reset_outputs()
+end
+
+local function _output_plan (self, max, directive, reason)
+    if self.have_output_plan then
+        error("The plan was already output")
+    end
+    local out = "1.." .. max
+    if directive then
+        out = out .. " # " .. directive
+    end
+    if reason then
+        out = out .. " " .. reason
+    end
+    _print(self, out)
+    self.have_output_plan = true
+end
+
+function m:plan (arg)
+    if self.have_plan then
+        error("You tried to plan twice")
+    end
+    if type(arg) == 'string' and arg == 'no_plan' then
+        self.have_plan = true
+        self.no_plan = true
+        return true
+    elseif type(arg) ~= 'number' then
+        error("Need a number of tests")
+    elseif arg < 0 then
+        error("Number of tests must be a positive integer.  You gave it '" .. arg .."'.")
+    else
+        self.expected_tests = arg
+        self.have_plan = true
+        _output_plan(self, arg)
+        return arg
+    end
+end
+
+function m:done_testing (num_tests)
+    if num_tests then
+        self.no_plan = false
+    end
+    num_tests = num_tests or self.curr_test
+    if self._done_testing then
+        tb:ok(false, "done_testing() was already called")
+        return
+    end
+    self._done_testing = true
+    if self.expected_tests > 0 and num_tests ~= self.expected_tests then
+        self:ok(false, "planned to run " .. self.expected_tests
+                    .. " but done_testing() expects " .. num_tests)
+    else
+        self.expected_tests = num_tests
+    end
+    if not self.have_output_plan then
+        _output_plan(self, num_tests)
+    end
+    self.have_plan = true
+    -- The wrong number of tests were run
+    if self.expected_tests ~= self.curr_test then
+        self.is_passing = false
+    end
+    -- No tests were run
+    if self.curr_test == 0 then
+        self.is_passing = false
+    end
+end
+
+function m:has_plan ()
+    if self.expected_tests > 0 then
+        return self.expected_tests
+    end
+    if self.no_plan then
+        return 'no_plan'
+    end
+    return nil
+end
+
+function m:skip_all (reason)
+    if self.have_plan then
+        error("You tried to plan twice")
+    end
+    self._skip_all = reason
+    _output_plan(self, 0, 'SKIP', reason)
+    if self.parent then
+        error("skip_all in child", 0)
+    end
+    -- os.exit(0)
+end
+
+local function _check_is_passing_plan (self)
+    local plan = self:has_plan()
+    if not plan or not tonumber(plan) then
+        return
+    end
+    if plan < self.curr_test then
+        self.is_passing = false
+    end
+end
+
+function m:ok (test, name, level)
+    if self.child_name then
+        name = name or 'unnamed test'
+        self.is_passing = false
+        error("Cannot run test (" .. name .. ") with active children")
+    end
+    name = name or ''
+    level = level or 0
+    self.curr_test = self.curr_test + 1
+    name = tostring(name)
+    if match(name, '^[%d%s]+$') then
+        self:diag("    You named your test '" .. name .."'.  You shouldn't use numbers for your test names."
+        .. "\n    Very confusing.")
+    end
+    local out = ''
+    if not test then
+        out = "not "
+    end
+    out = out .. "ok " .. self.curr_test
+    if name ~= '' then
+        out = out .. " - " .. name
+    end
+    if self.todo_reason and in_todo(self) then
+        out = out .. " # TODO " .. self.todo_reason
+    end
+    _print(self, out)
+    if not test then
+        local msg = in_todo(self) and "Failed (TODO)" or "Failed"
+        local info = debug and debug.getinfo(3 + level)
+        if info then
+            local file = info.short_src
+            local line = info.currentline
+            self:diag("    " .. msg .. " test (" .. file .. " at line " .. line .. ")")
+        else
+            self:diag("    " .. msg .. " test")
+        end
+    end
+    if not test and not in_todo(self) then
+        self.is_passing = false
+    end
+    _check_is_passing_plan(self)
+end
+
+function m:BAIL_OUT (reason)
+    local out = "Bail out!"
+    if reason then
+        out = out .. "  " .. reason
+    end
+    _print(self, out)
+    os.exit(255)
+end
+
+function m:current_test (num)
+    if num then
+        self.curr_test = num
+    end
+    return self.curr_test
+end
+
+function m:todo (reason, count)
+    count = count or 1
+    self.todo_upto = self.curr_test + count
+    self.todo_reason = reason
+end
+
+function m:skip (reason)
+    local name = "# skip"
+    if reason then
+        name = name .. " " .. reason
+    end
+    self:ok(true, name, 1)
+end
+
+function m:todo_skip (reason)
+    local name = "# TODO & SKIP"
+    if reason then
+        name = name .. " " .. reason
+    end
+    self:ok(false, name, 1)
+end
+
+function m:skip_rest (reason)
+    for i = self.curr_test, self.expected_tests do
+        tb:skip(reason)
+    end
+end
+
+local function diag_file (self)
+    if in_todo(self) then
+        return self:todo_output()
+    else
+        return self:failure_output()
+    end
+end
+
+function m:diag (...)
+    print_comment(self, diag_file(self), ...)
+end
+
+function m:note (...)
+    print_comment(self, self:output(), ...)
+end
+
+function m:output (f)
+    if f then
+        self.out_file = f
+    end
+    return self.out_file
+end
+
+function m:failure_output (f)
+    if f then
+        self.fail_file = f
+    end
+    return self.fail_file
+end
+
+function m:todo_output (f)
+    if f then
+        self.todo_file = f
+    end
+    return self.todo_file
+end
+
+function m:reset_outputs ()
+    self:output(testout)
+    self:failure_output(testerr)
+    self:todo_output(testout)
+end
+
+return m
+--
+-- Copyright (c) 2009-2012 Francois Perrad
+--
+-- This library is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--

+ 383 - 0
src/Unity/MoonSharp/Assets/Resources/MoonSharp/Scripts/Modules/Test/More.lua.txt

@@ -0,0 +1,383 @@
+
+--
+-- lua-TestMore : <http://fperrad.github.com/lua-TestMore/>
+--
+
+local loadstring = loadstring or load
+local pairs = pairs
+local pcall = pcall
+local require = require
+local tostring = tostring
+local type = type
+local match = require 'string'.match
+local unpack = require 'table'.unpack or unpack
+local _G = _G
+
+local tb = require 'Test.Builder'.new()
+
+_ENV = nil
+local m = {}
+
+function m.plan (arg)
+    tb:plan(arg)
+end
+
+function m.done_testing (num_tests)
+    tb:done_testing(num_tests)
+end
+
+function m.skip_all (reason)
+    tb:skip_all(reason)
+end
+
+function m.BAIL_OUT (reason)
+    tb:BAIL_OUT(reason)
+end
+
+function m.ok (test, name)
+    tb:ok(test, name)
+end
+
+function m.nok (test, name)
+    tb:ok(not test, name)
+end
+
+function m.is (got, expected, name)
+    local pass = got == expected
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("         got: " .. tostring(got)
+           .. "\n    expected: " .. tostring(expected))
+    end
+end
+
+function m.isnt (got, expected, name)
+    local pass = got ~= expected
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("         got: " .. tostring(got)
+           .. "\n    expected: anything else")
+    end
+end
+
+function m.like (got, pattern, name)
+    if type(pattern) ~= 'string' then
+        tb:ok(false, name)
+        tb:diag("pattern isn't a string : " .. tostring(pattern))
+        return
+    end
+    got = tostring(got)
+    local pass = match(got, pattern)
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("                  '" .. got .. "'"
+           .. "\n    doesn't match '" .. pattern .. "'")
+    end
+end
+
+function m.unlike (got, pattern, name)
+    if type(pattern) ~= 'string' then
+        tb:ok(false, name)
+        tb:diag("pattern isn't a string : " .. tostring(pattern))
+        return
+    end
+    got = tostring(got)
+    local pass = not match(got, pattern)
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("                  '" .. got .. "'"
+           .. "\n          matches '" .. pattern .. "'")
+    end
+end
+
+local cmp = {
+    ['<']  = function (a, b) return a <  b end,
+    ['<='] = function (a, b) return a <= b end,
+    ['>']  = function (a, b) return a >  b end,
+    ['>='] = function (a, b) return a >= b end,
+    ['=='] = function (a, b) return a == b end,
+    ['~='] = function (a, b) return a ~= b end,
+}
+
+function m.cmp_ok (this, op, that, name)
+    local f = cmp[op]
+    if not f then
+        tb:ok(false, name)
+        tb:diag("unknown operator : " .. tostring(op))
+        return
+    end
+    local pass = f(this, that)
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("    " .. tostring(this)
+           .. "\n        " .. op
+           .. "\n    " .. tostring(that))
+    end
+end
+
+function m.type_ok (val, t, name)
+    if type(t) ~= 'string' then
+        tb:ok(false, name)
+        tb:diag("type isn't a string : " .. tostring(t))
+        return
+    end
+    if type(val) == t then
+        tb:ok(true, name)
+    else
+        tb:ok(false, name)
+        tb:diag("    " .. tostring(val) .. " isn't a '" .. t .."' it's a '" .. type(val) .. "'")
+    end
+end
+
+function m.subtest (name, func)
+    tb:subtest(name, func)
+end
+
+function m.pass (name)
+    tb:ok(true, name)
+end
+
+function m.fail (name)
+    tb:ok(false, name)
+end
+
+function m.require_ok (mod)
+    local r, msg = pcall(require, mod)
+    tb:ok(r, "require '" .. tostring(mod) .. "'")
+    if not r then
+        tb:diag("    " .. msg)
+    end
+    return r
+end
+
+function m.eq_array (got, expected, name)
+    if type(got) ~= 'table' then
+        tb:ok(false, name)
+        tb:diag("got value isn't a table : " .. tostring(got))
+        return
+    elseif type(expected) ~= 'table' then
+        tb:ok(false, name)
+        tb:diag("expected value isn't a table : " .. tostring(expected))
+        return
+    end
+    for i = 1, #expected do
+        local v = expected[i]
+        local val = got[i]
+        if val ~= v then
+            tb:ok(false, name)
+            tb:diag("    at index: " .. tostring(i)
+               .. "\n         got: " .. tostring(val)
+               .. "\n    expected: " .. tostring(v))
+            return
+        end
+    end
+    local extra = #got - #expected
+    if extra ~= 0 then
+        tb:ok(false, name)
+        tb:diag("    " .. tostring(extra) .. " unexpected item(s)")
+    else
+        tb:ok(true, name)
+    end
+end
+
+function m.is_deeply (got, expected, name)
+    if type(got) ~= 'table' then
+        tb:ok(false, name)
+        tb:diag("got value isn't a table : " .. tostring(got))
+        return
+    elseif type(expected) ~= 'table' then
+        tb:ok(false, name)
+        tb:diag("expected value isn't a table : " .. tostring(expected))
+        return
+    end
+    local msg1
+    local msg2
+    local seen = {}
+
+    local function deep_eq (t1, t2, key_path)
+        if t1 == t2 or seen[t1] then
+            return true
+        end
+        seen[t1] = true
+        for k, v2 in pairs(t2) do
+            local v1 = t1[k]
+            if type(v1) == 'table' and type(v2) == 'table' then
+                local r = deep_eq(v1, v2, key_path .. "." .. tostring(k))
+                if not r then
+                    return false
+                end
+            else
+                if v1 ~= v2 then
+                    key_path = key_path .. "." .. tostring(k)
+                    msg1 = "     got" .. key_path .. ": " .. tostring(v1)
+                    msg2 = "expected" .. key_path .. ": " .. tostring(v2)
+                    return false
+                end
+            end
+        end
+        for k in pairs(t1) do
+            local v2 = t2[k]
+            if v2 == nil then
+                key_path = key_path .. "." .. tostring(k)
+                msg1 = "     got" .. key_path .. ": " .. tostring(t1[k])
+                msg2 = "expected" .. key_path .. ": " .. tostring(v2)
+                return false
+            end
+        end
+        return true
+    end -- deep_eq
+
+    local pass = deep_eq(got, expected, '')
+    tb:ok(pass, name)
+    if not pass then
+        tb:diag("    Tables begin differing at:")
+        tb:diag("    " .. msg1)
+        tb:diag("    " .. msg2)
+    end
+end
+
+function m.error_is (code, arg2, arg3, arg4)
+    local params, expected, name
+    if type(arg2) == 'table' then
+        params = arg2
+        expected = arg3
+        name = arg4
+    else
+        params = {}
+        expected = arg2
+        name = arg3
+    end
+    if type(code) == 'string' then
+        local msg
+        code, msg = loadstring(code)
+        if not code then
+            tb:ok(false, name)
+            tb:diag("    can't compile code :"
+               .. "\n    " .. msg)
+            return
+        end
+    end
+    local r, msg = pcall(code, unpack(params))
+    if r then
+        tb:ok(false, name)
+        tb:diag("    unexpected success"
+           .. "\n    expected: " .. tostring(expected))
+    else
+        local pass = msg == expected
+        tb:ok(pass, name)
+        if not pass then
+            tb:diag("         got: " .. msg
+               .. "\n    expected: " .. tostring(expected))
+        end
+    end
+end
+
+function m.error_like (code, arg2, arg3, arg4)
+    local params, pattern, name
+    if type(arg2) == 'table' then
+        params = arg2
+        pattern = arg3
+        name = arg4
+    else
+        params = {}
+        pattern = arg2
+        name = arg3
+    end
+    if type(code) == 'string' then
+        local msg
+        code, msg = loadstring(code)
+        if not code then
+            tb:ok(false, name)
+            tb:diag("    can't compile code :"
+               .. "\n    " .. msg)
+            return
+        end
+    end
+    local r, msg = pcall(code, unpack(params))
+    if r then
+        tb:ok(false, name)
+        tb:diag("    unexpected success"
+           .. "\n    expected: " .. tostring(pattern))
+    else
+        if type(pattern) ~= 'string' then
+            tb:ok(false, name)
+            tb:diag("pattern isn't a string : " .. tostring(pattern))
+            return
+        end
+        local pass = match(msg, pattern)
+        tb:ok(pass, name)
+        if not pass then
+            tb:diag("                  '" .. msg .. "'"
+               .. "\n    doesn't match '" .. pattern .. "'")
+        end
+    end
+end
+
+function m.lives_ok (code, arg2, arg3)
+    local params, name
+    if type(arg2) == 'table' then
+        params = arg2
+        name = arg3
+    else
+        params = {}
+        name = arg2
+    end
+    if type(code) == 'string' then
+        local msg
+        code, msg = loadstring(code)
+        if not code then
+            tb:ok(false, name)
+            tb:diag("    can't compile code :"
+               .. "\n    " .. msg)
+            return
+        end
+    end
+    local r, msg = pcall(code, unpack(params))
+    tb:ok(r, name)
+    if not r then
+        tb:diag("    " .. msg)
+    end
+end
+
+function m.diag (msg)
+    tb:diag(msg)
+end
+
+function m.note (msg)
+    tb:note(msg)
+end
+
+function m.skip (reason, count)
+    count = count or 1
+    for i = 1, count do
+        tb:skip(reason)
+    end
+end
+
+function m.todo_skip (reason, count)
+    count = count or 1
+    for i = 1, count do
+        tb:todo_skip(reason)
+    end
+end
+
+function m.skip_rest (reason)
+    tb:skip_rest(reason)
+end
+
+function m.todo (reason, count)
+    tb:todo(reason, count)
+end
+
+for k, v in pairs(m) do  -- injection
+    _G[k] = v
+end
+
+m._VERSION = "0.3.1"
+m._DESCRIPTION = "lua-TestMore : an Unit Testing Framework"
+m._COPYRIGHT = "Copyright (c) 2009-2012 Francois Perrad"
+return m
+--
+-- This library is licensed under the terms of the MIT/X11 license,
+-- like Lua itself.
+--

+ 229 - 0
src/Unity/MoonSharp/Assets/TestRunnerBehaviour.cs

@@ -0,0 +1,229 @@
+using UnityEngine;
+using System.Collections;
+using System.Threading;
+using MoonSharp.Interpreter.Tests;
+using MoonSharp.Interpreter;
+using MoonSharp.Interpreter.Loaders;
+using System.Collections.Generic;
+using System.Linq;
+using MoonSharp.Interpreter.Interop;
+using System;
+using MoonSharp.Interpreter.Interop.RegistrationPolicies;
+
+public class TestRunnerBehaviour : MonoBehaviour
+{
+
+    public class HardwireAndLogPolicy : IRegistrationPolicy
+    {
+        public IUserDataDescriptor HandleRegistration(IUserDataDescriptor newDescriptor, IUserDataDescriptor oldDescriptor)
+        {
+            if (oldDescriptor == null && newDescriptor != null)
+            {
+                return newDescriptor;
+            }
+
+            return oldDescriptor;
+        }
+
+        public bool AllowTypeAutoRegistration(Type type)
+        {
+            return false;
+        }
+
+    }
+
+
+    string m_Text = "";
+    object m_Lock = new object();
+    bool m_LastWasLine = true;
+
+    Dictionary<string, string> ReadAllScripts()
+    {
+        Dictionary<string, string> scripts = new  Dictionary<string, string>();
+
+        object[] result = Resources.LoadAll("MoonSharp/Scripts", typeof(TextAsset));
+
+        foreach(TextAsset ta in result.OfType<TextAsset>())
+        {
+            scripts.Add(ta.name, ta.text);
+        }
+
+        return scripts;
+    }
+     
+    // Use this for initialization
+    void Start()
+    {
+        Script.DefaultOptions.ScriptLoader = new MoonSharp.Interpreter.Loaders.UnityAssetsScriptLoader(ReadAllScripts());
+
+        Debug.Log("STARTED!");
+        StartCoroutine(DoTests());
+    }
+
+
+    // Update is called once per frame
+    void Update()
+    {
+
+    }
+    // Tests skipped on all platforms
+    static List<string> SKIPLIST = new List<string>()
+    {
+        "TestMore_308_io",  // avoid interactions with low level system
+        "TestMore_309_os",  // avoid interactions with low level system
+    };
+
+    static List<string> HARDWIRE_SKIPLIST = new List<string>()
+    {
+        // events
+        "Interop_Event_Simple",
+        "Interop_Event_TwoObjects",
+        "Interop_Event_Multi",
+        "Interop_Event_MultiAndDetach",
+        "Interop_Event_DetachAndDeregister",
+        "Interop_SEvent_DetachAndDeregister",
+        "Interop_SEvent_DetachAndReregister",
+
+        // tests dependent on type dereg
+        "Interop_ListMethod_None",
+        "Interop_ListMethod_Lazy",
+        "Interop_ListMethod_Precomputed",
+        "VInterop_ListMethod_None",
+        "VInterop_ListMethod_Lazy",
+        "VInterop_ListMethod_Precomputed",
+
+        // private members
+        "Interop_NestedTypes_Private_Ref",
+        "Interop_NestedTypes_Private_Val",
+
+        // value type property setters
+        "VInterop_IntPropertySetter_None",
+        "VInterop_IntPropertySetter_Lazy",
+        "VInterop_IntPropertySetter_Precomputed",
+        "VInterop_NIntPropertySetter_None",
+        "VInterop_NIntPropertySetter_Lazy",
+        "VInterop_NIntPropertySetter_Precomputed",
+        "VInterop_WoIntPropertySetter_None",
+        "VInterop_WoIntPropertySetter_Lazy",
+        "VInterop_WoIntPropertySetter_Precomputed",
+        "VInterop_WoIntProperty2Setter_None",
+        "VInterop_WoIntProperty2Setter_Lazy",
+        "VInterop_WoIntProperty2Setter_Precomputed",
+        "VInterop_IntPropertySetterWithSimplifiedSyntax",
+        "VInterop_IntFieldSetter_None",
+        "VInterop_IntFieldSetter_Lazy",
+        "VInterop_IntFieldSetter_Precomputed",
+        "VInterop_NIntFieldSetter_None",
+        "VInterop_NIntFieldSetter_Lazy",
+        "VInterop_NIntFieldSetter_Precomputed",
+        "VInterop_IntFieldSetterWithSimplifiedSyntax",
+    };
+
+
+    // Tests skipped on AOT platforms - known not workings :(
+    static List<string> AOT_SKIPLIST = new List<string>()
+    {
+        //"RegCollGen_List_ExtMeth_Last", 
+        //"VInterop_NIntPropertySetter_None",   
+        //"VInterop_NIntPropertySetter_Lazy",   
+        //"VInterop_NIntPropertySetter_Precomputed",    
+        //"VInterop_Overloads_NumDowncast", 
+        //"VInterop_Overloads_NilSelectsNonOptional",   
+        //"VInterop_Overloads_FullDecl",
+        //"VInterop_Overloads_Static2",
+        //"VInterop_Overloads_Cache1",
+        //"VInterop_Overloads_Cache2",
+        //"VInterop_ConcatMethod_None",
+        //"VInterop_ConcatMethod_Lazy",
+        //"VInterop_ConcatMethod_Precomputed",
+        //"VInterop_ConcatMethodSemicolon_None",
+        //"VInterop_ConcatMethodSemicolon_Lazy",
+        //"VInterop_ConcatMethodSemicolon_Precomputed",
+        //"VInterop_ConstructorAndConcatMethodSemicolon_None",
+        //"VInterop_ConstructorAndConcatMethodSemicolon_Lazy",
+        //"VInterop_ConstructorAndConcatMethodSemicolon_Precomputed",
+    };
+
+
+
+    IEnumerator DoTests()
+    {
+        SKIPLIST.AddRange(HARDWIRE_SKIPLIST);
+        UserData.RegistrationPolicy = new HardwireAndLogPolicy();
+
+
+
+        MoonSharp.Interpreter.Tests.TestRunner tr = new MoonSharp.Interpreter.Tests.TestRunner(Log);
+
+        foreach (var r in tr.IterateOnTests(null, SKIPLIST.ToArray()))
+        {
+            Log(r);
+            yield return null;
+        }
+
+        Console_Write("\n DONE!! \n");
+    }
+
+    void Log(TestResult r)
+    {
+        if (r.Type == TestResultType.Fail)
+        {
+            Console_WriteLine("[FAIL] | {0} - {1} - {2}", r.TestName, r.Message, ""); // r.Exception);
+        }
+        else if (r.Type == TestResultType.Ok)
+        {
+            Console_Write(".");
+        }
+        else if (r.Type == TestResultType.Skipped)
+        {
+            Console_Write("s");
+        }
+        else
+        {
+            //Console_WriteLine("{0}", r.Message);
+        }
+    }
+
+
+    private void Console_Write(string message)
+    {
+        lock (m_Lock)
+        {
+            m_Text = m_Text + message;
+            m_LastWasLine = false;
+        }
+    }
+
+    private void Console_WriteLine(string message, params object[] args)
+    {
+        lock (m_Lock)
+        {
+            if (!m_LastWasLine)
+            {
+                m_Text = m_Text + "\n";
+                m_LastWasLine = true;
+            }
+
+            m_Text = m_Text + string.Format(message, args) + "\n";
+        }
+    }
+
+
+
+    void OnGUI()
+    {
+        string text = "";
+        lock (m_Lock)
+            text = m_Text;
+
+        string banner = string.Format("MoonSharp Test Runner {0} [{1}]", Script.VERSION, Script.GlobalOptions.Platform.GetPlatformName());
+
+        GUI.Box(new Rect(0, 0, Screen.width, Screen.height), banner);
+        GUI.TextArea(new Rect(0, 30, Screen.width, Screen.height - 30), text);
+    }
+
+
+
+
+
+}

+ 97 - 0
src/Unity/MoonSharp/Assets/Tests/EmbeddableNUnitWrapper.cs

@@ -0,0 +1,97 @@
+#if EMBEDTEST || UNITY_5
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NUnit.Framework
+{
+	public class TestAttribute : Attribute
+	{ }
+
+	public class IgnoreAttribute : Attribute
+	{ }
+
+	public class TestFixtureAttribute : Attribute
+	{ }
+
+	public class ExpectedExceptionAttribute : Attribute
+	{
+		public Type ExpectedException { get; set; }
+
+		public ExpectedExceptionAttribute(Type t)
+		{
+			ExpectedException = t;
+		}
+	}
+
+	public static class Assert
+	{
+		public static void AreEqualNum(int expected, double other, string message = null)
+		{
+			Assert.IsTrue((double)expected == other, message ?? string.Format("{0} was expected, {1} was returned", expected, other));
+		}
+
+		public static void AreEqual(object expected, object other, string message = null)
+		{
+			if (expected is int && other is double) 
+				AreEqualNum((int)expected, (double)other, message);
+			else if (expected != null)
+				Assert.IsTrue(expected.Equals(other), message ?? string.Format("{0} was expected, {1} was returned", expected, other));
+			else
+				Assert.IsTrue(other == null, message ?? string.Format("null was expected, {0} was returned", other));
+		}
+
+		public static void IsTrue(bool condition, string message)
+		{
+			if (!condition)
+				throw new Exception("Test failed : " + message);
+		}
+
+		public static void IsFalse(bool condition, string message)
+		{
+			IsTrue(!condition, message);
+		}
+
+		internal static void IsNotNull(object o)
+		{
+			IsFalse(o == null, "Object is null");
+		}
+
+		internal static void IsNotNullOrEmpty(string p)
+		{
+			IsFalse(string.IsNullOrEmpty(p), "String is null or empty");
+		}
+
+		internal static void IsTrue(bool p)
+		{
+			IsTrue(p, "Value not true");
+		}
+
+		internal static void Catch<ET>(Action a)
+		{
+			try
+			{
+				a();
+			}
+			catch(Exception e)
+			{
+				Assert.IsTrue(e is ET);
+			}
+		}
+
+
+
+		internal static void Fail()
+		{
+			Assert.IsTrue(false);
+		}
+	}
+
+
+
+}
+
+
+#endif

+ 335 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/BinaryDumpTests.cs

@@ -0,0 +1,335 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class BinaryDumpTests
+	{
+		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();
+			}
+		}
+
+		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);
+			}
+		}
+
+
+		[Test]
+		public void BinDump_ChunkDump()
+		{
+			string script = @"
+				local chunk = load('return 81;');
+				local str = string.dump(chunk);
+				local fn = load(str);
+				return fn(9);
+			";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(81, res.Number);
+		}
+
+		[Test]
+		public void BinDump_StringDump()
+		{
+			string script = @"
+				local str = string.dump(function(n) return n * n; end);
+				local fn = load(str);
+				return fn(9);
+			";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(81, res.Number);
+		}
+
+		[Test]
+		public void BinDump_StandardDumpFunc()
+		{
+			string script = @"
+				function fact(n)
+					return n * 24;
+				end
+
+				local str = string.dump(fact);
+				
+			";
+
+			DynValue fact = Script_LoadFunc(script, "fact");
+			DynValue res = fact.Function.Call(5);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120, res.Number);
+		}
+
+
+
+		[Test]
+		public void BinDump_FactorialDumpFunc()
+		{
+			string script = @"
+				function fact(n)
+					if (n == 0) then return 1; end
+					return fact(n - 1) * n;
+				end
+			";
+
+			DynValue fact = Script_LoadFunc(script, "fact");
+			fact.Function.OwnerScript.Globals.Set("fact", fact);
+			DynValue res = fact.Function.Call(5);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120, res.Number);
+		}
+
+		[Test]
+		public void BinDump_FactorialDumpFuncGlobal()
+		{
+			string script = @"
+				x = 0
+
+				function fact(n)
+					if (n == x) then return 1; end
+					return fact(n - 1) * n;
+				end
+			";
+
+			DynValue fact = Script_LoadFunc(script, "fact");
+			fact.Function.OwnerScript.Globals.Set("fact", fact);
+			fact.Function.OwnerScript.Globals.Set("x", DynValue.NewNumber(0));
+			DynValue res = fact.Function.Call(5);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120, res.Number);
+		}
+
+
+		[Test]
+		[ExpectedException(typeof(ArgumentException))]
+		public void BinDump_FactorialDumpFuncUpvalue()
+		{
+			string script = @"
+				local x = 0
+
+				function fact(n)
+					if (n == x) then return 1; end
+					return fact(n - 1) * n;
+				end
+			";
+
+			DynValue fact = Script_LoadFunc(script, "fact");
+			fact.Function.OwnerScript.Globals.Set("fact", fact);
+			fact.Function.OwnerScript.Globals.Set("x", DynValue.NewNumber(0));
+			DynValue res = fact.Function.Call(5);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120, res.Number);
+		}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+		[Test]
+		public void BinDump_FactorialClosure()
+		{
+			string script = @"
+local x = 5;
+
+function fact(n)
+	if (n == x) then return 1; end
+	return fact(n - 1) * n;
+end
+
+x = 0;
+
+y = fact(5);
+
+x = 3;
+
+y = y + fact(5);
+
+return y;
+";
+
+			DynValue res = Script_RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(140, res.Number);
+		}
+
+		[Test]
+		public void BinDump_ClosureOnParam()
+		{
+			string script = @"
+				local function g (z)
+				  local function f(a)
+					return a + z;
+				  end
+				  return f;
+				end
+
+				return (g(3)(2));";
+
+			DynValue res = Script_RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(5, res.Number);
+		}
+
+		[Test]
+		public void BinDump_NestedUpvalues()
+		{
+			string script = @"
+	local y = y;
+
+	local x = 0;
+	local m = { };
+
+	function m:a()
+		self.t = {
+			dojob = function() 
+				if (x == 0) then return 1; else return 0; end
+			end,
+		};
+	end
+
+	m:a();
+
+	return 10 * m.t.dojob();
+								";
+
+			DynValue res = Script_RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(10, res.Number);
+		}
+
+
+		[Test]
+		public void BinDump_NestedOutOfScopeUpvalues()
+		{
+			string script = @"
+
+	function X()
+		local y = y;
+
+		local x = 0;
+		local m = { };
+
+		function m:a()
+			self.t = {
+				dojob = function() 
+					if (x == 0) then return 1; else return 0; end
+				end,
+			};
+		end
+
+		return m;
+	end
+
+	Q = X();
+
+	Q:a();
+
+	return 10 * Q.t.dojob();
+								";
+
+			DynValue res = Script_RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(10, res.Number);
+		}
+
+
+		[Test]
+		public void Load_ChangeEnvWithDebugSetUpvalue()
+		{
+			List<Table> list = new List<Table>();
+
+			string script = @"
+				function print_env()
+				  print(_ENV)
+				end
+
+				function sandbox()
+				  print(_ENV) -- prints: 'table: 0x100100610'
+				  -- need to keep access to a few globals:
+				  _ENV = { print = print, print_env = print_env, debug = debug, load = load }
+				  print(_ENV) -- prints: 'table: 0x100105140'
+				  print_env() -- prints: 'table: 0x100105140'
+				  local code1 = load('print(_ENV)')
+				  code1()     -- prints: 'table: 0x100100610'
+				  debug.setupvalue(code1, 0, _ENV) -- set our modified env
+				  debug.setupvalue(code1, 1, _ENV) -- set our modified env
+				  code1()     -- prints: 'table: 0x100105140'
+				  local code2 = load('print(_ENV)', nil, nil, _ENV) -- pass 'env' arg
+				  code2()     -- prints: 'table: 0x100105140'
+				end
+
+				sandbox()";
+
+			Script S = new Script(CoreModules.Preset_Complete);
+
+			S.Globals["print"] = (Action<Table>)(t => list.Add(t));
+
+			S.DoString(script);
+
+			Assert.AreEqual(6, list.Count);
+
+			int[] eqs = new int[] { 0, 1, 1, 0, 1, 1 };
+
+			for (int i = 0; i < 6; i++)
+				Assert.AreEqual(list[eqs[i]], list[i]);
+		}
+	}
+}

+ 326 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/ClosureTests.cs

@@ -0,0 +1,326 @@
+using System;
+using MoonSharp.Interpreter.Execution;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class ClosureTests
+	{
+		[Test]
+		public void ClosureOnParam()
+		{
+			string script = @"
+				local function g (z)
+				  local function f(a)
+					return a + z;
+				  end
+				  return f;
+				end
+
+				return (g(3)(2));";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(5, res.Number);
+		}
+
+		[Test]
+		public void LambdaFunctions()
+		{
+			string script = @"
+g = |f, x|f(x, x+1)
+f = |x, y, z|x*(y+z)
+return g(|x,y|f(x,y,1), 2)
+";
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(8, res.Number);
+		}
+
+
+
+		[Test]
+		public void ClosureOnParamLambda()
+		{
+			string script = @"
+				local function g (z)
+				  return |a| a + z
+				end
+
+				return (g(3)(2));";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(5, res.Number);
+		}
+
+
+		[Test]
+		public void Closures()
+		{
+			// expected : 201 2001 20001 200001 2000001
+			string script = @"
+						a = {}
+						x = 0
+
+						function container()
+							local x = 20
+
+							for i=1,5 do
+								local y = 0
+								a[i] = function () y=y+1; x = x * 10; return x+y end
+							end
+						end
+
+						container();
+
+						x = 4000
+
+						return a[1](), a[2](), a[3](), a[4](), a[5]()";
+
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(5, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[2].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[3].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[4].Type);
+			Assert.AreEqual(201, res.Tuple[0].Number);
+			Assert.AreEqual(2001, res.Tuple[1].Number);
+			Assert.AreEqual(20001, res.Tuple[2].Number);
+			Assert.AreEqual(200001, res.Tuple[3].Number);
+			Assert.AreEqual(2000001, res.Tuple[4].Number);
+		}
+
+		[Test]
+		public void ClosuresNonAnonymousLocal()
+		{
+			// expected : 201 2001 20001 200001 2000001
+			string script = @"
+						a = {}
+						x = 0
+
+						function container()
+							local x = 20
+
+							for i=1,5 do
+								local y = 0
+								local function zz() y=y+1; x = x * 10; return x+y end
+								a[i] = zz;
+							end
+						end
+
+						container();
+
+						x = 4000
+
+						return a[1](), a[2](), a[3](), a[4](), a[5]()";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(5, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[2].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[3].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[4].Type);
+			Assert.AreEqual(201, res.Tuple[0].Number);
+			Assert.AreEqual(2001, res.Tuple[1].Number);
+			Assert.AreEqual(20001, res.Tuple[2].Number);
+			Assert.AreEqual(200001, res.Tuple[3].Number);
+			Assert.AreEqual(2000001, res.Tuple[4].Number);
+		}
+
+
+		[Test]
+		public void ClosuresNonAnonymous()
+		{
+			// expected : 201 2001 20001 200001 2000001
+			string script = @"
+						a = {}
+						x = 0
+
+						function container()
+							local x = 20
+
+							for i=1,5 do
+								local y = 0
+								function zz() y=y+1; x = x * 10; return x+y end
+								a[i] = zz;
+							end
+						end
+
+						container();
+
+						x = 4000
+
+						return a[1](), a[2](), a[3](), a[4](), a[5]()";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(5, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[2].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[3].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[4].Type);
+			Assert.AreEqual(201, res.Tuple[0].Number);
+			Assert.AreEqual(2001, res.Tuple[1].Number);
+			Assert.AreEqual(20001, res.Tuple[2].Number);
+			Assert.AreEqual(200001, res.Tuple[3].Number);
+			Assert.AreEqual(2000001, res.Tuple[4].Number);
+		}
+
+		[Test]
+		public void ClosureNoTable()
+		{
+			string script = @"
+				x = 0
+
+				function container()
+					local x = 20
+
+					for i=1,5 do
+						local y = 0
+		
+						function zz() y=y+1; x = x * 10; return x+y end
+		
+						a1 = a2;
+						a2 = a3;
+						a3 = a4;
+						a4 = a5;
+						a5 = zz;
+					end
+				end
+
+				container();
+
+				x = 4000
+
+				return a1(), a2(), a3(), a4(), a5()";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(5, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[2].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[3].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[4].Type);
+			Assert.AreEqual(201, res.Tuple[0].Number);
+			Assert.AreEqual(2001, res.Tuple[1].Number);
+			Assert.AreEqual(20001, res.Tuple[2].Number);
+			Assert.AreEqual(200001, res.Tuple[3].Number);
+			Assert.AreEqual(2000001, res.Tuple[4].Number);
+		}
+
+
+		[Test]
+		public void NestedUpvalues()
+		{
+			string script = @"
+	local y = y;
+
+	local x = 0;
+	local m = { };
+
+	function m:a()
+		self.t = {
+			dojob = function() 
+				if (x == 0) then return 1; else return 0; end
+			end,
+		};
+	end
+
+	m:a();
+
+	return 10 * m.t.dojob();
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(10, res.Number);
+		}
+
+		[Test]
+		public void NestedOutOfScopeUpvalues()
+		{
+			string script = @"
+
+	function X()
+		local y = y;
+
+		local x = 0;
+		local m = { };
+
+		function m:a()
+			self.t = {
+				dojob = function() 
+					if (x == 0) then return 1; else return 0; end
+				end,
+			};
+		end
+
+		return m;
+	end
+
+	Q = X();
+
+	Q:a();
+
+	return 10 * Q.t.dojob();
+								";
+
+			DynValue res = new Script(CoreModules.Preset_HardSandbox).DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(10, res.Number);
+		}
+
+
+		[Test]
+		public void LocalRedefinition()
+		{
+			string script = @"
+
+				result = ''
+
+				local hi = 'hello'
+
+				local function test()
+					result = result .. hi;
+				end
+
+				test();
+
+				hi = 'X'
+
+				test();
+
+				local hi = '!';
+
+				test();
+
+				return result;
+								";
+
+			DynValue res = new Script(CoreModules.Preset_HardSandbox).DoString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("helloXX", res.String);
+		}
+
+
+	}
+}

+ 355 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/CollectionsBaseGenRegisteredTests.cs

@@ -0,0 +1,355 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class CollectionsBaseGenRegisteredTests
+	{
+		public class RegCollItem
+		{
+			public int Value;
+
+			public RegCollItem(int v)
+			{
+				Value = v;
+			}
+		}
+
+		public class RegCollMethods
+		{
+			List<RegCollItem> m_Items = new List<RegCollItem>() { new RegCollItem(7), new RegCollItem(8), new RegCollItem(9) };
+			List<int> m_List = new List<int>() { 1, 2, 3 };
+			int[] m_Array = new int[3] { 2, 4, 6 };
+			int[,] m_MultiArray = new int[2, 3] { { 2, 4, 6 }, { 7, 8, 9 } };
+
+			public int[,] GetMultiArray()
+			{
+				return m_MultiArray;
+			}
+
+			public int[] GetArray()
+			{
+				return m_Array;
+			}
+
+			public List<RegCollItem> GetItems()
+			{
+				return m_Items;
+			}
+
+			public List<int> GetList()
+			{
+				return m_List;
+			}
+
+			public IEnumerator<int> GetEnumerator()
+			{
+				return GetList().GetEnumerator();
+			}
+		}
+
+		void Do(string code, Action<DynValue> asserts)
+		{
+			Do(code, (d, o) => asserts(d));
+		}
+
+
+		void Do(string code, Action<DynValue, RegCollMethods> asserts)
+		{
+			try
+			{
+				UserData.RegisterType<RegCollMethods>();
+				UserData.RegisterType<RegCollItem>();
+				UserData.RegisterType<Array>();
+				UserData.RegisterType(typeof(List<>));
+				UserData.RegisterExtensionType(typeof(Enumerable));
+
+				Script s = new Script();
+
+				var obj = new RegCollMethods();
+				s.Globals["o"] = obj;
+				s.Globals["ctor"] = UserData.CreateStatic<RegCollItem>();
+
+				DynValue res = s.DoString(code);
+
+				asserts(res, obj);
+			}
+			catch (ScriptRuntimeException ex)
+			{
+				Debug.WriteLine(ex.DecoratedMessage);
+				ex.Rethrow();
+				throw;
+			}
+			finally
+			{
+				UserData.UnregisterType<RegCollMethods>();
+				UserData.UnregisterType<RegCollItem>();
+				UserData.UnregisterType<Array>();
+				UserData.UnregisterType(typeof(List<>));
+				UserData.UnregisterType(typeof(List<RegCollItem>));
+				UserData.UnregisterType(typeof(List<int>));
+				//UserData.UnregisterType<IEnumerable>();
+			}
+		}
+
+		[Test]
+		public void RegCollGen_List_ExtMeth_Last()
+		{
+			Do(@"
+				local list = o:GetList()
+				return list:Last();			
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(3, r.Number);
+			 });
+		}
+
+		[Test]
+		public void RegCollGen_List_ExtMeth_Sum()
+		{
+			Do(@"
+				local list = o:GetList()
+				return list:Sum();			
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(6, r.Number);
+			 });
+		}
+
+
+
+		[Test]
+		public void RegCollGen_IteratorOnList_Auto()
+		{
+			Do(@"
+				local list = o:GetList()
+
+				local x = 0;
+				for i in list do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(6, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegCollGen_IteratorOnList_Manual()
+		{
+			Do(@"
+				function each(obj)
+					local e = obj:GetEnumerator()
+					return function()
+						if e:MoveNext() then
+							return e.Current
+						end
+					end
+				end
+
+				local list = o; 
+
+				local x = 0;
+				for i in each(list) do 
+					x = x + i;
+				end
+				return x;
+
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(6, r.Number);
+			 });
+		}
+
+		[Test]
+		public void RegCollGen_IteratorOnList_ChangeElem()
+		{
+			Do(@"
+				local list = o:GetList()
+
+				list[1] = list[2] + list[1];
+
+				local x = 0;
+				for i in list do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(9, r.Number);
+				 Assert.AreEqual(1, o.GetList()[0]);
+				 Assert.AreEqual(5, o.GetList()[1]);
+				 Assert.AreEqual(3, o.GetList()[2]);
+			 });
+		}
+
+
+		[Test]
+		public void RegCollGen_IteratorOnArray_Auto()
+		{
+			Do(@"
+				local array = o:GetArray()
+
+				local x = 0;
+				for i in array do 
+					x = x + i;
+				end
+				return x;			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(12, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegCollGen_IteratorOnArray_ChangeElem()
+		{
+			Do(@"
+				local array = o:get_array()
+
+				array[1] = array[2] - 1;
+
+				local x = 0;
+				for i in array do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(13, r.Number);
+				 Assert.AreEqual(2, o.GetArray()[0]);
+				 Assert.AreEqual(5, o.GetArray()[1]);
+				 Assert.AreEqual(6, o.GetArray()[2]);
+			 });
+		}
+
+		[Test]
+		public void RegCollGen_IteratorOnMultiDimArray_ChangeElem()
+		{
+			Do(@"
+				local array = o:GetMultiArray()
+
+				array[0, 1] = array[1, 2];
+
+				local x = 0;
+				for i in array do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(41, r.Number);
+				 Assert.AreEqual(2, o.GetMultiArray()[0, 0]);
+				 Assert.AreEqual(9, o.GetMultiArray()[0, 1]);
+				 Assert.AreEqual(6, o.GetMultiArray()[0, 2]);
+				 Assert.AreEqual(7, o.GetMultiArray()[1, 0]);
+				 Assert.AreEqual(8, o.GetMultiArray()[1, 1]);
+				 Assert.AreEqual(9, o.GetMultiArray()[1, 2]);
+			 });
+		}
+
+
+
+
+
+		[Test]
+		public void RegCollGen_IteratorOnObjList_Auto()
+		{
+			Do(@"
+				local list = o:GetItems()
+
+				local x = 0;
+				for i in list do 
+					x = x + i.Value;
+				end
+				return x;
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(24, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegCollGen_IteratorOnObjList_Manual()
+		{
+			Do(@"
+				function each(obj)
+					local e = obj:GetEnumerator()
+					return function()
+						if e:MoveNext() then
+							return e.Current
+						end
+					end
+				end
+
+				local list = o.get_items(); 
+
+				local x = 0;
+				for i in each(list) do 
+					x = x + i.Value;
+				end
+				return x;
+
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(24, r.Number);
+			 });
+		}
+
+		[Test]
+		public void RegCollGen_IteratorOnObjList_ChangeElem()
+		{
+			Do(@"
+				local list = o:GetItems()
+
+				list[1] = ctor.__new(list[2].Value + list[1].Value);
+
+				local x = 0;
+				for i in list do 
+					x = x + i.Value;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(7 + 17 + 9, r.Number);
+				 Assert.AreEqual(7, o.GetItems()[0].Value);
+				 Assert.AreEqual(17, o.GetItems()[1].Value);
+				 Assert.AreEqual(9, o.GetItems()[2].Value);
+			 });
+		}
+
+
+
+	}
+}

+ 300 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/CollectionsBaseInterfGenRegisteredTests.cs

@@ -0,0 +1,300 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	public class RegCollItem
+	{
+		public int Value;
+
+		public RegCollItem(int v)
+		{
+			Value = v;
+		}
+	}
+
+	public class RegCollMethods
+	{
+		List<RegCollItem> m_Items = new List<RegCollItem>() { new RegCollItem(7), new RegCollItem(8), new RegCollItem(9) };
+		List<int> m_List = new List<int>() { 1, 2, 3 };
+		int[] m_Array = new int[3] { 2, 4, 6 };
+		int[,] m_MultiArray = new int[2, 3] { { 2, 4, 6 }, { 7, 8, 9 } };
+
+		public int[,] GetMultiArray()
+		{
+			return m_MultiArray;
+		}
+
+		public int[] GetArray()
+		{
+			return m_Array;
+		}
+
+		public List<RegCollItem> GetItems()
+		{
+			return m_Items;
+		}
+
+		public List<int> GetList()
+		{
+			return m_List;
+		}
+
+		public IEnumerator<int> GetEnumerator()
+		{
+			return GetList().GetEnumerator();
+		}
+	}
+
+
+
+	[TestFixture]
+	public class CollectionsBaseInterfGenRegisteredTests
+	{
+		void Do(string code, Action<DynValue> asserts)
+		{
+			Do(code, (d, o) => asserts(d));
+		}
+
+
+		void Do(string code, Action<DynValue, RegCollMethods> asserts)
+		{
+			try
+			{
+				UserData.RegisterType<RegCollMethods>();
+				UserData.RegisterType<RegCollItem>();
+				UserData.RegisterType(typeof(IList<>));
+
+				Script s = new Script();
+
+				var obj = new RegCollMethods();
+				s.Globals["o"] = obj;
+				s.Globals["ctor"] = UserData.CreateStatic<RegCollItem>();
+
+				DynValue res = s.DoString(code);
+
+				asserts(res, obj);
+			}
+			catch (ScriptRuntimeException ex)
+			{
+				Debug.WriteLine(ex.DecoratedMessage);
+				ex.Rethrow();
+				throw;
+			}
+			finally
+			{
+				UserData.UnregisterType<RegCollMethods>();
+				UserData.UnregisterType<RegCollItem>();
+				UserData.UnregisterType<Array>();
+				UserData.UnregisterType(typeof(IList<>));
+				UserData.UnregisterType(typeof(IList<RegCollItem>));
+				UserData.UnregisterType(typeof(IList<int>));
+				//UserData.UnregisterType<IEnumerable>();
+			}
+		}
+
+
+
+
+
+		[Test]
+		public void RegCollGenInterf_IteratorOnList_Auto()
+		{
+			Do(@"
+				local list = o:GetList()
+
+				local x = 0;
+				for i in list do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(6, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegCollGenInterf_IteratorOnList_Manual()
+		{
+			Do(@"
+				function each(obj)
+					local e = obj:GetEnumerator()
+					return function()
+						if e:MoveNext() then
+							return e.Current
+						end
+					end
+				end
+
+				local list = o; 
+
+				local x = 0;
+				for i in each(list) do 
+					x = x + i;
+				end
+				return x;
+
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(6, r.Number);
+			 });
+		}
+
+		[Test]
+		public void RegCollGenInterf_IteratorOnList_ChangeElem()
+		{
+			Do(@"
+				local list = o:GetList()
+
+				list[1] = list[2] + list[1];
+
+				local x = 0;
+				for i in list do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(9, r.Number);
+				 Assert.AreEqual(1, o.GetList()[0]);
+				 Assert.AreEqual(5, o.GetList()[1]);
+				 Assert.AreEqual(3, o.GetList()[2]);
+			 });
+		}
+
+
+		[Test]
+		public void RegCollGenInterf_IteratorOnArray_Auto()
+		{
+			Do(@"
+				local array = o:GetArray()
+
+				local x = 0;
+				for i in array do 
+					x = x + i;
+				end
+				return x;			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(12, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegCollGenInterf_IteratorOnArray_ChangeElem()
+		{
+			Do(@"
+				local array = o:get_array()
+
+				array[1] = array[2] - 1;
+
+				local x = 0;
+				for i in array do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(13, r.Number);
+				 Assert.AreEqual(2, o.GetArray()[0]);
+				 Assert.AreEqual(5, o.GetArray()[1]);
+				 Assert.AreEqual(6, o.GetArray()[2]);
+			 });
+		}
+
+
+
+		[Test]
+		public void RegCollGenInterf_IteratorOnObjList_Auto()
+		{
+			Do(@"
+				local list = o:GetItems()
+
+				local x = 0;
+				for i in list do 
+					x = x + i.Value;
+				end
+				return x;
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(24, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegCollGenInterf_IteratorOnObjList_Manual()
+		{
+			Do(@"
+				function each(obj)
+					local e = obj:GetEnumerator()
+					return function()
+						if e:MoveNext() then
+							return e.Current
+						end
+					end
+				end
+
+				local list = o.get_items(); 
+
+				local x = 0;
+				for i in each(list) do 
+					x = x + i.Value;
+				end
+				return x;
+
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(24, r.Number);
+			 });
+		}
+
+		[Test]
+		public void RegCollGenInterf_IteratorOnObjList_ChangeElem()
+		{
+			Do(@"
+				local list = o:GetItems()
+
+				list[1] = ctor.__new(list[2].Value + list[1].Value);
+
+				local x = 0;
+				for i in list do 
+					x = x + i.Value;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(7 + 17 + 9, r.Number);
+				 Assert.AreEqual(7, o.GetItems()[0].Value);
+				 Assert.AreEqual(17, o.GetItems()[1].Value);
+				 Assert.AreEqual(9, o.GetItems()[2].Value);
+			 });
+		}
+
+
+
+	}
+}

+ 328 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/CollectionsRegisteredTests.cs

@@ -0,0 +1,328 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class CollectionsRegisteredTests
+	{
+		public class RegCollItem
+		{
+			public int Value;
+
+			public RegCollItem(int v)
+			{
+				Value = v;
+			}
+		}
+
+		public class RegCollMethods 
+		{
+			List<RegCollItem> m_Items = new List<RegCollItem>() { new RegCollItem(7), new RegCollItem(8), new RegCollItem(9) };
+			List<int> m_List = new List<int>() { 1, 2, 3 };
+			int[] m_Array = new int[3] { 2, 4, 6 };
+			int[,] m_MultiArray = new int[2, 3] { { 2, 4, 6 }, { 7, 8, 9 } };
+
+			public int[,] GetMultiArray()
+			{
+				return m_MultiArray;
+			}
+
+			public int[] GetArray()
+			{
+				return m_Array;
+			}
+
+			public List<RegCollItem> GetItems()
+			{
+				return m_Items;
+			}
+
+			public List<int> GetList()
+			{
+				return m_List;
+			}
+
+			public IEnumerator<int> GetEnumerator()
+			{
+				return GetList().GetEnumerator();
+			}
+		}
+
+		void Do(string code, Action<DynValue> asserts)
+		{
+			Do(code, (d, o) => asserts(d));
+		}
+
+
+		void Do(string code, Action<DynValue, RegCollMethods> asserts)
+		{
+			try
+			{
+				UserData.RegisterType<RegCollMethods>();
+				UserData.RegisterType<RegCollItem>();
+				UserData.RegisterType<List<RegCollItem>>();
+				UserData.RegisterType<List<int>>();
+				UserData.RegisterType<int[]>();
+				UserData.RegisterType<int[,]>();
+
+				Script s = new Script();
+
+				var obj = new RegCollMethods();
+				s.Globals["o"] = obj;
+				s.Globals["ctor"] = UserData.CreateStatic<RegCollItem>();
+
+				DynValue res = s.DoString(code);
+
+				asserts(res, obj);
+			}
+			catch (ScriptRuntimeException ex)
+			{
+				Debug.WriteLine(ex.DecoratedMessage);
+				ex.Rethrow();
+				throw;
+			}
+			finally
+			{
+				UserData.UnregisterType<RegCollMethods>();
+				UserData.UnregisterType<RegCollItem>();
+				UserData.UnregisterType<List<RegCollItem>>();
+				UserData.UnregisterType<List<int>>();
+				UserData.UnregisterType<int[]>();
+				UserData.UnregisterType<int[,]>();
+			}
+		}
+
+
+
+
+
+		[Test]
+		public void RegColl_IteratorOnList_Auto()
+		{
+			Do(@"
+				local list = o:GetList()
+
+				local x = 0;
+				for i in list do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(6, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegColl_IteratorOnList_Manual()
+		{
+			Do(@"
+				function each(obj)
+					local e = obj:GetEnumerator()
+					return function()
+						if e:MoveNext() then
+							return e.Current
+						end
+					end
+				end
+
+				local list = o; 
+
+				local x = 0;
+				for i in each(list) do 
+					x = x + i;
+				end
+				return x;
+
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(6, r.Number);
+			 });
+		}
+
+		[Test]
+		public void RegColl_IteratorOnList_ChangeElem()
+		{
+			Do(@"
+				local list = o:GetList()
+
+				list[1] = list[2] + list[1];
+
+				local x = 0;
+				for i in list do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(9, r.Number);
+				 Assert.AreEqual(1, o.GetList()[0]);
+				 Assert.AreEqual(5, o.GetList()[1]);
+				 Assert.AreEqual(3, o.GetList()[2]);
+			 });
+		}
+
+
+		[Test]
+		public void RegColl_IteratorOnArray_Auto()
+		{
+			Do(@"
+				local array = o:GetArray()
+
+				local x = 0;
+				for i in array do 
+					x = x + i;
+				end
+				return x;			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(12, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegColl_IteratorOnArray_ChangeElem()
+		{
+			Do(@"
+				local array = o:get_array()
+
+				array[1] = array[2] - 1;
+
+				local x = 0;
+				for i in array do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(13, r.Number);
+				 Assert.AreEqual(2, o.GetArray()[0]);
+				 Assert.AreEqual(5, o.GetArray()[1]);
+				 Assert.AreEqual(6, o.GetArray()[2]);
+			 });
+		}
+
+		[Test]
+		public void RegColl_IteratorOnMultiDimArray_ChangeElem()
+		{
+			Do(@"
+				local array = o:GetMultiArray()
+
+				array[0, 1] = array[1, 2];
+
+				local x = 0;
+				for i in array do 
+					x = x + i;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(41, r.Number);
+				 Assert.AreEqual(2, o.GetMultiArray()[0, 0]);
+				 Assert.AreEqual(9, o.GetMultiArray()[0, 1]);
+				 Assert.AreEqual(6, o.GetMultiArray()[0, 2]);
+				 Assert.AreEqual(7, o.GetMultiArray()[1, 0]);
+				 Assert.AreEqual(8, o.GetMultiArray()[1, 1]);
+				 Assert.AreEqual(9, o.GetMultiArray()[1, 2]);
+			 });
+		}
+
+
+
+
+
+		[Test]
+		public void RegColl_IteratorOnObjList_Auto()
+		{
+			Do(@"
+				local list = o:GetItems()
+
+				local x = 0;
+				for i in list do 
+					x = x + i.Value;
+				end
+				return x;
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(24, r.Number);
+			 });
+		}
+
+
+		[Test]
+		public void RegColl_IteratorOnObjList_Manual()
+		{
+			Do(@"
+				function each(obj)
+					local e = obj:GetEnumerator()
+					return function()
+						if e:MoveNext() then
+							return e.Current
+						end
+					end
+				end
+
+				local list = o.get_items(); 
+
+				local x = 0;
+				for i in each(list) do 
+					x = x + i.Value;
+				end
+				return x;
+
+			",
+			 (r) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(24, r.Number);
+			 });
+		}
+
+		[Test]
+		public void RegColl_IteratorOnObjList_ChangeElem()
+		{
+			Do(@"
+				local list = o:GetItems()
+
+				list[1] = ctor.__new(list[2].Value + list[1].Value);
+
+				local x = 0;
+				for i in list do 
+					x = x + i.Value;
+				end
+				return x;
+			",
+			 (r, o) =>
+			 {
+				 Assert.AreEqual(DataType.Number, r.Type);
+				 Assert.AreEqual(7+17+9, r.Number);
+				 Assert.AreEqual(7, o.GetItems()[0].Value);
+				 Assert.AreEqual(17, o.GetItems()[1].Value);
+				 Assert.AreEqual(9, o.GetItems()[2].Value);
+			 });
+		}
+
+
+
+	}
+}

+ 105 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/ConfigPropertyAssignerTests.cs

@@ -0,0 +1,105 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter.Interop;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class ConfigPropertyAssignerTests
+	{
+		private class MySubclass
+		{
+			[MoonSharpProperty]
+			public string MyString { get; set; }
+
+			[MoonSharpProperty("number")]
+			public int MyNumber { get; private set; }
+		}
+
+		private class MyClass
+		{
+			[MoonSharpProperty]
+			public string MyString { get; set; }
+
+			[MoonSharpProperty("number")]
+			public int MyNumber { get; private set; }
+
+			[MoonSharpProperty]
+			internal Table SomeTable { get; private set; }
+
+			[MoonSharpProperty]
+			public DynValue NativeValue { get; private set; }
+
+			[MoonSharpProperty]
+			public MySubclass SubObj { get; private set; }
+		}
+
+		private MyClass Test(string tableDef)
+		{
+			Script s = new Script(CoreModules.None);
+
+			DynValue table = s.DoString("return " + tableDef);
+
+			Assert.AreEqual(DataType.Table, table.Type);
+
+			PropertyTableAssigner<MyClass> pta = new PropertyTableAssigner<MyClass>("class");
+			PropertyTableAssigner<MySubclass> pta2 = new PropertyTableAssigner<MySubclass>();
+
+			pta.SetSubassigner(pta2);
+
+			MyClass o = new MyClass();
+
+			pta.AssignObject(o, table.Table);
+
+			return o;
+		}
+
+		[Test]
+		public void ConfigProp_SimpleAssign()
+		{
+			MyClass x = Test(@"
+				{
+				class = 'oohoh',
+				myString = 'ciao',
+				number = 3,
+				some_table = {},
+				nativeValue = function() end,
+				subObj = { number = 15, myString = 'hi' },
+				}");
+
+			Assert.AreEqual(x.MyNumber, 3);
+			Assert.AreEqual(x.MyString, "ciao");
+			Assert.AreEqual(x.NativeValue.Type, DataType.Function);
+			Assert.AreEqual(x.SubObj.MyNumber, 15);
+			Assert.AreEqual(x.SubObj.MyString, "hi");
+			Assert.IsNotNull(x.SomeTable);
+
+		}
+
+
+		[Test]
+		[ExpectedException(typeof(ScriptRuntimeException))]
+		public void ConfigProp_ThrowsOnInvalid()
+		{
+			MyClass x = Test(@"
+				{
+				class = 'oohoh',
+				myString = 'ciao',
+				number = 3,
+				some_table = {},
+				invalid = 3,
+				nativeValue = function() end,
+				}");
+
+			Assert.AreEqual(x.MyNumber, 3);
+			Assert.AreEqual(x.MyString, "ciao");
+			Assert.AreEqual(x.NativeValue.Type, DataType.Function);
+			Assert.IsNotNull(x.SomeTable);
+
+		}
+
+	}
+}

+ 293 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/CoroutineTests.cs

@@ -0,0 +1,293 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	class CoroutineTests
+	{
+		[Test]
+		public void Coroutine_Basic()
+		{
+			string script = @"
+				s = ''
+
+				function foo()
+					for i = 1, 4 do
+						s = s .. i;
+						coroutine.yield();
+					end
+				end
+
+				function bar()
+					for i = 5, 9 do
+						s = s .. i;
+						coroutine.yield();
+					end
+				end
+
+				cf = coroutine.create(foo);
+				cb = coroutine.create(bar);
+
+				for i = 1, 4 do
+					coroutine.resume(cf);
+					s = s .. '-';
+					coroutine.resume(cb);
+					s = s .. ';';
+				end
+
+				return s;
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("1-5;2-6;3-7;4-8;", res.String);
+		}
+
+		[Test]
+		public void Coroutine_Wrap()
+		{
+			string script = @"
+				s = ''
+
+				function foo()
+					for i = 1, 4 do
+						s = s .. i;
+						coroutine.yield();
+					end
+				end
+
+				function bar()
+					for i = 5, 9 do
+						s = s .. i;
+						coroutine.yield();
+					end
+				end
+
+				cf = coroutine.wrap(foo);
+				cb = coroutine.wrap(bar);
+
+				for i = 1, 4 do
+					cf();
+					s = s .. '-';
+					cb();
+					s = s .. ';';
+				end
+
+				return s;
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("1-5;2-6;3-7;4-8;", res.String);
+		}
+
+		[Test]
+		public void Coroutine_ClrBoundaryHandling()
+		{
+			string code = @"
+				function a()
+					callback(b)
+				end
+
+				function b()
+					coroutine.yield();
+				end						
+
+				c = coroutine.create(a);
+
+				return coroutine.resume(c);		
+				";
+
+			// Load the code and get the returned function
+			Script script = new Script();
+
+			script.Globals["callback"] = DynValue.NewCallback(
+				(ctx, args) => args[0].Function.Call()
+				);
+
+			DynValue ret = script.DoString(code);
+
+			Assert.AreEqual(DataType.Tuple, ret.Type);
+			Assert.AreEqual(2, ret.Tuple.Length);
+			Assert.AreEqual(DataType.Boolean, ret.Tuple[0].Type);
+			Assert.AreEqual(false, ret.Tuple[0].Boolean);
+			Assert.AreEqual(DataType.String, ret.Tuple[1].Type);
+			Assert.IsTrue(ret.Tuple[1].String.EndsWith("attempt to yield across a CLR-call boundary"));
+		}
+
+		[Test]
+		public void Coroutine_VariousErrorHandling()
+		{
+			string last = "";
+			string code = @"
+
+function checkresume(step, ex, ey)
+	local x, y = coroutine.resume(c)
+	
+	assert(x == ex, 'Step ' .. step .. ': ' .. tostring(ex) .. ' was expected, got ' .. tostring(x));
+	assert(y:endsWith(ey), 'Step ' .. step .. ': ' .. tostring(ey) .. ' was expected, got ' .. tostring(y));
+end
+
+
+t = { }
+m = { __tostring = function() print('2'); coroutine.yield(); print('3'); end }
+
+setmetatable(t, m);
+
+
+function a()
+	checkresume(1, false, 'cannot resume non-suspended coroutine');
+	coroutine.yield('ok');
+	print(t);
+	coroutine.yield('ok'); 
+end
+
+c = coroutine.create(a);
+
+checkresume(2, true, 'ok');
+checkresume(3, false, 'attempt to yield across a CLR-call boundary');
+checkresume(4, false, 'cannot resume dead coroutine');
+checkresume(5, false, 'cannot resume dead coroutine');
+checkresume(6, false, 'cannot resume dead coroutine');
+
+				";
+
+			// Load the code and get the returned function
+			Script script = new Script();
+
+			script.Options.DebugPrint = (s) => last = s;
+
+			script.DoString(code);
+
+			Assert.AreEqual(last, "2");
+		}
+
+		[Test]
+		public void Coroutine_Direct_Resume()
+		{
+			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 = "";
+			while (coroutine.Coroutine.State != CoroutineState.Dead)
+			{
+				DynValue x = coroutine.Coroutine.Resume();
+				ret = ret + x.ToString();
+			}
+
+			Assert.AreEqual("1234567", ret);
+		}
+
+
+		[Test]
+		public void Coroutine_Direct_AsEnumerable()
+		{
+			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();
+			}
+
+			Assert.AreEqual("1234567", ret);
+		}
+
+
+		[Test]
+		public void Coroutine_AutoYield()
+		{
+			string code = @"
+				function fib(n)
+					if (n == 0 or n == 1) then
+						return 1;
+					else
+						return fib(n - 1) + fib(n - 2);
+					end
+				end
+				";
+
+			// Load the code and get the returned function
+			Script script = new Script(CoreModules.None);
+			script.DoString(code);
+
+			// get the function
+			DynValue function = script.Globals.Get("fib");
+
+			// Create the coroutine in C#
+			DynValue coroutine = script.CreateCoroutine(function);
+
+			// Set the automatic yield counter every 10 instructions. 
+			// 10 is a too small! Use a much bigger value in your code to avoid interrupting too often!
+			coroutine.Coroutine.AutoYieldCounter = 10;
+
+			int cycles = 0;
+			DynValue result = null;
+
+			// Cycle until we get that the coroutine has returned something useful and not an automatic yield..
+			for (result = coroutine.Coroutine.Resume(8); 
+				result.Type == DataType.YieldRequest;
+				result = coroutine.Coroutine.Resume()) 
+			{
+				cycles += 1;
+			}
+
+			// Check the values of the operation
+			Assert.AreEqual(DataType.Number, result.Type);
+			Assert.AreEqual(34, result.Number);
+
+			// Check the autoyield actually triggered
+			Assert.IsTrue(cycles > 10);
+		}
+
+
+
+
+
+
+	}
+}

+ 105 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/DynamicTests.cs

@@ -0,0 +1,105 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+using MoonSharp.Interpreter.Execution;
+using NUnit.Framework;
+using MoonSharp.Interpreter.CoreLib;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class DynamicTests
+	{
+		[Test]
+		public void DynamicAccessEval()
+		{
+			string script = @"
+				return dynamic.eval('5+1');		
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(6, res.Number);
+		}
+
+		[Test]
+		public void DynamicAccessPrepare()
+		{
+			string script = @"
+				x = dynamic.prepare('5+1');		
+				return dynamic.eval(x);
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(6, res.Number);
+		}
+
+		[Test]
+		public void DynamicAccessScope()
+		{
+			string script = @"
+				a = 3;
+
+				x = dynamic.prepare('a+1');		
+
+				function f()
+					a = 5;
+					return dynamic.eval(x);
+				end
+
+				return f();
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(6, res.Number);
+		}
+
+		[Test]
+		public void DynamicAccessScopeSecurity()
+		{
+			string script = @"
+				a = 5;
+
+				local x = dynamic.prepare('a');		
+
+				local eval = dynamic.eval;
+
+				local _ENV = { }
+
+				function f()
+					return eval(x);
+				end
+
+				return f();
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Nil, res.Type);
+			//Assert.AreEqual(6, res.Number);
+		}
+
+		[Test]
+		public void DynamicAccessFromCSharp()
+		{
+			string code = @"
+				t = { ciao = { 'hello' } }
+				";
+
+			Script script = new Script();
+			script.DoString(code);
+
+			DynValue v = script.CreateDynamicExpression("t.ciao[1] .. ' world'").Evaluate();
+
+			Assert.AreEqual(v.String, "hello world");
+		}
+
+
+	}
+}

+ 131 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/ErrorHandlingTests.cs

@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class ErrorHandlingTests
+	{
+		[Test]
+		public void PCallMultipleReturns()
+		{
+			string script = @"return pcall(function() return 1,2,3 end)";
+
+			Script S = new Script();
+			var res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(4, res.Tuple.Length);
+			Assert.AreEqual(true, res.Tuple[0].Boolean);
+			Assert.AreEqual(1, res.Tuple[1].Number);
+			Assert.AreEqual(2, res.Tuple[2].Number);
+			Assert.AreEqual(3, res.Tuple[3].Number);
+		}
+
+		[Test]
+		public void Errors_PCall_ClrFunction()
+		{
+			string script = @"
+				r, msg = pcall(assert, false, 'catched')
+				return r, msg;
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Boolean, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.String, res.Tuple[1].Type);
+			Assert.AreEqual(false, res.Tuple[0].Boolean);
+		}
+
+		[Test]
+		public void Errors_PCall_Multiples()
+		{
+			string script = @"
+function try(fn)
+	local x, y = pcall(fn)
+	
+	if (x) then
+		return y
+	else
+		return '!'
+	end
+end
+
+function a()
+	return try(b) .. 'a';
+end
+
+function b()
+	return try(c) .. 'b';
+end
+
+function c()
+	return try(d) .. 'c';
+end
+
+function d()
+	local t = { } .. 'x'
+end
+
+
+return a()
+";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("!cba", res.String);
+		}
+
+		[Test]
+		public void Errors_TryCatch_Multiples()
+		{
+			string script = @"
+function a()
+	return try(b) .. 'a';
+end
+
+function b()
+	return try(c) .. 'b';
+end
+
+function c()
+	return try(d) .. 'c';
+end
+
+function d()
+	local t = { } .. 'x'
+end
+
+
+return a()
+";
+			Script S = new Script(CoreModules.None);
+
+			S.Globals["try"] = DynValue.NewCallback((c, a) =>
+			{
+				try
+				{
+					var v = a[0].Function.Call();
+					return v;
+				}
+				catch (ScriptRuntimeException)
+				{
+					return DynValue.NewString("!");
+				}
+			});
+
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("!cba", res.String);
+		}
+
+	}
+}

+ 220 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/GotoTests.cs

@@ -0,0 +1,220 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class GotoTests
+	{
+		[Test]
+		public void Goto_Simple_Fwd()
+		{
+			string script = @"
+				function test()
+					x = 3
+					goto skip	
+					x = x + 2;
+					::skip::
+					return x;
+				end				
+
+				return test();
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(3, res.Number);
+		}
+
+		[Test]
+		public void Goto_Simple_Bwd()
+		{
+			string script = @"
+				function test()
+					x = 5;
+	
+					::jump::
+					if (x == 3) then return x; end
+					
+					x = 3
+					goto jump
+
+					x = 4
+					return x;
+				end				
+
+				return test();
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(3, res.Number);
+		}
+
+		[Test]
+		[ExpectedException(typeof(SyntaxErrorException))]
+		public void Goto_UndefinedLabel()
+		{
+			string script = @"
+				goto there
+				";
+
+			Script.RunString(script);
+		}
+
+		[Test]
+		[ExpectedException(typeof(SyntaxErrorException))]
+		public void Goto_DoubleDefinedLabel()
+		{
+			string script = @"
+				::label::
+				::label::
+				";
+
+			Script.RunString(script);
+		}
+
+		[Test]
+		public void Goto_RedefinedLabel()
+		{
+			string script = @"
+				::label::
+				do
+					::label::
+				end
+				";
+
+			Script.RunString(script);
+		}
+
+		[Test]
+		public void Goto_RedefinedLabel_Goto()
+		{
+			string script = @"
+				::label::
+				do
+					goto label
+					do return 5 end
+					::label::
+					return 3
+				end
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(3, res.Number);
+		}
+
+		[Test]
+		[ExpectedException(typeof(SyntaxErrorException))]
+		public void Goto_UndefinedLabel_2()
+		{
+			string script = @"
+				goto label
+				do
+					do return 5 end
+					::label::
+					return 3
+				end
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(3, res.Number);
+		}
+
+		[Test]
+		[ExpectedException(typeof(SyntaxErrorException))]
+		public void Goto_VarInScope()
+		{
+			string script = @"
+				goto f
+				local x
+				::f::
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(3, res.Number);
+		}
+
+
+		[Test]
+		public void Goto_JumpOutOfBlocks()
+		{
+			string script = @"
+				local u = 4
+
+				do
+					local x = 5
+	
+					do
+						local y = 6
+		
+						do
+							local z = 7
+						end
+		
+						goto out
+					end
+				end
+
+				do return 5 end
+
+				::out::
+
+				return 3
+			";
+
+			DynValue res = Script.RunString(script);
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(3, res.Number);
+		}
+
+		[Test]
+		public void Goto_JumpOutOfScopes()
+		{
+			string script = @"
+				local u = 4
+
+				do
+					local x = 5
+					do
+						local y = 6
+						do
+							goto out
+							local z = 7
+						end
+		
+					end
+				end
+
+				::out::
+
+				do 
+					local a
+					local b = 55
+
+					if (a == nil) then
+						b = b + 12
+					end
+
+					return b
+				end
+
+			";
+
+			DynValue res = Script.RunString(script);
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(67, res.Number);
+		}
+	}
+}

+ 136 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/JsonSerializationTests.cs

@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter;
+using MoonSharp.Interpreter.Serialization.Json;
+using NUnit.Framework;
+
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class JsonSerializationTests
+	{
+		void AssertTableValues(Table t)
+		{
+			Assert.AreEqual(DataType.Number, t.Get("aNumber").Type);
+			Assert.AreEqual(1, t.Get("aNumber").Number);
+
+			Assert.AreEqual(DataType.String, t.Get("aString").Type);
+			Assert.AreEqual("2", t.Get("aString").String);
+
+			Assert.AreEqual(DataType.Table, t.Get("anObject").Type);
+			Assert.AreEqual(DataType.Table, t.Get("anArray").Type);
+
+			Table o = t.Get("anObject").Table;
+
+			Assert.AreEqual(DataType.Number, o.Get("aNumber").Type);
+			Assert.AreEqual(3, o.Get("aNumber").Number);
+
+			Assert.AreEqual(DataType.String, o.Get("aString").Type);
+			Assert.AreEqual("4", o.Get("aString").String);
+
+			Table a = t.Get("anArray").Table;
+
+			//				'anArray' : [ 5, '6', true, null, { 'aNumber' : 7, 'aString' : '8' } ]
+
+			Assert.AreEqual(DataType.Number, a.Get(1).Type);
+			Assert.AreEqual(5, a.Get(1).Number);
+
+			Assert.AreEqual(DataType.String, a.Get(2).Type);
+			Assert.AreEqual("6", a.Get(2).String);
+
+			Assert.AreEqual(DataType.Boolean, a.Get(3).Type);
+			Assert.IsTrue(a.Get(3).Boolean);
+
+			Assert.AreEqual(DataType.Boolean, a.Get(3).Type);
+			Assert.IsTrue(a.Get(3).Boolean);
+
+			Assert.AreEqual(DataType.UserData, a.Get(4).Type);
+			Assert.IsTrue(JsonNull.IsJsonNull(a.Get(4)));
+
+			Assert.AreEqual(DataType.Table, a.Get(5).Type);
+			Table s = a.Get(5).Table;
+
+			Assert.AreEqual(DataType.Number, s.Get("aNumber").Type);
+			Assert.AreEqual(7, s.Get("aNumber").Number);
+
+			Assert.AreEqual(DataType.String, s.Get("aString").Type);
+			Assert.AreEqual("8", s.Get("aString").String);
+		}
+
+
+		[Test]
+		public void JsonDeserialization()
+		{
+			string json = @"{
+				'aNumber' : 1,
+				'aString' : '2',
+				'anObject' : { 'aNumber' : 3, 'aString' : '4' },
+				'anArray' : [ 5, '6', true, null, { 'aNumber' : 7, 'aString' : '8' } ]
+				}
+			".Replace('\'', '\"');
+
+			Table t = JsonTableConverter.JsonToTable(json);
+			AssertTableValues(t);
+		}
+
+		[Test]
+		public void JsonSerialization()
+		{
+			string json = @"{
+				'aNumber' : 1,
+				'aString' : '2',
+				'anObject' : { 'aNumber' : 3, 'aString' : '4' },
+				'anArray' : [ 5, '6', true, null, { 'aNumber' : 7, 'aString' : '8' } ]
+				}
+			".Replace('\'', '\"');
+
+			Table t1 = JsonTableConverter.JsonToTable(json);
+
+			string json2 = JsonTableConverter.TableToJson(t1);
+
+			Table t = JsonTableConverter.JsonToTable(json2);
+
+			AssertTableValues(t);
+		}
+
+
+		[Test]
+		public void JsonObjectSerialization()
+		{
+			object o = new
+			{
+				aNumber = 1,
+				aString = "2",
+				anObject = new
+				{
+					aNumber = 3,
+					aString = "4"
+				},
+				anArray = new object[]
+				{
+					5,
+					"6",
+					true,
+					null,
+					new
+					{
+						aNumber = 7,
+						aString = "8"
+					}
+				}
+			};
+
+
+			string json = JsonTableConverter.ObjectToJson(o);
+
+			Table t = JsonTableConverter.JsonToTable(json);
+
+			AssertTableValues(t);
+		}
+
+
+	}
+}

+ 171 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/LuaTestSuiteExtract.cs

@@ -0,0 +1,171 @@
+using System;
+using System.Collections.Generic;
+using MoonSharp.Interpreter.Diagnostics;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter.Execution;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	/// <summary>
+	/// Selected tests extracted from Lua test suite
+	/// </summary>
+	[TestFixture]
+	class LuaTestSuiteExtract
+	{
+		void RunTest(string script)
+		{
+			HashSet<string> failedTests = new HashSet<string>();
+			int i = 0;
+
+			Script S = new Script();
+
+			var globalCtx = S.Globals;
+			globalCtx.Set(DynValue.NewString("xassert"), DynValue.NewCallback(new CallbackFunction(
+				(x, a) =>
+				{
+					if (!a[1].CastToBool())
+						failedTests.Add(a[0].String);
+
+					return DynValue.Nil;
+				})));
+			globalCtx.Set(DynValue.NewString("assert"), DynValue.NewCallback(new CallbackFunction(
+				(x, a) =>
+				{
+					++i;
+
+					if (!a[0].CastToBool())
+						failedTests.Add(string.Format("assert #{0}", i));
+
+					return DynValue.Nil;
+				})));
+
+			globalCtx.Set(DynValue.NewString("print"), DynValue.NewCallback(new CallbackFunction((x, a) =>
+			{
+				// Debug.WriteLine(string.Join(" ", a.Select(v => v.AsString()).ToArray()));
+				return DynValue.Nil;
+			})));
+
+
+			DynValue res = S.DoString(script);
+
+			Assert.IsFalse(failedTests.Any(), string.Format("Failed asserts {0}",
+				string.Join(", ", failedTests.Select(xi => xi.ToString()).ToArray())));
+		}
+
+		[Test]
+		public void LuaSuite_Calls_LocalFunctionRecursion()
+		{
+			RunTest(@"
+				-- testing local-function recursion
+				fact = false
+				do
+				  local res = 1
+				  local function fact (n)
+					if n==0 then return res
+					else return n*fact(n-1)
+					end
+				  end
+				  xassert('fact(5) == 120', fact(5) == 120)
+				end
+				xassert('fact == false', fact == false)
+				");
+		}
+
+		[Test]
+		public void LuaSuite_Calls_Declarations()
+		{
+			RunTest(@"
+				-- testing local-function recursion
+				-- testing declarations
+				a = {i = 10}
+				self = 20
+				function a:x (x) return x+self.i end
+				function a.y (x) return x+self end
+
+				xassert('a:x(1)+10 == a.y(1)', a:x(1)+10 == a.y(1))
+
+				a.t = {i=-100}
+				a['t'].x = function (self, a,b) return self.i+a+b end
+
+				xassert('a.t:x(2,3) == -95', a.t:x(2,3) == -95)
+
+				do
+				  local a = {x=0}
+				  function a:add (x) self.x, a.y = self.x+x, 20; return self end
+				  xassert('a:add(10):add(20):add(30).x == 60 and a.y == 20', a:add(10):add(20):add(30).x == 60 and a.y == 20)
+				end
+
+				local a = {b={c={}}}
+
+				function a.b.c.f1 (x) return x+1 end
+				function a.b.c:f2 (x,y) self[x] = y end
+				xassert('a.b.c.f1(4) == 5', a.b.c.f1(4) == 5)
+				a.b.c:f2('k', 12); xassert('a.b.c.k == 12', a.b.c.k == 12)
+
+				print('+')
+
+				t = nil   -- 'declare' t
+				function f(a,b,c) local d = 'a'; t={a,b,c,d} end
+
+				f(      -- this line change must be valid
+				  1,2)
+				xassert('missingparam', t[1] == 1 and t[2] == 2 and t[3] == nil and t[4] == 'a')
+				f(1,2,   -- this one too
+					  3,4)
+				xassert('extraparam', t[1] == 1 and t[2] == 2 and t[3] == 3 and t[4] == 'a')
+
+				");
+		}
+
+
+
+		[Test]
+		public void LuaSuite_Calls_Closures()
+		{
+			RunTest(@"
+				-- fixed-point operator
+				Z = function (le)
+					  local function a (f)
+						return le(function (x) return f(f)(x) end)
+					  end
+					  return a(a)
+					end
+
+
+				-- non-recursive factorial
+
+				F = function (f)
+					  return function (n)
+							   if n == 0 then return 1
+							   else return n*f(n-1) end
+							 end
+					end
+
+				fat = Z(F)
+
+				xassert('fat(0) == 1 and fat(4) == 24 and Z(F)(5)==5*Z(F)(4)', fat(0) == 1 and fat(4) == 24 and Z(F)(5)==5*Z(F)(4))
+
+				local function g (z)
+				  local function f (a,b,c,d)
+					return function (x,y) return a+b+c+d+a+x+y+z end
+				  end
+				  return f(z,z+1,z+2,z+3)
+				end
+
+				f = g(10)
+
+				xassert('f(9, 16) == 10+11+12+13+10+9+16+10', f(9, 16) == 10+11+12+13+10+9+16+10)
+
+				Z, F, f = nil
+				--print('+')
+				");
+		}
+
+
+
+
+
+	}
+}

+ 301 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/MetatableTests.cs

@@ -0,0 +1,301 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter.CoreLib;
+using MoonSharp.Interpreter.Execution;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class MetatableTests
+	{
+		[Test]
+		public void TableIPairsWithMetatable()
+		{
+			string script = @"    
+				test = { 2, 4, 6 }
+
+				meta = { }
+
+				function meta.__ipairs(t)
+					local function ripairs_it(t,i)
+						i=i-1
+						local v=t[i]
+						if v==nil then return v end
+						return i,v
+					end
+
+					return ripairs_it, t, #t+1
+				end
+
+				setmetatable(test, meta);
+
+				x = '';
+
+				for i,v in ipairs(test) do
+					x = x .. i;
+				end
+
+				return x;";
+
+			DynValue res = (new Script()).DoString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("321", res.String);
+		}
+
+		[Test]
+		public void TableAddWithMetatable()
+		{
+			string script = @"    
+				v1 = { 'aaaa' }
+				v2 = { 'aaaaaa' } 
+
+				meta = { }
+
+				function meta.__add(t1, t2)
+					local o1 = #t1[1];
+					local o2 = #t2[1];
+	
+					return o1 * o2;
+				end
+
+
+				setmetatable(v1, meta);
+
+
+				return(v1 + v2);";
+
+			var S = new Script();
+			Table globalCtx = S.Globals;
+
+			globalCtx.RegisterModuleType<TableIteratorsModule>();
+			globalCtx.RegisterModuleType<MetaTableModule>();
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(24, res.Number);
+		}
+
+		[Test]
+		public void MetatableEquality()
+		{
+			string script = @"    
+				t1a = {}
+				t1b = {}
+				t2  = {}
+				mt1 = { __eq = function( o1, o2 ) return 'whee' end }
+				mt2 = { __eq = function( o1, o2 ) return 'whee' end }
+
+				setmetatable( t1a, mt1 )
+				setmetatable( t1b, mt1 )
+				setmetatable( t2,  mt2 )
+
+				return ( t1a == t1b ), ( t1a == t2 ) 
+				";
+
+			DynValue res = (new Script()).DoString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(true, res.Tuple[0].Boolean);
+			Assert.AreEqual(false, res.Tuple[1].Boolean);
+
+		}
+
+		[Test]
+		public void MetatableCall2()
+		{
+			string script = @"    
+					t = { }
+					meta = { }
+
+					x = 0;
+
+					function meta.__call(f, y)
+						x = 156 * y;
+						return x;
+					end
+
+					setmetatable(t, meta);
+
+					return t;
+				";
+
+			Script S = new Script();
+
+			DynValue tbl = S.DoString(script);
+			DynValue res = S.Call(tbl, 3);
+
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(468, res.Number);
+
+		}
+
+		[Test]
+		public void MetatableCall()
+		{
+			string script = @"    
+					t = { }
+					meta = { }
+
+					x = 0;
+
+					function meta.__call(f, y)
+						x = 156 * y;
+					end
+
+					setmetatable(t, meta);
+
+					t(3);
+					return x;
+				";
+
+			DynValue res = (new Script()).DoString(script);
+
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(468, res.Number);
+
+		}
+
+		[Test]
+		public void MetatableIndexAndSetIndexFuncs()
+		{
+			string script = @"    
+					T = { a = 'a', b = 'b', c = 'c' };
+
+					t = { };
+
+					m = { };
+
+					s = '';
+
+
+					function m.__index(obj, idx)
+						return T[idx];
+					end
+
+					function m.__newindex(obj, idx, val)
+						T[idx] = val;
+					end
+
+					setmetatable(t, m);
+
+					s = s .. t.a .. t.b .. t.c;
+
+					t.a = '!';
+
+					s = s .. t.a .. t.b .. t.c;
+
+					return(s);
+				";
+
+			DynValue res = (new Script()).DoString(script);
+
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("abc!bc", res.String);
+		}
+
+		[Test]
+		public void MetatableIndexAndSetIndexBounce()
+		{
+			string script = @"    
+					T = { a = 'a', b = 'b', c = 'c' };
+
+					t = { };
+
+					m = { __index = T, __newindex = T };
+
+					s = '';
+
+					setmetatable(t, m);
+
+					s = s .. t.a .. t.b .. t.c;
+
+					t.a = '!';
+
+					s = s .. t.a .. t.b .. t.c;
+
+					return(s);
+				";
+
+			DynValue res = (new Script()).DoString(script);
+
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("abc!bc", res.String);
+		}
+
+
+		public class MyObject
+		{
+			public int GetSomething()
+			{
+				return 10;
+			}
+		}
+
+		[Test]
+		public void MetatableExtensibleObjectSample()
+		{
+			string code = @"    
+
+				--declare this once for all
+				extensibleObjectMeta = {
+					__index = function(t, name) local obj = rawget(t, 'wrappedobj'); if (obj) then return obj[name]; end end
+				}
+
+				-- create a new wrapped object called myobj, wrapping the object o
+				myobj = { wrappedobj = o };
+				setmetatable(myobj, extensibleObjectMeta);
+
+				function myobj.extended()
+					return 12;	
+				end
+
+
+				return myobj.extended() * myobj.getSomething();
+				";
+
+			Script script = new Script();
+			UserData.RegisterType<MyObject>();
+			script.Globals["o"] = new MyObject();
+			
+			DynValue res = script.DoString(code);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120, res.Number);
+		}
+
+		[Test]
+		public void IndexSetDoesNotWrackStack()
+		{
+			string scriptCode = @"
+
+local aClass = {}
+setmetatable(aClass, {__newindex = function() end, __index = function() end })
+
+local p = {a = 1, b = 2}
+ 
+for x , v in pairs(p) do
+	print (x, v)
+	aClass[x] = v
+end
+
+";
+
+			Script script = new Script(CoreModules.Basic | CoreModules.Table | CoreModules.TableIterators | CoreModules.Metatables);
+
+			DynValue res = script.DoString(scriptCode);
+		}
+
+
+
+
+	}
+}

+ 47 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/ProxyObjectsTests.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter.Interop;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class ProxyObjectsTests
+	{
+		public class Proxy
+		{
+			[MoonSharpVisible(false)]
+			public Random random;
+
+			[MoonSharpVisible(false)]
+			public Proxy(Random r)
+			{
+				random = r;
+			}
+
+			public int GetValue() { return 3; }
+		}
+
+		[Test]
+		public void ProxyTest()
+		{
+			UserData.RegisterProxyType<Proxy, Random>(r => new Proxy(r));
+
+			Script S = new Script();
+
+			S.Globals["R"] = new Random();
+			S.Globals["func"] = (Action<Random>)(r => { Assert.IsNotNull(r); Assert.IsTrue(r is Random); });
+
+			S.DoString(@"
+				x = R.GetValue();
+				func(R);
+			");
+
+			Assert.AreEqual(3.0, S.Globals.Get("x").Number);
+		}
+
+
+	}
+}

+ 1536 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/SimpleTests.cs

@@ -0,0 +1,1536 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using MoonSharp.Interpreter.Execution;
+using NUnit.Framework;
+using MoonSharp.Interpreter.Loaders;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class SimpleTests
+	{
+		[Test]
+		public void EmptyLongComment()
+		{
+			Script S = new Script(CoreModules.None);
+			DynValue res = S.DoString("--[[]]");
+		}
+
+
+		[Test]
+		public void EmptyChunk()
+		{
+			Script S = new Script(CoreModules.None);
+			DynValue res = S.DoString("");
+		}
+
+		[Test]
+		public void CSharpStaticFunctionCallStatement()
+		{
+			IList<DynValue> args = null;
+
+			string script = "print(\"hello\", \"world\");";
+
+			Script S = new Script();
+
+			S.Globals.Set("print", DynValue.NewCallback(new CallbackFunction((x, a) => 
+			{
+				args = a.GetArray();
+				return DynValue.NewNumber(1234.0); 
+			})));
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Void, res.Type);
+			Assert.AreEqual(2, args.Count);
+			Assert.AreEqual(DataType.String, args[0].Type);
+			Assert.AreEqual("hello", args[0].String);
+			Assert.AreEqual(DataType.String, args[1].Type);
+			Assert.AreEqual("world", args[1].String);
+		}
+
+		[Test]
+		public void CSharpStaticFunctionCallRedef()
+		{
+			IList<DynValue> args = null;
+
+			string script = "local print = print; print(\"hello\", \"world\");";
+
+			var S = new Script();
+			S.Globals.Set("print", DynValue.NewCallback(new CallbackFunction((_x, a) => { args = a.GetArray(); return DynValue.NewNumber(1234.0); })));
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(2, args.Count);
+			Assert.AreEqual(DataType.String, args[0].Type);
+			Assert.AreEqual("hello", args[0].String);
+			Assert.AreEqual(DataType.String, args[1].Type);
+			Assert.AreEqual("world", args[1].String);
+			Assert.AreEqual(DataType.Void, res.Type);
+		}
+
+		[Test]
+		public void CSharpStaticFunctionCall4()
+		{
+			string script = "return callback()();";
+
+			var callback2 = DynValue.NewCallback(new CallbackFunction((_x, a) => { return DynValue.NewNumber(1234.0); }));
+			var callback = DynValue.NewCallback(new CallbackFunction((_x, a) => { return callback2; }));
+
+			var S = new Script();
+			S.Globals.Set("callback", callback);
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1234.0, res.Number);
+		}
+
+		[Test]
+		public void CSharpStaticFunctionCall3()
+		{
+			string script = "return callback();";
+
+			var callback = DynValue.NewCallback(new CallbackFunction((_x, a) => { return DynValue.NewNumber(1234.0); }));
+
+			var S = new Script();
+			S.Globals.Set("callback", callback);
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1234.0, res.Number);
+		}
+
+		[Test]
+		public void CSharpStaticFunctionCall2()
+		{
+			IList<DynValue> args = null;
+
+			string script = "return callback 'hello';";
+
+			var S = new Script();
+			S.Globals.Set("callback", DynValue.NewCallback(new CallbackFunction((_x, a) => { args = a.GetArray(); return DynValue.NewNumber(1234.0); })));
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(1, args.Count);
+			Assert.AreEqual(DataType.String, args[0].Type);
+			Assert.AreEqual("hello", args[0].String);
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1234.0, res.Number);
+		}
+
+		[Test]
+		public void CSharpStaticFunctionCall()
+		{
+			IList<DynValue> args = null;
+
+			string script = "return print(\"hello\", \"world\");";
+
+			var S = new Script();
+			S.Globals.Set("print", DynValue.NewCallback(new CallbackFunction((_x, a) => { args = a.GetArray(); return DynValue.NewNumber(1234.0); })));
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(2, args.Count);
+			Assert.AreEqual(DataType.String, args[0].Type);
+			Assert.AreEqual("hello", args[0].String);
+			Assert.AreEqual(DataType.String, args[1].Type);
+			Assert.AreEqual("world", args[1].String);
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1234.0, res.Number);
+		}
+
+		[Test]
+		//!!! DO NOT REFORMAT THIS METHOD !!!
+		public void LongStrings()
+		{
+			string script = @"    
+				x = [[
+					ciao
+				]];
+
+				y = [=[ [[uh]] ]=];
+
+				z = [===[[==[[=[[[eheh]]=]=]]===]
+
+				return x,y,z";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(3, res.Tuple.Length);
+			Assert.AreEqual(DataType.String, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.String, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.String, res.Tuple[2].Type);
+			Assert.AreEqual("\t\t\t\t\tciao\n\t\t\t\t", res.Tuple[0].String);
+			Assert.AreEqual(" [[uh]] ", res.Tuple[1].String);
+			Assert.AreEqual("[==[[=[[[eheh]]=]=]", res.Tuple[2].String);
+		}
+
+
+		[Test]
+		public void UnicodeEscapeLua53Style()
+		{
+			string script = @"    
+				x = 'ciao\u{41}';
+				return x;";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("ciaoA", res.String);
+		}
+
+		[Test]
+		[ExpectedException(typeof(SyntaxErrorException))]
+		public void InvalidEscape()
+		{
+			string script = @"    
+				x = 'ciao\k{41}';
+				return x;";
+
+			DynValue res = Script.RunString(script);
+		}
+
+		[Test]
+		public void KeywordsInStrings()
+		{
+			string keywrd = "and break do else elseif end false end for function end goto if ::in:: in local nil not [or][[][==][[]] repeat return { then 0 end return; }; then true (x != 5 or == * 3 - 5) x";
+
+			string script = string.Format(@"    
+				x = '{0}';
+				return x;", keywrd);
+
+			DynValue res = Script.RunString(script);
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual(keywrd, res.String);
+		}
+
+
+
+		[Test]
+		public void ParserErrorMessage()
+		{
+			bool caught = false;
+			string script = @"    
+				return 'It's a wet floor warning saying wheat flour instead. \
+				Probably, the cook thought it was funny. \
+				He was wrong.'";
+
+			try
+			{
+				DynValue res = Script.RunString(script);
+			}
+			catch (SyntaxErrorException ex)
+			{
+				caught = true;
+				Assert.IsNotNullOrEmpty(ex.Message);
+			}
+
+			Assert.IsTrue(caught);
+		}
+
+		[Test]
+		public void StringsWithBackslashLineEndings2()
+		{
+			string script = @"    
+				return 'a\
+				b\
+				c'";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+		}
+
+		[Test]
+		public void StringsWithBackslashLineEndings()
+		{
+			string script = @"    
+				return 'It is a wet floor warning saying wheat flour instead. \
+				Probably, the cook thought it was funny. \
+				He was wrong.'";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+		}
+
+		[Test]
+		public void FunctionCallWrappers()
+		{
+			string script = @"    
+				function boh(x) 
+					return 1912 + x;
+				end
+			";
+
+			Script s = new Script();
+			s.DoString(script);
+
+			DynValue res = s.Globals.Get("boh").Function.Call(82);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1994, res.Number);
+		}
+
+
+		[Test]
+		public void ReturnSimpleUnop()
+		{
+			string script = @"return -42";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(-42, res.Number);
+		}
+
+		[Test]
+		public void ReturnSimple()
+		{
+			string script = @"return 42";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(42, res.Number);
+		}
+
+
+		[Test]
+		public void OperatorSimple()
+		{
+			string script = @"return 6*7";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(42, res.Number);
+		}
+
+
+		[Test]
+		public void SimpleBoolShortCircuit()
+		{
+			string script = @"    
+				x = true or crash();
+				y = false and crash();
+			";
+
+			Script S = new Script();
+			S.Globals.Set("crash", DynValue.NewCallback(new CallbackFunction((_x, a) =>
+			{
+				throw new Exception("FAIL!");
+			})));
+
+			S.DoString(script);
+		}
+
+		[Test]
+		public void FunctionOrOperator()
+		{
+			string script = @"    
+				loadstring = loadstring or load;
+
+				return loadstring;
+			";
+
+			Script S = new Script();
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.ClrFunction, res.Type);
+
+		}
+
+
+		[Test]
+		public void SelectNegativeIndex()
+		{
+			string script = @"    
+				return select(-1,'a','b','c');
+			";
+
+			Script S = new Script();
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("c", res.String);
+		}
+
+
+
+
+
+		[Test]
+		public void BoolConversionAndShortCircuit()
+		{
+			string script = @"    
+				i = 0;
+
+				function f()
+					i = i + 1;
+					return '!';
+				end					
+				
+				x = false;
+				y = true;
+
+				return false or f(), true or f(), false and f(), true and f(), i";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(5, res.Tuple.Length);
+			Assert.AreEqual(DataType.String, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Boolean, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.Boolean, res.Tuple[2].Type);
+			Assert.AreEqual(DataType.String, res.Tuple[3].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[4].Type);
+			Assert.AreEqual("!", res.Tuple[0].String);
+			Assert.AreEqual(true, res.Tuple[1].Boolean);
+			Assert.AreEqual(false, res.Tuple[2].Boolean);
+			Assert.AreEqual("!", res.Tuple[3].String);
+			Assert.AreEqual(2, res.Tuple[4].Number);
+		}
+		[Test]
+		public void HanoiTowersDontCrash()
+		{
+			string script = @"
+			function move(n, src, dst, via)
+				if n > 0 then
+					move(n - 1, src, via, dst)
+					move(n - 1, via, dst, src)
+				end
+			end
+ 
+			move(4, 1, 2, 3)
+			";
+
+			DynValue res = Script.RunString(script);
+		}
+
+		[Test]
+		public void Factorial()
+		{
+			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);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120.0, res.Number);
+		}
+
+		[Test]
+		public void IfStatmWithScopeCheck()
+		{
+			string script = @"    
+				x = 0
+
+				if (x == 0) then
+					local i = 3;
+					x = i * 2;
+				end
+    
+				return i, x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Nil, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(6, res.Tuple[1].Number);
+		}
+
+		[Test]
+		public void ScopeBlockCheck()
+		{
+			string script = @"    
+				local x = 6;
+				
+				do
+					local i = 33;
+				end
+		
+				return i, x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Nil, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(6, res.Tuple[1].Number);
+		}
+
+		[Test]
+		public void ForLoopWithBreak()
+		{
+			string script = @"    
+				x = 0
+
+				for i = 1, 10 do
+					x = i
+					break;
+				end
+    
+				return x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1, res.Number);
+		}
+
+
+		[Test]
+		public void ForEachLoopWithBreak()
+		{
+			string script = @"    
+				x = 0
+				y = 0
+
+				t = { 2, 4, 6, 8, 10, 12 };
+
+				function iter (a, ii)
+				  ii = ii + 1
+				  local v = a[ii]
+				  if v then
+					return ii, v
+				  end
+				end
+    
+				function ipairslua (a)
+				  return iter, a, 0
+				end
+
+				for i,j in ipairslua(t) do
+					x = x + i
+					y = y + j
+
+					if (i >= 3) then
+						break
+					end
+				end
+    
+				return x, y";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(6, res.Tuple[0].Number);
+			Assert.AreEqual(12, res.Tuple[1].Number);
+		}
+
+
+		[Test]
+		public void ForEachLoop()
+		{
+			string script = @"    
+				x = 0
+				y = 0
+
+				t = { 2, 4, 6, 8, 10, 12 };
+
+				function iter (a, ii)
+				  ii = ii + 1
+				  local v = a[ii]
+				  if v then
+					return ii, v
+				  end
+				end
+    
+				function ipairslua (a)
+				  return iter, a, 0
+				end
+
+				for i,j in ipairslua(t) do
+					x = x + i
+					y = y + j
+				end
+    
+				return x, y";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(21, res.Tuple[0].Number);
+			Assert.AreEqual(42, res.Tuple[1].Number);
+		}
+
+		[Test]
+		public void LengthOperator()
+		{
+			string script = @"    
+				x = 'ciao'
+				y = { 1, 2, 3 }
+   
+				return #x, #y";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(4, res.Tuple[0].Number);
+			Assert.AreEqual(3, res.Tuple[1].Number);
+		}
+
+
+		[Test]
+		public void ForLoopWithBreakAndScopeCheck()
+		{
+			string script = @"    
+				x = 0
+
+				for i = 1, 10 do
+					x = x + i
+
+					if (i == 3) then
+						break
+					end
+				end
+    
+				return i, x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Nil, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(6, res.Tuple[1].Number);
+		}
+
+		[Test]
+		public void FactorialWithOneReturn()
+		{
+			string script = @"    
+				-- defines a factorial function
+				function fact (n)
+					if (n == 0) then
+						return 1
+					end
+					return n*fact(n - 1)
+				end
+    
+				return fact(5)";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120.0, res.Number);
+		}
+
+		[Test]
+		public void VeryBasic()
+		{
+			string script = @"return 7";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(7, res.Number);
+		}
+
+		[Test]
+		public void OperatorPrecedence1()
+		{
+			string script = @"return 1+2*3";
+
+			Script s = new Script(CoreModules.None);
+			DynValue res = s.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(7, res.Number);
+		}
+		[Test]
+		public void OperatorPrecedence2()
+		{
+			string script = @"return 2*3+1";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(7, res.Number);
+		}
+
+		[Test]
+		public void OperatorAssociativity()
+		{
+			string script = @"return 2^3^2";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(512, res.Number);
+		}
+
+		[Test]
+		public void OperatorPrecedence3()
+		{
+			string script = @"return 5-3-2";
+			Script S = new Script(CoreModules.None);
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(0, res.Number);
+		}
+
+		[Test]
+		public void OperatorPrecedence4()
+		{
+			string script = @"return 3 + -1";
+			Script S = new Script(CoreModules.None);
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(2, res.Number);
+		}
+
+		[Test]
+		public void OperatorPrecedence5()
+		{
+			string script = @"return 3 * -1 + 5 * 3";
+			Script S = new Script(CoreModules.None);
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(12, res.Number);
+		}
+
+		[Test]
+		public void OperatorPrecedence6()
+		{
+			string script = @"return -2^2";
+			Script S = new Script(CoreModules.None);
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(-4, res.Number);
+		}
+
+		[Test]
+		public void OperatorPrecedence7()
+		{
+			string script = @"return -7 / 0.5";
+			Script S = new Script(CoreModules.None);
+
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(-14, res.Number);
+		}
+
+		[Test]
+		public void OperatorPrecedenceAndAssociativity()
+		{
+			string script = @"return 5+3*7-2*5+2^3^2";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(528, res.Number);
+		}
+
+		[Test]
+		public void OperatorParenthesis()
+		{
+			string script = @"return (5+3)*7-2*5+(2^3)^2";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(110, res.Number);
+		}
+
+		[Test]
+		public void GlobalVarAssignment()
+		{
+			string script = @"x = 1; return x;";    
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1, res.Number);
+		}
+		[Test]
+		public void TupleAssignment1()
+		{
+			string script = @"    
+				function y()
+					return 2, 3
+				end
+
+				function x()
+					return 1, y()
+				end
+
+				w, x, y, z = 0, x()
+    
+				return w+x+y+z";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(6, res.Number);
+		}
+
+		[Test]
+		public void IterativeFactorialWithWhile()
+		{
+			string script = @"    
+				function fact (n)
+					local result = 1;
+					while(n > 0) do
+						result = result * n;
+						n = n - 1;
+					end
+					return result;
+				end
+    
+				return fact(5)";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120.0, res.Number);
+		}
+
+
+
+		[Test]
+		public void IterativeFactorialWithRepeatUntilAndScopeCheck()
+		{
+			string script = @"    
+				function fact (n)
+					local result = 1;
+					repeat
+						local checkscope = 1;
+						result = result * n;
+						n = n - 1;
+					until (n == 0 and checkscope == 1)
+					return result;
+				end
+    
+				return fact(5)";
+
+			Script s = new Script(CoreModules.None);
+			DynValue res = s.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120.0, res.Number);
+		}
+
+		[Test]
+
+		public void SimpleForLoop()
+		{
+			string script = @"    
+					x = 0
+					for i = 1, 3 do
+						x = x + i;
+					end
+
+					return x;
+			";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(6.0, res.Number);
+		}
+
+		[Test]
+		public void SimpleFunc()
+		{
+			string script = @"    
+				function fact (n)
+					return 3;
+				end
+    
+				return fact(3)";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(3, res.Number);
+		}
+
+		[Test]
+		public void IterativeFactorialWithFor()
+		{
+			string script = @"    
+				-- defines a factorial function
+				function fact (n)
+					x = 1
+					for i = n, 1, -1 do
+						x = x * i;
+					end
+
+					return x;
+				end
+    
+				return fact(5)";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(120.0, res.Number);
+		}
+
+
+		[Test]
+		public void LocalFunctionsObscureScopeRule()
+		{
+			string script = @"    
+				local function fact()
+					return fact;
+				end
+
+				return fact();
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Function, res.Type);
+		}
+
+		[Test]
+		public void FunctionWithStringArg2()
+		{
+			string script = @"    
+				x = 0;
+
+				fact = function(y)
+					x = y
+				end
+
+				fact 'ciao';
+
+				return x;
+				";
+
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("ciao", res.String);
+		}
+
+		[Test]
+		public void FunctionWithStringArg()
+		{
+			string script = @"    
+				x = 0;
+
+				function fact(y)
+					x = y
+				end
+
+				fact 'ciao';
+
+				return x;
+				";
+
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("ciao", res.String);
+
+		}
+
+		[Test]
+		public void FunctionWithTableArg()
+		{
+			string script = @"    
+				x = 0;
+
+				function fact(y)
+					x = y
+				end
+
+				fact { 1,2,3 };
+
+				return x;
+				";
+
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Table, res.Type);
+
+		}
+
+
+		[Test]
+		public void TupleAssignment2()
+		{
+			string script = @"    
+				function boh()
+					return 1, 2;
+				end
+
+				x,y,z = boh(), boh()
+
+				return x,y,z;
+				";
+
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[2].Type);
+			Assert.AreEqual(1, res.Tuple[0].Number);
+			Assert.AreEqual(1, res.Tuple[1].Number);
+			Assert.AreEqual(2, res.Tuple[2].Number);
+		}
+		[Test]
+		public void LoopWithReturn()
+		{
+			string script = @"function Allowed( )
+									for i = 1, 20 do
+  										return false 
+									end
+									return true
+								end
+						Allowed();
+								";
+
+			DynValue res = Script.RunString(script);
+
+		}
+		[Test]
+		public void IfWithLongExpr()
+		{
+			string script = @"function Allowed( )
+									for i = 1, 20 do
+									if ( false ) or ( true and true ) or ( 7+i <= 9 and false ) then 
+  										return false 
+									end
+									end		
+									return true
+								end
+						Allowed();
+								";
+
+			DynValue res = Script.RunString(script);
+
+		}
+
+		[Test]
+		public void IfWithLongExprTbl()
+		{
+			string script = @"
+						t = { {}, {} }
+						
+						function Allowed( )
+									for i = 1, 20 do
+									if ( t[1][3] ) or ( i <= 17 and t[1][1] ) or ( 7+i <= 9 and t[1][1] ) then 
+  										return false 
+									end
+									end		
+									return true
+								end
+						Allowed();
+								";
+
+			DynValue res = Script.RunString(script);
+
+		}
+
+		[Test]
+		public void ExpressionReducesTuples()
+		{
+			string script = @"
+					function x()
+						return 1,2
+					end
+
+					do return (x()); end
+					do return x(); end
+								";
+
+			DynValue res = (new Script(CoreModules.None)).DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1, res.Number);
+		}
+
+
+		[Test]
+		public void ExpressionReducesTuples2()
+		{
+			string script = @"
+					function x()
+						return 3,4
+					end
+
+					return 1,x(),x()
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(4, res.Tuple.Length);
+		}
+
+
+		[Test]
+		public void ArgsDoNotChange()
+		{
+			string script = @"
+					local a = 1;
+					local b = 2;
+
+					function x(c, d)
+						c = c + 3;
+						d = d + 4;
+						return c + d;
+					end
+
+					return x(a, b+1), a, b;
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(3, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[2].Type);
+			Assert.AreEqual(11, res.Tuple[0].Number);
+			Assert.AreEqual(1, res.Tuple[1].Number);
+			Assert.AreEqual(2, res.Tuple[2].Number);
+		}
+
+
+		[Test]
+		public void VarArgsNoError()
+		{
+			string script = @"
+					function x(...)
+
+					end
+
+					function y(a, ...)
+
+					end
+
+					return 1;
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1, res.Number);
+		}
+
+		[Test]
+		public void VarArgsSum()
+		{
+			string script = @"
+					function x(...)
+						local t = pack(...);
+						local sum = 0;
+
+						for i = 1, #t do
+							sum = sum + t[i];
+						end
+	
+						return sum;
+					end
+
+					return x(1,2,3,4);
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(10, res.Number);
+		}
+
+		[Test]
+		public void VarArgsSum2()
+		{
+			string script = @"
+					function x(m, ...)
+						local t = pack(...);
+						local sum = 0;
+
+						for i = 1, #t do
+							sum = sum + t[i];
+						end
+	
+						return sum * m;
+					end
+
+					return x(5,1,2,3,4);
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(50, res.Number);
+		}
+
+		[Test]
+		public void VarArgsSumTb()
+		{
+			string script = @"
+					function x(...)
+						local t = {...};
+						local sum = 0;
+
+						for i = 1, #t do
+							sum = sum + t[i];
+						end
+	
+						return sum;
+					end
+
+					return x(1,2,3,4);
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(10, res.Number);
+		}
+
+		[Test]
+		public void SwapPattern()
+		{
+			string script = @"
+					local n1 = 1
+					local n2 = 2
+					local n3 = 3
+					local n4 = 4
+					n1,n2,n3,n4 = n4,n3,n2,n1
+
+					return n1,n2,n3,n4;
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(4, res.Tuple.Length);
+			Assert.AreEqual(4, res.Tuple[0].Number);
+			Assert.AreEqual(3, res.Tuple[1].Number);
+			Assert.AreEqual(2, res.Tuple[2].Number);
+			Assert.AreEqual(1, res.Tuple[3].Number);
+		}
+
+		[Test]
+		public void SwapPatternGlobal()
+		{
+			string script = @"
+					n1 = 1
+					n2 = 2
+					n3 = 3
+					n4 = 4
+					n1,n2,n3,n4 = n4,n3,n2,n1
+
+					return n1,n2,n3,n4;
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(4, res.Tuple.Length);
+			Assert.AreEqual(4, res.Tuple[0].Number);
+			Assert.AreEqual(3, res.Tuple[1].Number);
+			Assert.AreEqual(2, res.Tuple[2].Number);
+			Assert.AreEqual(1, res.Tuple[3].Number);
+		}
+
+		[Test]
+		public void EnvTestSuite()
+		{
+			string script = @"
+				local RES = { }
+
+				RES.T1 = (_ENV == _G) 
+
+				a = 1
+
+				local function f(t)
+				  local _ENV = t 
+
+				  RES.T2 = (getmetatable == nil) 
+  
+				  a = 2 -- create a new entry in t, doesn't touch the original 'a' global
+				  b = 3 -- create a new entry in t
+				end
+
+				local t = {}
+				f(t)
+
+				RES.T3 = a;
+				RES.T4 = b;
+				RES.T5 = t.a;
+				RES.T6 = t.b;
+
+				return RES;
+								";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Table, res.Type);
+
+			Table T = res.Table;
+
+			Assert.AreEqual(DataType.Boolean, T.Get("T1").Type, "T1-Type");
+			Assert.AreEqual(true, T.Get("T1").Boolean, "T1-Val");
+
+			Assert.AreEqual(DataType.Boolean, T.Get("T2").Type, "T2-Type");
+			Assert.AreEqual(true, T.Get("T2").Boolean, "T2-Val");
+
+			Assert.AreEqual(DataType.Number, T.Get("T3").Type, "T3-Type");
+			Assert.AreEqual(1, T.Get("T3").Number, "T3-Val");
+
+			Assert.AreEqual(DataType.Nil, T.Get("T4").Type, "T4");
+
+			Assert.AreEqual(DataType.Number, T.Get("T5").Type, "T5-Type");
+			Assert.AreEqual(2, T.Get("T5").Number, "T5-Val");
+
+			Assert.AreEqual(DataType.Number, T.Get("T6").Type, "T6-Type");
+			Assert.AreEqual(3, T.Get("T6").Number, "T6-Val");
+		}
+
+		[Test]
+		public void TupleToOperator()
+		{
+			string script = @"    
+				function x()
+					return 3, 'xx';
+				end
+
+				return x() == 3;	
+			";
+
+			Script S = new Script(CoreModules.None);
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Boolean, res.Type);
+			Assert.AreEqual(true, res.Boolean);
+		}
+
+
+		[Test]
+		public void LiteralExpands()
+		{
+			string script = @"    
+				x = 'a\65\66\67z';
+				return x;	
+			";
+
+			Script S = new Script(CoreModules.None);
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("aABCz", res.String);
+		}
+
+		[Test]
+		public void HomonymArguments()
+		{
+			string script = @"    
+				function test(_,value,_) return _; end
+
+				return test(1, 2, 3);	
+			";
+
+			Script S = new Script(CoreModules.None);
+			DynValue res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(3, res.Number);
+		}
+
+		[Test]
+		public void VarArgsSumMainChunk()
+		{
+			string script = @"
+					local t = pack(...);
+					local sum = 0;
+
+					for i = 1, #t do
+						sum = sum + t[i];
+					end
+	
+					return sum;
+								";
+
+			DynValue fn = new Script().LoadString(script);
+
+			DynValue res = fn.Function.Call(1, 2, 3, 4);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(10, res.Number);
+		}
+
+		[Test]
+		[ExpectedException(typeof(SyntaxErrorException))]
+		public void VarArgsInNoVarArgsReturnsError()
+		{
+			string script = @"
+					function x()
+						local t = {...};
+						local sum = 0;
+
+						for i = 1, #t do
+							sum = sum + t[i];
+						end
+	
+						return sum;
+					end
+
+					return x(1,2,3,4);
+								";
+
+			DynValue res = Script.RunString(script);
+		}
+
+		[Test]
+		public void HexFloats_1()
+		{
+			string script = "return 0x0.1E";
+			DynValue result = Script.RunString(script);
+			Assert.AreEqual((double)0x1E / (double)0x100, result.Number);
+		}
+
+		[Test]
+		public void HexFloats_2()
+		{
+			string script = "return 0xA23p-4";
+			DynValue result = Script.RunString(script);
+			Assert.AreEqual((double)0xA23 / 16.0, result.Number);
+		}
+
+		[Test]
+		public void HexFloats_3()
+		{
+			string script = "return 0X1.921FB54442D18P+1";
+			DynValue result = Script.RunString(script);
+			Assert.AreEqual((1 + (double)0x921FB54442D18 / (double)0x10000000000000) * 2, result.Number);
+		}
+
+		[Test]
+		public void Simple_Delegate_Interop_1()
+		{
+			int a = 3;
+			var script = new Script();
+			script.Globals["action"] = new Action(() => a = 5);
+			script.DoString("action()");
+			Assert.AreEqual(5, a);
+		}
+
+		[Test]
+		public void Simple_Delegate_Interop_2()
+		{
+			var oldPolicy = UserData.RegistrationPolicy;
+
+			try
+			{
+				UserData.RegistrationPolicy = Interop.InteropRegistrationPolicy.Automatic;
+
+				int a = 3;
+				var script = new Script();
+				script.Globals["action"] = new Action(() => a = 5);
+				script.DoString("action()");
+				Assert.AreEqual(5, a);
+			}
+			finally
+			{
+				UserData.RegistrationPolicy = oldPolicy;
+			}
+		}
+
+		[Test]
+		public void MissingArgsDefaultToNil()
+		{
+			Script S = new Script(CoreModules.None);
+			DynValue res = S.DoString(@"
+				function test(a)
+					return a;
+				end
+
+				test();
+				");
+		}
+
+		[Test]
+		public void ParsingTest()
+		{
+			Script S = new Script(CoreModules.None);
+			DynValue res = S.LoadString(@"
+				t = {'a', 'b', 'c', ['d'] = 'f', ['e'] = 5, [65] = true, [true] = false}
+				function myFunc()
+				  return 'one', 'two'
+				end
+
+				print('Table Test 1:')
+				for k,v in pairs(t) do
+				  print(tostring(k) .. ' / ' .. tostring(v))
+				end
+				print('Table Test 2:')
+				for X,X in pairs(t) do
+				  print(tostring(X) .. ' / ' .. tostring(X))
+				end
+				print('Function Test 1:')
+				v1,v2 = myFunc()
+				print(v1)
+				print(v2)
+				print('Function Test 2:')
+				v,v = myFunc()
+				print(v)
+				print(v)
+				");			
+		}
+
+
+//		[Test]
+//		public void TestModulesLoadingWithoutCrash()
+//		{
+//#if !PCL
+//			var basePath = AppDomain.CurrentDomain.BaseDirectory;
+//			var scriptPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "scripts\\test");
+//			Script script = new Script();
+
+//			((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new[]
+//			{
+//				System.IO.Path.Combine(basePath, "scripts\\test\\test.lua"),
+//			};
+//			var obj = script.LoadFile(System.IO.Path.Combine(scriptPath, "test.lua"));
+//			obj.Function.Call();
+//#endif
+//		}
+
+	}
+}

+ 262 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/StringLibTests.cs

@@ -0,0 +1,262 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class StringLibTests
+	{
+		[Test]
+		public void String_GMatch_1()
+		{
+			string script = @"    
+				t = '';
+
+				for word in string.gmatch('Hello Lua user', '%a+') do 
+					t = t .. word;
+				end
+
+				return (t);
+				";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("HelloLuauser", res.String);
+		}
+
+		[Test]
+		public void String_Find_1()
+		{
+			string script = @"return string.find('Hello Lua user', 'Lua');";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, 7, 9);
+		}
+
+		[Test]
+		public void String_Find_2()
+		{
+			string script = @"return string.find('Hello Lua user', 'banana');";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, null);
+		}
+
+		[Test]
+		public void String_Find_3()
+		{
+			string script = @"return string.find('Hello Lua user', 'Lua', 1);";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, 7, 9);
+		}
+
+		[Test]
+		public void String_Find_4()
+		{
+			string script = @"return string.find('Hello Lua user', 'Lua', 8);";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, null);
+		}
+
+		[Test]
+		public void String_Find_5()
+		{
+			string script = @"return string.find('Hello Lua user', 'e', -5);";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, 13, 13);
+		}
+
+		[Test]
+		public void String_Find_6()
+		{
+			string script = @"return string.find('Hello Lua user', '%su');";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, 10, 11);
+		}
+
+		[Test]
+		public void String_Find_7()
+		{
+			string script = @"return string.find('Hello Lua user', '%su', 1);";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, 10, 11);
+		}
+
+		[Test]
+		public void String_Find_8()
+		{
+			string script = @"return string.find('Hello Lua user', '%su', 1, true);";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, null);
+		}
+		[Test]
+		public void String_Find_9()
+		{
+			string script = @"
+				s = 'Deadline is 30/05/1999, firm'
+				date = '%d%d/%d%d/%d%d%d%d';
+				return s:sub(s:find(date));
+			";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, "30/05/1999");
+		}
+
+		[Test]
+		public void String_Find_10()
+		{
+			string script = @"
+				s = 'Deadline is 30/05/1999, firm'
+				date = '%f[%S]%d%d/%d%d/%d%d%d%d';
+				return s:sub(s:find(date));
+			";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, "30/05/1999");
+		}
+
+		[Test]
+		public void String_Find_11()
+		{
+			string script = @"
+				s = 'Deadline is 30/05/1999, firm'
+				date = '%f[%s]%d%d/%d%d/%d%d%d%d';
+				return s:find(date);
+			";
+			DynValue res = Script.RunString(script);
+			Assert.IsTrue(res.IsNil());
+		}
+
+		[Test]
+		public void String_Format_1()
+		{
+			string script = @"
+				d = 5; m = 11; y = 1990
+				return string.format('%02d/%02d/%04d', d, m, y)
+			";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, "05/11/1990");
+		}
+
+		[Test]
+		public void String_GSub_1()
+		{
+			string script = @"
+				s = string.gsub('hello world', '(%w+)', '%1 %1')
+				return s, s == 'hello hello world world'
+			";
+			DynValue res = Script.RunString(script);
+			Assert.AreEqual(res.Tuple[0].String, "hello hello world world");
+			Assert.AreEqual(res.Tuple[1].Boolean, true);
+		}
+
+		[Test]
+		public void PrintTest1()
+		{
+			string script = @"
+				print('ciao', 1);
+			";
+			string printed = null;
+
+			Script S = new Script();
+			DynValue main = S.LoadString(script);
+
+			S.Options.DebugPrint = s =>
+			{
+				printed = s;
+			};
+
+			S.Call(main);
+
+			Assert.AreEqual("ciao\t1", printed);
+		}
+
+		[Test]
+		public void PrintTest2()
+		{
+			string script = @"
+				t = {};
+				m = {};
+
+				function m.__tostring()
+					return 'ciao';
+				end
+
+				setmetatable(t, m);
+
+				print(t, 1);
+			";
+			string printed = null;
+
+			Script S = new Script();
+			DynValue main = S.LoadString(script);
+
+			S.Options.DebugPrint = s =>
+			{
+				printed = s;
+			};
+
+			S.Call(main);
+
+			Assert.AreEqual("ciao\t1", printed);
+		}
+
+		[Test]
+		public void ToStringTest()
+		{
+			string script = @"
+				t = {}
+				mt = {}
+				a = nil
+				function mt.__tostring () a = 'yup' end
+				setmetatable(t, mt)
+				return tostring(t), a;
+			";
+			DynValue res = Script.RunString(script);
+			Utils.DynAssert(res, DataType.Void, "yup");
+		}
+
+		[Test]
+		[ExpectedException(typeof(ScriptRuntimeException))]
+		public void String_GSub_2()
+		{
+			string script = @"
+				string.gsub('hello world', '%w+', '%e')
+			";
+			DynValue res = Script.RunString(script);
+		}
+
+		[Test]
+		public void String_GSub_3()
+		{
+			Script S = new Script();
+			S.Globals["a"] = @"                  'C:\temp\test.lua:68: bad argument #1 to 'date' (invalid conversion specifier '%Ja')'
+    doesn't match '^[^:]+:%d+: bad argument #1 to 'date' %(invalid conversion specifier '%%Ja'%)'";
+
+			string script = @"
+				string.gsub(a, '\n', '\n #')
+			";
+			DynValue res = S.DoString(script);
+		}
+
+		[Test]
+		public void String_Match_1()
+		{
+			string s = @"test.lua:185: field 'day' missing in date table";
+			string p = @"^[^:]+:%d+: field 'day' missing in date table";
+
+			TestMatch(s, p, true);
+		}
+
+		private void TestMatch(string s, string p, bool expected)
+		{
+			Script S = new Script(CoreModules.String);
+			S.Globals["s"] = s;
+			S.Globals["p"] = p;
+			DynValue res = S.DoString("return string.match(s, p)");
+
+			Assert.AreEqual(expected, !res.IsNil());
+		}
+
+	}
+}

+ 114 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/StructAssignmentTechnique.cs

@@ -0,0 +1,114 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter.Interop.BasicDescriptors;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class StructAssignmentTechnique
+	{
+		public struct Vector3
+		{
+			public float X;
+			public float Y;
+			public float Z;
+		}
+
+
+		public class Transform
+		{
+			public Vector3 position;
+		}
+
+		public class Vector3_Accessor 
+		{
+			Transform transf;
+
+			public Vector3_Accessor(Transform t)
+			{
+				transf = t;
+			}
+
+			public float X
+			{
+				get { return transf.position.X; }
+				set { transf.position.X = value; }
+			}
+
+			public float Y
+			{
+				get { return transf.position.Y; }
+				set { transf.position.Y = value; }
+			}
+
+			public float Z
+			{
+				get { return transf.position.Z; }
+				set { transf.position.Z = value; }
+			}
+		}
+
+		//[Test]
+		//public void StructField_CanSetWithWorkaround()
+		//{
+		//	UserData.RegisterType<Vector3>();
+		//	UserData.RegisterType<Vector3_Accessor>();
+
+		//	DispatchingUserDataDescriptor descr = (DispatchingUserDataDescriptor)UserData.RegisterType<Transform>();
+
+		//	descr.AddMember("Position", new 
+
+
+		//	Script S = new Script();
+
+		//	Transform T = new Transform();
+
+		//	T.position.X = 3;
+
+		//	S.Globals["transform"] = T;
+
+		//	S.DoString("transform.position.X = 15;");
+
+		//	Assert.AreEqual(3, T.position.X);
+		//	UserData.UnregisterType<Transform>();
+		//	UserData.UnregisterType<Vector3>();
+		//	UserData.UnregisterType<Vector3_Accessor>();
+		//}
+
+
+
+
+		[Test]
+		public void StructField_CantSet()
+		{
+			UserData.RegisterType<Transform>();
+			UserData.RegisterType<Vector3>();
+
+			Script S = new Script();
+
+			Transform T = new Transform();
+
+			T.position.X = 3;
+
+			S.Globals["transform"] = T;
+
+			S.DoString("transform.position.X = 15;");
+
+			Assert.AreEqual(3, (int)T.position.X);
+			UserData.UnregisterType<Transform>();
+			UserData.UnregisterType<Vector3>();
+		}
+
+
+
+
+
+
+
+
+
+	}
+}

+ 567 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/TableTests.cs

@@ -0,0 +1,567 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+using MoonSharp.Interpreter.Execution;
+using NUnit.Framework;
+using MoonSharp.Interpreter.CoreLib;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class TableTests
+	{
+		[Test]
+		public void TableAccessAndEmptyCtor()
+		{
+			string script = @"
+						a = { }
+						
+						a[1] = 1;
+
+						return a[1]";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1, res.Number);
+		}
+
+
+
+		[Test]
+		public void TableAccessAndCtor()
+		{
+			string script = @"
+						a = { 55, 2, 3, aurevoir=6, [false] = 7 }
+						
+						a[1] = 1;
+						a.ciao = 4;
+						a['hello'] = 5;
+
+						return a[1], a[2], a[3], a['ciao'], a.hello, a.aurevoir, a[false]";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(7, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[2].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[3].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[4].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[5].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[6].Type);
+			Assert.AreEqual(1, res.Tuple[0].Number);
+			Assert.AreEqual(2, res.Tuple[1].Number);
+			Assert.AreEqual(3, res.Tuple[2].Number);
+			Assert.AreEqual(4, res.Tuple[3].Number);
+			Assert.AreEqual(5, res.Tuple[4].Number);
+			Assert.AreEqual(6, res.Tuple[5].Number);
+			Assert.AreEqual(7, res.Tuple[6].Number);
+		}
+
+		[Test]
+		public void TableMethod1()
+		{
+			string script = @"
+						x = 0
+	
+						a = 
+						{ 
+							value = 1912,
+
+							val = function(self, num)
+								x = self.value + num
+							end
+						}
+						
+						a.val(a, 82);
+
+						return x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1994, res.Number);
+		}
+
+		[Test]
+		public void TableMethod2()
+		{
+			string script = @"
+						x = 0
+	
+						a = 
+						{ 
+							value = 1912,
+
+							val = function(self, num)
+								x = self.value + num
+							end
+						}
+						
+						a:val(82);
+
+						return x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1994, res.Number);
+		}
+
+		[Test]
+		public void TableMethod3()
+		{
+			string script = @"
+						x = 0
+	
+						a = 
+						{ 
+							value = 1912,
+						}
+
+						function a.val(self, num)
+							x = self.value + num
+						end
+						
+						a:val(82);
+
+						return x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1994, res.Number);
+		}
+
+
+		[Test]
+		public void TableMethod4()
+		{
+			string script = @"
+						x = 0
+	
+						local a = 
+						{ 
+							value = 1912,
+						}
+
+						function a:val(num)
+							x = self.value + num
+						end
+						
+						a:val(82);
+
+						return x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1994, res.Number);
+		}
+
+		[Test]
+		public void TableMethod5()
+		{
+			string script = @"
+						x = 0
+
+						a = 
+						{ 
+							value = 1912,
+						}
+
+						b = { tb = a };
+						c = { tb = b };
+
+						function c.tb.tb:val(num)
+							x = self.value + num
+						end
+						
+						a:val(82);
+
+						return x";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(1994, res.Number);
+		}
+
+		
+		[Test]
+		public void TableMethod6()
+		{
+			string script = @"
+						do
+						  local a = {x=0}
+						  function a:add (x) self.x, a.y = self.x+x, 20; return self end
+						  return (a:add(10):add(20):add(30).x == 60 and a.y == 20)
+						end";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Boolean, res.Type);
+			Assert.AreEqual(true, res.CastToBool());
+		}
+
+		[Test]
+		public void TableNextWithChangeInCollection()
+		{
+			string script = @"
+				x = { }
+
+				function copy(k, v)
+					x[k] = v;
+				end
+
+
+				t = 
+				{
+					a = 1,
+					b = 2,
+					c = 3,
+					d = 4,
+					e = 5
+				}
+
+				k,v = next(t, nil);
+				copy(k, v);
+
+				k,v = next(t, k);
+				copy(k, v);
+				v = nil;
+
+				k,v = next(t, k);
+				copy(k, v);
+
+				k,v = next(t, k);
+				copy(k, v);
+
+				k,v = next(t, k);
+				copy(k, v);
+
+				s = x.a .. '|' .. x.b .. '|' .. x.c .. '|' .. x.d .. '|' .. x.e
+
+				return s;";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("1|2|3|4|5", res.String);
+		}
+
+
+		[Test]
+		public void TablePairsWithoutMetatable()
+		{
+			string script = @"
+				V = 0
+				K = ''
+
+				t = 
+				{
+					a = 1,
+					b = 2,
+					c = 3,
+					d = 4,
+					e = 5
+				}
+
+				for k, v in pairs(t) do
+					K = K .. k;
+					V = V + v;
+				end
+
+				return K, V;";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(DataType.String, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(5, res.Tuple[0].String.Length);
+			Assert.AreEqual(15, res.Tuple[1].Number);
+		}
+
+		[Test]
+		public void TableIPairsWithoutMetatable()
+		{
+			string script = @"    
+				x = 0
+				y = 0
+
+				t = { 2, 4, 6, 8, 10, 12 };
+
+				for i,j in ipairs(t) do
+					x = x + i
+					y = y + j
+
+					if (i >= 3) then
+						break
+					end
+				end
+    
+				return x, y";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.Number, res.Tuple[1].Type);
+			Assert.AreEqual(6, res.Tuple[0].Number);
+			Assert.AreEqual(12, res.Tuple[1].Number);
+		}
+
+		[Test]
+		public void TestLoadSyntaxError()
+		{
+			string script = @"    
+			function reader ()
+				i = i + 1
+				return t[i]
+			end
+
+
+			t = { [[?syntax error?]] }
+			i = 0
+			f, msg = load(reader, 'errorchunk')
+
+			return f, msg;
+		";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(DataType.Nil, res.Tuple[0].Type);
+			Assert.AreEqual(DataType.String, res.Tuple[1].Type);
+		}
+
+
+		[Test]
+		public void TableSimplifiedAccess1()
+		{
+			string script = @"    
+			t = {
+				ciao = 'hello'
+			}
+
+			return t;
+		";
+
+			Script s = new Script();
+			DynValue t = s.DoString(script);
+
+			Assert.AreEqual("hello", t.Table["ciao"]);
+		}
+
+		[Test]
+		public void TableSimplifiedAccess2()
+		{
+			string script = @"    
+			t = {
+				ciao = x
+			}
+
+			return t;
+		";
+
+			Script s = new Script();
+			s.Globals["x"] = "hello";
+			DynValue t = s.DoString(script);
+
+			Assert.AreEqual("hello", t.Table["ciao"]);
+		}
+
+		[Test]
+		public void TableSimplifiedAccess3()
+		{
+			string script = @"    
+			t = {
+			}
+
+			return t;
+		";
+
+			Script s = new Script();
+			DynValue t = s.DoString(script);
+
+			s.Globals["t", "ciao"] = "hello";
+
+			Assert.AreEqual("hello", t.Table["ciao"]);
+		}
+
+		[Test]
+		public void TableSimplifiedAccess4()
+		{
+			string script = @"    
+			t = {
+			}
+		";
+
+			Script s = new Script();
+			s.DoString(script);
+
+			s.Globals["t", "ciao"] = "hello";
+
+			Assert.AreEqual("hello", s.Globals["t", "ciao"]);
+		}
+
+
+		[Test]
+		public void TableSimplifiedAccess5()
+		{
+			string script = @"    
+			t = {
+				ciao = 'hello'
+			}
+		";
+
+			Script s = new Script();
+			s.DoString(script);
+
+			Assert.AreEqual("hello", s.Globals["t", "ciao"]);
+		}
+
+		[Test]
+		public void TableSimplifiedAccess6()
+		{
+			string script = @"    
+			t = {
+				ciao = 
+				{	'hello' }
+			}
+		";
+
+			Script s = new Script(CoreModules.None);
+			s.DoString(script);
+
+			Assert.AreEqual("hello", s.Globals["t", "ciao", 1]);
+		}
+
+
+		[Test]
+		public void TestNilRemovesEntryForPairs()
+		{
+			string script = @"
+				str = ''
+
+				function showTable(t)
+					for i, j in pairs(t) do
+						str = str .. i;
+					end
+					str = str .. '$'
+				end
+
+				tb = {}
+				tb['id'] = 3
+
+				showTable(tb)
+
+				tb['id'] = nil
+
+				showTable(tb)
+
+				return str
+			";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("id$$", res.String);
+		}
+
+		[Test]
+		public void TestUnpack()
+		{
+			string script = @"
+				return unpack({3,4})
+			";
+
+			DynValue res = Script.RunString(script);
+
+			Assert.AreEqual(DataType.Tuple, res.Type);
+			Assert.AreEqual(2, res.Tuple.Length);
+			Assert.AreEqual(3, res.Tuple[0].Number);
+			Assert.AreEqual(4, res.Tuple[1].Number);
+		}
+
+		[Test]
+		public void PrimeTable_1()
+		{
+			string script = @"    
+			t = ${
+				ciao = 'hello'
+			}
+		";
+
+			Script s = new Script();
+			s.DoString(script);
+
+			Assert.AreEqual("hello", s.Globals["t", "ciao"]);
+			Assert.IsTrue(s.Globals.Get("t").Table.OwnerScript == null);
+		}
+
+
+		[Test]
+		[ExpectedException(typeof(ScriptRuntimeException))]
+		public void PrimeTable_2()
+		{
+			string script = @"    
+			t = ${
+				ciao = function() end
+			}
+		";
+
+			Script s = new Script();
+			s.DoString(script);
+
+			Assert.Fail();
+		}
+
+
+		[Test]
+		public void Table_Length_Calculations()
+		{
+			Table T = new Table(null);
+
+			Assert.AreEqual(0, T.Length, "A");
+
+			T.Set(1, DynValue.True);
+
+			Assert.AreEqual(1, T.Length, "B");
+
+			T.Set(2, DynValue.True);
+			T.Set(3, DynValue.True);
+			T.Set(4, DynValue.True);
+
+			Assert.AreEqual(4, T.Length, "C");
+
+			T.Set(3, DynValue.Nil);
+
+			Assert.AreEqual(2, T.Length, "D");
+
+			T.Set(3, DynValue.True);
+
+			Assert.AreEqual(4, T.Length, "E");
+
+			T.Set(3, DynValue.Nil);
+
+			Assert.AreEqual(2, T.Length, "F");
+
+			T.Append(DynValue.True);
+
+			Assert.AreEqual(4, T.Length, "G");
+
+			T.Append(DynValue.True);
+
+			Assert.AreEqual(5, T.Length, "H");
+
+		}
+
+	}
+}

+ 127 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/TailCallTests.cs

@@ -0,0 +1,127 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter.Execution;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	[TestFixture]
+	public class TailCallTests
+	{
+		[Test]
+		public void TcoTest_Pre()
+		{
+			// this just verifies the algorithm for TcoTest_Big
+			string script = @"
+				function recsum(num, partial)
+					if (num == 0) then
+						return partial
+					else
+						return recsum(num - 1, partial + num)
+					end
+				end
+				
+				return recsum(10, 0)";
+
+
+			Script S = new Script();
+			var res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(55, res.Number);
+		}
+
+		[Test]
+		public void TcoTest_Big()
+		{
+			// calc the sum of the first N numbers in the most stupid way ever to waste stack and trigger TCO..
+			// (this could be a simple X*(X+1) / 2... )
+			string script = @"
+				function recsum(num, partial)
+					if (num == 0) then
+						return partial
+					else
+						return recsum(num - 1, partial + num)
+					end
+				end
+				
+				return recsum(70000, 0)";
+
+
+			Script S = new Script();
+			var res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(2450035000.0, res.Number);
+		}
+
+
+		[Test]
+		public void TailCallFromCLR()
+		{
+			string script = @"
+				function getResult(x)
+					return 156*x;  
+				end
+
+				return clrtail(9)";
+
+
+			Script S = new Script();
+
+			S.Globals.Set("clrtail", DynValue.NewCallback((xc, a) =>
+			{
+				DynValue fn = S.Globals.Get("getResult");
+				DynValue k3 = DynValue.NewNumber(a[0].Number / 3);
+
+				return DynValue.NewTailCallReq(fn, k3);
+			}));
+
+			var res = S.DoString(script);
+
+			Assert.AreEqual(DataType.Number, res.Type);
+			Assert.AreEqual(468, res.Number);
+		}
+
+
+		[Test]
+		public void CheckToString()
+		{
+			string script = @"
+				return tostring(9)";
+
+
+			Script S = new Script(CoreModules.Basic);
+			var res = S.DoString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("9", res.String);
+		}
+
+		[Test]
+		public void CheckToStringMeta()
+		{
+			string script = @"
+				t = {}
+				m = {
+					__tostring = function(v)
+						return 'ciao';
+					end
+				}
+
+				setmetatable(t, m);
+				s = tostring(t);
+
+				return (s);";
+
+
+			Script S = new Script();
+			var res = S.DoString(script);
+
+			Assert.AreEqual(DataType.String, res.Type);
+			Assert.AreEqual("ciao", res.String);
+		}
+	}
+}

+ 189 - 0
src/Unity/MoonSharp/Assets/Tests/EndToEnd/UserDataEnumsTest.cs

@@ -0,0 +1,189 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace MoonSharp.Interpreter.Tests.EndToEnd
+{
+	public enum MyEnum : short
+	{
+		Uno = 1,
+		MenoUno = -1,
+		Quattro = 4,
+		Cinque = 5,
+		TantaRoba = short.MaxValue,
+		PocaRoba = short.MinValue,
+	}
+
+	[Flags]
+	public enum MyFlags : ushort
+	{
+		Uno = 1,
+		Due = 2,
+		Quattro = 4,
+		Cinque = 5,
+		Otto = 8
+	}
+
+
+	[TestFixture]
+	public class UserDataEnumsTests
+	{
+		public class EnumOverloadsTestClass
+		{
+			public string MyMethod(MyEnum enm)
+			{
+				return "[" + enm.ToString() + "]";
+			}
+
+			public string MyMethod(MyFlags enm)
+			{
+				return ((long)enm).ToString();
+			}
+
+			public string MyMethod2(MyEnum enm)
+			{
+				return "(" + enm.ToString() + ")";
+			}
+
+			public string MyMethodB(bool b)
+			{
+				return b ? "T" : "F";
+			}
+
+			public MyEnum Get()
+			{
+				return MyEnum.Quattro;
+			}
+
+			public MyFlags GetF()
+			{
+				return MyFlags.Quattro;
+			}
+		}
+
+
+		private void RunTestOverload(string code, string expected)
+		{
+			Script S = new Script();
+
+			EnumOverloadsTestClass obj = new EnumOverloadsTestClass();
+
+			UserData.RegisterType<EnumOverloadsTestClass>(InteropAccessMode.Reflection);
+
+			UserData.RegisterType<MyEnum>();
+			UserData.RegisterType<MyFlags>();
+
+			S.Globals.Set("MyEnum", UserData.CreateStatic<MyEnum>());
+//			S.Globals.Set("MyFlags", UserData.CreateStatic<MyFlags>());
+			S.Globals["MyFlags"] = typeof(MyFlags);
+
+			S.Globals.Set("o", UserData.Create(obj));
+
+			DynValue v = S.DoString("return " + code);
+
+			Assert.AreEqual(DataType.String, v.Type);
+			Assert.AreEqual(expected, v.String);
+		}
+
+
+		[Test]
+		public void Interop_Enum_Simple()
+		{
+			RunTestOverload("o:MyMethod2(MyEnum.Cinque)", "(Cinque)");
+		}
+
+		[Test]
+		public void Interop_Enum_Simple2()
+		{
+			RunTestOverload("o:MyMethod2(MyEnum.cinque)", "(Cinque)");
+		}
+
+		[Test]
+		public void Interop_Enum_Overload1()
+		{
+			RunTestOverload("o:MyMethod(MyFlags.flagsOr(MyFlags.Uno, MyFlags.Due))", "3");
+			RunTestOverload("o:MyMethod(MyEnum.Cinque)", "[Cinque]");
+		}
+
+		[Test]
+		public void Interop_Enum_NumberConversion()
+		{
+			RunTestOverload("o:MyMethod2(5)", "(Cinque)");
+		}
+
+
+		[Test]
+		public void Interop_Enum_Flags_Or()
+		{
+			RunTestOverload("o:MyMethod(MyFlags.flagsOr(MyFlags.Uno, MyFlags.Due))", "3");
+		}
+
+		[Test]
+		public void Interop_Enum_Flags_And()
+		{
+			RunTestOverload("o:MyMethod(MyFlags.flagsAnd(MyFlags.Uno, MyFlags.Cinque))", "1");
+		}
+
+		[Test]
+		public void Interop_Enum_Flags_Xor()
+		{
+			RunTestOverload("o:MyMethod(MyFlags.flagsXor(MyFlags.Uno, MyFlags.Cinque))", "4");
+		}
+
+		[Test]
+		public void Interop_Enum_Flags_Not()
+		{
+			RunTestOverload("o:MyMethod(MyFlags.flagsAnd(MyFlags.Cinque, MyFlags.flagsNot(MyFlags.Uno)))", "4");
+		}
+
+		[Test]
+		public void Interop_Enum_Flags_Or2()
+		{
+			RunTestOverload("o:MyMethod(MyFlags.flagsOr(MyFlags.Uno, 2))", "3");
+		}
+
+		[Test]
+		public void Interop_Enum_Flags_Or3()
+		{
+			RunTestOverload("o:MyMethod(MyFlags.flagsOr(1, MyFlags.Due))", "3");
+		}
+
+		[Test]
+		public void Interop_Enum_Flags_Or_Meta()
+		{
+			RunTestOverload("o:MyMethod(MyFlags.Uno .. MyFlags.Due)", "3");
+		}
+
+
+		[Test]
+		public void Interop_Enum_Flags_HasAll()
+		{
+			RunTestOverload("o:MyMethodB(MyFlags.hasAll(MyFlags.Uno, MyFlags.Cinque))", "F");
+			RunTestOverload("o:MyMethodB(MyFlags.hasAll(MyFlags.Cinque, MyFlags.Uno))", "T");
+		}
+
+		[Test]
+		public void Interop_Enum_Flags_HasAny()
+		{
+			RunTestOverload("o:MyMethodB(MyFlags.hasAny(MyFlags.Uno, MyFlags.Cinque))", "T");
+			RunTestOverload("o:MyMethodB(MyFlags.hasAny(MyFlags.Cinque, MyFlags.Uno))", "T");
+			RunTestOverload("o:MyMethodB(MyFlags.hasAny(MyFlags.Quattro, MyFlags.Uno))", "F");
+		}
+
+		[Test]
+		public void Interop_Enum_Read()
+		{
+			RunTestOverload("o:MyMethod(o:get())", "[Quattro]");
+		}
+
+		[Test]
+		public void Interop_Enum_Flags_Or_Meta_Read()
+		{
+			RunTestOverload("o:MyMethod(o:getF() .. MyFlags.Due)", "6");
+		}
+
+
+	}
+}

Some files were not shown because too many files changed in this diff