浏览代码

A lot of XML help added

Xanathar 10 年之前
父节点
当前提交
15ee5ec616
共有 69 个文件被更改,包括 492 次插入145 次删除
  1. 3 0
      src/MoonSharp.Interpreter/CoreLib/BasicModule.cs
  2. 4 1
      src/MoonSharp.Interpreter/CoreLib/Bit32Module.cs
  3. 3 0
      src/MoonSharp.Interpreter/CoreLib/CoroutineModule.cs
  4. 3 0
      src/MoonSharp.Interpreter/CoreLib/DebugModule.cs
  5. 3 0
      src/MoonSharp.Interpreter/CoreLib/DynamicModule.cs
  6. 3 0
      src/MoonSharp.Interpreter/CoreLib/ErrorHandlingModule.cs
  7. 3 0
      src/MoonSharp.Interpreter/CoreLib/IO/FileUserData.cs
  8. 3 0
      src/MoonSharp.Interpreter/CoreLib/IO/FileUserDataBase.cs
  9. 3 0
      src/MoonSharp.Interpreter/CoreLib/IO/StandardIOFileUserDataBase.cs
  10. 3 0
      src/MoonSharp.Interpreter/CoreLib/IO/StreamFileUserDataBase.cs
  11. 3 0
      src/MoonSharp.Interpreter/CoreLib/IoModule.cs
  12. 3 0
      src/MoonSharp.Interpreter/CoreLib/LoadModule.cs
  13. 4 1
      src/MoonSharp.Interpreter/CoreLib/MathModule.cs
  14. 3 0
      src/MoonSharp.Interpreter/CoreLib/MetaTableModule.cs
  15. 4 0
      src/MoonSharp.Interpreter/CoreLib/OsSystemModule.cs
  16. 3 0
      src/MoonSharp.Interpreter/CoreLib/OsTimeModule.cs
  17. 4 1
      src/MoonSharp.Interpreter/CoreLib/StringModule.cs
  18. 3 0
      src/MoonSharp.Interpreter/CoreLib/TableIteratorsModule.cs
  19. 3 0
      src/MoonSharp.Interpreter/CoreLib/TableModule.cs
  20. 5 1
      src/MoonSharp.Interpreter/DataStructs/FastStack.cs
  21. 5 1
      src/MoonSharp.Interpreter/DataStructs/FastStackDynamic.cs
  22. 0 13
      src/MoonSharp.Interpreter/DataStructs/ITrackableReference.cs
  23. 1 1
      src/MoonSharp.Interpreter/DataStructs/LinkedListIndex.cs
  24. 6 1
      src/MoonSharp.Interpreter/DataStructs/MultiDictionary.cs
  25. 1 1
      src/MoonSharp.Interpreter/DataStructs/Slice.cs
  26. 4 1
      src/MoonSharp.Interpreter/DataTypes/CallbackFunction.cs
  27. 40 1
      src/MoonSharp.Interpreter/DataTypes/Coroutine.cs
  28. 35 0
      src/MoonSharp.Interpreter/DataTypes/CoroutineState.cs
  29. 1 1
      src/MoonSharp.Interpreter/DataTypes/DynValue.cs
  30. 17 0
      src/MoonSharp.Interpreter/DataTypes/RefIdObject.cs
  31. 11 0
      src/MoonSharp.Interpreter/DataTypes/ScriptFunctionDelegate.cs
  32. 35 2
      src/MoonSharp.Interpreter/DataTypes/SymbolRef.cs
  33. 15 0
      src/MoonSharp.Interpreter/DataTypes/SymbolRefType.cs
  34. 19 5
      src/MoonSharp.Interpreter/DataTypes/Table.cs
  35. 19 0
      src/MoonSharp.Interpreter/DataTypes/TailCallData.cs
  36. 77 3
      src/MoonSharp.Interpreter/DataTypes/UserData.cs
  37. 6 0
      src/MoonSharp.Interpreter/DataTypes/YieldRequest.cs
  38. 3 0
      src/MoonSharp.Interpreter/Errors/DynamicExpressionException.cs
  39. 3 0
      src/MoonSharp.Interpreter/Errors/InternalErrorException.cs
  40. 12 0
      src/MoonSharp.Interpreter/Errors/InterpreterException.cs
  41. 7 0
      src/MoonSharp.Interpreter/Errors/ScriptRuntimeException.cs
  42. 3 0
      src/MoonSharp.Interpreter/Errors/SyntaxErrorException.cs
  43. 33 0
      src/MoonSharp.Interpreter/Execution/DynamicExpression.cs
  44. 0 26
      src/MoonSharp.Interpreter/Execution/FileLoadRequestedEventArgs.cs
  45. 0 13
      src/MoonSharp.Interpreter/Execution/Scopes/BuildTimeLabelTracker.cs
  46. 1 1
      src/MoonSharp.Interpreter/Execution/Scopes/BuildTimeScope.cs
  47. 22 0
      src/MoonSharp.Interpreter/Execution/Scopes/ClosureContext.cs
  48. 1 1
      src/MoonSharp.Interpreter/Execution/Scopes/IClosureBuilder.cs
  49. 1 1
      src/MoonSharp.Interpreter/Execution/Scopes/LoopTracker.cs
  50. 1 1
      src/MoonSharp.Interpreter/Execution/Scopes/RuntimeScopeBlock.cs
  51. 1 1
      src/MoonSharp.Interpreter/Execution/Scopes/RuntimeScopeFrame.cs
  52. 1 8
      src/MoonSharp.Interpreter/Execution/VM/ByteCode.cs
  53. 1 1
      src/MoonSharp.Interpreter/Execution/VM/CallStackItem.cs
  54. 1 1
      src/MoonSharp.Interpreter/Execution/VM/CallStackItemFlags.cs
  55. 0 17
      src/MoonSharp.Interpreter/Execution/VM/CoroutineState.cs
  56. 4 1
      src/MoonSharp.Interpreter/IO/BinDumpBinaryReader.cs
  57. 4 1
      src/MoonSharp.Interpreter/IO/BinDumpBinaryWriter.cs
  58. 1 1
      src/MoonSharp.Interpreter/IO/UndisposableStream.cs
  59. 4 7
      src/MoonSharp.Interpreter/MoonSharp.Interpreter.net35-client.csproj
  60. 0 0
      src/MoonSharp.Interpreter/Platforms/PortableWrappers/Attributes.cs
  61. 0 0
      src/MoonSharp.Interpreter/Platforms/PortableWrappers/ExtensionMethods.cs
  62. 0 0
      src/MoonSharp.Interpreter/Platforms/PortableWrappers/Stopwatch.cs
  63. 12 0
      src/MoonSharp.Interpreter/Platforms/StandardFileType.cs
  64. 1 1
      src/MoonSharp.Interpreter/Platforms/StandardPlatformAccessor.cs
  65. 4 13
      src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.net40-client/MoonSharp.Interpreter.net40-client.csproj
  66. 4 13
      src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.portable40/MoonSharp.Interpreter.portable40.csproj
  67. 3 0
      src/MoonSharp/Program.cs
  68. 二进制
      src/Unity/UnityTestBed/ProjectSettings/ProjectSettings.asset
  69. 6 3
      src/Unity/UnityTestBed/UnityVS.UnityTestBed.CSharp.csproj

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/BasicModule.cs

@@ -7,6 +7,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing basic Lua functions (print, type, tostring, etc) as a MoonSharp module.
+	/// </summary>
 	[MoonSharpModule]
 	public class BasicModule
 	{

+ 4 - 1
src/MoonSharp.Interpreter/CoreLib/Bit32Module.cs

@@ -6,7 +6,10 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
-	[MoonSharpModule(Namespace="bit32")]
+	/// <summary>
+	/// Class implementing bit32 Lua functions 
+	/// </summary>
+	[MoonSharpModule(Namespace = "bit32")]
 	public class Bit32Module
 	{
 		static readonly uint[] BITS = new uint[] { 

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/CoroutineModule.cs

@@ -8,6 +8,9 @@ using MoonSharp.Interpreter.Execution.VM;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing coroutine Lua functions 
+	/// </summary>
 	[MoonSharpModule(Namespace = "coroutine")]
 	public class CoroutineModule
 	{

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/DebugModule.cs

@@ -7,6 +7,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing debug Lua functions. Support for the debug module is partial. 
+	/// </summary>
 	[MoonSharpModule(Namespace = "debug")]
 	public class DebugModule
 	{

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/DynamicModule.cs

@@ -6,6 +6,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing dynamic expression evaluations at runtime (a MoonSharp addition).
+	/// </summary>
 	[MoonSharpModule(Namespace = "dynamic")]
 	public class DynamicModule
 	{

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/ErrorHandlingModule.cs

@@ -7,6 +7,9 @@ using MoonSharp.Interpreter.Execution.VM;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing error handling Lua functions (pcall and xpcall)
+	/// </summary>
 	[MoonSharpModule]
 	public class ErrorHandlingModule
 	{

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/IO/FileUserData.cs

@@ -6,6 +6,9 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.CoreLib.IO
 {
+	/// <summary>
+	/// Abstract class implementing a file Lua userdata. Methods are meant to be called by Lua code.
+	/// </summary>
 	public class FileUserData : StreamFileUserDataBase
 	{
 		public FileUserData(Script script, string filename, Encoding encoding, string mode)

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/IO/FileUserDataBase.cs

@@ -6,6 +6,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib.IO
 {
+	/// <summary>
+	/// Abstract class implementing a file Lua userdata. Methods are meant to be called by Lua code.
+	/// </summary>
 	public abstract class FileUserDataBase : RefIdObject
 	{
 		public DynValue lines(ScriptExecutionContext executionContext, CallbackArguments args)

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/IO/StandardIOFileUserDataBase.cs

@@ -6,6 +6,9 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.CoreLib.IO
 {
+	/// <summary>
+	/// Abstract class implementing an unclosable file Lua userdata. Methods are meant to be called by Lua code.
+	/// </summary>
 	public class StandardIOFileUserDataBase : StreamFileUserDataBase
 	{
 		protected override string Close()

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/IO/StreamFileUserDataBase.cs

@@ -6,6 +6,9 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.CoreLib.IO
 {
+	/// <summary>
+	/// Abstract class implementing a file Lua userdata. Methods are meant to be called by Lua code.
+	/// </summary>
 	public abstract class StreamFileUserDataBase : FileUserDataBase
 	{
 		protected Stream m_Stream;

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/IoModule.cs

@@ -9,6 +9,9 @@ using MoonSharp.Interpreter.Platforms;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing io Lua functions. Proper support requires a compatible IPlatformAccessor
+	/// </summary>
 	[MoonSharpModule(Namespace = "io")]
 	public class IoModule
 	{

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/LoadModule.cs

@@ -6,6 +6,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing loading Lua functions like 'require', 'load', etc.
+	/// </summary>
 	[MoonSharpModule]
 	public class LoadModule
 	{

+ 4 - 1
src/MoonSharp.Interpreter/CoreLib/MathModule.cs

@@ -7,7 +7,10 @@ using MoonSharp.Interpreter.Interop;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
-	[MoonSharpModule(Namespace="math")]
+	/// <summary>
+	/// Class implementing math Lua functions 
+	/// </summary>
+	[MoonSharpModule(Namespace = "math")]
 	public class MathModule
 	{
 		[MoonSharpConstant]

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/MetaTableModule.cs

@@ -6,6 +6,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing metatable related Lua functions (xxxmetatable and rawxxx).
+	/// </summary>
 	[MoonSharpModule]
 	public class MetaTableModule
 	{

+ 4 - 0
src/MoonSharp.Interpreter/CoreLib/OsSystemModule.cs

@@ -8,6 +8,10 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing system related Lua functions from the 'os' module.
+	/// Proper support requires a compatible IPlatformAccessor
+	/// </summary>
 	[MoonSharpModule(Namespace = "os")]
 	public class OsSystemModule
 	{

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/OsTimeModule.cs

@@ -6,6 +6,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing time related Lua functions from the 'os' module.
+	/// </summary>
 	[MoonSharpModule(Namespace = "os")]
 	public class OsTimeModule
 	{

+ 4 - 1
src/MoonSharp.Interpreter/CoreLib/StringModule.cs

@@ -8,7 +8,10 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
-	[MoonSharpModule(Namespace="string")]
+	/// <summary>
+	/// Class implementing string Lua functions 
+	/// </summary>
+	[MoonSharpModule(Namespace = "string")]
 	public class StringModule
 	{
 		public const string BASE64_DUMP_HEADER = "MoonSharp_dump_b64::";

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/TableIteratorsModule.cs

@@ -6,6 +6,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing table Lua iterators (pairs, ipairs, next)
+	/// </summary>
 	[MoonSharpModule]
 	public class TableIteratorsModule
 	{

+ 3 - 0
src/MoonSharp.Interpreter/CoreLib/TableModule.cs

@@ -7,6 +7,9 @@ using MoonSharp.Interpreter.Execution;
 
 namespace MoonSharp.Interpreter.CoreLib
 {
+	/// <summary>
+	/// Class implementing table Lua functions 
+	/// </summary>
 	[MoonSharpModule(Namespace = "table")]
 	public class TableModule
 	{

+ 5 - 1
src/MoonSharp.Interpreter/DataStructs/FastStack.cs

@@ -7,7 +7,11 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.DataStructs
 {
-	public class FastStack<T> : IList<T>
+	/// <summary>
+	/// A preallocated, non-resizable, stack
+	/// </summary>
+	/// <typeparam name="T"></typeparam>
+	internal class FastStack<T> : IList<T>
 	{
 		T[] m_Storage;
 		int m_HeadIdx = 0;

+ 5 - 1
src/MoonSharp.Interpreter/DataStructs/FastStackDynamic.cs

@@ -9,7 +9,11 @@ namespace MoonSharp.Interpreter.DataStructs
 	public class FastStack<T> : FastStackDynamic<T>
 #endif
 
-	public class FastStackDynamic<T> : List<T>
+	/// <summary>
+	/// A non preallocated, non_fixed size stack
+	/// </summary>
+	/// <typeparam name="T"></typeparam>
+	internal class FastStackDynamic<T> : List<T>
 	{
 			public FastStackDynamic(int startingCapacity)
 			: base(startingCapacity)

+ 0 - 13
src/MoonSharp.Interpreter/DataStructs/ITrackableReference.cs

@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace MoonSharp.Interpreter.DataStructs
-{
-	public interface ITrackableReference
-	{
-		int ReferenceID { get; }
-
-	}
-}

+ 1 - 1
src/MoonSharp.Interpreter/DataStructs/LinkedListIndex.cs

@@ -12,7 +12,7 @@ namespace MoonSharp.Interpreter.DataStructs
 	/// </summary>
 	/// <typeparam name="TKey">The type of the key. Must implement Equals and GetHashCode appropriately.</typeparam>
 	/// <typeparam name="TValue">The type of the values contained in the linked list.</typeparam>
-	public class LinkedListIndex<TKey, TValue>
+	internal class LinkedListIndex<TKey, TValue>
 	{
 		LinkedList<TValue> m_LinkedList;
 		Dictionary<TKey, LinkedListNode<TValue>> m_Map = null;

+ 6 - 1
src/MoonSharp.Interpreter/DataStructs/MultiDictionary.cs

@@ -5,7 +5,12 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.DataStructs
 {
-	public class MultiDictionary<K, V>
+	/// <summary>
+	/// A Dictionary where multiple values can be associated to the same key
+	/// </summary>
+	/// <typeparam name="K"></typeparam>
+	/// <typeparam name="V"></typeparam>
+	internal class MultiDictionary<K, V>
 	{
 		Dictionary<K, List<V>> m_Map = new Dictionary<K, List<V>>();
 

+ 1 - 1
src/MoonSharp.Interpreter/DataStructs/Slice.cs

@@ -9,7 +9,7 @@ namespace MoonSharp.Interpreter.DataStructs
 	/// Provides facility to create a "sliced" view over an existing IList<typeparamref name="T"/>
 	/// </summary>
 	/// <typeparam name="T">The type of the items contained in the collection</typeparam>
-	public class Slice<T> : IEnumerable<T>, IList<T>
+	internal class Slice<T> : IEnumerable<T>, IList<T>
 	{
 		IList<T> m_SourceList;
 		int m_From, m_Length;

+ 4 - 1
src/MoonSharp.Interpreter/DataTypes/CallbackFunction.cs

@@ -8,13 +8,16 @@ using MoonSharp.Interpreter.Interop;
 namespace MoonSharp.Interpreter
 {
 	/// <summary>
-	/// This class wraps 
+	/// This class wraps a CLR function 
 	/// </summary>
 	public sealed class CallbackFunction : RefIdObject
 	{
 		Func<ScriptExecutionContext, CallbackArguments, DynValue> m_CallBack;
 		private static InteropAccessMode m_DefaultAccessMode = InteropAccessMode.LazyOptimized;
 
+		/// <summary>
+		/// Gets the name of the function
+		/// </summary>
 		public string Name { get; private set; }
 
 		/// <summary>

+ 40 - 1
src/MoonSharp.Interpreter/DataTypes/Coroutine.cs

@@ -8,15 +8,33 @@ using MoonSharp.Interpreter.Execution.VM;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// A class representing a script coroutine
+	/// </summary>
 	public class Coroutine : RefIdObject
 	{
+		/// <summary>
+		/// Possible types of coroutine
+		/// </summary>
 		public enum CoroutineType
 		{
+			/// <summary>
+			/// A valid coroutine
+			/// </summary>
 			Coroutine,
+			/// <summary>
+			/// A CLR callback assigned to a coroutine. 
+			/// </summary>
 			ClrCallback,
+			/// <summary>
+			/// A CLR callback assigned to a coroutine and already executed.
+			/// </summary>
 			ClrCallbackDead
 		}
 
+		/// <summary>
+		/// Gets the type of coroutine
+		/// </summary>
 		public  CoroutineType Type { get; private set; }
 
 		private CallbackFunction m_ClrCallback;
@@ -44,7 +62,13 @@ namespace MoonSharp.Interpreter
 			Type = CoroutineType.ClrCallbackDead;
 		}
 
-	
+
+		/// <summary>
+		/// Resumes the coroutine
+		/// </summary>
+		/// <param name="args">The arguments.</param>
+		/// <returns></returns>
+		/// <exception cref="System.InvalidOperationException">Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead</exception>
 		public DynValue Resume(params DynValue[] args)
 		{
 			if (Type == CoroutineType.Coroutine)
@@ -54,6 +78,12 @@ namespace MoonSharp.Interpreter
 		}
 
 
+		/// <summary>
+		/// Resumes the coroutine
+		/// </summary>
+		/// <param name="context">The ScriptExecutionContext.</param>
+		/// <param name="args">The arguments.</param>
+		/// <returns></returns>
 		public DynValue Resume(ScriptExecutionContext context, params DynValue[] args)
 		{
 			if (Type == CoroutineType.Coroutine)
@@ -68,6 +98,9 @@ namespace MoonSharp.Interpreter
 				throw ScriptRuntimeException.CannotResumeNotSuspended(CoroutineState.Dead);
 		}
 
+		/// <summary>
+		/// Gets the coroutine state.
+		/// </summary>
 		public CoroutineState State
 		{
 			get
@@ -81,6 +114,12 @@ namespace MoonSharp.Interpreter
 			}
 		}
 
+		/// <summary>
+		/// Gets the coroutine stack trace for debug purposes
+		/// </summary>
+		/// <param name="skip">The skip.</param>
+		/// <param name="entrySourceRef">The entry source reference.</param>
+		/// <returns></returns>
 		public WatchItem[] GetStackTrace(int skip, SourceRef entrySourceRef = null)
 		{
 			if (this.State != CoroutineState.Running)

+ 35 - 0
src/MoonSharp.Interpreter/DataTypes/CoroutineState.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MoonSharp.Interpreter.DataStructs;
+
+namespace MoonSharp.Interpreter
+{
+	/// <summary>
+	/// State of coroutines
+	/// </summary>
+	public enum CoroutineState
+	{
+		/// <summary>
+		/// This is the main coroutine
+		/// </summary>
+		Main,
+		/// <summary>
+		/// Coroutine has not started yet
+		/// </summary>
+		NotStarted,
+		/// <summary>
+		/// Coroutine is suspended
+		/// </summary>
+		Suspended,
+		/// <summary>
+		/// Coroutine is running
+		/// </summary>
+		Running,
+		/// <summary>
+		/// Coroutine has terminated
+		/// </summary>
+		Dead
+	}
+}

+ 1 - 1
src/MoonSharp.Interpreter/DataTypes/DynValue.cs

@@ -27,7 +27,7 @@ namespace MoonSharp.Interpreter
 
 
 		/// <summary>
-		/// Gets a unique reference identifier. This is guaranteed to be unique only in a single Script object as it's not thread-safe.
+		/// Gets a unique reference identifier. This is guaranteed to be unique only for dynvalues created in a single thread as it's not thread-safe.
 		/// </summary>
 		public int ReferenceID { get { return m_RefID; } }
 

+ 17 - 0
src/MoonSharp.Interpreter/DataTypes/RefIdObject.cs

@@ -5,14 +5,31 @@ using System.Text;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// A base class for many MoonSharp objects. 
+	/// Helds a ReferenceID property which gets a different value for every object instance, for debugging
+	/// purposes. Note that the ID is not assigned in a thread safe manner for speed reason, so the IDs
+	/// are guaranteed to be unique only if everything is running on one thread at a time.
+	/// </summary>
 	public class RefIdObject
 	{
 		private static int s_RefIDCounter = 0;
 		private int m_RefID = ++s_RefIDCounter;
 
+		/// <summary>
+		/// Gets the reference identifier.
+		/// </summary>
+		/// <value>
+		/// The reference identifier.
+		/// </value>
 		public int ReferenceID { get { return m_RefID; } }
 
 
+		/// <summary>
+		/// Formats a string with a type name and a ref-id
+		/// </summary>
+		/// <param name="typeString">The type name.</param>
+		/// <returns></returns>
 		public string FormatTypeString(string typeString)
 		{
 			return string.Format("{0}: {1:X8}", typeString, m_RefID);

+ 11 - 0
src/MoonSharp.Interpreter/DataTypes/ScriptFunctionDelegate.cs

@@ -5,6 +5,17 @@ using System.Text;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// A Delegate type which can wrap a script function
+	/// </summary>
+	/// <param name="args">The arguments.</param>
+	/// <returns>The return value of the script function</returns>
 	public delegate object ScriptFunctionDelegate(params object[] args);
+	/// <summary>
+	/// A Delegate type which can wrap a script function with a generic typed return value
+	/// </summary>
+	/// <typeparam name="T"></typeparam>
+	/// <param name="args">The arguments.</param>
+	/// <returns>The return value of the script function</returns>
 	public delegate T ScriptFunctionDelegate<T>(params object[] args);
 }

+ 35 - 2
src/MoonSharp.Interpreter/DataTypes/SymbolRef.cs

@@ -27,25 +27,52 @@ namespace MoonSharp.Interpreter
 		public SymbolRef Environment { get { return i_Env; } }
 
 
+		/// <summary>
+		/// Gets the default _ENV.
+		/// </summary>
 		public static SymbolRef DefaultEnv { get { return s_DefaultEnv; } }
 
+		/// <summary>
+		/// Creates a new symbol reference pointing to a global var
+		/// </summary>
+		/// <param name="name">The name.</param>
+		/// <param name="envSymbol">The _ENV symbol.</param>
+		/// <returns></returns>
 		public static SymbolRef Global(string name, SymbolRef envSymbol)
 		{
 			return new SymbolRef() { i_Index = -1, i_Type = SymbolRefType.Global, i_Env = envSymbol, i_Name = name };
 		}
 
-		public static SymbolRef Local(string name, int index)
+		/// <summary>
+		/// Creates a new symbol reference pointing to a local var
+		/// </summary>
+		/// <param name="name">The name.</param>
+		/// <param name="index">The index of the var in local scope.</param>
+		/// <returns></returns>
+		internal static SymbolRef Local(string name, int index)
 		{
 			//Debug.Assert(index >= 0, "Symbol Index < 0");
 			return new SymbolRef() { i_Index = index, i_Type = SymbolRefType.Local, i_Name = name };
 		}
 
-		public static SymbolRef Upvalue(string name, int index)
+		/// <summary>
+		/// Creates a new symbol reference pointing to an upvalue var
+		/// </summary>
+		/// <param name="name">The name.</param>
+		/// <param name="index">The index of the var in closure scope.</param>
+		/// <returns></returns>
+		internal static SymbolRef Upvalue(string name, int index)
 		{
 			//Debug.Assert(index >= 0, "Symbol Index < 0");
 			return new SymbolRef() { i_Index = index, i_Type = SymbolRefType.Upvalue, i_Name = name };
 		}
 
+		/// <summary>
+		/// Returns a <see cref="System.String" /> that represents this instance.
+		/// </summary>
+		/// <returns>
+		/// A <see cref="System.String" /> that represents this instance.
+		/// </returns>
 		public override string ToString()
 		{
 			if (i_Type == SymbolRefType.DefaultEnv)
@@ -57,6 +84,9 @@ namespace MoonSharp.Interpreter
 				return string.Format("{2} : {0}[{1}]", i_Type, i_Index, i_Name);
 		}
 
+		/// <summary>
+		/// Writes this instance to a binary stream
+		/// </summary>
 		internal void WriteBinary(BinaryWriter bw)
 		{
 			bw.Write((byte)this.i_Type);
@@ -64,6 +94,9 @@ namespace MoonSharp.Interpreter
 			bw.Write(i_Name);
 		}
 
+		/// <summary>
+		/// Reads a symbolref from a binary stream 
+		/// </summary>
 		internal static SymbolRef ReadBinary(BinaryReader br)
 		{
 			SymbolRef that = new SymbolRef();

+ 15 - 0
src/MoonSharp.Interpreter/DataTypes/SymbolRefType.cs

@@ -5,11 +5,26 @@ using System.Text;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Enumeration of the types of SymbolRef
+	/// </summary>
 	public enum SymbolRefType
 	{
+		/// <summary>
+		/// The symbol ref of a local variable
+		/// </summary>
 		Local,
+		/// <summary>
+		/// The symbol ref of an upvalue variable
+		/// </summary>
 		Upvalue,
+		/// <summary>
+		/// The symbol ref of a global variable
+		/// </summary>
 		Global,
+		/// <summary>
+		/// The symbol ref of the global environment
+		/// </summary>
 		DefaultEnv,
 	}
 }

+ 19 - 5
src/MoonSharp.Interpreter/DataTypes/Table.cs

@@ -128,6 +128,11 @@ namespace MoonSharp.Interpreter
 			return t;
 		}
 
+		/// <summary>
+		/// Gets the dynvalue associated with the specified key (expressed as a System.Object)
+		/// </summary>
+		/// <param name="key">The key.</param>
+		/// <returns></returns>
 		public DynValue GetWithObjectKey(object key)
 		{
 			if (key is string)
@@ -140,6 +145,11 @@ namespace MoonSharp.Interpreter
 		}
 
 
+		/// <summary>
+		/// Gets the dynvalue associated with the specified key (expressed as a System.Object) as a System.Object.
+		/// </summary>
+		/// <param name="key">The key.</param>
+		/// <returns></returns>
 		public object GetAsObject(object key)
 		{
 			if (key is string)
@@ -151,6 +161,11 @@ namespace MoonSharp.Interpreter
 			return Get(dynkey).ToObject();
 		}
 
+		/// <summary>
+		/// Sets the dynvalue associated with the specified key. Both expressed as System.Object.
+		/// </summary>
+		/// <param name="key">The key.</param>
+		/// <param name="value">The value.</param>
 		public void SetAsObject(object key, object value)
 		{
 			DynValue dynval = DynValue.FromObject(this.OwnerScript, value);
@@ -164,9 +179,6 @@ namespace MoonSharp.Interpreter
 		}
 
 
-
-
-
 		/// <summary>
 		/// Sets the value associated to the specified key.
 		/// </summary>
@@ -316,9 +328,11 @@ namespace MoonSharp.Interpreter
 		}
 
 		/// <summary>
-		/// Collects the dead keys.
+		/// Collects the dead keys. This frees up memory but invalidates pending iterators.
+		/// It's called automatically internally when the semantics of Lua tables allow, but can be forced
+		/// externally if it's known that no iterators are pending.
 		/// </summary>
-		private void CollectDeadKeys()
+		public void CollectDeadKeys()
 		{
 			for (LinkedListNode<TablePair> node = m_Values.First; node != null; node = node.Next)
 			{

+ 19 - 0
src/MoonSharp.Interpreter/DataTypes/TailCallData.cs

@@ -6,12 +6,31 @@ using MoonSharp.Interpreter.Execution.VM;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Class used to support "tail" continuations - a way for C# / Lua interaction which supports 
+	/// coroutine yielding (at the expense of a LOT of added complexity in calling code).
+	/// </summary>
 	public class TailCallData
 	{
+		/// <summary>
+		/// Gets or sets the function to call
+		/// </summary>
 		public DynValue Function { get; set; }
+		/// <summary>
+		/// Gets or sets the arguments to the function
+		/// </summary>
 		public DynValue[] Args { get; set; }
+		/// <summary>
+		/// Gets or sets the callback to be used as a continuation.
+		/// </summary>
 		public CallbackFunction Continuation { get; set; }
+		/// <summary>
+		/// Gets or sets the callback to be used in case of errors.
+		/// </summary>
 		public CallbackFunction ErrorHandler { get; set; }
+		/// <summary>
+		/// Gets or sets the error handler to be called before stack unwinding
+		/// </summary>
 		public DynValue ErrorHandlerBeforeUnwind { get; set; }
 	}
 }

+ 77 - 3
src/MoonSharp.Interpreter/DataTypes/UserData.cs

@@ -8,6 +8,10 @@ using MoonSharp.Interpreter.Interop;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Class exposing C# objects as Lua userdata.
+	/// For efficiency, a global registry of types is maintained, instead of a per-script one.
+	/// </summary>
 	public class UserData : RefIdObject
 	{
 		private UserData()
@@ -15,10 +19,21 @@ namespace MoonSharp.Interpreter
 			// This type can only be instantiated using one of the Create methods
 		}
 
+		/// <summary>
+		/// Gets or sets the "uservalue". See debug.getuservalue and debug.setuservalue.
+		/// http://www.lua.org/manual/5.2/manual.html#pdf-debug.setuservalue
+		/// </summary>
 		public DynValue UserValue { get; set; }
 
-		public object Object { get; set; }
-		internal IUserDataDescriptor Descriptor { get; set; }
+		/// <summary>
+		/// Gets the object associated to this userdata (null for statics)
+		/// </summary>
+		public object Object { get; private set; }
+
+		/// <summary>
+		/// Gets the type descriptor of this userdata
+		/// </summary>
+		public IUserDataDescriptor Descriptor { get; private set; }
 
 		private static object s_Lock = new object();
 		private static Dictionary<Type, IUserDataDescriptor> s_Registry = new Dictionary<Type, IUserDataDescriptor>();
@@ -31,26 +46,52 @@ namespace MoonSharp.Interpreter
 			s_DefaultAccessMode = InteropAccessMode.LazyOptimized;
 		}
 
+		/// <summary>
+		/// Registers a type for userdata interop
+		/// </summary>
+		/// <typeparam name="T">The type to be registered</typeparam>
+		/// <param name="accessMode">The access mode (optional).</param>
+		/// <param name="friendlyName">Friendly name for the type (optional)</param>
 		public static void RegisterType<T>(InteropAccessMode accessMode = InteropAccessMode.Default, string friendlyName = null)
 		{
 			RegisterType_Impl(typeof(T), accessMode, friendlyName, null);
 		}
 
+		/// <summary>
+		/// Registers a type for userdata interop
+		/// </summary>
+		/// <param name="type">The type to be registered</param>
+		/// <param name="accessMode">The access mode (optional).</param>
+		/// <param name="friendlyName">Friendly name for the type (optional)</param>
 		public static void RegisterType(Type type, InteropAccessMode accessMode = InteropAccessMode.Default, string friendlyName = null)
 		{
 			RegisterType_Impl(type, accessMode, friendlyName, null);
 		}
 
+		/// <summary>
+		/// Registers a type with a custom userdata descriptor
+		/// </summary>
+		/// <typeparam name="T">The type to be registered</typeparam>
+		/// <param name="customDescriptor">The custom descriptor.</param>
 		public static void RegisterType<T>(IUserDataDescriptor customDescriptor)
 		{
 			RegisterType_Impl(typeof(T), InteropAccessMode.Default, null, customDescriptor);
 		}
 
+		/// <summary>
+		/// Registers a type with a custom userdata descriptor
+		/// </summary>
+		/// <param name="type">The type to be registered</param>
+		/// <param name="customDescriptor">The custom descriptor.</param>
 		public static void RegisterType(Type type, IUserDataDescriptor customDescriptor)
 		{
 			RegisterType_Impl(type, InteropAccessMode.Default, null, customDescriptor);
 		}
 
+		/// <summary>
+		/// Registers all types marked with a MoonSharpUserDataAttribute that ar contained in an assembly.
+		/// </summary>
+		/// <param name="asm">The assembly.</param>
 		public static void RegisterAssembly(Assembly asm = null)
 		{
 			asm = asm ?? Assembly.GetCallingAssembly();
@@ -69,11 +110,19 @@ namespace MoonSharp.Interpreter
 			}
 		}
 
+		/// <summary>
+		/// Unregisters a type.
+		/// </summary>
+		/// <typeparam name="T">The type to be unregistered</typeparam>
 		public static void UnregisterType<T>()
 		{
 			UnregisterType(typeof(T));
 		}
 
+		/// <summary>
+		/// Unregisters a type.
+		/// </summary>
+		/// <param name="t">The The type to be unregistered</param>
 		public static void UnregisterType(Type t)
 		{
 			lock (s_Lock)
@@ -81,6 +130,11 @@ namespace MoonSharp.Interpreter
 					s_Registry.Remove(t);
 		}
 
+		/// <summary>
+		/// Creates a userdata DynValue from the specified object
+		/// </summary>
+		/// <param name="o">The object</param>
+		/// <returns></returns>
 		public static DynValue Create(object o)
 		{
 			var descr = GetDescriptorForObject(o);
@@ -93,6 +147,11 @@ namespace MoonSharp.Interpreter
 				});
 		}
 
+		/// <summary>
+		/// Creates a static userdata DynValue from the specified Type
+		/// </summary>
+		/// <param name="t">The type</param>
+		/// <returns></returns>
 		public static DynValue CreateStatic(Type t)
 		{
 			var descr = GetDescriptorForType(t, false);
@@ -105,20 +164,35 @@ namespace MoonSharp.Interpreter
 			});
 		}
 
+		/// <summary>
+		/// Creates a static userdata DynValue from the specified Type
+		/// </summary>
+		/// <typeparam name="T">The Type</typeparam>
+		/// <returns></returns>
 		public static DynValue CreateStatic<T>()
 		{
 			return CreateStatic(typeof(T));
 		}
 
+		/// <summary>
+		/// Gets or sets the registration policy to be used in the whole application
+		/// </summary>
 		public static InteropRegistrationPolicy RegistrationPolicy { get; set; }
 
+		/// <summary>
+		/// Gets or sets the default access mode to be used in the whole application
+		/// </summary>
+		/// <value>
+		/// The default access mode.
+		/// </value>
+		/// <exception cref="System.ArgumentException">InteropAccessMode is InteropAccessMode.Default</exception>
 		public static InteropAccessMode DefaultAccessMode
 		{
 			get { return s_DefaultAccessMode; }
 			set
 			{
 				if (value == InteropAccessMode.Default)
-					throw new ArgumentException("DefaultAccessMode");
+					throw new ArgumentException("InteropAccessMode is InteropAccessMode.Default");
 
 				s_DefaultAccessMode = value;
 			}

+ 6 - 0
src/MoonSharp.Interpreter/DataTypes/YieldRequest.cs

@@ -5,8 +5,14 @@ using System.Text;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Class wrapping a request to yield a coroutine
+	/// </summary>
 	public class YieldRequest
 	{
+		/// <summary>
+		/// The return values of the coroutine
+		/// </summary>
 		public DynValue[] ReturnValues;
 	}
 }

+ 3 - 0
src/MoonSharp.Interpreter/Errors/DynamicExpressionException.cs

@@ -5,6 +5,9 @@ using System.Text;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Exception thrown when a dynamic expression is invalid
+	/// </summary>
 	public class DynamicExpressionException : ScriptRuntimeException
 	{
 		public DynamicExpressionException(string format, params object[] args)

+ 3 - 0
src/MoonSharp.Interpreter/Errors/InternalErrorException.cs

@@ -5,6 +5,9 @@ using System.Text;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Exception thrown when an inconsistent state is reached in the interpreter
+	/// </summary>
 	[Serializable]
 	public class InternalErrorException : InterpreterException
 	{

+ 12 - 0
src/MoonSharp.Interpreter/Errors/InterpreterException.cs

@@ -6,6 +6,9 @@ using MoonSharp.Interpreter.Debugging;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Base type of all exceptions thrown in MoonSharp
+	/// </summary>
 	public class InterpreterException : Exception 
 	{
 		protected InterpreterException(Exception ex)
@@ -26,10 +29,19 @@ namespace MoonSharp.Interpreter
 
 		}
 
+		/// <summary>
+		/// Gets the instruction pointer of the execution (if it makes sense)
+		/// </summary>
 		public int InstructionPtr { get; internal set; }
 
+		/// <summary>
+		/// Gets the interpreter call stack.
+		/// </summary>
 		public IList<MoonSharp.Interpreter.Debugging.WatchItem> CallStack { get; internal set; }
 
+		/// <summary>
+		/// Gets the decorated message (error message plus error location in script) if possible.
+		/// </summary>
 		public string DecoratedMessage { get; internal set; }
 
 		internal void DecorateMessage(Script script, SourceRef sref, int ip = -1)

+ 7 - 0
src/MoonSharp.Interpreter/Errors/ScriptRuntimeException.cs

@@ -6,6 +6,10 @@ using MoonSharp.Interpreter.Execution.VM;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Exception for all runtime errors. In addition to constructors, it offers a lot of static methods
+	/// generating more "standard" Lua errors.
+	/// </summary>
 	[Serializable]
 	public class ScriptRuntimeException : InterpreterException
 	{
@@ -26,6 +30,9 @@ namespace MoonSharp.Interpreter
 
 		}
 
+		/// <summary>
+		/// Gets or sets a value indicating whether the message should not be decorated
+		/// </summary>
 		public bool DoNotDecorateMessage { get; set; }
 
 		public static ScriptRuntimeException ArithmeticOnNonNumber(DynValue l, DynValue r = null)

+ 3 - 0
src/MoonSharp.Interpreter/Errors/SyntaxErrorException.cs

@@ -8,6 +8,9 @@ using MoonSharp.Interpreter.Tree;
 
 namespace MoonSharp.Interpreter
 {
+	/// <summary>
+	/// Exception for all parsing/lexing errors. 
+	/// </summary>
 	[Serializable]
 	public class SyntaxErrorException : InterpreterException
 	{

+ 33 - 0
src/MoonSharp.Interpreter/Execution/DynamicExpression.cs

@@ -31,6 +31,11 @@ namespace MoonSharp.Interpreter
 			m_Constant = constant;
 		}
 
+		/// <summary>
+		/// Evaluates the expression
+		/// </summary>
+		/// <param name="context">The context.</param>
+		/// <returns></returns>
 		public DynValue Evaluate(ScriptExecutionContext context = null)
 		{
 			context = context ?? OwnerScript.CreateDynamicExecutionContext();
@@ -41,6 +46,11 @@ namespace MoonSharp.Interpreter
 			return m_Exp.Eval(context);
 		}
 
+		/// <summary>
+		/// Finds a symbol in the expression
+		/// </summary>
+		/// <param name="context">The context.</param>
+		/// <returns></returns>
 		public SymbolRef FindSymbol(ScriptExecutionContext context)
 		{
 			if (m_Exp != null)
@@ -49,22 +59,45 @@ namespace MoonSharp.Interpreter
 				return null;
 		}
 
+		/// <summary>
+		/// Gets the script owning this resource.
+		/// </summary>
+		/// <value>
+		/// The script owning this resource.
+		/// </value>
 		public Script OwnerScript
 		{
 			get;
 			private set;
 		}
 
+		/// <summary>
+		/// Determines whether this instance is a constant expression
+		/// </summary>
+		/// <returns></returns>
 		public bool IsConstant()
 		{
 			return m_Constant != null;
 		}
 
+		/// <summary>
+		/// Returns a hash code for this instance.
+		/// </summary>
+		/// <returns>
+		/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
+		/// </returns>
 		public override int GetHashCode()
 		{
 			return ExpressionCode.GetHashCode();
 		}
 
+		/// <summary>
+		/// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
+		/// </summary>
+		/// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
+		/// <returns>
+		///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
+		/// </returns>
 		public override bool Equals(object obj)
 		{
 			DynamicExpression o = obj as DynamicExpression;

+ 0 - 26
src/MoonSharp.Interpreter/Execution/FileLoadRequestedEventArgs.cs

@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace MoonSharp.Interpreter.Execution
-{
-	public enum FileLoadRequestResponseType
-	{
-		FilePath,
-		ScriptCode,
-		RegisteredModule
-	}
-
-	public class FileLoadRequestedEventArgs : EventArgs 
-	{
-		public string Name { get; internal set; }
-		public bool IsModule { get; internal set; }
-		public Script OriginatingScript { get; internal set; }
-		public DynValue Coroutine { get; internal set; }
-
-		public bool Handled { get; set; }
-		public string Response { get; set; }
-		public FileLoadRequestResponseType ResponseType { get; set; }
-	}
-}

+ 0 - 13
src/MoonSharp.Interpreter/Execution/Scopes/BuildTimeLabelTracker.cs

@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using MoonSharp.Interpreter.Tree.Statements;
-
-namespace MoonSharp.Interpreter.Execution.Scopes
-{
-	class BuildTimeLabelTracker
-	{
-
-	}
-}

+ 1 - 1
src/MoonSharp.Interpreter/Execution/Scopes/BuildTimeScope.cs

@@ -7,7 +7,7 @@ using MoonSharp.Interpreter.Tree.Statements;
 
 namespace MoonSharp.Interpreter.Execution
 {
-	public class BuildTimeScope
+	internal class BuildTimeScope
 	{
 		List<BuildTimeScopeFrame> m_Frames = new List<BuildTimeScopeFrame>();
 		List<IClosureBuilder> m_ClosureBuilders = new List<IClosureBuilder>();

+ 22 - 0
src/MoonSharp.Interpreter/Execution/Scopes/ClosureContext.cs

@@ -5,16 +5,34 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.Execution
 {
+	/// <summary>
+	/// The scope of a closure (container of upvalues)
+	/// </summary>
 	public class ClosureContext : List<DynValue>
 	{
+		/// <summary>
+		/// Type of closure based on upvalues
+		/// </summary>
 		public enum UpvaluesType
 		{
+			/// <summary>
+			/// The closure has no upvalues (thus, technically, it's a function and not a closure!)
+			/// </summary>
 			None,
+			/// <summary>
+			/// The closure has _ENV as its only upvalue
+			/// </summary>
 			Environment,
+			/// <summary>
+			/// The closure is a "real" closure, with multiple upvalues
+			/// </summary>
 			Closure
 		}
 
 
+		/// <summary>
+		/// Gets the symbols.
+		/// </summary>
 		public string[] Symbols { get; private set; }
 
 		internal ClosureContext(SymbolRef[] symbols, IEnumerable<DynValue> values)
@@ -28,6 +46,10 @@ namespace MoonSharp.Interpreter.Execution
 			Symbols = new string[0];
 		}
 
+		/// <summary>
+		/// Gets the type of the upvalues contained in this closure
+		/// </summary>
+		/// <returns></returns>
 		public UpvaluesType GetUpvaluesType()
 		{
 			if (Symbols.Length == 0)

+ 1 - 1
src/MoonSharp.Interpreter/Execution/Scopes/IClosureBuilder.cs

@@ -5,7 +5,7 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.Execution
 {
-	public interface IClosureBuilder
+	internal interface IClosureBuilder
 	{
 		SymbolRef CreateUpvalue(BuildTimeScope scope, SymbolRef symbol);
 

+ 1 - 1
src/MoonSharp.Interpreter/Execution/Scopes/LoopTracker.cs

@@ -14,7 +14,7 @@ namespace MoonSharp.Interpreter.Execution
 	}
 
 
-	class LoopTracker
+	internal class LoopTracker
 	{
 		public FastStack<ILoop> Loops = new FastStack<ILoop>(16384);
 	}

+ 1 - 1
src/MoonSharp.Interpreter/Execution/Scopes/RuntimeScopeBlock.cs

@@ -5,7 +5,7 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.Execution
 {
-	public class RuntimeScopeBlock
+	internal class RuntimeScopeBlock
 	{
 		public int From { get; internal set; }
 		public int To { get; internal set; }

+ 1 - 1
src/MoonSharp.Interpreter/Execution/Scopes/RuntimeScopeFrame.cs

@@ -5,7 +5,7 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.Execution
 {
-	public class RuntimeScopeFrame 
+	internal class RuntimeScopeFrame 
 	{
 		public List<SymbolRef> DebugSymbols { get; private set; }
 		public int Count { get { return DebugSymbols.Count; } }

+ 1 - 8
src/MoonSharp.Interpreter/Execution/VM/ByteCode.cs

@@ -12,7 +12,7 @@ using MoonSharp.Interpreter.Debugging;
 
 namespace MoonSharp.Interpreter.Execution.VM
 {
-	internal class ByteCode : ITrackableReference
+	internal class ByteCode : RefIdObject
 	{
 		public List<Instruction> Code = new List<Instruction>();
 		public Script Script { get; private set; }
@@ -26,13 +26,6 @@ namespace MoonSharp.Interpreter.Execution.VM
 			Script = script;
 		}
 
-		#region ITrackableReference
-
-		static int s_RefIDCounter = 0;
-		private int m_RefID = Interlocked.Increment(ref s_RefIDCounter);
-		public int ReferenceID { get { return m_RefID; } }
-
-		#endregion
 
 		public IDisposable EnterSource(SourceRef sref)
 		{

+ 1 - 1
src/MoonSharp.Interpreter/Execution/VM/CallStackItem.cs

@@ -6,7 +6,7 @@ using MoonSharp.Interpreter.Debugging;
 
 namespace MoonSharp.Interpreter.Execution.VM
 {
-	public class CallStackItem
+	internal class CallStackItem
 	{
 		public int Debug_EntryPoint;
 		public SymbolRef[] Debug_Symbols;

+ 1 - 1
src/MoonSharp.Interpreter/Execution/VM/CallStackItemFlags.cs

@@ -6,7 +6,7 @@ using System.Text;
 namespace MoonSharp.Interpreter.Execution.VM
 {
 	[Flags]
-	public enum CallStackItemFlags
+	internal enum CallStackItemFlags
 	{
 		None = 0,
 

+ 0 - 17
src/MoonSharp.Interpreter/Execution/VM/CoroutineState.cs

@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using MoonSharp.Interpreter.DataStructs;
-
-namespace MoonSharp.Interpreter.Execution.VM
-{
-	public enum CoroutineState
-	{
-		Main,
-		NotStarted,
-		Suspended,
-		Running,
-		Dead
-	}
-}

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

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

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

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

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

@@ -11,7 +11,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>
-	public class UndisposableStream : Stream
+	internal class UndisposableStream : Stream
 	{
 		Stream m_Stream;
 

+ 4 - 7
src/MoonSharp.Interpreter/MoonSharp.Interpreter.net35-client.csproj

@@ -93,7 +93,6 @@
     <Compile Include="CoreLib\OsTimeModule.cs" />
     <Compile Include="CoreLib\StringLib\KopiLua_StrLib.cs" />
     <Compile Include="DataStructs\MultiDictionary.cs" />
-    <Compile Include="Execution\Scopes\BuildTimeLabelTracker.cs" />
     <Compile Include="IO\BinDumpBinaryReader.cs" />
     <Compile Include="IO\BinDumpBinaryWriter.cs">
       <SubType>Code</SubType>
@@ -119,7 +118,6 @@
     <Compile Include="CoreLib\TableModule.cs" />
     <Compile Include="DataStructs\Extension_Methods.cs" />
     <Compile Include="DataStructs\FastStackDynamic.cs" />
-    <Compile Include="DataStructs\ITrackableReference.cs" />
     <Compile Include="DataStructs\LinkedListIndex.cs" />
     <Compile Include="DataStructs\Slice.cs" />
     <Compile Include="DataTypes\Coroutine.cs" />
@@ -158,12 +156,11 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="DataTypes\TablePair.cs" />
-    <Compile Include="Execution\FileLoadRequestedEventArgs.cs" />
     <Compile Include="Execution\ScriptExecutionContext.cs">
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Debugging\SourceCode.cs" />
-    <Compile Include="Execution\VM\CoroutineState.cs" />
+    <Compile Include="DataTypes\CoroutineState.cs" />
     <Compile Include="Execution\VM\ExecutionState.cs" />
     <Compile Include="Execution\VM\Processor\DebugContext.cs" />
     <Compile Include="Execution\VM\Processor\Processor_Coroutines.cs" />
@@ -214,9 +211,9 @@
     <Compile Include="Platforms\LimitedPlatformAccessor.cs" />
     <Compile Include="Platforms\StandardFileType.cs" />
     <Compile Include="Platforms\StandardPlatformAccessor.cs" />
-    <Compile Include="RuntimeAbstraction\PortableWrappers\Attributes.cs" />
-    <Compile Include="RuntimeAbstraction\PortableWrappers\ExtensionMethods.cs" />
-    <Compile Include="RuntimeAbstraction\PortableWrappers\Stopwatch.cs" />
+    <Compile Include="Platforms\PortableWrappers\Attributes.cs" />
+    <Compile Include="Platforms\PortableWrappers\ExtensionMethods.cs" />
+    <Compile Include="Platforms\PortableWrappers\Stopwatch.cs" />
     <Compile Include="Script.cs" />
     <Compile Include="DataTypes\Table.cs" />
     <Compile Include="Execution\VM\ByteCode.cs" />

+ 0 - 0
src/MoonSharp.Interpreter/RuntimeAbstraction/PortableWrappers/Attributes.cs → src/MoonSharp.Interpreter/Platforms/PortableWrappers/Attributes.cs


+ 0 - 0
src/MoonSharp.Interpreter/RuntimeAbstraction/PortableWrappers/ExtensionMethods.cs → src/MoonSharp.Interpreter/Platforms/PortableWrappers/ExtensionMethods.cs


+ 0 - 0
src/MoonSharp.Interpreter/RuntimeAbstraction/PortableWrappers/Stopwatch.cs → src/MoonSharp.Interpreter/Platforms/PortableWrappers/Stopwatch.cs


+ 12 - 0
src/MoonSharp.Interpreter/Platforms/StandardFileType.cs

@@ -5,10 +5,22 @@ using System.Text;
 
 namespace MoonSharp.Interpreter.Platforms
 {
+	/// <summary>
+	/// Enumeration of standard file handles
+	/// </summary>
 	public enum StandardFileType
 	{
+		/// <summary>
+		/// Standard Input
+		/// </summary>
 		StdIn,
+		/// <summary>
+		/// Standard Output
+		/// </summary>
 		StdOut,
+		/// <summary>
+		/// Standard Error Output
+		/// </summary>
 		StdErr
 	}
 }

+ 1 - 1
src/MoonSharp.Interpreter/Platforms/StandardPlatformAccessor.cs

@@ -9,7 +9,7 @@ using System.Text;
 namespace MoonSharp.Interpreter.Platforms
 {
 	/// <summary>
-	/// Class providing the IPlatformAccessor interface for standard implementations.
+	/// Class providing the IPlatformAccessor interface for standard full-feaured implementations.
 	/// </summary>
 	public class StandardPlatformAccessor : PlatformAccessorBase
 	{

+ 4 - 13
src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.net40-client/MoonSharp.Interpreter.net40-client.csproj

@@ -97,9 +97,6 @@
     <Compile Include="..\..\DataStructs\MultiDictionary.cs">
       <Link>MultiDictionary.cs</Link>
     </Compile>
-    <Compile Include="..\..\Execution\Scopes\BuildTimeLabelTracker.cs">
-      <Link>BuildTimeLabelTracker.cs</Link>
-    </Compile>
     <Compile Include="..\..\IO\BinDumpBinaryReader.cs">
       <Link>BinDumpBinaryReader.cs</Link>
     </Compile>
@@ -170,9 +167,6 @@
     <Compile Include="..\..\DataStructs\FastStackDynamic.cs">
       <Link>FastStackDynamic.cs</Link>
     </Compile>
-    <Compile Include="..\..\DataStructs\ITrackableReference.cs">
-      <Link>ITrackableReference.cs</Link>
-    </Compile>
     <Compile Include="..\..\DataStructs\LinkedListIndex.cs">
       <Link>LinkedListIndex.cs</Link>
     </Compile>
@@ -272,9 +266,6 @@
     <Compile Include="..\..\DataTypes\TablePair.cs">
       <Link>TablePair.cs</Link>
     </Compile>
-    <Compile Include="..\..\Execution\FileLoadRequestedEventArgs.cs">
-      <Link>FileLoadRequestedEventArgs.cs</Link>
-    </Compile>
     <Compile Include="..\..\Execution\ScriptExecutionContext.cs">
       <SubType>Code</SubType>
       <Link>ScriptExecutionContext.cs</Link>
@@ -282,7 +273,7 @@
     <Compile Include="..\..\Debugging\SourceCode.cs">
       <Link>SourceCode.cs</Link>
     </Compile>
-    <Compile Include="..\..\Execution\VM\CoroutineState.cs">
+    <Compile Include="..\..\DataTypes\CoroutineState.cs">
       <Link>CoroutineState.cs</Link>
     </Compile>
     <Compile Include="..\..\Execution\VM\ExecutionState.cs">
@@ -420,13 +411,13 @@
     <Compile Include="..\..\Platforms\StandardPlatformAccessor.cs">
       <Link>StandardPlatformAccessor.cs</Link>
     </Compile>
-    <Compile Include="..\..\RuntimeAbstraction\PortableWrappers\Attributes.cs">
+    <Compile Include="..\..\Platforms\PortableWrappers\Attributes.cs">
       <Link>Attributes.cs</Link>
     </Compile>
-    <Compile Include="..\..\RuntimeAbstraction\PortableWrappers\ExtensionMethods.cs">
+    <Compile Include="..\..\Platforms\PortableWrappers\ExtensionMethods.cs">
       <Link>ExtensionMethods.cs</Link>
     </Compile>
-    <Compile Include="..\..\RuntimeAbstraction\PortableWrappers\Stopwatch.cs">
+    <Compile Include="..\..\Platforms\PortableWrappers\Stopwatch.cs">
       <Link>Stopwatch.cs</Link>
     </Compile>
     <Compile Include="..\..\Script.cs">

+ 4 - 13
src/MoonSharp.Interpreter/_Projects/MoonSharp.Interpreter.portable40/MoonSharp.Interpreter.portable40.csproj

@@ -94,9 +94,6 @@
     <Compile Include="..\..\DataStructs\MultiDictionary.cs">
       <Link>MultiDictionary.cs</Link>
     </Compile>
-    <Compile Include="..\..\Execution\Scopes\BuildTimeLabelTracker.cs">
-      <Link>BuildTimeLabelTracker.cs</Link>
-    </Compile>
     <Compile Include="..\..\IO\BinDumpBinaryReader.cs">
       <Link>BinDumpBinaryReader.cs</Link>
     </Compile>
@@ -167,9 +164,6 @@
     <Compile Include="..\..\DataStructs\FastStackDynamic.cs">
       <Link>FastStackDynamic.cs</Link>
     </Compile>
-    <Compile Include="..\..\DataStructs\ITrackableReference.cs">
-      <Link>ITrackableReference.cs</Link>
-    </Compile>
     <Compile Include="..\..\DataStructs\LinkedListIndex.cs">
       <Link>LinkedListIndex.cs</Link>
     </Compile>
@@ -269,9 +263,6 @@
     <Compile Include="..\..\DataTypes\TablePair.cs">
       <Link>TablePair.cs</Link>
     </Compile>
-    <Compile Include="..\..\Execution\FileLoadRequestedEventArgs.cs">
-      <Link>FileLoadRequestedEventArgs.cs</Link>
-    </Compile>
     <Compile Include="..\..\Execution\ScriptExecutionContext.cs">
       <SubType>Code</SubType>
       <Link>ScriptExecutionContext.cs</Link>
@@ -279,7 +270,7 @@
     <Compile Include="..\..\Debugging\SourceCode.cs">
       <Link>SourceCode.cs</Link>
     </Compile>
-    <Compile Include="..\..\Execution\VM\CoroutineState.cs">
+    <Compile Include="..\..\DataTypes\CoroutineState.cs">
       <Link>CoroutineState.cs</Link>
     </Compile>
     <Compile Include="..\..\Execution\VM\ExecutionState.cs">
@@ -417,13 +408,13 @@
     <Compile Include="..\..\Platforms\StandardPlatformAccessor.cs">
       <Link>StandardPlatformAccessor.cs</Link>
     </Compile>
-    <Compile Include="..\..\RuntimeAbstraction\PortableWrappers\Attributes.cs">
+    <Compile Include="..\..\Platforms\PortableWrappers\Attributes.cs">
       <Link>Attributes.cs</Link>
     </Compile>
-    <Compile Include="..\..\RuntimeAbstraction\PortableWrappers\ExtensionMethods.cs">
+    <Compile Include="..\..\Platforms\PortableWrappers\ExtensionMethods.cs">
       <Link>ExtensionMethods.cs</Link>
     </Compile>
-    <Compile Include="..\..\RuntimeAbstraction\PortableWrappers\Stopwatch.cs">
+    <Compile Include="..\..\Platforms\PortableWrappers\Stopwatch.cs">
       <Link>Stopwatch.cs</Link>
     </Compile>
     <Compile Include="..\..\Script.cs">

+ 3 - 0
src/MoonSharp/Program.cs

@@ -7,6 +7,7 @@ using System.Reflection;
 using System.Text;
 using MoonSharp.Interpreter;
 using MoonSharp.Interpreter.Execution;
+using MoonSharp.Interpreter.Loaders;
 using MoonSharp.RemoteDebugger;
 using MoonSharp.RemoteDebugger.Network;
 
@@ -19,6 +20,8 @@ namespace MoonSharp
 		[STAThread]
 		static void Main(string[] args)
 		{
+			Script.DefaultOptions.ScriptLoader = new ReplInterpreterScriptLoader();
+
 			Console.WriteLine("MoonSharp REPL {0} [{1}]", Script.VERSION, Script.Platform.GetPlatformName());
 			Console.WriteLine("Copyright (C) 2014 Marco Mastropaolo");
 			Console.WriteLine("http://www.moonsharp.org");

二进制
src/Unity/UnityTestBed/ProjectSettings/ProjectSettings.asset


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

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