Decompiled source of LuaModdingFramework v0.1.0

Mods/MoonSharp.Interpreter.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using MoonSharp.Interpreter.Compatibility;
using MoonSharp.Interpreter.Compatibility.Frameworks;
using MoonSharp.Interpreter.CoreLib;
using MoonSharp.Interpreter.CoreLib.IO;
using MoonSharp.Interpreter.CoreLib.StringLib;
using MoonSharp.Interpreter.DataStructs;
using MoonSharp.Interpreter.Debugging;
using MoonSharp.Interpreter.Diagnostics;
using MoonSharp.Interpreter.Diagnostics.PerformanceCounters;
using MoonSharp.Interpreter.Execution;
using MoonSharp.Interpreter.Execution.Scopes;
using MoonSharp.Interpreter.Execution.VM;
using MoonSharp.Interpreter.IO;
using MoonSharp.Interpreter.Interop;
using MoonSharp.Interpreter.Interop.BasicDescriptors;
using MoonSharp.Interpreter.Interop.Converters;
using MoonSharp.Interpreter.Interop.LuaStateInterop;
using MoonSharp.Interpreter.Interop.RegistrationPolicies;
using MoonSharp.Interpreter.Interop.StandardDescriptors;
using MoonSharp.Interpreter.Interop.UserDataRegistries;
using MoonSharp.Interpreter.Loaders;
using MoonSharp.Interpreter.Platforms;
using MoonSharp.Interpreter.REPL;
using MoonSharp.Interpreter.Serialization.Json;
using MoonSharp.Interpreter.Tree;
using MoonSharp.Interpreter.Tree.Expressions;
using MoonSharp.Interpreter.Tree.Fast_Interface;
using MoonSharp.Interpreter.Tree.Statements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MoonSharp.Interpreter")]
[assembly: AssemblyDescription("An interpreter for the Lua language")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("http://www.moonsharp.org")]
[assembly: AssemblyProduct("MoonSharp.Interpreter")]
[assembly: AssemblyCopyright("Copyright © 2014-2015, Marco Mastropaolo")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c971e5a8-dbec-4408-8046-86e4fdd1b2e3")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: InternalsVisibleTo("MoonSharp.Interpreter.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100F704C50BBDC3F2F011CC26A8C6C4797A40E0B4BC94CFB1335E9BA208326340696B686DC13099F10D3054544532F5E3E66C26A13FF260AEA2343E0410511FE56EDCC2AFB898AAA1BC21DA33C0D0AE60824EB441D02A0E6B7AE251CDE0946BFC748209C12B062573ECDB008A3D10CC40534B314847591CE5342A3BC6AA83CE23B8")]
[assembly: InternalsVisibleTo("MoonSharp.Interpreter.Tests.net40-client, PublicKey=0024000004800000940000000602000000240000525341310004000001000100F704C50BBDC3F2F011CC26A8C6C4797A40E0B4BC94CFB1335E9BA208326340696B686DC13099F10D3054544532F5E3E66C26A13FF260AEA2343E0410511FE56EDCC2AFB898AAA1BC21DA33C0D0AE60824EB441D02A0E6B7AE251CDE0946BFC748209C12B062573ECDB008A3D10CC40534B314847591CE5342A3BC6AA83CE23B8")]
[assembly: InternalsVisibleTo("MoonSharp.Interpreter.Tests.portable40, PublicKey=0024000004800000940000000602000000240000525341310004000001000100F704C50BBDC3F2F011CC26A8C6C4797A40E0B4BC94CFB1335E9BA208326340696B686DC13099F10D3054544532F5E3E66C26A13FF260AEA2343E0410511FE56EDCC2AFB898AAA1BC21DA33C0D0AE60824EB441D02A0E6B7AE251CDE0946BFC748209C12B062573ECDB008A3D10CC40534B314847591CE5342A3BC6AA83CE23B8")]
[assembly: InternalsVisibleTo("MoonSharp.Interpreter.Tests.net35-client, PublicKey=0024000004800000940000000602000000240000525341310004000001000100F704C50BBDC3F2F011CC26A8C6C4797A40E0B4BC94CFB1335E9BA208326340696B686DC13099F10D3054544532F5E3E66C26A13FF260AEA2343E0410511FE56EDCC2AFB898AAA1BC21DA33C0D0AE60824EB441D02A0E6B7AE251CDE0946BFC748209C12B062573ECDB008A3D10CC40534B314847591CE5342A3BC6AA83CE23B8")]
[assembly: TargetFramework(".NETFramework,Version=v4.0,Profile=Client", FrameworkDisplayName = ".NET Framework 4 Client Profile")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace MoonSharp.Interpreter
{
	public static class AsyncExtensions
	{
		private static Task<T> ExecAsync<T>(Func<T> func)
		{
			return Task.Factory.StartNew(func);
		}

		private static Task ExecAsyncVoid(Action func)
		{
			return Task.Factory.StartNew(func);
		}

		public static Task<DynValue> CallAsync(this Closure function)
		{
			return ExecAsync(() => function.Call());
		}

		public static Task<DynValue> CallAsync(this Closure function, params object[] args)
		{
			return ExecAsync(() => function.Call(args));
		}

		public static Task<DynValue> CallAsync(this Closure function, params DynValue[] args)
		{
			return ExecAsync(() => function.Call(args));
		}

		public static Task<DynValue> DoStringAsync(this Script script, string code, Table globalContext = null, string codeFriendlyName = null)
		{
			return ExecAsync(() => script.DoString(code, globalContext, codeFriendlyName));
		}

		public static Task<DynValue> DoStreamAsync(this Script script, Stream stream, Table globalContext = null, string codeFriendlyName = null)
		{
			return ExecAsync(() => script.DoStream(stream, globalContext, codeFriendlyName));
		}

		public static Task<DynValue> DoFileAsync(this Script script, string filename, Table globalContext = null, string codeFriendlyName = null)
		{
			return ExecAsync(() => script.DoFile(filename, globalContext, codeFriendlyName));
		}

		public static Task<DynValue> LoadFunctionAsync(this Script script, string code, Table globalTable = null, string funcFriendlyName = null)
		{
			return ExecAsync(() => script.LoadFunction(code, globalTable, funcFriendlyName));
		}

		public static Task<DynValue> LoadStringAsync(this Script script, string code, Table globalTable = null, string codeFriendlyName = null)
		{
			return ExecAsync(() => script.LoadString(code, globalTable, codeFriendlyName));
		}

		public static Task<DynValue> LoadStreamAsync(this Script script, Stream stream, Table globalTable = null, string codeFriendlyName = null)
		{
			return ExecAsync(() => script.LoadStream(stream, globalTable, codeFriendlyName));
		}

		public static Task DumpAsync(this Script script, DynValue function, Stream stream)
		{
			return ExecAsyncVoid(delegate
			{
				script.Dump(function, stream);
			});
		}

		public static Task<DynValue> LoadFileAsync(this Script script, string filename, Table globalContext = null, string friendlyFilename = null)
		{
			return ExecAsync(() => script.LoadFile(filename, globalContext, friendlyFilename));
		}

		public static Task<DynValue> CallAsync(this Script script, DynValue function)
		{
			return ExecAsync(() => script.Call(function));
		}

		public static Task<DynValue> CallAsync(this Script script, DynValue function, params DynValue[] args)
		{
			return ExecAsync(() => script.Call(function, args));
		}

		public static Task<DynValue> CallAsync(this Script script, DynValue function, params object[] args)
		{
			return ExecAsync(() => script.Call(function, args));
		}

		public static Task<DynValue> CallAsync(this Script script, object function)
		{
			return ExecAsync(() => script.Call(function));
		}

		public static Task<DynValue> CallAsync(this Script script, object function, params object[] args)
		{
			return ExecAsync(() => script.Call(function, args));
		}

		public static Task<DynamicExpression> CreateDynamicExpressionAsync(this Script script, string code)
		{
			return ExecAsync(() => script.CreateDynamicExpression(code));
		}

		public static Task<DynValue> EvaluateAsync(this ReplInterpreter interpreter, string input)
		{
			return ExecAsync(() => interpreter.Evaluate(input));
		}

		public static Task<DynValue> ResumeAsync(this Coroutine cor, params DynValue[] args)
		{
			return ExecAsync(() => cor.Resume(args));
		}

		public static Task<DynValue> ResumeAsync(this Coroutine cor, ScriptExecutionContext context, params DynValue[] args)
		{
			return ExecAsync(() => cor.Resume(context, args));
		}

		public static Task<DynValue> ResumeAsync(this Coroutine cor)
		{
			return ExecAsync(() => cor.Resume());
		}

		public static Task<DynValue> ResumeAsync(this Coroutine cor, ScriptExecutionContext context)
		{
			return ExecAsync(() => cor.Resume(context));
		}

		public static Task<DynValue> ResumeAsync(this Coroutine cor, params object[] args)
		{
			return ExecAsync(() => cor.Resume(args));
		}

		public static Task<DynValue> ResumeAsync(this Coroutine cor, ScriptExecutionContext context, params object[] args)
		{
			return ExecAsync(() => cor.Resume(context, args));
		}
	}
	[AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = true)]
	public sealed class MoonSharpPropertyAttribute : Attribute
	{
		public string Name { get; private set; }

		public MoonSharpPropertyAttribute()
		{
		}

		public MoonSharpPropertyAttribute(string name)
		{
			Name = name;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
	public sealed class MoonSharpUserDataMetamethodAttribute : Attribute
	{
		public string Name { get; private set; }

		public MoonSharpUserDataMetamethodAttribute(string name)
		{
			Name = name;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = true, AllowMultiple = true)]
	public sealed class MoonSharpHideMemberAttribute : Attribute
	{
		public string MemberName { get; private set; }

		public MoonSharpHideMemberAttribute(string memberName)
		{
			MemberName = memberName;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event, Inherited = true, AllowMultiple = false)]
	public sealed class MoonSharpHiddenAttribute : Attribute
	{
	}
	public delegate object ScriptFunctionDelegate(params object[] args);
	public delegate T ScriptFunctionDelegate<T>(params object[] args);
	[Flags]
	public enum TypeValidationFlags
	{
		None = 0,
		AllowNil = 1,
		AutoConvert = 2,
		Default = 2
	}
	[Serializable]
	public class DynamicExpressionException : ScriptRuntimeException
	{
		public DynamicExpressionException(string format, params object[] args)
			: base("<dynamic>: " + format, args)
		{
		}

		public DynamicExpressionException(string message)
			: base("<dynamic>: " + message)
		{
		}
	}
	public class DynamicExpression : IScriptPrivateResource
	{
		private DynamicExprExpression m_Exp;

		private DynValue m_Constant;

		public readonly string ExpressionCode;

		public Script OwnerScript { get; private set; }

		internal DynamicExpression(Script S, string strExpr, DynamicExprExpression expr)
		{
			ExpressionCode = strExpr;
			OwnerScript = S;
			m_Exp = expr;
		}

		internal DynamicExpression(Script S, string strExpr, DynValue constant)
		{
			ExpressionCode = strExpr;
			OwnerScript = S;
			m_Constant = constant;
		}

		public DynValue Evaluate(ScriptExecutionContext context = null)
		{
			context = context ?? OwnerScript.CreateDynamicExecutionContext();
			this.CheckScriptOwnership(context.GetScript());
			if (m_Constant != null)
			{
				return m_Constant;
			}
			return m_Exp.Eval(context);
		}

		public SymbolRef FindSymbol(ScriptExecutionContext context)
		{
			this.CheckScriptOwnership(context.GetScript());
			if (m_Exp != null)
			{
				return m_Exp.FindDynamic(context);
			}
			return null;
		}

		public bool IsConstant()
		{
			return m_Constant != null;
		}

		public override int GetHashCode()
		{
			return ExpressionCode.GetHashCode();
		}

		public override bool Equals(object obj)
		{
			if (!(obj is DynamicExpression dynamicExpression))
			{
				return false;
			}
			return dynamicExpression.ExpressionCode == ExpressionCode;
		}
	}
	internal static class Extension_Methods
	{
		public static TValue GetOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key)
		{
			if (dictionary.TryGetValue(key, out var value))
			{
				return value;
			}
			return default(TValue);
		}

		public static TValue GetOrCreate<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, Func<TValue> creator)
		{
			if (!dictionary.TryGetValue(key, out var value))
			{
				value = creator();
				dictionary.Add(key, value);
			}
			return value;
		}
	}
	public class Coroutine : RefIdObject, IScriptPrivateResource
	{
		public enum CoroutineType
		{
			Coroutine,
			ClrCallback,
			ClrCallbackDead
		}

		private CallbackFunction m_ClrCallback;

		private Processor m_Processor;

		public CoroutineType Type { get; private set; }

		public CoroutineState State
		{
			get
			{
				if (Type == CoroutineType.ClrCallback)
				{
					return CoroutineState.NotStarted;
				}
				if (Type == CoroutineType.ClrCallbackDead)
				{
					return CoroutineState.Dead;
				}
				return m_Processor.State;
			}
		}

		public Script OwnerScript { get; private set; }

		public long AutoYieldCounter
		{
			get
			{
				return m_Processor.AutoYieldCounter;
			}
			set
			{
				m_Processor.AutoYieldCounter = value;
			}
		}

		internal Coroutine(CallbackFunction function)
		{
			Type = CoroutineType.ClrCallback;
			m_ClrCallback = function;
			OwnerScript = null;
		}

		internal Coroutine(Processor proc)
		{
			Type = CoroutineType.Coroutine;
			m_Processor = proc;
			m_Processor.AssociatedCoroutine = this;
			OwnerScript = proc.GetScript();
		}

		internal void MarkClrCallbackAsDead()
		{
			if (Type != CoroutineType.ClrCallback)
			{
				throw new InvalidOperationException("State must be CoroutineType.ClrCallback");
			}
			Type = CoroutineType.ClrCallbackDead;
		}

		public IEnumerable<DynValue> AsTypedEnumerable()
		{
			if (Type != 0)
			{
				throw new InvalidOperationException("Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead");
			}
			while (State == CoroutineState.NotStarted || State == CoroutineState.Suspended || State == CoroutineState.ForceSuspended)
			{
				yield return Resume();
			}
		}

		public IEnumerable<object> AsEnumerable()
		{
			foreach (DynValue item in AsTypedEnumerable())
			{
				yield return item.ToScalar().ToObject();
			}
		}

		public IEnumerable<T> AsEnumerable<T>()
		{
			foreach (DynValue item in AsTypedEnumerable())
			{
				yield return item.ToScalar().ToObject<T>();
			}
		}

		public IEnumerator AsUnityCoroutine()
		{
			foreach (DynValue item in AsTypedEnumerable())
			{
				_ = item;
				yield return null;
			}
		}

		public DynValue Resume(params DynValue[] args)
		{
			this.CheckScriptOwnership(args);
			if (Type == CoroutineType.Coroutine)
			{
				return m_Processor.Coroutine_Resume(args);
			}
			throw new InvalidOperationException("Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead");
		}

		public DynValue Resume(ScriptExecutionContext context, params DynValue[] args)
		{
			this.CheckScriptOwnership(context);
			this.CheckScriptOwnership(args);
			if (Type == CoroutineType.Coroutine)
			{
				return m_Processor.Coroutine_Resume(args);
			}
			if (Type == CoroutineType.ClrCallback)
			{
				DynValue result = m_ClrCallback.Invoke(context, args);
				MarkClrCallbackAsDead();
				return result;
			}
			throw ScriptRuntimeException.CannotResumeNotSuspended(CoroutineState.Dead);
		}

		public DynValue Resume()
		{
			return Resume(new DynValue[0]);
		}

		public DynValue Resume(ScriptExecutionContext context)
		{
			return Resume(context, new DynValue[0]);
		}

		public DynValue Resume(params object[] args)
		{
			if (Type != 0)
			{
				throw new InvalidOperationException("Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead");
			}
			DynValue[] array = new DynValue[args.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = DynValue.FromObject(OwnerScript, args[i]);
			}
			return Resume(array);
		}

		public DynValue Resume(ScriptExecutionContext context, params object[] args)
		{
			DynValue[] array = new DynValue[args.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = DynValue.FromObject(context.GetScript(), args[i]);
			}
			return Resume(context, array);
		}

		public WatchItem[] GetStackTrace(int skip, SourceRef entrySourceRef = null)
		{
			if (State != CoroutineState.Running)
			{
				entrySourceRef = m_Processor.GetCoroutineSuspendedLocation();
			}
			return m_Processor.Debugger_GetCallStack(entrySourceRef).Skip(skip).ToArray();
		}
	}
	public interface IScriptPrivateResource
	{
		Script OwnerScript { get; }
	}
	internal static class ScriptPrivateResource_Extension
	{
		public static void CheckScriptOwnership(this IScriptPrivateResource containingResource, DynValue[] values)
		{
			foreach (DynValue value in values)
			{
				containingResource.CheckScriptOwnership(value);
			}
		}

		public static void CheckScriptOwnership(this IScriptPrivateResource containingResource, DynValue value)
		{
			if (value != null)
			{
				IScriptPrivateResource asPrivateResource = value.GetAsPrivateResource();
				if (asPrivateResource != null)
				{
					containingResource.CheckScriptOwnership(asPrivateResource);
				}
			}
		}

		public static void CheckScriptOwnership(this IScriptPrivateResource resource, Script script)
		{
			if (resource.OwnerScript != null && resource.OwnerScript != script && script != null)
			{
				throw new ScriptRuntimeException("Attempt to access a resource owned by a script, from another script");
			}
		}

		public static void CheckScriptOwnership(this IScriptPrivateResource containingResource, IScriptPrivateResource itemResource)
		{
			if (itemResource != null)
			{
				if (containingResource.OwnerScript != null && containingResource.OwnerScript != itemResource.OwnerScript && itemResource.OwnerScript != null)
				{
					throw new ScriptRuntimeException("Attempt to perform operations with resources owned by different scripts.");
				}
				if (containingResource.OwnerScript == null && itemResource.OwnerScript != null)
				{
					throw new ScriptRuntimeException("Attempt to perform operations with a script private resource on a shared resource.");
				}
			}
		}
	}
	public class RefIdObject
	{
		private static int s_RefIDCounter;

		private int m_RefID = ++s_RefIDCounter;

		public int ReferenceID => m_RefID;

		public string FormatTypeString(string typeString)
		{
			return $"{typeString}: {m_RefID:X8}";
		}
	}
	public class TailCallData
	{
		public DynValue Function { get; set; }

		public DynValue[] Args { get; set; }

		public CallbackFunction Continuation { get; set; }

		public CallbackFunction ErrorHandler { get; set; }

		public DynValue ErrorHandlerBeforeUnwind { get; set; }
	}
	public class UserData : RefIdObject
	{
		public DynValue UserValue { get; set; }

		public object Object { get; private set; }

		public IUserDataDescriptor Descriptor { get; private set; }

		public static IRegistrationPolicy RegistrationPolicy
		{
			get
			{
				return TypeDescriptorRegistry.RegistrationPolicy;
			}
			set
			{
				TypeDescriptorRegistry.RegistrationPolicy = value;
			}
		}

		public static InteropAccessMode DefaultAccessMode
		{
			get
			{
				return TypeDescriptorRegistry.DefaultAccessMode;
			}
			set
			{
				TypeDescriptorRegistry.DefaultAccessMode = value;
			}
		}

		private UserData()
		{
		}

		static UserData()
		{
			RegistrationPolicy = InteropRegistrationPolicy.Default;
			RegisterType<EventFacade>(InteropAccessMode.NoReflectionAllowed);
			RegisterType<AnonWrapper>(InteropAccessMode.HideMembers);
			RegisterType<EnumerableWrapper>(InteropAccessMode.NoReflectionAllowed);
			RegisterType<JsonNull>(InteropAccessMode.Reflection);
			DefaultAccessMode = InteropAccessMode.LazyOptimized;
		}

		public static IUserDataDescriptor RegisterType<T>(InteropAccessMode accessMode = InteropAccessMode.Default, string friendlyName = null)
		{
			return TypeDescriptorRegistry.RegisterType_Impl(typeof(T), accessMode, friendlyName, null);
		}

		public static IUserDataDescriptor RegisterType(Type type, InteropAccessMode accessMode = InteropAccessMode.Default, string friendlyName = null)
		{
			return TypeDescriptorRegistry.RegisterType_Impl(type, accessMode, friendlyName, null);
		}

		public static IUserDataDescriptor RegisterProxyType(IProxyFactory proxyFactory, InteropAccessMode accessMode = InteropAccessMode.Default, string friendlyName = null)
		{
			return TypeDescriptorRegistry.RegisterProxyType_Impl(proxyFactory, accessMode, friendlyName);
		}

		public static IUserDataDescriptor RegisterProxyType<TProxy, TTarget>(Func<TTarget, TProxy> wrapDelegate, InteropAccessMode accessMode = InteropAccessMode.Default, string friendlyName = null) where TProxy : class where TTarget : class
		{
			return RegisterProxyType(new DelegateProxyFactory<TProxy, TTarget>(wrapDelegate), accessMode, friendlyName);
		}

		public static IUserDataDescriptor RegisterType<T>(IUserDataDescriptor customDescriptor)
		{
			return TypeDescriptorRegistry.RegisterType_Impl(typeof(T), InteropAccessMode.Default, null, customDescriptor);
		}

		public static IUserDataDescriptor RegisterType(Type type, IUserDataDescriptor customDescriptor)
		{
			return TypeDescriptorRegistry.RegisterType_Impl(type, InteropAccessMode.Default, null, customDescriptor);
		}

		public static IUserDataDescriptor RegisterType(IUserDataDescriptor customDescriptor)
		{
			return TypeDescriptorRegistry.RegisterType_Impl(customDescriptor.Type, InteropAccessMode.Default, null, customDescriptor);
		}

		public static void RegisterAssembly(Assembly asm = null, bool includeExtensionTypes = false)
		{
			if (asm == null)
			{
				asm = Assembly.GetCallingAssembly();
			}
			TypeDescriptorRegistry.RegisterAssembly(asm, includeExtensionTypes);
		}

		public static bool IsTypeRegistered(Type t)
		{
			return TypeDescriptorRegistry.IsTypeRegistered(t);
		}

		public static bool IsTypeRegistered<T>()
		{
			return TypeDescriptorRegistry.IsTypeRegistered(typeof(T));
		}

		public static void UnregisterType<T>()
		{
			TypeDescriptorRegistry.UnregisterType(typeof(T));
		}

		public static void UnregisterType(Type t)
		{
			TypeDescriptorRegistry.UnregisterType(t);
		}

		public static DynValue Create(object o, IUserDataDescriptor descr)
		{
			return DynValue.NewUserData(new UserData
			{
				Descriptor = descr,
				Object = o
			});
		}

		public static DynValue Create(object o)
		{
			IUserDataDescriptor descriptorForObject = GetDescriptorForObject(o);
			if (descriptorForObject == null)
			{
				if (o is Type)
				{
					return CreateStatic((Type)o);
				}
				return null;
			}
			return Create(o, descriptorForObject);
		}

		public static DynValue CreateStatic(IUserDataDescriptor descr)
		{
			if (descr == null)
			{
				return null;
			}
			return DynValue.NewUserData(new UserData
			{
				Descriptor = descr,
				Object = null
			});
		}

		public static DynValue CreateStatic(Type t)
		{
			return CreateStatic(GetDescriptorForType(t, searchInterfaces: false));
		}

		public static DynValue CreateStatic<T>()
		{
			return CreateStatic(GetDescriptorForType(typeof(T), searchInterfaces: false));
		}

		public static void RegisterExtensionType(Type type, InteropAccessMode mode = InteropAccessMode.Default)
		{
			ExtensionMethodsRegistry.RegisterExtensionType(type, mode);
		}

		public static List<IOverloadableMemberDescriptor> GetExtensionMethodsByNameAndType(string name, Type extendedType)
		{
			return ExtensionMethodsRegistry.GetExtensionMethodsByNameAndType(name, extendedType);
		}

		public static int GetExtensionMethodsChangeVersion()
		{
			return ExtensionMethodsRegistry.GetExtensionMethodsChangeVersion();
		}

		public static IUserDataDescriptor GetDescriptorForType<T>(bool searchInterfaces)
		{
			return TypeDescriptorRegistry.GetDescriptorForType(typeof(T), searchInterfaces);
		}

		public static IUserDataDescriptor GetDescriptorForType(Type type, bool searchInterfaces)
		{
			return TypeDescriptorRegistry.GetDescriptorForType(type, searchInterfaces);
		}

		public static IUserDataDescriptor GetDescriptorForObject(object o)
		{
			return TypeDescriptorRegistry.GetDescriptorForType(o.GetType(), searchInterfaces: true);
		}

		public static Table GetDescriptionOfRegisteredTypes(bool useHistoricalData = false)
		{
			DynValue dynValue = DynValue.NewPrimeTable();
			foreach (KeyValuePair<Type, IUserDataDescriptor> item in useHistoricalData ? TypeDescriptorRegistry.RegisteredTypesHistory : TypeDescriptorRegistry.RegisteredTypes)
			{
				if (item.Value is IWireableDescriptor wireableDescriptor)
				{
					DynValue dynValue2 = DynValue.NewPrimeTable();
					dynValue.Table.Set(item.Key.FullName, dynValue2);
					wireableDescriptor.PrepareForWiring(dynValue2.Table);
				}
			}
			return dynValue.Table;
		}

		public static IEnumerable<Type> GetRegisteredTypes(bool useHistoricalData = false)
		{
			return (useHistoricalData ? TypeDescriptorRegistry.RegisteredTypesHistory : TypeDescriptorRegistry.RegisteredTypes).Select((KeyValuePair<Type, IUserDataDescriptor> p) => p.Value.Type);
		}
	}
	public static class WellKnownSymbols
	{
		public const string VARARGS = "...";

		public const string ENV = "_ENV";
	}
	public class YieldRequest
	{
		public DynValue[] ReturnValues;

		public bool Forced { get; internal set; }
	}
	[Serializable]
	public class ScriptRuntimeException : InterpreterException
	{
		public ScriptRuntimeException(Exception ex)
			: base(ex)
		{
		}

		public ScriptRuntimeException(ScriptRuntimeException ex)
			: base(ex, ex.DecoratedMessage)
		{
			base.DecoratedMessage = Message;
			base.DoNotDecorateMessage = true;
		}

		public ScriptRuntimeException(string message)
			: base(message)
		{
		}

		public ScriptRuntimeException(string format, params object[] args)
			: base(format, args)
		{
		}

		public static ScriptRuntimeException ArithmeticOnNonNumber(DynValue l, DynValue r = null)
		{
			if (l.Type != DataType.Number && l.Type != DataType.String)
			{
				return new ScriptRuntimeException("attempt to perform arithmetic on a {0} value", l.Type.ToLuaTypeString());
			}
			if (r != null && r.Type != DataType.Number && r.Type != DataType.String)
			{
				return new ScriptRuntimeException("attempt to perform arithmetic on a {0} value", r.Type.ToLuaTypeString());
			}
			if (l.Type == DataType.String || (r != null && r.Type == DataType.String))
			{
				return new ScriptRuntimeException("attempt to perform arithmetic on a string value");
			}
			throw new InternalErrorException("ArithmeticOnNonNumber - both are numbers");
		}

		public static ScriptRuntimeException ConcatOnNonString(DynValue l, DynValue r)
		{
			if (l.Type != DataType.Number && l.Type != DataType.String)
			{
				return new ScriptRuntimeException("attempt to concatenate a {0} value", l.Type.ToLuaTypeString());
			}
			if (r != null && r.Type != DataType.Number && r.Type != DataType.String)
			{
				return new ScriptRuntimeException("attempt to concatenate a {0} value", r.Type.ToLuaTypeString());
			}
			throw new InternalErrorException("ConcatOnNonString - both are numbers/strings");
		}

		public static ScriptRuntimeException LenOnInvalidType(DynValue r)
		{
			return new ScriptRuntimeException("attempt to get length of a {0} value", r.Type.ToLuaTypeString());
		}

		public static ScriptRuntimeException CompareInvalidType(DynValue l, DynValue r)
		{
			if (l.Type.ToLuaTypeString() == r.Type.ToLuaTypeString())
			{
				return new ScriptRuntimeException("attempt to compare two {0} values", l.Type.ToLuaTypeString());
			}
			return new ScriptRuntimeException("attempt to compare {0} with {1}", l.Type.ToLuaTypeString(), r.Type.ToLuaTypeString());
		}

		public static ScriptRuntimeException BadArgument(int argNum, string funcName, string message)
		{
			return new ScriptRuntimeException("bad argument #{0} to '{1}' ({2})", argNum + 1, funcName, message);
		}

		public static ScriptRuntimeException BadArgumentUserData(int argNum, string funcName, Type expected, object got, bool allowNil)
		{
			return new ScriptRuntimeException("bad argument #{0} to '{1}' (userdata<{2}>{3} expected, got {4})", argNum + 1, funcName, expected.Name, allowNil ? "nil or " : "", (got != null) ? ("userdata<" + got.GetType().Name + ">") : "null");
		}

		public static ScriptRuntimeException BadArgument(int argNum, string funcName, DataType expected, DataType got, bool allowNil)
		{
			return BadArgument(argNum, funcName, expected.ToErrorTypeString(), got.ToErrorTypeString(), allowNil);
		}

		public static ScriptRuntimeException BadArgument(int argNum, string funcName, string expected, string got, bool allowNil)
		{
			return new ScriptRuntimeException("bad argument #{0} to '{1}' ({2}{3} expected, got {4})", argNum + 1, funcName, allowNil ? "nil or " : "", expected, got);
		}

		public static ScriptRuntimeException BadArgumentNoValue(int argNum, string funcName, DataType expected)
		{
			return new ScriptRuntimeException("bad argument #{0} to '{1}' ({2} expected, got no value)", argNum + 1, funcName, expected.ToErrorTypeString());
		}

		public static ScriptRuntimeException BadArgumentIndexOutOfRange(string funcName, int argNum)
		{
			return new ScriptRuntimeException("bad argument #{0} to '{1}' (index out of range)", argNum + 1, funcName);
		}

		public static ScriptRuntimeException BadArgumentNoNegativeNumbers(int argNum, string funcName)
		{
			return new ScriptRuntimeException("bad argument #{0} to '{1}' (not a non-negative number in proper range)", argNum + 1, funcName);
		}

		public static ScriptRuntimeException BadArgumentValueExpected(int argNum, string funcName)
		{
			return new ScriptRuntimeException("bad argument #{0} to '{1}' (value expected)", argNum + 1, funcName);
		}

		public static ScriptRuntimeException IndexType(DynValue obj)
		{
			return new ScriptRuntimeException("attempt to index a {0} value", obj.Type.ToLuaTypeString());
		}

		public static ScriptRuntimeException LoopInIndex()
		{
			return new ScriptRuntimeException("loop in gettable");
		}

		public static ScriptRuntimeException LoopInNewIndex()
		{
			return new ScriptRuntimeException("loop in settable");
		}

		public static ScriptRuntimeException LoopInCall()
		{
			return new ScriptRuntimeException("loop in call");
		}

		public static ScriptRuntimeException TableIndexIsNil()
		{
			return new ScriptRuntimeException("table index is nil");
		}

		public static ScriptRuntimeException TableIndexIsNaN()
		{
			return new ScriptRuntimeException("table index is NaN");
		}

		public static ScriptRuntimeException ConvertToNumberFailed(int stage)
		{
			return stage switch
			{
				1 => new ScriptRuntimeException("'for' initial value must be a number"), 
				2 => new ScriptRuntimeException("'for' step must be a number"), 
				3 => new ScriptRuntimeException("'for' limit must be a number"), 
				_ => new ScriptRuntimeException("value must be a number"), 
			};
		}

		public static ScriptRuntimeException ConvertObjectFailed(object obj)
		{
			return new ScriptRuntimeException("cannot convert clr type {0}", obj.GetType());
		}

		public static ScriptRuntimeException ConvertObjectFailed(DataType t)
		{
			return new ScriptRuntimeException("cannot convert a {0} to a clr type", t.ToString().ToLowerInvariant());
		}

		public static ScriptRuntimeException ConvertObjectFailed(DataType t, Type t2)
		{
			return new ScriptRuntimeException("cannot convert a {0} to a clr type {1}", t.ToString().ToLowerInvariant(), t2.FullName);
		}

		public static ScriptRuntimeException UserDataArgumentTypeMismatch(DataType t, Type clrType)
		{
			return new ScriptRuntimeException("cannot find a conversion from a MoonSharp {0} to a clr {1}", t.ToString().ToLowerInvariant(), clrType.FullName);
		}

		public static ScriptRuntimeException UserDataMissingField(string typename, string fieldname)
		{
			return new ScriptRuntimeException("cannot access field {0} of userdata<{1}>", fieldname, typename);
		}

		public static ScriptRuntimeException CannotResumeNotSuspended(CoroutineState state)
		{
			if (state == CoroutineState.Dead)
			{
				return new ScriptRuntimeException("cannot resume dead coroutine");
			}
			return new ScriptRuntimeException("cannot resume non-suspended coroutine");
		}

		public static ScriptRuntimeException CannotYield()
		{
			return new ScriptRuntimeException("attempt to yield across a CLR-call boundary");
		}

		public static ScriptRuntimeException CannotYieldMain()
		{
			return new ScriptRuntimeException("attempt to yield from outside a coroutine");
		}

		public static ScriptRuntimeException AttemptToCallNonFunc(DataType type, string debugText = null)
		{
			string text = type.ToErrorTypeString();
			if (debugText != null)
			{
				return new ScriptRuntimeException("attempt to call a {0} value near '{1}'", text, debugText);
			}
			return new ScriptRuntimeException("attempt to call a {0} value", text);
		}

		public static ScriptRuntimeException AccessInstanceMemberOnStatics(IMemberDescriptor desc)
		{
			return new ScriptRuntimeException("attempt to access instance member {0} from a static userdata", desc.Name);
		}

		public static ScriptRuntimeException AccessInstanceMemberOnStatics(IUserDataDescriptor typeDescr, IMemberDescriptor desc)
		{
			return new ScriptRuntimeException("attempt to access instance member {0}.{1} from a static userdata", typeDescr.Name, desc.Name);
		}

		public override void Rethrow()
		{
			if (Script.GlobalOptions.RethrowExceptionNested)
			{
				throw new ScriptRuntimeException(this);
			}
		}
	}
	[Serializable]
	public class InternalErrorException : InterpreterException
	{
		internal InternalErrorException(string message)
			: base(message)
		{
		}

		internal InternalErrorException(string format, params object[] args)
			: base(format, args)
		{
		}
	}
	[Serializable]
	public class InterpreterException : Exception
	{
		public int InstructionPtr { get; internal set; }

		public IList<WatchItem> CallStack { get; internal set; }

		public string DecoratedMessage { get; internal set; }

		public bool DoNotDecorateMessage { get; set; }

		protected InterpreterException(Exception ex, string message)
			: base(message, ex)
		{
		}

		protected InterpreterException(Exception ex)
			: base(ex.Message, ex)
		{
		}

		protected InterpreterException(string message)
			: base(message)
		{
		}

		protected InterpreterException(string format, params object[] args)
			: base(string.Format(format, args))
		{
		}

		internal void DecorateMessage(Script script, SourceRef sref, int ip = -1)
		{
			if (string.IsNullOrEmpty(DecoratedMessage))
			{
				if (DoNotDecorateMessage)
				{
					DecoratedMessage = Message;
				}
				else if (sref != null)
				{
					DecoratedMessage = $"{sref.FormatLocation(script)}: {Message}";
				}
				else
				{
					DecoratedMessage = $"bytecode:{ip}: {Message}";
				}
			}
		}

		public virtual void Rethrow()
		{
		}
	}
	[Serializable]
	public class SyntaxErrorException : InterpreterException
	{
		internal Token Token { get; private set; }

		public bool IsPrematureStreamTermination { get; set; }

		internal SyntaxErrorException(Token t, string format, params object[] args)
			: base(format, args)
		{
			Token = t;
		}

		internal SyntaxErrorException(Token t, string message)
			: base(message)
		{
			Token = t;
		}

		internal SyntaxErrorException(Script script, SourceRef sref, string format, params object[] args)
			: base(format, args)
		{
			DecorateMessage(script, sref);
		}

		internal SyntaxErrorException(Script script, SourceRef sref, string message)
			: base(message)
		{
			DecorateMessage(script, sref);
		}

		private SyntaxErrorException(SyntaxErrorException syntaxErrorException)
			: base(syntaxErrorException, syntaxErrorException.DecoratedMessage)
		{
			Token = syntaxErrorException.Token;
			base.DecoratedMessage = Message;
		}

		internal void DecorateMessage(Script script)
		{
			if (Token != null)
			{
				DecorateMessage(script, Token.GetSourceRef(isStepStop: false));
			}
		}

		public override void Rethrow()
		{
			if (Script.GlobalOptions.RethrowExceptionNested)
			{
				throw new SyntaxErrorException(this);
			}
		}
	}
	public class CallbackArguments
	{
		private IList<DynValue> m_Args;

		private int m_Count;

		private bool m_LastIsTuple;

		public int Count => m_Count;

		public bool IsMethodCall { get; private set; }

		public DynValue this[int index] => RawGet(index, translateVoids: true) ?? DynValue.Void;

		public CallbackArguments(IList<DynValue> args, bool isMethodCall)
		{
			m_Args = args;
			if (m_Args.Count > 0)
			{
				DynValue dynValue = m_Args[m_Args.Count - 1];
				if (dynValue.Type == DataType.Tuple)
				{
					m_Count = dynValue.Tuple.Length - 1 + m_Args.Count;
					m_LastIsTuple = true;
				}
				else if (dynValue.Type == DataType.Void)
				{
					m_Count = m_Args.Count - 1;
				}
				else
				{
					m_Count = m_Args.Count;
				}
			}
			else
			{
				m_Count = 0;
			}
			IsMethodCall = isMethodCall;
		}

		public DynValue RawGet(int index, bool translateVoids)
		{
			if (index >= m_Count)
			{
				return null;
			}
			DynValue dynValue = ((m_LastIsTuple && index >= m_Args.Count - 1) ? m_Args[m_Args.Count - 1].Tuple[index - (m_Args.Count - 1)] : m_Args[index]);
			if (dynValue.Type == DataType.Tuple)
			{
				dynValue = ((dynValue.Tuple.Length == 0) ? DynValue.Nil : dynValue.Tuple[0]);
			}
			if (translateVoids && dynValue.Type == DataType.Void)
			{
				dynValue = DynValue.Nil;
			}
			return dynValue;
		}

		public DynValue[] GetArray(int skip = 0)
		{
			if (skip >= m_Count)
			{
				return new DynValue[0];
			}
			DynValue[] array = new DynValue[m_Count - skip];
			for (int i = skip; i < m_Count; i++)
			{
				array[i - skip] = this[i];
			}
			return array;
		}

		public DynValue AsType(int argNum, string funcName, DataType type, bool allowNil = false)
		{
			return this[argNum].CheckType(funcName, type, argNum, allowNil ? (TypeValidationFlags.AllowNil | TypeValidationFlags.AutoConvert) : TypeValidationFlags.AutoConvert);
		}

		public T AsUserData<T>(int argNum, string funcName, bool allowNil = false)
		{
			return this[argNum].CheckUserDataType<T>(funcName, argNum, allowNil ? TypeValidationFlags.AllowNil : TypeValidationFlags.None);
		}

		public int AsInt(int argNum, string funcName)
		{
			return (int)AsType(argNum, funcName, DataType.Number).Number;
		}

		public long AsLong(int argNum, string funcName)
		{
			return (long)AsType(argNum, funcName, DataType.Number).Number;
		}

		public string AsStringUsingMeta(ScriptExecutionContext executionContext, int argNum, string funcName)
		{
			if (this[argNum].Type == DataType.Table && this[argNum].Table.MetaTable != null && this[argNum].Table.MetaTable.RawGet("__tostring") != null)
			{
				DynValue dynValue = executionContext.GetScript().Call(this[argNum].Table.MetaTable.RawGet("__tostring"), this[argNum]);
				if (dynValue.Type != DataType.String)
				{
					throw new ScriptRuntimeException("'tostring' must return a string to '{0}'", funcName);
				}
				return dynValue.ToPrintString();
			}
			return this[argNum].ToPrintString();
		}

		public CallbackArguments SkipMethodCall()
		{
			if (IsMethodCall)
			{
				return new CallbackArguments(new Slice<DynValue>(m_Args, 1, m_Args.Count - 1, reversed: false), isMethodCall: false);
			}
			return this;
		}
	}
	public class Closure : RefIdObject, IScriptPrivateResource
	{
		public enum UpvaluesType
		{
			None,
			Environment,
			Closure
		}

		private static ClosureContext emptyClosure = new ClosureContext();

		public int EntryPointByteCodeLocation { get; private set; }

		public Script OwnerScript { get; private set; }

		internal ClosureContext ClosureContext { get; private set; }

		internal Closure(Script script, int idx, SymbolRef[] symbols, IEnumerable<DynValue> resolvedLocals)
		{
			OwnerScript = script;
			EntryPointByteCodeLocation = idx;
			if (symbols.Length != 0)
			{
				ClosureContext = new ClosureContext(symbols, resolvedLocals);
			}
			else
			{
				ClosureContext = emptyClosure;
			}
		}

		public DynValue Call()
		{
			return OwnerScript.Call(this);
		}

		public DynValue Call(params object[] args)
		{
			return OwnerScript.Call(this, args);
		}

		public DynValue Call(params DynValue[] args)
		{
			return OwnerScript.Call(this, args);
		}

		public ScriptFunctionDelegate GetDelegate()
		{
			return (object[] args) => Call(args).ToObject();
		}

		public ScriptFunctionDelegate<T> GetDelegate<T>()
		{
			return (object[] args) => Call(args).ToObject<T>();
		}

		public int GetUpvaluesCount()
		{
			return ClosureContext.Count;
		}

		public string GetUpvalueName(int idx)
		{
			return ClosureContext.Symbols[idx];
		}

		public DynValue GetUpvalue(int idx)
		{
			return ClosureContext[idx];
		}

		public UpvaluesType GetUpvaluesType()
		{
			switch (GetUpvaluesCount())
			{
			case 0:
				return UpvaluesType.None;
			case 1:
				if (GetUpvalueName(0) == "_ENV")
				{
					return UpvaluesType.Environment;
				}
				break;
			}
			return UpvaluesType.Closure;
		}
	}
	public sealed class CallbackFunction : RefIdObject
	{
		private static InteropAccessMode m_DefaultAccessMode = InteropAccessMode.LazyOptimized;

		public string Name { get; private set; }

		public Func<ScriptExecutionContext, CallbackArguments, DynValue> ClrCallback { get; private set; }

		public static InteropAccessMode DefaultAccessMode
		{
			get
			{
				return m_DefaultAccessMode;
			}
			set
			{
				if (value == InteropAccessMode.Default || value == InteropAccessMode.HideMembers || value == InteropAccessMode.BackgroundOptimized)
				{
					throw new ArgumentException("DefaultAccessMode");
				}
				m_DefaultAccessMode = value;
			}
		}

		public object AdditionalData { get; set; }

		public CallbackFunction(Func<ScriptExecutionContext, CallbackArguments, DynValue> callBack, string name = null)
		{
			ClrCallback = callBack;
			Name = name;
		}

		public DynValue Invoke(ScriptExecutionContext executionContext, IList<DynValue> args, bool isMethodCall = false)
		{
			if (isMethodCall)
			{
				switch (executionContext.GetScript().Options.ColonOperatorClrCallbackBehaviour)
				{
				case ColonOperatorBehaviour.TreatAsColon:
					isMethodCall = false;
					break;
				case ColonOperatorBehaviour.TreatAsDotOnUserData:
					isMethodCall = args.Count > 0 && args[0].Type == DataType.UserData;
					break;
				}
			}
			return ClrCallback(executionContext, new CallbackArguments(args, isMethodCall));
		}

		public static CallbackFunction FromDelegate(Script script, Delegate del, InteropAccessMode accessMode = InteropAccessMode.Default)
		{
			if (accessMode == InteropAccessMode.Default)
			{
				accessMode = m_DefaultAccessMode;
			}
			return new MethodMemberDescriptor(del.Method, accessMode).GetCallbackFunction(script, del.Target);
		}

		public static CallbackFunction FromMethodInfo(Script script, MethodInfo mi, object obj = null, InteropAccessMode accessMode = InteropAccessMode.Default)
		{
			if (accessMode == InteropAccessMode.Default)
			{
				accessMode = m_DefaultAccessMode;
			}
			return new MethodMemberDescriptor(mi, accessMode).GetCallbackFunction(script, obj);
		}

		public static bool CheckCallbackSignature(MethodInfo mi, bool requirePublicVisibility)
		{
			ParameterInfo[] parameters = mi.GetParameters();
			if (parameters.Length == 2 && parameters[0].ParameterType == typeof(ScriptExecutionContext) && parameters[1].ParameterType == typeof(CallbackArguments) && mi.ReturnType == typeof(DynValue))
			{
				if (!requirePublicVisibility)
				{
					return mi.IsPublic;
				}
				return true;
			}
			return false;
		}
	}
	public sealed class DynValue
	{
		private static int s_RefIDCounter;

		private int m_RefID = ++s_RefIDCounter;

		private int m_HashCode = -1;

		private bool m_ReadOnly;

		private double m_Number;

		private object m_Object;

		private DataType m_Type;

		public int ReferenceID => m_RefID;

		public DataType Type => m_Type;

		public Closure Function => m_Object as Closure;

		public double Number => m_Number;

		public DynValue[] Tuple => m_Object as DynValue[];

		public Coroutine Coroutine => m_Object as Coroutine;

		public Table Table => m_Object as Table;

		public bool Boolean => Number != 0.0;

		public string String => m_Object as string;

		public CallbackFunction Callback => m_Object as CallbackFunction;

		public TailCallData TailCallData => m_Object as TailCallData;

		public YieldRequest YieldRequest => m_Object as YieldRequest;

		public UserData UserData => m_Object as UserData;

		public bool ReadOnly => m_ReadOnly;

		public static DynValue Void { get; private set; }

		public static DynValue Nil { get; private set; }

		public static DynValue True { get; private set; }

		public static DynValue False { get; private set; }

		public static DynValue NewNil()
		{
			return new DynValue();
		}

		public static DynValue NewBoolean(bool v)
		{
			return new DynValue
			{
				m_Number = (v ? 1 : 0),
				m_Type = DataType.Boolean
			};
		}

		public static DynValue NewNumber(double num)
		{
			return new DynValue
			{
				m_Number = num,
				m_Type = DataType.Number,
				m_HashCode = -1
			};
		}

		public static DynValue NewString(string str)
		{
			return new DynValue
			{
				m_Object = str,
				m_Type = DataType.String
			};
		}

		public static DynValue NewString(StringBuilder sb)
		{
			return new DynValue
			{
				m_Object = sb.ToString(),
				m_Type = DataType.String
			};
		}

		public static DynValue NewString(string format, params object[] args)
		{
			return new DynValue
			{
				m_Object = string.Format(format, args),
				m_Type = DataType.String
			};
		}

		public static DynValue NewCoroutine(Coroutine coroutine)
		{
			return new DynValue
			{
				m_Object = coroutine,
				m_Type = DataType.Thread
			};
		}

		public static DynValue NewClosure(Closure function)
		{
			return new DynValue
			{
				m_Object = function,
				m_Type = DataType.Function
			};
		}

		public static DynValue NewCallback(Func<ScriptExecutionContext, CallbackArguments, DynValue> callBack, string name = null)
		{
			return new DynValue
			{
				m_Object = new CallbackFunction(callBack, name),
				m_Type = DataType.ClrFunction
			};
		}

		public static DynValue NewCallback(CallbackFunction function)
		{
			return new DynValue
			{
				m_Object = function,
				m_Type = DataType.ClrFunction
			};
		}

		public static DynValue NewTable(Table table)
		{
			return new DynValue
			{
				m_Object = table,
				m_Type = DataType.Table
			};
		}

		public static DynValue NewPrimeTable()
		{
			return NewTable(new Table(null));
		}

		public static DynValue NewTable(Script script)
		{
			return NewTable(new Table(script));
		}

		public static DynValue NewTable(Script script, params DynValue[] arrayValues)
		{
			return NewTable(new Table(script, arrayValues));
		}

		public static DynValue NewTailCallReq(DynValue tailFn, params DynValue[] args)
		{
			return new DynValue
			{
				m_Object = new TailCallData
				{
					Args = args,
					Function = tailFn
				},
				m_Type = DataType.TailCallRequest
			};
		}

		public static DynValue NewTailCallReq(TailCallData tailCallData)
		{
			return new DynValue
			{
				m_Object = tailCallData,
				m_Type = DataType.TailCallRequest
			};
		}

		public static DynValue NewYieldReq(DynValue[] args)
		{
			return new DynValue
			{
				m_Object = new YieldRequest
				{
					ReturnValues = args
				},
				m_Type = DataType.YieldRequest
			};
		}

		internal static DynValue NewForcedYieldReq()
		{
			return new DynValue
			{
				m_Object = new YieldRequest
				{
					Forced = true
				},
				m_Type = DataType.YieldRequest
			};
		}

		public static DynValue NewTuple(params DynValue[] values)
		{
			if (values.Length == 0)
			{
				return NewNil();
			}
			if (values.Length == 1)
			{
				return values[0];
			}
			return new DynValue
			{
				m_Object = values,
				m_Type = DataType.Tuple
			};
		}

		public static DynValue NewTupleNested(params DynValue[] values)
		{
			if (!values.Any((DynValue v) => v.Type == DataType.Tuple))
			{
				return NewTuple(values);
			}
			if (values.Length == 1)
			{
				return values[0];
			}
			List<DynValue> list = new List<DynValue>();
			foreach (DynValue dynValue in values)
			{
				if (dynValue.Type == DataType.Tuple)
				{
					list.AddRange(dynValue.Tuple);
				}
				else
				{
					list.Add(dynValue);
				}
			}
			return new DynValue
			{
				m_Object = list.ToArray(),
				m_Type = DataType.Tuple
			};
		}

		public static DynValue NewUserData(UserData userData)
		{
			return new DynValue
			{
				m_Object = userData,
				m_Type = DataType.UserData
			};
		}

		public DynValue AsReadOnly()
		{
			if (ReadOnly)
			{
				return this;
			}
			return Clone(readOnly: true);
		}

		public DynValue Clone()
		{
			return Clone(ReadOnly);
		}

		public DynValue Clone(bool readOnly)
		{
			return new DynValue
			{
				m_Object = m_Object,
				m_Number = m_Number,
				m_HashCode = m_HashCode,
				m_Type = m_Type,
				m_ReadOnly = readOnly
			};
		}

		public DynValue CloneAsWritable()
		{
			return Clone(readOnly: false);
		}

		static DynValue()
		{
			Nil = new DynValue
			{
				m_Type = DataType.Nil
			}.AsReadOnly();
			Void = new DynValue
			{
				m_Type = DataType.Void
			}.AsReadOnly();
			True = NewBoolean(v: true).AsReadOnly();
			False = NewBoolean(v: false).AsReadOnly();
		}

		public string ToPrintString()
		{
			if (m_Object != null && m_Object is RefIdObject)
			{
				RefIdObject refIdObject = (RefIdObject)m_Object;
				string typeString = Type.ToLuaTypeString();
				if (m_Object is UserData)
				{
					UserData userData = (UserData)m_Object;
					string text = userData.Descriptor.AsString(userData.Object);
					if (text != null)
					{
						return text;
					}
				}
				return refIdObject.FormatTypeString(typeString);
			}
			return Type switch
			{
				DataType.String => String, 
				DataType.Tuple => string.Join("\t", Tuple.Select((DynValue t) => t.ToPrintString()).ToArray()), 
				DataType.TailCallRequest => "(TailCallRequest -- INTERNAL!)", 
				DataType.YieldRequest => "(YieldRequest -- INTERNAL!)", 
				_ => ToString(), 
			};
		}

		public string ToDebugPrintString()
		{
			if (m_Object != null && m_Object is RefIdObject)
			{
				RefIdObject refIdObject = (RefIdObject)m_Object;
				string typeString = Type.ToLuaTypeString();
				if (m_Object is UserData)
				{
					UserData userData = (UserData)m_Object;
					string text = userData.Descriptor.AsString(userData.Object);
					if (text != null)
					{
						return text;
					}
				}
				return refIdObject.FormatTypeString(typeString);
			}
			return Type switch
			{
				DataType.Tuple => string.Join("\t", Tuple.Select((DynValue t) => t.ToPrintString()).ToArray()), 
				DataType.TailCallRequest => "(TailCallRequest)", 
				DataType.YieldRequest => "(YieldRequest)", 
				_ => ToString(), 
			};
		}

		public override string ToString()
		{
			return Type switch
			{
				DataType.Void => "void", 
				DataType.Nil => "nil", 
				DataType.Boolean => Boolean.ToString().ToLower(), 
				DataType.Number => Number.ToString(CultureInfo.InvariantCulture), 
				DataType.String => "\"" + String + "\"", 
				DataType.Function => $"(Function {Function.EntryPointByteCodeLocation:X8})", 
				DataType.ClrFunction => string.Format("(Function CLR)", Function), 
				DataType.Table => "(Table)", 
				DataType.Tuple => string.Join(", ", Tuple.Select((DynValue t) => t.ToString()).ToArray()), 
				DataType.TailCallRequest => "Tail:(" + string.Join(", ", Tuple.Select((DynValue t) => t.ToString()).ToArray()) + ")", 
				DataType.UserData => "(UserData)", 
				DataType.Thread => $"(Coroutine {Coroutine.ReferenceID:X8})", 
				_ => "(???)", 
			};
		}

		public override int GetHashCode()
		{
			if (m_HashCode != -1)
			{
				return m_HashCode;
			}
			int num = (int)Type << 27;
			switch (Type)
			{
			case DataType.Nil:
			case DataType.Void:
				m_HashCode = 0;
				break;
			case DataType.Boolean:
				m_HashCode = (Boolean ? 1 : 2);
				break;
			case DataType.Number:
				m_HashCode = num ^ Number.GetHashCode();
				break;
			case DataType.String:
				m_HashCode = num ^ String.GetHashCode();
				break;
			case DataType.Function:
				m_HashCode = num ^ Function.GetHashCode();
				break;
			case DataType.ClrFunction:
				m_HashCode = num ^ Callback.GetHashCode();
				break;
			case DataType.Table:
				m_HashCode = num ^ Table.GetHashCode();
				break;
			case DataType.Tuple:
			case DataType.TailCallRequest:
				m_HashCode = num ^ Tuple.GetHashCode();
				break;
			default:
				m_HashCode = 999;
				break;
			}
			return m_HashCode;
		}

		public override bool Equals(object obj)
		{
			if (!(obj is DynValue dynValue))
			{
				return false;
			}
			if ((dynValue.Type == DataType.Nil && Type == DataType.Void) || (dynValue.Type == DataType.Void && Type == DataType.Nil))
			{
				return true;
			}
			if (dynValue.Type != Type)
			{
				return false;
			}
			switch (Type)
			{
			case DataType.Nil:
			case DataType.Void:
				return true;
			case DataType.Boolean:
				return Boolean == dynValue.Boolean;
			case DataType.Number:
				return Number == dynValue.Number;
			case DataType.String:
				return String == dynValue.String;
			case DataType.Function:
				return Function == dynValue.Function;
			case DataType.ClrFunction:
				return Callback == dynValue.Callback;
			case DataType.Table:
				return Table == dynValue.Table;
			case DataType.Tuple:
			case DataType.TailCallRequest:
				return Tuple == dynValue.Tuple;
			case DataType.Thread:
				return Coroutine == dynValue.Coroutine;
			case DataType.UserData:
			{
				UserData userData = UserData;
				UserData userData2 = dynValue.UserData;
				if (userData == null || userData2 == null)
				{
					return false;
				}
				if (userData.Descriptor != userData2.Descriptor)
				{
					return false;
				}
				if (userData.Object == null && userData2.Object == null)
				{
					return true;
				}
				if (userData.Object != null && userData2.Object != null)
				{
					return userData.Object.Equals(userData2.Object);
				}
				return false;
			}
			default:
				return this == dynValue;
			}
		}

		public string CastToString()
		{
			DynValue dynValue = ToScalar();
			if (dynValue.Type == DataType.Number)
			{
				return dynValue.Number.ToString();
			}
			if (dynValue.Type == DataType.String)
			{
				return dynValue.String;
			}
			return null;
		}

		public double? CastToNumber()
		{
			DynValue dynValue = ToScalar();
			if (dynValue.Type == DataType.Number)
			{
				return dynValue.Number;
			}
			if (dynValue.Type == DataType.String && double.TryParse(dynValue.String, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
			{
				return result;
			}
			return null;
		}

		public bool CastToBool()
		{
			DynValue dynValue = ToScalar();
			if (dynValue.Type == DataType.Boolean)
			{
				return dynValue.Boolean;
			}
			if (dynValue.Type != 0)
			{
				return dynValue.Type != DataType.Void;
			}
			return false;
		}

		public IScriptPrivateResource GetAsPrivateResource()
		{
			return m_Object as IScriptPrivateResource;
		}

		public DynValue ToScalar()
		{
			if (Type != DataType.Tuple)
			{
				return this;
			}
			if (Tuple.Length == 0)
			{
				return Void;
			}
			return Tuple[0].ToScalar();
		}

		public void Assign(DynValue value)
		{
			if (ReadOnly)
			{
				throw new ScriptRuntimeException("Assigning on r-value");
			}
			m_Number = value.m_Number;
			m_Object = value.m_Object;
			m_Type = value.Type;
			m_HashCode = -1;
		}

		public DynValue GetLength()
		{
			if (Type == DataType.Table)
			{
				return NewNumber(Table.Length);
			}
			if (Type == DataType.String)
			{
				return NewNumber(String.Length);
			}
			throw new ScriptRuntimeException("Can't get length of type {0}", Type);
		}

		public bool IsNil()
		{
			if (Type != 0)
			{
				return Type == DataType.Void;
			}
			return true;
		}

		public bool IsNotNil()
		{
			if (Type != 0)
			{
				return Type != DataType.Void;
			}
			return false;
		}

		public bool IsVoid()
		{
			return Type == DataType.Void;
		}

		public bool IsNotVoid()
		{
			return Type != DataType.Void;
		}

		public bool IsNilOrNan()
		{
			if (Type != 0 && Type != DataType.Void)
			{
				if (Type == DataType.Number)
				{
					return double.IsNaN(Number);
				}
				return false;
			}
			return true;
		}

		internal void AssignNumber(double num)
		{
			if (ReadOnly)
			{
				throw new InternalErrorException(null, "Writing on r-value");
			}
			if (Type != DataType.Number)
			{
				throw new InternalErrorException("Can't assign number to type {0}", Type);
			}
			m_Number = num;
		}

		public static DynValue FromObject(Script script, object obj)
		{
			return ClrToScriptConversions.ObjectToDynValue(script, obj);
		}

		public object ToObject()
		{
			return ScriptToClrConversions.DynValueToObject(this);
		}

		public object ToObject(Type desiredType)
		{
			return ScriptToClrConversions.DynValueToObjectOfType(this, desiredType, null, isOptional: false);
		}

		public T ToObject<T>()
		{
			return (T)ToObject(typeof(T));
		}

		public dynamic ToDynamic()
		{
			return ScriptToClrConversions.DynValueToObject(this);
		}

		public DynValue CheckType(string funcName, DataType desiredType, int argNum = -1, TypeValidationFlags flags = TypeValidationFlags.AutoConvert)
		{
			if (Type == desiredType)
			{
				return this;
			}
			bool flag = (flags & TypeValidationFlags.AllowNil) != 0;
			if (flag && IsNil())
			{
				return this;
			}
			if ((flags & TypeValidationFlags.AutoConvert) != 0)
			{
				switch (desiredType)
				{
				case DataType.Boolean:
					return NewBoolean(CastToBool());
				case DataType.Number:
				{
					double? num = CastToNumber();
					if (num.HasValue)
					{
						return NewNumber(num.Value);
					}
					break;
				}
				}
				if (desiredType == DataType.String)
				{
					string text = CastToString();
					if (text != null)
					{
						return NewString(text);
					}
				}
			}
			if (IsVoid())
			{
				throw ScriptRuntimeException.BadArgumentNoValue(argNum, funcName, desiredType);
			}
			throw ScriptRuntimeException.BadArgument(argNum, funcName, desiredType, Type, flag);
		}

		public T CheckUserDataType<T>(string funcName, int argNum = -1, TypeValidationFlags flags = TypeValidationFlags.AutoConvert)
		{
			DynValue dynValue = CheckType(funcName, DataType.UserData, argNum, flags);
			bool allowNil = (flags & TypeValidationFlags.AllowNil) != 0;
			if (dynValue.IsNil())
			{
				return default(T);
			}
			object @object = dynValue.UserData.Object;
			if (@object != null && @object is T)
			{
				return (T)@object;
			}
			throw ScriptRuntimeException.BadArgumentUserData(argNum, funcName, typeof(T), @object, allowNil);
		}
	}
	public struct TablePair
	{
		private static TablePair s_NilNode = new TablePair(DynValue.Nil, DynValue.Nil);

		private DynValue key;

		private DynValue value;

		public DynValue Key
		{
			get
			{
				return key;
			}
			private set
			{
				Key = key;
			}
		}

		public DynValue Value
		{
			get
			{
				return value;
			}
			set
			{
				if (key.IsNotNil())
				{
					Value = value;
				}
			}
		}

		public static TablePair Nil => s_NilNode;

		public TablePair(DynValue key, DynValue val)
		{
			this.key = key;
			value = val;
		}
	}
	public class ScriptExecutionContext : IScriptPrivateResource
	{
		private Processor m_Processor;

		private CallbackFunction m_Callback;

		public bool IsDynamicExecution { get; private set; }

		public SourceRef CallingLocation { get; private set; }

		public object AdditionalData
		{
			get
			{
				if (m_Callback == null)
				{
					return null;
				}
				return m_Callback.AdditionalData;
			}
			set
			{
				if (m_Callback == null)
				{
					throw new InvalidOperationException("Cannot set additional data on a context which has no callback");
				}
				m_Callback.AdditionalData = value;
			}
		}

		public Table CurrentGlobalEnv
		{
			get
			{
				DynValue dynValue = EvaluateSymbolByName("_ENV");
				if (dynValue == null || dynValue.Type != DataType.Table)
				{
					return null;
				}
				return dynValue.Table;
			}
		}

		public Script OwnerScript => GetScript();

		internal ScriptExecutionContext(Processor p, CallbackFunction callBackFunction, SourceRef sourceRef, bool isDynamic = false)
		{
			IsDynamicExecution = isDynamic;
			m_Processor = p;
			m_Callback = callBackFunction;
			CallingLocation = sourceRef;
		}

		public Table GetMetatable(DynValue value)
		{
			return m_Processor.GetMetatable(value);
		}

		public DynValue GetMetamethod(DynValue value, string metamethod)
		{
			return m_Processor.GetMetamethod(value, metamethod);
		}

		public DynValue GetMetamethodTailCall(DynValue value, string metamethod, params DynValue[] args)
		{
			DynValue metamethod2 = GetMetamethod(value, metamethod);
			if (metamethod2 == null)
			{
				return null;
			}
			return DynValue.NewTailCallReq(metamethod2, args);
		}

		public DynValue GetBinaryMetamethod(DynValue op1, DynValue op2, string eventName)
		{
			return m_Processor.GetBinaryMetamethod(op1, op2, eventName);
		}

		public Script GetScript()
		{
			return m_Processor.GetScript();
		}

		public Coroutine GetCallingCoroutine()
		{
			return m_Processor.AssociatedCoroutine;
		}

		public DynValue EmulateClassicCall(CallbackArguments args, string functionName, Func<LuaState, int> callback)
		{
			LuaState luaState = new LuaState(this, args, functionName);
			int retvals = callback(luaState);
			return luaState.GetReturnValue(retvals);
		}

		public DynValue Call(DynValue func, params DynValue[] args)
		{
			if (func.Type == DataType.Function)
			{
				return GetScript().Call(func, args);
			}
			if (func.Type == DataType.ClrFunction)
			{
				DynValue dynValue;
				while (true)
				{
					dynValue = func.Callback.Invoke(this, args);
					if (dynValue.Type == DataType.YieldRequest)
					{
						throw ScriptRuntimeException.CannotYield();
					}
					if (dynValue.Type != DataType.TailCallRequest)
					{
						break;
					}
					TailCallData tailCallData = dynValue.TailCallData;
					if (tailCallData.Continuation != null || tailCallData.ErrorHandler != null)
					{
						throw new ScriptRuntimeException("the function passed cannot be called directly. wrap in a script function instead.");
					}
					args = tailCallData.Args;
					func = tailCallData.Function;
				}
				return dynValue;
			}
			int num = 10;
			while (num > 0)
			{
				DynValue metamethod = GetMetamethod(func, "__call");
				if (metamethod == null && metamethod.IsNil())
				{
					throw ScriptRuntimeException.AttemptToCallNonFunc(func.Type);
				}
				func = metamethod;
				if (func.Type == DataType.Function || func.Type == DataType.ClrFunction)
				{
					return Call(func, args);
				}
			}
			throw ScriptRuntimeException.LoopInCall();
		}

		public DynValue EvaluateSymbol(SymbolRef symref)
		{
			if (symref == null)
			{
				return DynValue.Nil;
			}
			return m_Processor.GetGenericSymbol(symref);
		}

		public DynValue EvaluateSymbolByName(string symbol)
		{
			return EvaluateSymbol(FindSymbolByName(symbol));
		}

		public SymbolRef FindSymbolByName(string symbol)
		{
			return m_Processor.FindSymbolByName(symbol);
		}

		public void PerformMessageDecorationBeforeUnwind(DynValue messageHandler, ScriptRuntimeException exception)
		{
			if (messageHandler != null)
			{
				exception.DecoratedMessage = m_Processor.PerformMessageDecorationBeforeUnwind(messageHandler, exception.Message, CallingLocation);
			}
			else
			{
				exception.DecoratedMessage = exception.Message;
			}
		}
	}
	public enum CoroutineState
	{
		Main,
		NotStarted,
		Suspended,
		ForceSuspended,
		Running,
		Dead
	}
	public static class LinqHelpers
	{
		public static IEnumerable<T> Convert<T>(this IEnumerable<DynValue> enumerable, DataType type)
		{
			return from v in enumerable
				where v.Type == type
				select v.ToObject<T>();
		}

		public static IEnumerable<DynValue> OfDataType(this IEnumerable<DynValue> enumerable, DataType type)
		{
			return enumerable.Where((DynValue v) => v.Type == type);
		}

		public static IEnumerable<object> AsObjects(this IEnumerable<DynValue> enumerable)
		{
			return enumerable.Select((DynValue v) => v.ToObject());
		}

		public static IEnumerable<T> AsObjects<T>(this IEnumerable<DynValue> enumerable)
		{
			return enumerable.Select((DynValue v) => v.ToObject<T>());
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
	public sealed class MoonSharpUserDataAttribute : Attribute
	{
		public InteropAccessMode AccessMode { get; set; }

		public MoonSharpUserDataAttribute()
		{
			AccessMode = InteropAccessMode.Default;
		}
	}
	internal class AutoDescribingUserDataDescriptor : IUserDataDescriptor
	{
		private string m_FriendlyName;

		private Type m_Type;

		public string Name => m_FriendlyName;

		public Type Type => m_Type;

		public AutoDescribingUserDataDescriptor(Type type, string friendlyName)
		{
			m_FriendlyName = friendlyName;
			m_Type = type;
		}

		public DynValue Index(Script script, object obj, DynValue index, bool isDirectIndexing)
		{
			if (obj is IUserDataType userDataType)
			{
				return userDataType.Index(script, index, isDirectIndexing);
			}
			return null;
		}

		public bool SetIndex(Script script, object obj, DynValue index, DynValue value, bool isDirectIndexing)
		{
			if (obj is IUserDataType userDataType)
			{
				return userDataType.SetIndex(script, index, value, isDirectIndexing);
			}
			return false;
		}

		public string AsString(object obj)
		{
			return obj?.ToString();
		}

		public DynValue MetaIndex(Script script, object obj, string metaname)
		{
			if (obj is IUserDataType userDataType)
			{
				return userDataType.MetaIndex(script, metaname);
			}
			return null;
		}

		public bool IsTypeCompatible(Type type, object obj)
		{
			return Framework.Do.IsInstanceOfType(type, obj);
		}
	}
	public enum InteropAccessMode
	{
		Reflection,
		LazyOptimized,
		Preoptimized,
		BackgroundOptimized,
		Hardwired,
		HideMembers,
		NoReflectionAllowed,
		Default
	}
	public enum SymbolRefType
	{
		Local,
		Upvalue,
		Global,
		DefaultEnv
	}
	public class SymbolRef
	{
		private static SymbolRef s_DefaultEnv = new SymbolRef
		{
			i_Type = SymbolRefType.DefaultEnv
		};

		internal SymbolRefType i_Type;

		internal SymbolRef i_Env;

		internal int i_Index;

		internal string i_Name;

		public SymbolRefType Type => i_Type;

		public int Index => i_Index;

		public string Name => i_Name;

		public SymbolRef Environment => i_Env;

		public static SymbolRef DefaultEnv => s_DefaultEnv;

		public static SymbolRef Global(string name, SymbolRef envSymbol)
		{
			return new SymbolRef
			{
				i_Index = -1,
				i_Type = SymbolRefType.Global,
				i_Env = envSymbol,
				i_Name = name
			};
		}

		internal static SymbolRef Local(string name, int index)
		{
			return new SymbolRef
			{
				i_Index = index,
				i_Type = SymbolRefType.Local,
				i_Name = name
			};
		}

		internal static SymbolRef Upvalue(string name, int index)
		{
			return new SymbolRef
			{
				i_Index = index,
				i_Type = SymbolRefType.Upvalue,
				i_Name = name
			};
		}

		public override string ToString()
		{
			if (i_Type == SymbolRefType.DefaultEnv)
			{
				return "(default _ENV)";
			}
			if (i_Type == SymbolRefType.Global)
			{
				return string.Format("{2} : {0} / {1}", i_Type, i_Env, i_Name);
			}
			return string.Format("{2} : {0}[{1}]", i_Type, i_Index, i_Name);
		}

		internal void WriteBinary(BinaryWriter bw)
		{
			bw.Write((byte)i_Type);
			bw.Write(i_Index);
			bw.Write(i_Name);
		}

		internal static SymbolRef ReadBinary(BinaryReader br)
		{
			return new SymbolRef
			{
				i_Type = (SymbolRefType)br.ReadByte(),
				i_Index = br.ReadInt32(),
				i_Name = br.ReadString()
			};
		}

		internal void WriteBinaryEnv(BinaryWriter bw, Dictionary<SymbolRef, int> symbolMap)
		{
			if (i_Env != null)
			{
				bw.Write(symbolMap[i_Env]);
			}
			else
			{
				bw.Write(-1);
			}
		}

		internal void ReadBinaryEnv(BinaryReader br, SymbolRef[] symbolRefs)
		{
			int num = br.ReadInt32();
			if (num >= 0)
			{
				i_Env = symbolRefs[num];
			}
		}
	}
	public enum DataType
	{
		Nil,
		Void,
		Boolean,
		Number,
		String,
		Function,
		Table,
		Tuple,
		UserData,
		Thread,
		ClrFunction,
		TailCallRequest,
		YieldRequest
	}
	public static class LuaTypeExtensions
	{
		internal const DataType MaxMetaTypes = DataType.Table;

		internal const DataType MaxConvertibleTypes = DataType.ClrFunction;

		public static bool CanHaveTypeMetatables(this DataType type)
		{
			return type < DataType.Table;
		}

		public static string ToErrorTypeString(this DataType type)
		{
			return type switch
			{
				DataType.Void => "no value", 
				DataType.Nil => "nil", 
				DataType.Boolean => "boolean", 
				DataType.Number => "number", 
				DataType.String => "string", 
				DataType.Function => "function", 
				DataType.ClrFunction => "function", 
				DataType.Table => "table", 
				DataType.UserData => "userdata", 
				DataType.Thread => "coroutine", 
				_ => $"internal<{type.ToLuaDebuggerString()}>", 
			};
		}

		public static string ToLuaDebuggerString(this DataType type)
		{
			return type.ToString().ToLowerInvariant();
		}

		public static string ToLuaTypeString(this DataType type)
		{
			switch (type)
			{
			case DataType.Nil:
			case DataType.Void:
				return "nil";
			case DataType.Boolean:
				return "boolean";
			case DataType.Number:
				return "number";
			case DataType.String:
				return "string";
			case DataType.Function:
				return "function";
			case DataType.ClrFunction:
				return "function";
			case DataType.Table:
				return "table";
			case DataType.UserData:
				return "userdata";
			case DataType.Thread:
				return "thread";
			default:
				throw new ScriptRuntimeException("Unexpected LuaType {0}", type);
			}
		}
	}
	public enum ColonOperatorBehaviour
	{
		TreatAsDot,
		TreatAsDotOnUserData,
		TreatAsColon
	}
	[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
	public sealed class MoonSharpModuleConstantAttribute : Attribute
	{
		public string Name { get; set; }
	}
	internal static class NamespaceDoc
	{
	}
	public class Script : IScriptPrivateResource
	{
		public const string VERSION = "2.0.0.0";

		public const string LUA_VERSION = "5.2";

		private Processor m_MainProcessor;

		private ByteCode m_ByteCode;

		private List<SourceCode> m_Sources = new List<SourceCode>();

		private Table m_GlobalTable;

		private IDebugger m_Debugger;

		private Table[] m_TypeMetatables = new Table[6];

		public static ScriptOptions DefaultOptions { get; private set; }

		public ScriptOptions Options { get; private set; }

		public static ScriptGlobalOptions GlobalOptions { get; private set; }

		public PerformanceStatistics PerformanceStats { get; private set; }

		public Table Globals => m_GlobalTable;

		public bool DebuggerEnabled
		{
			get
			{
				return m_MainProcessor.DebuggerEnabled;
			}
			set
			{
				m_MainProcessor.DebuggerEnabled = value;
			}
		}

		public int SourceCodeCount => m_Sources.Count;

		public Table Registry { get; private set; }

		Script IScriptPrivateResource.OwnerScript => this;

		static Script()
		{
			GlobalOptions = new ScriptGlobalOptions();
			DefaultOptions = new ScriptOptions
			{
				DebugPrint = delegate(string s)
				{
					GlobalOptions.Platform.DefaultPrint(s);
				},
				DebugInput = (string s) => GlobalOptions.Platform.DefaultInput(s),
				CheckThreadAccess = true,
				ScriptLoader = PlatformAutoDetector.GetDefaultScriptLoader(),
				TailCallOptimizationThreshold = 65536
			};
		}

		public Script()
			: this(CoreModules.Preset_Default)
		{
		}

		public Script(CoreModules coreModules)
		{
			Options = new ScriptOptions(DefaultOptions);
			PerformanceStats = new PerformanceStatistics();
			Registry = new Table(this);
			m_ByteCode = new ByteCode(this);
			m_MainProcessor = new Processor(this, m_GlobalTable, m_ByteCode);
			m_GlobalTable = new Table(this).RegisterCoreModules(coreModules);
		}

		public DynValue LoadFunction(string code, Table globalTable = null, string funcFriendlyName = null)
		{
			this.CheckScriptOwnership(globalTable);
			SourceCode sourceCode = new SourceCode($"libfunc_{funcFriendlyName ?? m_Sources.Count.ToString()}", code, m_Sources.Count, this);
			m_Sources.Add(sourceCode);
			int address = Loader_Fast.LoadFunction(this, sourceCode, m_ByteCode, globalTable != null || m_GlobalTable != null);
			SignalSourceCodeChange(sourceCode);
			SignalByteCodeChange();
			return MakeClosure(address, globalTable ?? m_GlobalTable);
		}

		private void SignalByteCodeChange()
		{
			if (m_Debugger != null)
			{
				m_Debugger.SetByteCode(m_ByteCode.Code.Select((Instruction s) => s.ToString()).ToArray());
			}
		}

		private void SignalSourceCodeChange(SourceCode source)
		{
			if (m_Debugger != null)
			{
				m_Debugger.SetSourceCode(source);
			}
		}

		public DynValue LoadString(string code, Table globalTable = null, string codeFriendlyName = null)
		{
			this.CheckScriptOwnership(globalTable);
			if (code.StartsWith("MoonSharp_dump_b64::"))
			{
				code = code.Substring("MoonSharp_dump_b64::".Length);
				using MemoryStream stream = new MemoryStream(Convert.FromBase64String(code));
				return LoadStream(stream, globalTable, codeFriendlyName);
			}
			string text = string.Format("{0}", codeFriendlyName ?? ("chunk_" + m_Sources.Count));
			SourceCode sourceCode = new SourceCode(codeFriendlyName ?? text, code, m_Sources.Count, this);
			m_Sources.Add(sourceCode);
			int address = Loader_Fast.LoadChunk(this, sourceCode, m_ByteCode);
			SignalSourceCodeChange(sourceCode);
			SignalByteCodeChange();
			return MakeClosure(address, globalTable ?? m_GlobalTable);
		}

		public DynValue LoadStream(Stream stream, Table globalTable = null, string codeFriendlyName = null)
		{
			this.CheckScriptOwnership(globalTable);
			Stream stream2 = new UndisposableStream(stream);
			if (!Processor.IsDumpStream(stream2))
			{
				using (StreamReader streamReader = new StreamReader(stream2))
				{
					string code = streamReader.ReadToEnd();
					return LoadString(code, globalTable, codeFriendlyName);
				}
			}
			string text = string.Format("{0}", codeFriendlyName ?? ("dump_" + m_Sources.Count));
			SourceCode sourceCode = new SourceCode(codeFriendlyName ?? text, $"-- This script was decoded from a binary dump - dump_{m_Sources.Count}", m_Sources.Count, this);
			m_Sources.Add(sourceCode);
			bool hasUpvalues;
			int address = m_MainProcessor.Undump(stream2, m_Sources.Count - 1, globalTable ?? m_GlobalTable, out hasUpvalues);
			SignalSourceCodeChange(sourceCode);
			SignalByteCodeChange();
			if (hasUpvalues)
			{
				return MakeClosure(address, globalTable ?? m_GlobalTable);
			}
			return MakeClosure(address);
		}

		public void Dump(DynValue function, Stream stream)
		{
			this.CheckScriptOwnership(function);
			if (function.Type != DataType.Function)
			{
				throw new ArgumentException("function arg is not a function!");
			}
			if (!stream.CanWrite)
			{
				throw new ArgumentException("stream is readonly!");
			}
			Closure.UpvaluesType upvaluesType = function.Function.GetUpvaluesType();
			if (upvaluesType == Closure.UpvaluesType.Closure)
			{
				throw new ArgumentException("function arg has upvalues other than _ENV");
			}
			UndisposableStream stream2 = new UndisposableStream(stream);
			m_MainProcessor.Dump(stream2, function.Function.EntryPointByteCodeLocation, upvaluesType == Closure.UpvaluesType.Environment);
		}

		public DynValue LoadFile(string filename, Table globalContext = null, string friendlyFilename = null)
		{
			this.CheckScriptOwnership(globalContext);
			filename = Options.ScriptLoader.ResolveFileName(filename, globalContext ?? m_GlobalTable);
			object obj = Options.ScriptLoader.LoadFile(filename, globalContext ?? m_GlobalTable);
			if (obj is string)
			{
				return LoadString((string)obj, globalContext, friendlyFilename ?? filename);
			}
			if (obj is byte[])
			{
				using (MemoryStream stream = new MemoryStream((byte[])obj))
				{
					return LoadStream(stream, globalContext, friendlyFilename ?? filename);
				}
			}
			if (obj is Stream)
			{
				try
				{
					return LoadStream((Stream)obj, globalContext, friendlyFilename ?? filename);
				}
				finally
				{
					((Stream)obj).Dispose();
				}
			}
			if (obj == null)
			{
				throw new InvalidCastException("Unexpected null from IScriptLoader.LoadFile");
			}
			throw new InvalidCastException($"Unsupported return type from IScriptLoader.LoadFile : {obj.GetType()}");
		}

		public DynValue DoString(string code, Table globalContext = null, string codeFriendlyName = null)
		{
			DynValue function = LoadString(code, globalContext, codeFriendlyName);
			return Call(function);
		}

		public DynValue DoStream(Stream stream, Table globalContext = null, string codeFriendlyName = null)
		{
			DynValue function = LoadStream(stream, globalContext, codeFriendlyName);
			return Call(function);
		}

		public DynValue DoFile(string filename, Table globalContext = null, string codeFriendlyName = null)
		{
			DynValue function = LoadFile(filename, globalContext, codeFriendlyName);
			return Call(function);
		}

		public static DynValue RunFile(string filename)
		{
			return new Script().DoFile(filename);
		}

		public static DynValue RunString(string code)
		{
			return new Script().DoString(code);
		}

		private DynValue MakeClosure(int address, Table envTable = null)
		{
			this.CheckScriptOwnership(envTable);
			Closure function;
			if (envTable == null)
			{
				Instruction instruction = m_MainProcessor.FindMeta(ref address);
				function = ((instruction == null || instruction.NumVal2 != 0) ? new Closure(this, address, new SymbolRef[0], new DynValue[0]) : new Closure(this, address, new SymbolRef[1] { SymbolRef.Upvalue("_ENV", 0) }, new DynValue[1] { instruction.Value }));
			}
			else
			{
				SymbolRef[] symbols = new SymbolRef[1]
				{
					new SymbolRef
					{
						i_Env = null,
						i_Index = 0,
						i_Name = "_ENV",
						i_Type = SymbolRefType.DefaultEnv
					}
				};
				DynValue[] resolvedLocals = new DynValue[1] { DynValue.NewTable(envTable) };
				function = new Closure(this, address, symbols, resolvedLocals);
			}
			return DynValue.NewClosure(function);
		}

		public DynValue Call(DynValue function)
		{
			return Call(function, new DynValue[0]);
		}

		public DynValue Call(DynValue function, params DynValue[] args)
		{
			this.CheckScriptOwnership(function);
			this.CheckScriptOwnership(args);
			if (function.Type != DataType.Function && function.Type != DataType.ClrFunction)
			{
				DynValue metamethod = m_MainProcessor.GetMetamethod(function, "__call");
				if (metamethod == null)
				{
					throw new ArgumentException("function is not a function and has no __call metamethod.");
				}
				DynValue[] array = new DynValue[args.Length + 1];
				array[0] = function;
				for (int i = 0; i < args.Length; i++)
				{
					array[i + 1] = args[i];
				}
				function = metamethod;
				args = array;
			}
			else if (function.Type == DataType.ClrFunction)
			{
				return function.Callback.ClrCallback(CreateDynamicExecutionContext(function.Callback), new CallbackArguments(args, isMethodCall: false));
			}
			return m_MainProcessor.Call(function, args);
		}

		public DynValue Call(DynValue function, params object[] args)
		{
			DynValue[] array = new DynValue[args.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = DynValue.FromObject(this, args[i]);
			}
			return Call(function, array);
		}

		public DynValue Call(object function)
		{
			return Call(DynValue.FromObject(this, function));
		}

		public DynValue Call(object function, params object[] args)
		{
			return Call(DynValue.FromObject(this, function), args);
		}

		public DynValue CreateCoroutine(DynValue function)
		{
			this.CheckScriptOwnership(function);
			if (function.Type == DataType.Function)
			{
				return m_MainProcessor.Coroutine_Create(function.Function);
			}
			if (function.Type == DataType.ClrFunction)
			{
				return DynValue.NewCoroutine(new Coroutine(function.Callback));
			}
			throw new ArgumentException("function is not of DataType.Function or DataType.ClrFunction");
		}

		public DynValue CreateCoroutine(object function)
		{
			return CreateCoroutine(DynValue.FromObject(this, function));
		}

		public void AttachDebugger(IDebugger debugger)
		{
			DebuggerEnabled = true;
			m_Debugger = debugger;
			m_MainProcessor.AttachDebugger(debugger);
			foreach (SourceCode source in m_Sources)
			{
				SignalSourceCodeChange(source);
			}
			SignalByteCodeChange();
		}

		public SourceCode GetSourceCode(int sourceCodeID)
		{
			return m_Sources[sourceCodeID];
		}

		public DynValue RequireModule(string modname, Table globalContext = null)
		{
			this.CheckScriptOwnership(globalContext);
			Table globalContext2 = globalContext ?? m_GlobalTable;
			string text = Options.ScriptLoader.ResolveModuleName(modname, globalContext2);
			if (text == null)
			{
				throw new ScriptRuntimeException("module '{0}' not found", modname);
			}
			return LoadFile(text, globalContext, text);
		}

		public Table GetTypeMetatable(DataType type)
		{
			if (type >= DataType.Nil && (int)type < m_TypeMetatables.Length)
			{
				return m_TypeMetatables[(int)type];
			}
			return null;
		}

		public void SetTypeMetatable(DataType type, Table metatable)
		{
			this.CheckScriptOwnership(metatable);
			int num = (int)type;
			if (num >= 0 && num < m_TypeMetatables.Length)
			{
				m_TypeMetatables[num] = metatable;
				return;
			}
			throw new ArgumentException("Specified type not supported : " + type);
		}

		public static void WarmUp()
		{
			new Script(CoreModules.Basic).LoadString("return 1;");
		}

		public DynamicExpression CreateDynamicExpression(string code)
		{
			DynamicExprExpression expr = Loader_Fast.LoadDynamicExpr(this, new SourceCode("__dynamic", code, -1, this));
			return new DynamicExpression(this, code, expr);
		}

		public DynamicExpression CreateConstantDynamicExpression(string code, DynValue constant)
		{
			this.CheckScriptOwnership(constant);
			return new DynamicExpression(this, code, constant);
		}

		internal ScriptExecutionContext CreateDynamicExecutionContext(CallbackFunction func = null)
		{
			return new ScriptExecutionContext(m_MainProcessor, func, null, isDynamic: true);
		}

		public static string GetBanner(string subproduct = null)
		{
			subproduct = ((subproduct != null) ? (subproduct + " ") : "");
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine(string.Format("MoonSharp {0}{1} [{2}]", subproduct, "2.0.0.0", GlobalOptions.Platform.GetPlatformName()));
			stringBuilder.AppendLine("Copyright (C) 2014-2016 Marco Mastropaolo");
			stringBuilder.AppendLine("http://www.moonsharp.org");
			return stringBuilder.ToString();
		}
	}
	public class Table : RefIdObject, IScriptPrivateResource
	{
		private readonly LinkedList<TablePair> m_Values;

		private readonly LinkedListIndex<DynValue, TablePair> m_ValueMap;

		private readonly LinkedListIndex<string, TablePair> m_StringMap;

		private readonly LinkedListIndex<int, TablePair> m_ArrayMap;

		private readonly Script m_Owner;

		private int m_InitArray;

		private int m_CachedLength = -1;

		private bool m_ContainsNilEntries;

		private Table m_MetaTable;

		public Script OwnerScript => m_Owner;

		public object this[params object[] keys]
		{
			get
			{
				return Get(keys).ToObject();
			}
			set
			{
				Set(keys, DynValue.FromObject(OwnerScript, value));
			}
		}

		public object this[object key]
		{
			get
			{
				return Get(key).ToObject();
			}
			set
			{
				Set(key, DynValue.FromObject(OwnerScript, value));
			}
		}

		public int Length
		{
			get
			{
				if (m_CachedLength < 0)
				{
					m_CachedLength = 0;
					for (int i = 1; m_ArrayMap.ContainsKey(i) && !m_ArrayMap.Find(i).Value.Value.IsNil(); i++)
					{
						m_CachedLength = i;
					}
				}
				return m_CachedLength;
			}
		}

		public Table MetaTable
		{
			get
			{
				return m_MetaTable;
			}
			set
			{
				this.CheckScriptOwnership(m_MetaTable);
				m_MetaTable = value;
			}
		}

		public IEnumerable<TablePair> Pairs => m_Values.Select((TablePair n) => new TablePair(n.Key, n.Value));

		public IEnumerable<DynValue> Keys => m_Values.Select((TablePair n) => n.Key);

		public IEnumerable<DynValue> Values => m_Values.Select((TablePair n) => n.Value);

		public Table(Script owner)
		{
			m_Values = new LinkedList<TablePair>();
			m_StringMap = new LinkedListIndex<string, TablePair>(m_Values);
			m_ArrayMap = new LinkedListIndex<int, TablePair>(m_Values);
			m_ValueMap = new LinkedListIndex<DynValue, TablePair>(m_Values);
			m_Owner = owner;
		}

		public Table(Script owner, params DynValue[] arrayValues)
			: this(owner)
		{
			for (int i = 0; i < arrayValues.Length; i++)
			{
				Set(DynValue.NewNumber(i + 1), arrayValues[i]);
			}
		}

		public void Clear()
		{
			m_Values.Clear();
			m_StringMap.Clear();
			m_ArrayMap.Clear();
			m_ValueMap.Clear();
			m_CachedLength = -1;
		}

		private int GetIntegralKey(double d)
		{
			int num = (int)d;
			if (d >= 1.0 && d == (double)num)
			{
				return num;
			}
			return -1;
		}

		private Table ResolveMultipleKeys(object[] keys, out object key)
		{
			Table table = this;
			key = ((keys.Length != 0) ? keys[0] : null);
			for (int i = 1; i < keys.Length; i++)
			{
				DynValue obj = table.RawGet(key) ?? throw new ScriptRuntimeException("Key '{0}' did not point to anything");
				if (obj.Type != DataType.Table)
				{
					throw new ScriptRuntimeException("Key '{0}' did not point to a table");
				}
				table = obj.Table;
				key = keys[i];
			}
			return table;
		}

		public void Append(DynValue value)
		{
			this.CheckScriptOwnership(value);
			PerformTableSet(m_ArrayMap, Length + 1, DynValue.NewNumber(Length + 1), value, isNumber: true, Length + 1);
		}

		private void PerformTableSet<T>(LinkedListIndex<T, TablePair> listIndex, T key, DynValue keyDynValue, DynValue value, bool isNumber, int appendKey)
		{
			TablePair tablePair = listIndex.Set(key, new TablePair(keyDynValue, value));
			if (m_ContainsNilEntries && value.IsNotNil() && (tablePair.Value == null || tablePair.Value.IsNil()))
			{
				CollectDeadKeys();
			}
			else if (value.IsNil())
			{
				m_ContainsNilEntries = true;
				if (isNumber)
				{
					m_CachedLength = -1;
				}
			}
			else
			{
				if (!isNumber || (tablePair.Value != null && !tablePair.Value.IsNilOrNan()))
				{
					return;
				}
				if (appendKey >= 0)
				{
					LinkedListNode<TablePair> linkedListNode = m_ArrayMap.Find(appendKey + 1);
					if (linkedListNode == null || linkedListNode.Value.Value == null || linkedListNode.Value.Value.IsNil())
					{
						m_CachedLength++;
					}
					else
					{
						m_CachedLength = -1;
					}
				}
				else
				{
					m_CachedLength = -1;
				}
			}
		}

		public void Set(string key, DynValue value)
		{
			if (key == null)
			{
				throw ScriptRuntimeException.TableIndexIsNil();
			}
			this.CheckScriptOwnership(value);
			PerformTableSet(m_StringMap, key, DynValue.NewString(key), value, isNumber: false, -1);
		}

		public void Set(int key, DynValue value)
		{
			this.CheckScriptOwnership(value);
			PerformTableSet(m_ArrayMap, key, DynValue.NewNumber(key), value, isNumber: true, -1);
		}

		public void Set(DynValue key, DynValue value)
		{
			if (key.IsNilOrNan())
			{
				if (key.IsNil())
				{
					throw ScriptRuntimeException.TableIndexIsNil();
				}
				throw ScriptRuntimeException.TableIndexIsNaN();
			}
			if (key.Type == DataType.String)
			{
				Set(key.String, value);
				return;
			}
			if (key.Type == DataType.Number)
			{
				int integralKey = GetIntegralKey(key.Number);
				if (integralKey > 0)
				{
					Set(integralKey, value);
					return;
				}
			}
			this.CheckScriptOwnership(key);
			this.CheckScriptOwnership(value);
			PerformTableSet(m_ValueMap, key, key, value, isNumber: false, -1);
		}

		public void Set(object key, DynValue value)
		{
			if (key == null)
			{
				throw ScriptRuntimeException.TableIndexIsNil();
			}
			if (key is string)
			{
				Set((string)key, value);
			}
			else if (key is int)
			{
				Set((int)key, value);
			}
			else
			{
				Set(DynValue.FromObject(OwnerScript, key), value);
			}
		}

		public void Set(object[] keys, DynValue value)
		{
			if (keys == null || keys.Length == 0)
			{
				throw ScriptRuntimeException.TableIndexIsNil();
			}
			ResolveMultipleKeys(keys, out var key).Set(key, value);
		}

		public DynValue Get(string key)
		{
			return RawGet(key) ?? DynValue.Nil;
		}

		public DynValue Get(int key)
		{
			return RawGet(key) ?? DynValue.Nil;
		}

		public DynValue Get(DynValue key)
		{
			return RawGet(key) ?? DynValue.Nil;
		}

		public DynValue Get(object key)
		{
			return RawGet(key) ?? DynValue.Nil;
		}

		public DynValue Get(params object[] keys)
		{
			return RawGet(keys) ?? DynValue.Nil;
		}

		private static DynValue RawGetValue(LinkedListNode<TablePair> linkedListNode)
		{
			return linkedListNode?.Value.Value;
		}

		public DynValue RawGet(string key)
		{
			return RawGetValue(m_StringMap.Find(key));
		}

		public DynValue RawGet(int key)
		{
			return RawGetValue(m_ArrayMap.Find(key));
		}

		public DynValue RawGet(DynValue key)
		{
			if (key.Type == DataType.String)
			{
				return RawGet(key.String);
			}
			if (key.Type == DataType.Number)
			{
				int integralKey = GetIntegralKey(key.Number);
				if (integralKey > 0)
				{
					return RawGet(integralKey);
				}
			}
			return RawGetValue(m_ValueMap.Find(key));
		}

		public DynValue RawGet(object key)
		{
			if (key == null)
			{
				return null;
			}
			if (key is string)
			{
				return RawGet((string)key);
			}
			if (key is int)
			{
				return RawGet((int)key);
			}
			return RawGet(DynValue.FromObject(OwnerScript, key));
		}

		public DynValue RawGet(params object[] keys)
		{
			if (keys == null || keys.Length == 0)
			{
				return null;
			}
			object key;
			return ResolveMultipleKeys(keys, out key).RawGet(key);
		}

		private bool PerformTableRemove<T>(LinkedListIndex<T, TablePair> listIndex, T key, bool isNumber)
		{
			bool num = listIndex.Remove(key);
			if (num && isNumber)
			{
				m_CachedLength = -1;
			}
			return num;
		}

		public bool Remove(string key)
		{
			return PerformTableRemove(m_StringMap, key, isNumber: false);
		}

		public bool Remove(int key)
		{
			return PerformTableRemove(m_ArrayMap, key, isNumber: true);
		}

		public bool Remove(DynValue key)
		{
			if (key.Type == DataType.String)
			{
				return Remove(key.String);
			}
			if (key.Type == DataType.Number)
			{
				int integralKey = GetIntegralKey(key.Number);
				if (integralKey > 0)
				{
					return Remove(integralKey);
				}
			}
			return PerformTableRemove(m_ValueMap, key, isNumber: false);
		}

		public bool Remove(object key)
		{
			if (key is string)
			{
				return Remove((string)key);
			}
			if (key is int)
			{
				return Remove((int)key);
			}
			return Remove(DynValue.FromObject(OwnerScript, key));
		}

		public bool Remove(params object[] keys)
		{
			if (keys == null || keys.Length == 0)
			{
				return false;
			}
			object key;
			return ResolveMultipleKeys(keys, out key).Remove(key);
		}

		public void CollectDeadKeys()
		{
			for (LinkedListNode<TablePair> linkedListNode = m_Values.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
			{
				if (linkedListNode.Value.Value.IsNil())
				{
					Remove(linkedListNode.Value.Key);
				}
			}
			m_ContainsNilEntries = false;
			m_CachedLength = -1;
		}

		public TablePair? NextKey(DynValue v)
		{
			if (v.IsNil())
			{
				LinkedListNode<TablePair> first = m_Values.First;
				if (first == null)
				{
					return TablePair.Nil;
				}
				if (first.Value.Value.IsNil())
				{
					return NextKey(first.Value.Key);
				}
				return first.Value;
			}
			if (v.Type == DataType.String)
			{
				return GetNextOf(m_StringMap.Find(v.String));
			}
			if (v.Type == DataType.Number)
			{
				int integralKey = GetIntegralKey(v.Number);
				if (integralKey > 0)
				{
					return GetNextOf(m_ArrayMap.Find(integralKey));
				}
			}
			return GetNextOf(m_ValueMap.Find(v));
		}

		private TablePair? GetNextOf(LinkedListNode<TablePair> linkedListNode)
		{
			do
			{
				if (linkedListNode == null)
				{
					return null;
				}
				if (linkedListNode.Next == null)
				{
					return TablePair.Nil;
				}
				linkedListNode = linkedListNode.Next;
			}
			while (linkedListNode.Value.Value.IsNil());
			return linkedListNode.Value;
		}

		internal void InitNextArrayKeys(DynValue val, bool lastpos)
		{
			if (val.Type == DataType.Tuple && lastpos)
			{
				DynValue[] tuple = val.Tuple;
				foreach (DynValue val2 in tuple)
				{
					InitNextArrayKeys(val2, lastpos: true);
				}
			}
			else
			{
				Set(++m_InitArray, val.ToScalar());
			}
		}
	}
	[Flags]
	public enum CoreModules
	{
		None = 0,
		Basic = 0x40,
		GlobalConsts = 1,
		TableIterators = 2,
		Metatables = 4,
		String = 8,
		LoadMethods = 0x10,
		Table = 0x20,
		ErrorHandling = 0x80,
		Math = 0x100,
		Coroutine = 0x200,
		Bit32 = 0x400,
		OS_Time = 0x800,
		OS_System = 0x1000,
		IO = 0x2000,
		Debug = 0x4000,
		Dynamic = 0x8000,
		Json = 0x10000,
		Preset_HardSandbox = 0x56B,
		Preset_SoftSandbox = 0x18FEF,
		Preset_Default = 0x1BFFF,
		Preset_Complete = 0x1FFFF
	}
	internal static class CoreModules_ExtensionMethods
	{
		public static bool Has(this CoreModules val, CoreModules flag)
		{
			return (val & flag) == flag;
		}
	}
	public static class ModuleRegister
	{
		public static Table RegisterCoreModules(this Table table, CoreModules modules)
		{
			modules = Script.GlobalOptions.Platform.FilterSupportedCoreModules(modules);
			if (modules.Has(CoreModules.GlobalConsts))
			{
				table.RegisterConstants();
			}
			if (modules.Has(CoreModules.TableIterators))
			{
				table.RegisterModuleType<TableIteratorsModule>();
			}
			if (modules.Has(CoreModules.Basic))
			{
				table.RegisterModuleType<BasicModule>();
			}
			if (modules.Has(CoreModules.Metatables))
			{
				table.RegisterModuleType<MetaTableModule>();
			}
			if (modules.Has(CoreModules.String))
			{
				table.RegisterModuleType<StringModule>();
			}
			if (modules.Has(CoreModules.LoadMethods))
			{
				table.RegisterModuleType<LoadModule>();
			}
			if (modules.Has(CoreModules.Table))
			{
				table.RegisterModuleType<TableModule>();
			}
			if (modules.Has(CoreModules.Table))
			{
				table.RegisterModuleType<TableModule_Globals>();
			}
			if (modules.Has(CoreModules.ErrorHandling))
			{
				table.RegisterModuleType<ErrorHandlingModule>();
			}
			if (modules.Has(CoreModules.Math))
			{
				table.RegisterModuleType<MathModule>();
			}
			if (modules.Has(CoreModules.Coroutine))
			{
				table.RegisterModuleType<CoroutineModule>();
			}
			if (modules.Has(CoreModules.Bit32))
			{
				table.RegisterModuleType<Bit32Module>();
			}
			if (modules.Has(CoreModules.Dynamic))
			{
				table.RegisterModuleType<DynamicModule>();
			}
			if (modules.Has(CoreModules.OS_System))
			{
				table.RegisterModuleType<OsSystemModule>();
			}
			if (modules.Has(CoreModules.OS_Time))
			{
				table.RegisterModuleType<OsTimeModule>();
			}
			if (modules.Has(CoreModules.IO))
			{
				table.RegisterModuleType<IoModule>();
			}
			if (modules.Has(CoreModules.Debug))
			{
				table.RegisterModuleType<DebugModule>();
			}
			if (modules.Has(CoreModules.Json))
			{
				table.RegisterModuleType<JsonModule>();
			}
			return table;
		}

		public static Table RegisterConstants(this Table table)
		{
			DynValue dynValue = DynValue.NewTable(table.OwnerScript);
			Table table2 = dynValue.Table;
			table.Set("_G", DynValue.NewTable(table));
			table.Set("_VERSION", DynValue.NewString(string.Format("MoonSharp {0}", "2.0.0.0")));
			table.Set("_MOONSHARP", dynValue);
			table2.Set("version", DynValue.NewString("2.0.0.0"));
			table2.Set("luacompat", DynValue.NewString("5.2"));
			table2.Set("platform", DynValue.NewString(Script.GlobalOptions.Platform.GetPlatformName()));
			table2.Set("is_aot", DynValue.NewBoolean(Script.GlobalOptions.Platform.IsRunningOnAOT()));
			table2.Set("is_unity", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnUnity));
			table2.Set("is_mono", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnMono));
			table2.Set("is_clr4", DynValue.NewBoolean(PlatformAutoDetector.IsRunningOnClr4));
			table2.Set("is_pcl", DynValue.NewBoolean(PlatformAutoDetector.IsPortableFramework));
			table2.Set("banner", DynValue.NewString(Script.GetBanner()));
			return table;
		}

		public static Table RegisterModuleType(this Table gtable, Type t)
		{
			Table table = CreateModuleNamespace(gtable, t);
			foreach (MethodInfo item in from __mi in Framework.Do.GetMethods(t)
				where __mi.IsStatic
				select __mi)
			{
				if (item.GetCustomAttributes(typeof(MoonSharpModuleMethodAttribute), inherit: false).ToArray().Length != 0)
				{
					MoonSharpModuleMethodAttribute moonSharpModuleMethodAttribute = (MoonSharpModuleMethodAttribute)item.GetCustomAttributes(typeof(MoonSharpModuleMethodAttribute), inherit: false).First();
					if (!CallbackFunction.CheckCallbackSignature(item, requirePublicVisibility: true))
					{
						throw new ArgumentException($"Method {item.Name} does not have the right signature.");
					}
					Func<ScriptExecutionContext, CallbackArguments, DynValue> callBack = (Func<ScriptExecutionContext, CallbackArguments, DynValue>)Delegate.CreateDelegate(typeof(Func<ScriptExecutionContext, CallbackArguments, DynValue>), item);
					string text = ((!string.IsNullOrEmpty(moonSharpModuleMethodAttribute.Name)) ? moonSharpModuleMethodAttribute.Name : item.Name);
					table.Set(text, DynValue.NewCallback(callBack, text));
				}
				else if (item.Name == "MoonSharpInit")
				{
					object[] parameters = new object[2] { gtable, table };
					item.Invoke(null, parameters);
				}
			}
			foreach (FieldInfo item2 in from _mi in Framework.Do.GetFields(t)
				where _mi.IsStatic && _mi.GetCustomAttributes(typeof(MoonSharpModuleMethodAttribute), inherit: false).ToArray().Length != 0
				select _mi)
			{
				MoonSharpModuleMethodAttribute moonSharpModuleMethodAttribute2 = (MoonSharpModuleMethodAttribute)item2.GetCustomAttributes(typeof(MoonSharpModuleMethodAttribute), inherit: false).First();
				string name = ((!string.IsNullOrEmpty(moonSharpModuleMethodAttribute2.Name)) ? moonSharpModuleMethodAttribute2.Name : item2.Name);
				RegisterScriptField(item2, null, table, t, name);
			}
			foreach (FieldInfo item3 in from _mi in Framework.Do.GetFields(t)
				where _mi.IsStatic && _mi.GetCustomAttributes(typeof(MoonSharpModuleConstantAttribute), inherit: false).ToArray().Length != 0
				select _mi)
			{
				MoonSharpModuleConstantAttribute moonSharpModuleConstantAttribute = (MoonSharpModuleConstantAttribute)item3.GetCustomAttributes(typeof(MoonSharpModuleConstantAttribute), inherit: false).First();
				string name2 = ((!string.IsNullOrEmpty(moonSharpModuleConstantAttribute.Name)) ? moonSharpModuleConstantAttribute.Name : item3.Name);
				RegisterScriptFieldAsConst(item3, null, table, t, name2);
			}
			return gtable;
		}

		private static void RegisterScriptFieldAsConst(FieldInfo fi, object o, Table table, Type t, string name)
		{
			if (fi.FieldType == typeof(string))
			{
				string str = fi.GetValue(o) as string;
				table.Set(name, DynValue.NewString(str));
				return;
			}
			if (fi.FieldType == typeof(double))
			{
				double num = (double)fi.GetValue(o);
				table.Set(name, DynValue.NewNumber(num));
				return;
			}
			throw new ArgumentException($"Field {name} does not have the right type - it must be string or double.");
		}

		private static void RegisterScriptField(FieldInfo fi, object o, Table table, Type t, string name)
		{
			if (fi.FieldType != typeof(string))
			{
				throw new ArgumentException($"Field {name} does not have the right type - it must be string.");
			}
			string code = fi.GetValue(o) as string;
			DynValue value = table.OwnerScript.LoadFunction(code, table, name);
			table.Set(name, value);
		}

		private static Table CreateModuleNamespace(Table gtable, Type t)
		{
			MoonSharpModuleAttribute moonSharpModuleAttribute = (MoonSharpModuleAttribute)Framework.Do.GetCustomAttributes(t, typeof(MoonSharpModuleAttribute), inherit: false).First();
			if (string.IsNullOrEmpty(moonSharpModuleAttribute.Namespace))
			{
				return gtable;
			}
			Table table = null;
			DynValue dynValue = gtable.Get(moonSharpModuleAttribute.Namespace);
			if (dynValue.Type == DataType.Table)
			{
				table = dynValue.Table;
			}
			else
			{
				table = new Table(gtable.OwnerScript);
				gtable.Set(moonSharpModuleAttribute.Namespace, DynValue.NewTable(table));
			}
			DynValue dynValue2 = gtable.RawGet("package");
			if (dynValue2 == null || dynValue2.Type != DataType.Table)
			{
				gtable.Set("package", dynValue2 = DynValue.NewTable(gtable.OwnerScript));
			}
			DynValue dynValue3 = dynValue2.Table.RawGet("loaded");
			if (dynValue3 == null || dynValue3.Type != DataType.Table)
			{
				dynValue2.Table.Set("loaded", dynValue3 = DynValue.NewTable(gtable.OwnerScript));
			}
			dynValue3.Table.Set(moonSharpModuleAttribute.Namespace, DynValue.NewTable(table));
			return table;
		}

		public static Table RegisterModuleType<T>(this Table table)
		{
			return table.RegisterModuleType(typeof(T));
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
	public sealed class MoonSharpModuleMethodAttribute : Attribute
	{
		public string Name { get; set; }
	}
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	public sealed class MoonSharpModuleAttribute : Attribute
	{
		public string Namespace { get; set; }
	}
	public class ScriptGlobalOptions
	{
		public CustomConvertersCollection CustomConverters { get; set; }

		public IPlatformAccessor Platform { get; set; }

		public bool RethrowExceptionNested { get; set; }

		internal ScriptGlobalOptions()
		{
			Platform = PlatformAutoDetector.GetDefaultPlatform();
			CustomConverters = new CustomConvertersCollection();
		}
	}
	public class ScriptOptions
	{
		public IScriptLoader ScriptLoader { get; set; }

		public Action<string> DebugPrint { get; set; }

		public Func<string, string> DebugInput { get; set; }

		public bool Us

Mods/MoonSharp.RemoteDebugger.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Xml;
using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Debugging;
using MoonSharp.RemoteDebugger.Network;
using MoonSharp.RemoteDebugger.Threading;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MoonSharp.RemoteDebugger")]
[assembly: AssemblyDescription("Remote Debugger for the MoonSharp interpreter")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("http://www.moonsharp.org")]
[assembly: AssemblyProduct("MoonSharp.Debugger")]
[assembly: AssemblyCopyright("Copyright © 2014-2015, Marco Mastropaolo")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace MoonSharp.RemoteDebugger
{
	public class DebugServer : IDebugger, IDisposable
	{
		private List<DynamicExpression> m_Watches = new List<DynamicExpression>();

		private HashSet<string> m_WatchesChanging = new HashSet<string>();

		private Utf8TcpServer m_Server;

		private Script m_Script;

		private string m_AppName;

		private object m_Lock = new object();

		private BlockingQueue<DebuggerAction> m_QueuedActions = new BlockingQueue<DebuggerAction>();

		private SourceRef m_LastSentSourceRef;

		private bool m_InGetActionLoop;

		private bool m_HostBusySent;

		private bool m_RequestPause;

		private string[] m_CachedWatches = new string[6];

		private bool m_FreeRunAfterAttach;

		private Regex m_ErrorRegEx = new Regex("\\A.*\\Z");

		public string AppName => m_AppName;

		public int Port => m_Server.PortNumber;

		public DebugServer(string appName, Script script, int port, Utf8TcpServerOptions options, bool freeRunAfterAttach)
		{
			m_AppName = appName;
			m_Server = new Utf8TcpServer(port, 1048576, '\0', options);
			m_Server.Start();
			m_Server.DataReceived += m_Server_DataReceived;
			m_Script = script;
			m_FreeRunAfterAttach = freeRunAfterAttach;
		}

		public string GetState()
		{
			if (m_HostBusySent)
			{
				return "Busy";
			}
			if (m_InGetActionLoop)
			{
				return "Waiting debugger";
			}
			return "Unknown";
		}

		public int ConnectedClients()
		{
			return m_Server.GetConnectedClients();
		}

		public void SetSourceCode(SourceCode sourceCode)
		{
			Send(delegate(XmlWriter xw)
			{
				using (xw.Element("source-code"))
				{
					xw.Attribute("id", sourceCode.SourceID).Attribute("name", sourceCode.Name);
					string[] lines = sourceCode.Lines;
					foreach (string line in lines)
					{
						xw.ElementCData("l", EpurateNewLines(line));
					}
				}
			});
		}

		private string EpurateNewLines(string line)
		{
			return line.Replace('\n', ' ').Replace('\r', ' ');
		}

		private void Send(Action<XmlWriter> a)
		{
			XmlWriterSettings settings = new XmlWriterSettings
			{
				CheckCharacters = true,
				CloseOutput = true,
				ConformanceLevel = ConformanceLevel.Fragment,
				Encoding = Encoding.UTF8,
				Indent = false
			};
			StringBuilder stringBuilder = new StringBuilder();
			XmlWriter xmlWriter = XmlWriter.Create(stringBuilder, settings);
			a(xmlWriter);
			xmlWriter.Close();
			string message = stringBuilder.ToString();
			m_Server.BroadcastMessage(message);
		}

		private void SendWelcome()
		{
			Send(delegate(XmlWriter xw)
			{
				using (xw.Element("welcome"))
				{
					xw.Attribute("app", m_AppName).Attribute("moonsharpver", Assembly.GetAssembly(typeof(Script)).GetName().Version.ToString());
				}
			});
			SendOption("error_rx", m_ErrorRegEx.ToString());
		}

		public void Update(WatchType watchType, IEnumerable<WatchItem> items)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected I4, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)watchType != 2 && (int)watchType != 0)
			{
				return;
			}
			int num = (int)watchType;
			string text = string.Join("|", items.Select((WatchItem l) => ((object)l).ToString()).ToArray());
			if (m_CachedWatches[num] != null && !(m_CachedWatches[num] != text))
			{
				return;
			}
			m_CachedWatches[num] = text;
			Send(delegate(XmlWriter xw)
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Invalid comparison between Unknown and I4
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				using (xw.Element(((object)(WatchType)(ref watchType)).ToString().ToLowerInvariant()))
				{
					foreach (WatchItem item in items)
					{
						using (xw.Element("item"))
						{
							if (item.Name == null)
							{
								if ((int)watchType == 2)
								{
									xw.Attribute("name", (item.RetAddress < 0) ? "<chunk-root>" : "<??unknown??>");
								}
								else
								{
									xw.Attribute("name", "(null name ??)");
								}
							}
							else
							{
								xw.Attribute("name", item.Name);
							}
							if (item.Value != null)
							{
								xw.Attribute("value", ((object)item.Value).ToString());
								xw.Attribute("type", item.IsError ? "error" : LuaTypeExtensions.ToLuaDebuggerString(item.Value.Type));
							}
							xw.Attribute("address", item.Address.ToString("X8"));
							xw.Attribute("baseptr", item.BasePtr.ToString("X8"));
							xw.Attribute("lvalue", item.LValue);
							xw.Attribute("retaddress", item.RetAddress.ToString("X8"));
						}
					}
				}
			});
		}

		public void SetByteCode(string[] byteCode)
		{
		}

		public void QueueAction(DebuggerAction action)
		{
			m_QueuedActions.Enqueue(action);
		}

		public DebuggerAction GetAction(int ip, SourceRef sourceref)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Invalid comparison between Unknown and I4
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Invalid comparison between Unknown and I4
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Invalid comparison between Unknown and I4
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Invalid comparison between Unknown and I4
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Invalid comparison between Unknown and I4
			try
			{
				if (m_FreeRunAfterAttach)
				{
					m_FreeRunAfterAttach = false;
					return new DebuggerAction
					{
						Action = (ActionType)6
					};
				}
				m_InGetActionLoop = true;
				m_RequestPause = false;
				if (m_HostBusySent)
				{
					m_HostBusySent = false;
					SendMessage("Host ready!");
				}
				if (sourceref != m_LastSentSourceRef)
				{
					Send(delegate(XmlWriter xw)
					{
						SendSourceRef(xw, sourceref);
					});
				}
				DebuggerAction val;
				do
				{
					val = m_QueuedActions.Dequeue();
					if ((int)val.Action == 11 || (int)val.Action == 12)
					{
						lock (m_Lock)
						{
							HashSet<string> existing = new HashSet<string>();
							m_Watches.RemoveAll((DynamicExpression de) => !m_WatchesChanging.Contains(de.ExpressionCode));
							existing.UnionWith(m_Watches.Select((DynamicExpression de) => de.ExpressionCode));
							m_Watches.AddRange(from code in m_WatchesChanging
								where !existing.Contains(code)
								select CreateDynExpr(code));
						}
						return val;
					}
					if ((int)val.Action == 7 || (int)val.Action == 8 || (int)val.Action == 9)
					{
						return val;
					}
				}
				while (!(val.Age < TimeSpan.FromMilliseconds(100.0)));
				return val;
			}
			finally
			{
				m_InGetActionLoop = false;
			}
		}

		private DynamicExpression CreateDynExpr(string code)
		{
			try
			{
				return m_Script.CreateDynamicExpression(code);
			}
			catch (Exception ex)
			{
				SendMessage($"Error setting watch {code} :\n{ex.Message}");
				return m_Script.CreateConstantDynamicExpression(code, DynValue.NewString(ex.Message));
			}
		}

		private void SendSourceRef(XmlWriter xw, SourceRef sourceref)
		{
			using (xw.Element("source-loc"))
			{
				xw.Attribute("srcid", sourceref.SourceIdx).Attribute("cf", sourceref.FromChar).Attribute("ct", sourceref.ToChar)
					.Attribute("lf", sourceref.FromLine)
					.Attribute("lt", sourceref.ToLine);
			}
		}

		private void m_Server_DataReceived(object sender, Utf8TcpPeerEventArgs e)
		{
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Expected O, but got Unknown
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Expected O, but got Unknown
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.LoadXml(e.Message);
			if (xmlDocument.DocumentElement.Name == "policy-file-request")
			{
				Send(delegate(XmlWriter xw)
				{
					using (xw.Element("cross-domain-policy"))
					{
						using (xw.Element("allow-access-from"))
						{
							xw.Attribute("domain", "*");
							xw.Attribute("to-ports", m_Server.PortNumber);
						}
					}
				});
			}
			else
			{
				if (!(xmlDocument.DocumentElement.Name == "Command"))
				{
					return;
				}
				string text = xmlDocument.DocumentElement.GetAttribute("cmd").ToLowerInvariant();
				string attribute = xmlDocument.DocumentElement.GetAttribute("arg");
				switch (text)
				{
				case "handshake":
				{
					SendWelcome();
					for (int k = 0; k < m_Script.SourceCodeCount; k++)
					{
						SetSourceCode(m_Script.GetSourceCode(k));
					}
					break;
				}
				case "stepin":
					QueueAction(new DebuggerAction
					{
						Action = (ActionType)3
					});
					break;
				case "refresh":
					lock (m_Lock)
					{
						for (int i = 0; i < 6; i++)
						{
							m_CachedWatches[i] = null;
						}
					}
					QueueRefresh();
					break;
				case "run":
					QueueAction(new DebuggerAction
					{
						Action = (ActionType)6
					});
					break;
				case "stepover":
					QueueAction(new DebuggerAction
					{
						Action = (ActionType)4
					});
					break;
				case "stepout":
					QueueAction(new DebuggerAction
					{
						Action = (ActionType)5
					});
					break;
				case "pause":
					m_RequestPause = true;
					break;
				case "error_rx":
					m_ErrorRegEx = new Regex(attribute.Trim());
					SendOption("error_rx", m_ErrorRegEx.ToString());
					break;
				case "addwatch":
					lock (m_Lock)
					{
						m_WatchesChanging.UnionWith(from s in attribute.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)
							select s.Trim());
					}
					QueueRefresh();
					break;
				case "delwatch":
					lock (m_Lock)
					{
						string[] array = attribute.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
						foreach (string item in array)
						{
							m_WatchesChanging.Remove(item);
						}
					}
					QueueRefresh();
					break;
				case "breakpoint":
				{
					ActionType action = (ActionType)7;
					if (attribute == "set")
					{
						action = (ActionType)8;
					}
					else if (attribute == "clear")
					{
						action = (ActionType)9;
					}
					QueueAction(new DebuggerAction
					{
						Action = action,
						SourceID = int.Parse(xmlDocument.DocumentElement.GetAttribute("src")),
						SourceLine = int.Parse(xmlDocument.DocumentElement.GetAttribute("line")),
						SourceCol = int.Parse(xmlDocument.DocumentElement.GetAttribute("col"))
					});
					break;
				}
				}
			}
		}

		private void QueueRefresh()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			if (!m_InGetActionLoop)
			{
				SendMessage("Host busy, wait for it to become ready...");
				m_HostBusySent = true;
			}
			QueueAction(new DebuggerAction
			{
				Action = (ActionType)12
			});
		}

		private void SendOption(string optionName, string optionVal)
		{
			Send(delegate(XmlWriter xw)
			{
				using (xw.Element(optionName))
				{
					xw.Attribute("arg", optionVal);
				}
			});
		}

		private void SendMessage(string text)
		{
			Send(delegate(XmlWriter xw)
			{
				xw.ElementCData("message", text);
			});
		}

		public List<DynamicExpression> GetWatchItems()
		{
			return m_Watches;
		}

		public bool IsPauseRequested()
		{
			return m_RequestPause;
		}

		public void SignalExecutionEnded()
		{
			Send(delegate(XmlWriter xw)
			{
				xw.Element("execution-completed", "");
			});
		}

		public void RefreshBreakpoints(IEnumerable<SourceRef> refs)
		{
			Send(delegate(XmlWriter xw)
			{
				using (xw.Element("breakpoints"))
				{
					foreach (SourceRef @ref in refs)
					{
						SendSourceRef(xw, @ref);
					}
				}
			});
		}

		public bool SignalRuntimeException(ScriptRuntimeException ex)
		{
			SendMessage($"Error: {((InterpreterException)ex).DecoratedMessage}");
			m_RequestPause = m_ErrorRegEx.IsMatch(((Exception)(object)ex).Message);
			return IsPauseRequested();
		}

		public void Dispose()
		{
			m_Server.Dispose();
		}

		public void SetDebugService(DebugService debugService)
		{
		}

		public DebuggerCaps GetDebuggerCaps()
		{
			return (DebuggerCaps)1;
		}
	}
	public class DebugWebHost : HttpServer
	{
		public DebugWebHost(int port, Utf8TcpServerOptions options)
			: base(port, options)
		{
			RegisterEmbeddedResource("Main.html", HttpResourceType.Html, "Debugger");
			RegisterEmbeddedResource("Main.swf", HttpResourceType.Binary);
			RegisterEmbeddedResource("playerProductInstall.swf", HttpResourceType.Binary);
			RegisterEmbeddedResource("swfobject.js", HttpResourceType.PlainText);
			RegisterEmbeddedResource("bootstrap.min.css", HttpResourceType.Css);
			RegisterEmbeddedResource("theme.css", HttpResourceType.Css);
			RegisterEmbeddedResource("moonsharpdbg.png", HttpResourceType.Png);
			RegisterEmbeddedResource("bootstrap.min.js", HttpResourceType.Javascript);
			RegisterEmbeddedResource("jquery.min.js", HttpResourceType.Javascript);
		}

		private HttpResource RegisterEmbeddedResource(string resourceName, HttpResourceType type, string urlName = null)
		{
			urlName = urlName ?? resourceName;
			byte[] resourceData = GetResourceData(resourceName);
			HttpResource httpResource = HttpResource.CreateBinary(type, resourceData);
			RegisterResource("/" + urlName, httpResource);
			RegisterResource(urlName, httpResource);
			return httpResource;
		}

		private byte[] GetResourceData(string resourceName)
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MoonSharp.RemoteDebugger.Resources." + resourceName);
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			return array;
		}

		public string GetJumpPageText()
		{
			byte[] resourceData = GetResourceData("JumpPage.html");
			return Encoding.UTF8.GetString(resourceData);
		}
	}
	public class RemoteDebuggerService : IDisposable
	{
		private RemoteDebuggerOptions m_Options;

		private DebugWebHost m_HttpServer;

		private string m_JumpPage;

		private int m_RpcPortMax;

		private List<DebugServer> m_DebugServers = new List<DebugServer>();

		private object m_Lock = new object();

		public string HttpUrlStringLocalHost
		{
			get
			{
				if (m_HttpServer != null)
				{
					return $"http://127.0.0.1:{m_Options.HttpPort.Value}/";
				}
				return null;
			}
		}

		public RemoteDebuggerService()
			: this(RemoteDebuggerOptions.Default)
		{
		}

		public RemoteDebuggerService(RemoteDebuggerOptions options)
		{
			m_Options = options;
			if (options.HttpPort.HasValue)
			{
				Utf8TcpServerOptions options2 = options.NetworkOptions & ~Utf8TcpServerOptions.SingleClientOnly;
				m_HttpServer = new DebugWebHost(options.HttpPort.Value, options2);
				if (options.SingleScriptMode)
				{
					m_HttpServer.RegisterResource("/", HttpResource.CreateText(HttpResourceType.Html, string.Format("<html><body><iframe height='100%' width='100%' src='Debugger?port={0}'>Please follow <a href='{0}'>link</a>.</iframe></body></html>", options.RpcPortBase)));
				}
				else
				{
					m_JumpPage = m_HttpServer.GetJumpPageText();
					m_HttpServer.RegisterResource("/", HttpResource.CreateCallback(GetJumpPageData));
				}
				m_HttpServer.Start();
			}
			m_RpcPortMax = options.RpcPortBase;
		}

		private HttpResource GetJumpPageData(Dictionary<string, string> arg)
		{
			lock (m_Lock)
			{
				return HttpResource.CreateText(HttpResourceType.Html, string.Format(m_JumpPage, GetJumpHtmlFragment()));
			}
		}

		public void Attach(Script S, string scriptName, bool freeRunAfterAttach = false)
		{
			lock (m_Lock)
			{
				DebugServer debugServer = new DebugServer(scriptName, S, m_RpcPortMax, m_Options.NetworkOptions, freeRunAfterAttach);
				S.AttachDebugger((IDebugger)(object)debugServer);
				m_DebugServers.Add(debugServer);
			}
		}

		public string GetJumpHtmlFragment()
		{
			StringBuilder stringBuilder = new StringBuilder();
			lock (m_Lock)
			{
				foreach (DebugServer debugServer in m_DebugServers)
				{
					stringBuilder.AppendFormat("<tr><td><a href=\"Debugger?port={0}\">{1}</a></td><td>{2}</td><td>{3}</td><td>{0}</td></tr>\n", debugServer.Port, debugServer.AppName, debugServer.GetState(), debugServer.ConnectedClients());
				}
			}
			return stringBuilder.ToString();
		}

		public void Dispose()
		{
			m_HttpServer.Dispose();
			m_DebugServers.ForEach(delegate(DebugServer s)
			{
				s.Dispose();
			});
		}
	}
	public struct RemoteDebuggerOptions
	{
		public Utf8TcpServerOptions NetworkOptions;

		public bool SingleScriptMode;

		public int? HttpPort;

		public int RpcPortBase;

		public static RemoteDebuggerOptions Default
		{
			get
			{
				RemoteDebuggerOptions result = default(RemoteDebuggerOptions);
				result.NetworkOptions = Utf8TcpServerOptions.LocalHostOnly | Utf8TcpServerOptions.SingleClientOnly;
				result.SingleScriptMode = false;
				result.HttpPort = 2705;
				result.RpcPortBase = 2006;
				return result;
			}
		}
	}
}
namespace MoonSharp.RemoteDebugger.Threading
{
	public 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)
				{
					_stopped = true;
					Monitor.PulseAll(_queue);
				}
			}
		}
	}
}
namespace MoonSharp.RemoteDebugger.Network
{
	public class HttpResource
	{
		public HttpResourceType Type { get; private set; }

		public byte[] Data { get; private set; }

		public Func<Dictionary<string, string>, HttpResource> Callback { get; private set; }

		private HttpResource()
		{
		}

		public static HttpResource CreateBinary(HttpResourceType type, byte[] data)
		{
			return new HttpResource
			{
				Type = type,
				Data = data
			};
		}

		public static HttpResource CreateBinary(HttpResourceType type, string base64data)
		{
			return new HttpResource
			{
				Type = type,
				Data = Convert.FromBase64String(base64data)
			};
		}

		public static HttpResource CreateText(HttpResourceType type, string data)
		{
			return new HttpResource
			{
				Type = type,
				Data = Encoding.UTF8.GetBytes(data)
			};
		}

		public static HttpResource CreateCallback(Func<Dictionary<string, string>, HttpResource> callback)
		{
			return new HttpResource
			{
				Type = HttpResourceType.Callback,
				Callback = callback
			};
		}

		public string GetContentTypeString()
		{
			return Type switch
			{
				HttpResourceType.PlainText => "text/plain", 
				HttpResourceType.Html => "text/html", 
				HttpResourceType.Json => "application/json", 
				HttpResourceType.Xml => "application/xml", 
				HttpResourceType.Jpeg => "image/jpeg", 
				HttpResourceType.Png => "image/png", 
				HttpResourceType.Binary => "application/octet-stream", 
				HttpResourceType.Javascript => "application/javascript", 
				HttpResourceType.Css => "text/css", 
				_ => throw new InvalidOperationException(), 
			};
		}
	}
	public enum HttpResourceType
	{
		PlainText,
		Html,
		Xml,
		Json,
		Jpeg,
		Png,
		Binary,
		Callback,
		Css,
		Javascript
	}
	public class HttpServer : IDisposable
	{
		private Utf8TcpServer m_Server;

		private Dictionary<string, List<string>> m_HttpData = new Dictionary<string, List<string>>();

		private Dictionary<string, HttpResource> m_Resources = new Dictionary<string, HttpResource>();

		private object m_Lock = new object();

		private const string ERROR_TEMPLATE = "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><html><head><title>{0}</title></head><body><h1>{0}</h1>{1}<hr><address>MoonSharp Remote Debugger / {2}</address></body></html><!-- This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. -->";

		private static readonly string VERSION = Assembly.GetExecutingAssembly().GetName().Version.ToString();

		private readonly string ERROR_401 = string.Format("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><html><head><title>{0}</title></head><body><h1>{0}</h1>{1}<hr><address>MoonSharp Remote Debugger / {2}</address></body></html><!-- This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. -->", "401 Unauthorized", "Please login.", VERSION);

		private readonly string ERROR_404 = string.Format("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><html><head><title>{0}</title></head><body><h1>{0}</h1>{1}<hr><address>MoonSharp Remote Debugger / {2}</address></body></html><!-- This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. -->", "404 Not Found", "The specified resource cannot be found.", VERSION);

		private readonly string ERROR_500 = string.Format("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><html><head><title>{0}</title></head><body><h1>{0}</h1>{1}<hr><address>MoonSharp Remote Debugger / {2}</address></body></html><!-- This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. -->", "500 Internal Server Error", "An internal server error occurred.", VERSION);

		public Func<string, string, bool> Authenticator { get; set; }

		public HttpServer(int port, Utf8TcpServerOptions options)
		{
			m_Server = new Utf8TcpServer(port, 102400, '\n', options);
			m_Server.DataReceived += OnDataReceivedAny;
			m_Server.ClientDisconnected += OnClientDisconnected;
		}

		public void Start()
		{
			m_Server.Start();
		}

		private void OnDataReceivedAny(object sender, Utf8TcpPeerEventArgs e)
		{
			lock (m_Lock)
			{
				string text = e.Message.Replace("\n", "").Replace("\r", "");
				if (!m_HttpData.TryGetValue(e.Peer.Id, out var value))
				{
					value = new List<string>();
					m_HttpData.Add(e.Peer.Id, value);
				}
				if (text.Length == 0)
				{
					ExecHttpRequest(e.Peer, value);
					e.Peer.Disconnect();
				}
				else
				{
					value.Add(text);
				}
			}
		}

		private void SendHttp(Utf8TcpPeer peer, string responseCode, string contentType, string data, params string[] extraHeaders)
		{
			SendHttp(peer, responseCode, contentType, Encoding.UTF8.GetBytes(data), extraHeaders);
		}

		private void SendHttp(Utf8TcpPeer peer, string responseCode, string contentType, byte[] data, params string[] extraHeaders)
		{
			peer.Send("HTTP/1.0 {0}", responseCode);
			peer.Send("Server: moonsharp-remote-debugger/{0}", VERSION);
			peer.Send("Content-Type: {0}", contentType);
			peer.Send("Content-Length: {0}", data.Length);
			peer.Send("Connection: close");
			peer.Send("Cache-Control: max-age=0, no-cache");
			foreach (string message in extraHeaders)
			{
				peer.Send(message);
			}
			peer.Send("");
			peer.SendBinary(data);
		}

		private void ExecHttpRequest(Utf8TcpPeer peer, List<string> httpdata)
		{
			try
			{
				if (Authenticator != null)
				{
					string text = httpdata.FirstOrDefault((string s) => s.StartsWith("Authorization:"));
					bool flag = false;
					if (text != null)
					{
						ParseAuthenticationString(text, out var user, out var password);
						flag = Authenticator(user, password);
					}
					if (!flag)
					{
						SendHttp(peer, "401 Not Authorized", "text/html", ERROR_401, "WWW-Authenticate: Basic realm=\"moonsharp-remote-debugger\"");
						return;
					}
				}
				HttpResource resourceFromPath = GetResourceFromPath(httpdata[0]);
				if (resourceFromPath == null)
				{
					SendHttp(peer, "404 Not Found", "text/html", ERROR_404);
				}
				else
				{
					SendHttp(peer, "200 OK", resourceFromPath.GetContentTypeString(), resourceFromPath.Data);
				}
			}
			catch (Exception ex)
			{
				m_Server.Logger(ex.Message);
				try
				{
					SendHttp(peer, "500 Internal Server Error", "text/html", ERROR_500);
				}
				catch (Exception ex2)
				{
					m_Server.Logger(ex2.Message);
				}
			}
		}

		private void ParseAuthenticationString(string authstr, out string user, out string password)
		{
			user = null;
			password = null;
			string[] array = authstr.Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
			if (array.Length >= 3 && !(array[1] != "Basic"))
			{
				byte[] bytes = Convert.FromBase64String(array[2]);
				string[] array2 = Encoding.UTF8.GetString(bytes).Split(new char[1] { ':' }, 2);
				if (array2.Length == 2)
				{
					user = array2[0];
					password = array2[1];
				}
			}
		}

		private HttpResource GetResourceFromPath(string path)
		{
			string[] array = path.Split(new char[2] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
			if (array.Length < 2)
			{
				return null;
			}
			if (array[0] != "GET")
			{
				return null;
			}
			string text = array[1];
			if (!Enumerable.Contains(text, '?'))
			{
				return GetResourceFromUri(text, null);
			}
			string[] array2 = text.Split(new char[1] { '?' }, 2);
			text = array2[0];
			string[] array3 = array2[1].Split(new char[1] { '&' }, StringSplitOptions.RemoveEmptyEntries);
			Dictionary<string, string> args = new Dictionary<string, string>();
			string[] array4 = array3;
			foreach (string t in array4)
			{
				ParseArgument(t, args);
			}
			return GetResourceFromUri(text, args);
		}

		private void ParseArgument(string t, Dictionary<string, string> args)
		{
			string[] array = t.Split(new char[1] { '=' }, 2);
			if (array.Length == 2)
			{
				args.Add(array[0], array[1]);
			}
			else
			{
				args.Add(t, null);
			}
		}

		private HttpResource GetResourceFromUri(string uri, Dictionary<string, string> args)
		{
			if (uri != "/")
			{
				uri = uri.TrimEnd(new char[1] { '/' });
			}
			if (m_Resources.TryGetValue(uri, out var value))
			{
				if (value.Type == HttpResourceType.Callback)
				{
					if (args == null)
					{
						args = new Dictionary<string, string>();
					}
					args.Add("?", uri);
					return value.Callback(args);
				}
				return value;
			}
			return null;
		}

		private void OnClientDisconnected(object sender, Utf8TcpPeerEventArgs e)
		{
			lock (m_Lock)
			{
				if (m_HttpData.ContainsKey(e.Peer.Id))
				{
					m_HttpData.Remove(e.Peer.Id);
				}
			}
		}

		public void RegisterResource(string path, HttpResource resource)
		{
			m_Resources.Add(path, resource);
		}

		public void Dispose()
		{
			m_Server.Dispose();
		}
	}
	public class Utf8TcpPeerEventArgs : EventArgs
	{
		public Utf8TcpPeer Peer { get; private set; }

		public string Message { get; private set; }

		public Utf8TcpPeerEventArgs(Utf8TcpPeer peer, string message = null)
		{
			Peer = peer;
			Message = message;
		}
	}
	[Flags]
	public enum Utf8TcpServerOptions
	{
		LocalHostOnly = 1,
		SingleClientOnly = 2,
		Default = 0
	}
	internal static class XmlWriter_Extensions
	{
		private class RaiiExecutor : IDisposable
		{
			private Action m_Action;

			public RaiiExecutor(Action a)
			{
				m_Action = a;
			}

			public void Dispose()
			{
				m_Action();
			}
		}

		public static IDisposable Element(this XmlWriter xw, string name)
		{
			xw.WriteStartElement(name);
			return new RaiiExecutor(delegate
			{
				xw.WriteEndElement();
			});
		}

		public static XmlWriter Attribute(this XmlWriter xw, string name, string val)
		{
			if (val == null)
			{
				val = "(null)";
			}
			xw.WriteAttributeString(name, val);
			return xw;
		}

		public static XmlWriter Attribute(this XmlWriter xw, string name, object val)
		{
			if (val == null)
			{
				val = "(null)";
			}
			xw.WriteAttributeString(name, val.ToString());
			return xw;
		}

		public static XmlWriter Element(this XmlWriter xw, string name, string val)
		{
			if (val == null)
			{
				val = "(null)";
			}
			xw.WriteElementString(name, val);
			return xw;
		}

		public static XmlWriter ElementCData(this XmlWriter xw, string name, string val)
		{
			if (val == null)
			{
				val = "(null)";
			}
			xw.WriteStartElement(name);
			xw.WriteCData(val);
			xw.WriteEndElement();
			return xw;
		}

		public static XmlWriter Comment(this XmlWriter xw, object text)
		{
			if (text == null)
			{
				return xw;
			}
			xw.WriteComment(text.ToString());
			return xw;
		}

		public static XmlWriter Attribute(this XmlWriter xw, string name, string format, params object[] args)
		{
			xw.WriteAttributeString(name, string.Format(format, args));
			return xw;
		}

		public static XmlWriter Element(this XmlWriter xw, string name, string format, params object[] args)
		{
			xw.WriteElementString(name, string.Format(format, args));
			return xw;
		}

		public static XmlWriter ElementCData(this XmlWriter xw, string name, string format, params object[] args)
		{
			xw.WriteStartElement(name);
			xw.WriteCData(string.Format(format, args));
			xw.WriteEndElement();
			return xw;
		}

		public static XmlWriter Comment(this XmlWriter xw, string format, params object[] args)
		{
			xw.WriteComment(string.Format(format, args));
			return xw;
		}
	}
	public class Utf8TcpPeer
	{
		private Socket m_Socket;

		private Utf8TcpServer m_Server;

		private int m_PrevSize;

		private byte[] m_RecvBuffer;

		public string Id { get; private set; }

		public event EventHandler<Utf8TcpPeerEventArgs> ConnectionClosed;

		public event EventHandler<Utf8TcpPeerEventArgs> DataReceived;

		internal Utf8TcpPeer(Utf8TcpServer server, Socket socket)
		{
			m_Socket = socket;
			m_Server = server;
			m_RecvBuffer = new byte[m_Server.BufferSize];
			Id = Guid.NewGuid().ToString();
		}

		internal void Start()
		{
			m_Socket.BeginReceive(m_RecvBuffer, 0, m_RecvBuffer.Length, SocketFlags.None, OnDataReceived, null);
		}

		private void OnDataReceived(IAsyncResult ar)
		{
			try
			{
				bool flag = false;
				int num = m_Socket.EndReceive(ar);
				if (num == 0)
				{
					CloseConnection("zero byte received");
					return;
				}
				int num2 = m_PrevSize;
				m_PrevSize += num;
				do
				{
					flag = false;
					char packetSeparator = m_Server.PacketSeparator;
					for (int i = num2; i < m_PrevSize; i++)
					{
						if (m_RecvBuffer[i] == packetSeparator)
						{
							flag = true;
							string @string = Encoding.UTF8.GetString(m_RecvBuffer, 0, i);
							for (int j = i + 1; j < m_PrevSize; j++)
							{
								m_RecvBuffer[j - (i + 1)] = m_RecvBuffer[j];
							}
							num2 = 0;
							m_PrevSize = m_PrevSize - i - 1;
							if (this.DataReceived != null)
							{
								this.DataReceived(this, new Utf8TcpPeerEventArgs(this, @string));
							}
							break;
						}
					}
				}
				while (flag);
				if (m_Socket.Connected)
				{
					m_Socket.BeginReceive(m_RecvBuffer, m_PrevSize, m_RecvBuffer.Length - m_PrevSize, SocketFlags.None, OnDataReceived, null);
				}
			}
			catch (SocketException ex)
			{
				m_Server.Logger(ex.Message);
				CloseConnection(ex.Message);
			}
			catch (ObjectDisposedException ex2)
			{
				m_Server.Logger(ex2.Message);
				CloseConnection(ex2.Message);
			}
		}

		private void CloseConnection(string reason)
		{
			if (this.DataReceived != null)
			{
				this.ConnectionClosed(this, new Utf8TcpPeerEventArgs(this, reason));
			}
			try
			{
				m_Socket.Close();
			}
			catch
			{
			}
		}

		public void Send(string message)
		{
			SendTerminated(m_Server.CompleteMessage(message));
		}

		public void Send(string message, params object[] args)
		{
			SendTerminated(m_Server.CompleteMessage(string.Format(message, args)));
		}

		public void SendTerminated(string message)
		{
			byte[] bytes = Encoding.UTF8.GetBytes(message);
			SendBinary(bytes);
		}

		public void Disconnect()
		{
			m_Socket.Close();
		}

		public void SendBinary(byte[] bytes)
		{
			try
			{
				m_Socket.Send(bytes);
			}
			catch (SocketException ex)
			{
				m_Server.Logger(ex.Message);
				CloseConnection(ex.Message);
			}
			catch (ObjectDisposedException ex2)
			{
				m_Server.Logger(ex2.Message);
				CloseConnection(ex2.Message);
			}
		}
	}
	public class Utf8TcpServer : IDisposable
	{
		private int m_PortNumber = 1912;

		private IPAddress m_IPAddress;

		private TcpListener m_Listener;

		private Action<string> m_Logger;

		private List<Utf8TcpPeer> m_PeerList = new List<Utf8TcpPeer>();

		private object m_PeerListLock = new object();

		public char PacketSeparator { get; private set; }

		public Utf8TcpServerOptions Options { get; private set; }

		public int PortNumber => m_PortNumber;

		public Action<string> Logger
		{
			get
			{
				return m_Logger;
			}
			set
			{
				m_Logger = value ?? ((Action<string>)delegate(string s)
				{
					Console.WriteLine(s);
				});
			}
		}

		public int BufferSize { get; private set; }

		public event EventHandler<Utf8TcpPeerEventArgs> ClientConnected;

		public event EventHandler<Utf8TcpPeerEventArgs> DataReceived;

		public event EventHandler<Utf8TcpPeerEventArgs> ClientDisconnected;

		public Utf8TcpServer(int port, int bufferSize, char packetSeparator, Utf8TcpServerOptions options)
		{
			m_IPAddress = (((options & Utf8TcpServerOptions.LocalHostOnly) != 0) ? IPAddress.Loopback : IPAddress.Any);
			m_PortNumber = port;
			m_Logger = delegate
			{
			};
			PacketSeparator = packetSeparator;
			BufferSize = bufferSize;
			Options = options;
		}

		public void Start()
		{
			m_Listener = new TcpListener(m_IPAddress, m_PortNumber);
			m_Listener.Start();
			m_Listener.BeginAcceptSocket(OnAcceptSocket, null);
		}

		private void OnAcceptSocket(IAsyncResult ar)
		{
			try
			{
				Socket socket = m_Listener.EndAcceptSocket(ar);
				AddNewClient(socket);
				m_Listener.BeginAcceptSocket(OnAcceptSocket, null);
			}
			catch (SocketException ex)
			{
				Logger("OnAcceptSocket : " + ex.Message);
			}
			catch (ObjectDisposedException ex2)
			{
				Logger("OnAcceptSocket : " + ex2.Message);
			}
		}

		public int GetConnectedClients()
		{
			lock (m_PeerListLock)
			{
				return m_PeerList.Count;
			}
		}

		private void AddNewClient(Socket socket)
		{
			if ((Options & Utf8TcpServerOptions.SingleClientOnly) != 0)
			{
				lock (m_PeerListLock)
				{
					foreach (Utf8TcpPeer peer in m_PeerList)
					{
						peer.Disconnect();
					}
				}
			}
			Utf8TcpPeer utf8TcpPeer = new Utf8TcpPeer(this, socket);
			lock (m_PeerListLock)
			{
				m_PeerList.Add(utf8TcpPeer);
				utf8TcpPeer.ConnectionClosed += OnPeerDisconnected;
				utf8TcpPeer.DataReceived += OnPeerDataReceived;
			}
			if (this.ClientConnected != null)
			{
				Utf8TcpPeerEventArgs e = new Utf8TcpPeerEventArgs(utf8TcpPeer);
				this.ClientConnected(this, e);
			}
			utf8TcpPeer.Start();
		}

		private void OnPeerDataReceived(object sender, Utf8TcpPeerEventArgs e)
		{
			if (this.DataReceived != null)
			{
				this.DataReceived(this, e);
			}
		}

		private void OnPeerDisconnected(object sender, Utf8TcpPeerEventArgs e)
		{
			try
			{
				if (this.ClientDisconnected != null)
				{
					this.ClientDisconnected(this, e);
				}
				lock (m_PeerListLock)
				{
					m_PeerList.Remove(e.Peer);
					e.Peer.ConnectionClosed -= OnPeerDisconnected;
					e.Peer.DataReceived -= OnPeerDataReceived;
				}
			}
			catch
			{
			}
		}

		public void BroadcastMessage(string message)
		{
			List<Utf8TcpPeer> list;
			lock (m_PeerListLock)
			{
				list = m_PeerList.ToList();
			}
			message = CompleteMessage(message);
			if (message == null)
			{
				return;
			}
			foreach (Utf8TcpPeer item in list)
			{
				try
				{
					item.SendTerminated(message);
				}
				catch
				{
				}
			}
		}

		public string CompleteMessage(string message)
		{
			if (string.IsNullOrEmpty(message))
			{
				return PacketSeparator.ToString();
			}
			if (message[message.Length - 1] != PacketSeparator)
			{
				message += PacketSeparator;
			}
			return message;
		}

		public void Stop()
		{
			m_Listener.Stop();
		}

		public void Dispose()
		{
			Stop();
		}
	}
}

Mods/LuaMod.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BoneLib;
using BoneLib.BoneMenu;
using FieldInjector;
using HarmonyLib;
using Il2Cpp;
using Il2CppAra;
using Il2CppCysharp.Threading.Tasks;
using Il2CppDynamite3D.RealIvy;
using Il2CppECE;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppLuxURPEssentials;
using Il2CppLux_SRP_GrassDisplacement;
using Il2CppMK.Glow;
using Il2CppRealisticEyeMovements;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Bonelab.Obsolete;
using Il2CppSLZ.Bonelab.SaveData;
using Il2CppSLZ.Bonelab.VoidLogic;
using Il2CppSLZ.Combat;
using Il2CppSLZ.Data;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.AI;
using Il2CppSLZ.Marrow.Circuits;
using Il2CppSLZ.Marrow.Combat;
using Il2CppSLZ.Marrow.Console;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Input;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.PuppetMasta;
using Il2CppSLZ.Marrow.SaveData;
using Il2CppSLZ.Marrow.SceneStreaming;
using Il2CppSLZ.Marrow.VoidLogic;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.Marrow.Zones;
using Il2CppSLZ.SFX;
using Il2CppSLZ.VFX;
using Il2CppSLZ.VRMK;
using Il2CppSLZ.Vehicle;
using Il2CppSplineMesh;
using Il2CppSystem;
using Il2CppTMPro;
using Il2CppTMPro.SpriteAssetUtilities;
using LuaMod;
using LuaMod.BoneMenu;
using LuaMod.LuaAPI;
using MelonLoader;
using Microsoft.CodeAnalysis;
using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Loaders;
using Unity.Rendering.HybridV2;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Experimental.AI;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Playables;
using UnityEngine.Profiling.Memory.Experimental;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RendererUtils;
using UnityEngine.SceneManagement;
using UnityEngine.Search;
using UnityEngine.TerrainTools;
using UnityEngine.TerrainUtils;
using UnityEngine.U2D;
using UnityEngine.Video;
using UnityEngineInternal;
using UnityEngineInternal.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::LuaMod.LuaMod), "LuaMod", "1.0.0", "pc", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("LuaMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+baf726670dc914648db4c17d3c73c5e13a4b89a6")]
[assembly: AssemblyProduct("LuaMod")]
[assembly: AssemblyTitle("LuaMod")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LuaMod
{
	public class LuaMod : MelonMod
	{
		[MoonSharpHidden]
		public static List<Type> LoadedTypes = new List<Type>();

		public static List<Type> LoadedTypesForReg = new List<Type>();

		[MoonSharpHidden]
		public static List<Type> RegisteredTypes = new List<Type>();

		[MoonSharpHidden]
		public static void LoadAllAssemblies()
		{
			LoadAssemblyTypes("UnityEngine.Core");
			LoadAssemblyTypes("UnityEngine.CoreModule");
			LoadAssemblyTypes("UnityEngine.PhysicsModule");
			LoadAssemblyTypes("UnityEngine.UIModule");
			LoadAssemblyTypes("UnityEngine.AIModule");
			LoadAssemblyTypes("UnityEngine.AnimationModule");
			LoadAssemblyTypes("UnityEngine.TextRenderingModule");
			LoadAssemblyTypes("UnityEngine.ParticleSystemModule");
			LoadAssemblyTypes("UnityEngine.TerrainModule");
			LoadAssemblyTypes("UnityEngine.AudioModule");
			LoadAssemblyTypes("UnityEngine.VideoModule");
			LoadAssemblyTypes("UnityEngine.InputLegacyModule");
			LoadAssemblyTypes("UnityEngine.CoreModule");
			LoadAssemblyTypes("UnityEngine");
			LoadAssemblyTypes("Unity.TextMeshPro");
			LoadAssemblyTypes("Il2CppSLZ.Algorithms");
			LoadAssemblyTypes("Il2CppSLZ.Algorithms.Unity");
			LoadAssemblyTypes("Il2CppSLZ.Marrow");
			LoadAssemblyTypes("Il2CppSLZ.Marrow.VoidLogic.Core");
			LoadAssemblyTypes("Il2CppSLZ.Marrow.VoidLogic.Engine");
			LoadAssemblyTypes("BoneLib");
			LoadAssemblyTypes("Assembly-CSharp");
			LoadAssemblyTypes();
		}

		[MoonSharpHidden]
		private static void LoadAssemblyTypes()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			List<Type> list = new List<Type>();
			List<Type> list2 = new List<Type>();
			Type[] array = types;
			foreach (Type type in array)
			{
				MelonLogger.Msg(type.FullName + " " + type.Assembly.GetName().Name);
				list2.Add(type);
				if (InheritsFromUnityComponent(type))
				{
					list.Add(type);
				}
			}
			LoadedTypes.AddRange(list);
			LoadedTypesForReg.AddRange(list2);
			MelonLogger.Msg($"Successfully loaded {types.Length} types from local mod assembly");
		}

		[MoonSharpHidden]
		private static void PrintEnums(string assemblyPathOrName)
		{
			try
			{
				Assembly assembly;
				try
				{
					assembly = Assembly.Load(assemblyPathOrName);
				}
				catch (Exception)
				{
					assembly = Assembly.LoadFrom(assemblyPathOrName);
				}
				Type[] types = assembly.GetTypes();
				int num = 0;
				int num2 = 0;
				List<string> list = new List<string>();
				string[] source = new string[39]
				{
					"io", "network", "lowlevel", "low level", "unsafe", "file", "directory", "webcam", "microphone", "location",
					"windows", "security", "diagnostic", "net", "process", "thread", "systeminfo", "reflection", "garbagecollector", "garbage",
					"collector", "delegate", "graphicsbuffer", "graphics", "internal", "debug", "experimental", "qualitysettings", "display", "buffer",
					"gizmos", "rendering", "execute", "unityengineinternal", "microsoft", "embedded", "command", "apple", "testtools"
				};
				list.Add("// Enums from assembly: " + assembly.FullName);
				list.Add("");
				Type[] array = types;
				foreach (Type type in array)
				{
					if (type.IsEnum)
					{
						string fullNameLower = type.FullName.ToLowerInvariant();
						if (source.Any((string b) => fullNameLower.Contains(b)))
						{
							num2++;
							continue;
						}
						num++;
						string value = type.FullName.Replace('+', '.');
						string value2 = ((!(type.DeclaringType != null)) ? type.Name : (type.DeclaringType.Name + "." + type.Name));
						string text = $"LuaScript.Globals[\"{value2}\"] = UserData.CreateStatic<{value}>();";
						list.Add(text);
						MelonLogger.Msg(text);
					}
				}
				list.Add("");
				using (StreamWriter streamWriter = new StreamWriter("Enums.txt", append: true))
				{
					foreach (string item in list)
					{
						streamWriter.WriteLine(item);
					}
				}
				MelonLogger.Msg("Finished scanning assembly: " + assembly.FullName);
				MelonLogger.Msg($"Registered {num} enums (skipped {num2} due to blacklist). Output appended to Enums.txt.");
			}
			catch (Exception ex2)
			{
				MelonLogger.Error("Error loading assembly: " + ex2.Message);
			}
		}

		[MoonSharpHidden]
		private static void PrintComponents(string assemblyPathOrName)
		{
			try
			{
				Assembly assembly;
				try
				{
					assembly = Assembly.Load(assemblyPathOrName);
				}
				catch (Exception)
				{
					assembly = Assembly.LoadFrom(assemblyPathOrName);
				}
				Type[] types = assembly.GetTypes();
				int num = 0;
				int num2 = 0;
				List<string> list = new List<string>();
				string[] source = new string[39]
				{
					"io", "network", "lowlevel", "low level", "unsafe", "file", "directory", "webcam", "microphone", "location",
					"windows", "security", "diagnostic", "net", "process", "thread", "systeminfo", "reflection", "garbagecollector", "garbage",
					"collector", "delegate", "graphicsbuffer", "graphics", "internal", "debug", "experimental", "qualitysettings", "display", "buffer",
					"gizmos", "rendering", "execute", "unityengineinternal", "microsoft", "embedded", "command", "apple", "testtools"
				};
				list.Add("// Types from assembly: " + assembly.FullName);
				list.Add("");
				Type[] array = types;
				foreach (Type type in array)
				{
					if (!type.IsAbstract && !type.IsGenericTypeDefinition)
					{
						string fullNameLower = type.FullName.ToLowerInvariant();
						if (source.Any((string b) => fullNameLower.Contains(b)) || type.IsSubclassOf(typeof(MulticastDelegate)) || type.IsSubclassOf(typeof(Delegate)))
						{
							num2++;
							continue;
						}
						num++;
						string text = type.FullName.Replace('+', '.');
						string text2 = "LuaRegisterType<" + text + ">();";
						list.Add(text2);
						MelonLogger.Msg(text2);
					}
				}
				list.Add("");
				using (StreamWriter streamWriter = new StreamWriter("Components.txt", append: true))
				{
					foreach (string item in list)
					{
						streamWriter.WriteLine(item);
					}
				}
				MelonLogger.Msg("Finished scanning assembly: " + assembly.FullName);
				MelonLogger.Msg($"Registered {num} types (skipped {num2} due to blacklist). Output appended to Components.txt.");
			}
			catch (Exception ex2)
			{
				MelonLogger.Error("Error loading assembly: " + ex2.Message);
			}
		}

		[MoonSharpHidden]
		public static bool InheritsFromUnityComponent(Type type)
		{
			if (type == null)
			{
				return false;
			}
			return type.IsSubclassOf(typeof(Object)) || type == typeof(Object);
		}

		[MoonSharpHidden]
		private static void PrintAssemblyTypes(string assemblyPathOrName)
		{
			try
			{
				Assembly assembly = null;
				try
				{
					assembly = Assembly.Load(assemblyPathOrName);
				}
				catch (Exception)
				{
				}
				Type[] types = assembly.GetTypes();
				List<Type> list = new List<Type>();
				Type[] array = types;
				foreach (Type type in array)
				{
					if (InheritsFromUnityComponent(type))
					{
						MelonLogger.Msg("LuaRegisterType<" + type.Name + ">();");
					}
				}
				LoadedTypes.AddRange(list);
				MelonLogger.Msg($"Successfully loaded {list.Count} types from {assembly.FullName}");
			}
			catch (Exception ex2)
			{
				MelonLogger.Error("Error loading assembly: " + ex2.Message);
			}
		}

		[MoonSharpHidden]
		private static void LoadAssemblyTypes(string assemblyPathOrName)
		{
			try
			{
				Assembly assembly = null;
				try
				{
					assembly = Assembly.Load(assemblyPathOrName);
				}
				catch (Exception)
				{
				}
				Type[] types = assembly.GetTypes();
				List<Type> list = new List<Type>();
				List<Type> list2 = new List<Type>();
				Type[] array = types;
				foreach (Type type in array)
				{
					list2.Add(type);
					if (InheritsFromUnityComponent(type))
					{
						list.Add(type);
					}
				}
				LoadedTypes.AddRange(list);
				LoadedTypesForReg.AddRange(list2);
				MelonLogger.Msg($"Successfully loaded {list.Count} types from {assembly.FullName}");
			}
			catch (Exception ex2)
			{
				MelonLogger.Error("Error loading assembly: " + ex2.Message);
			}
		}

		[MoonSharpHidden]
		public static void LuaRegisterType<T>(bool includeCollections = false)
		{
			try
			{
				Type typeFromHandle = typeof(T);
				if (typeFromHandle == null || typeFromHandle.Assembly == null)
				{
					MelonLogger.Warning($"[LuaRegisterType] The type '{typeFromHandle}' is invalid or missing from the assembly.");
					return;
				}
				string text = $"LuaRegisterTypeByName(\"{typeFromHandle.FullName}\", \"{typeFromHandle.Assembly.GetName().Name}\", {includeCollections.ToString().ToLower()});";
				File.AppendAllText("LuaTypes.txt", text + "\n");
				UserData.RegisterType(typeFromHandle, (InteropAccessMode)7, (string)null);
				RegisteredTypes.Add(typeFromHandle);
				if (!includeCollections)
				{
					return;
				}
				try
				{
					UserData.RegisterType(typeFromHandle.MakeArrayType(), (InteropAccessMode)7, (string)null);
				}
				catch (Exception ex)
				{
					MelonLogger.Warning("[LuaRegisterType] Array<" + typeFromHandle.FullName + "> failed: " + ex.Message);
				}
				try
				{
					UserData.RegisterType(typeof(List<>).MakeGenericType(typeFromHandle), (InteropAccessMode)7, (string)null);
				}
				catch (Exception ex2)
				{
					MelonLogger.Warning("[LuaRegisterType] List<" + typeFromHandle.FullName + "> failed: " + ex2.Message);
				}
			}
			catch (Exception ex3)
			{
				MelonLogger.Warning("[LuaRegisterType] Failed to register type: " + ex3.Message);
			}
		}

		[MoonSharpHidden]
		public static void LuaRegisterTypeByName(string typeName, string assemblyName, bool includeCollections = false)
		{
			try
			{
				Type type = null;
				foreach (Type item in LoadedTypesForReg)
				{
					if (item.FullName == typeName && item.Assembly.GetName().Name == assemblyName)
					{
						type = item;
						break;
					}
				}
				if (type == null)
				{
					MelonLogger.Warning($"[LuaRegisterTypeByName] No matching type found for type name '{typeName}' and assembly '{assemblyName}'.");
					return;
				}
				UserData.RegisterType(type, (InteropAccessMode)7, (string)null);
				RegisteredTypes.Add(type);
				if (!includeCollections)
				{
					return;
				}
				try
				{
					UserData.RegisterType(type.MakeArrayType(), (InteropAccessMode)7, (string)null);
				}
				catch (Exception ex)
				{
					MelonLogger.Warning("[LuaRegisterTypeByName] Array<" + type.FullName + "> failed: " + ex.Message);
				}
				try
				{
					UserData.RegisterType(typeof(List<>).MakeGenericType(type), (InteropAccessMode)7, (string)null);
				}
				catch (Exception ex2)
				{
					MelonLogger.Warning("[LuaRegisterTypeByName] List<" + type.FullName + "> failed: " + ex2.Message);
				}
			}
			catch (Exception ex3)
			{
				MelonLogger.Warning("[LuaRegisterTypeByName] Failed to register type: " + ex3.Message);
			}
		}

		[MoonSharpHidden]
		public void LoadTypes()
		{
			LuaRegisterType<string>(includeCollections: true);
			LuaRegisterType<string>(includeCollections: true);
			LuaRegisterType<int>(includeCollections: true);
			LuaRegisterType<float>(includeCollections: true);
			LuaRegisterType<double>(includeCollections: true);
			LuaRegisterType<BlendWeights>();
			LuaRegisterType<GUIText>();
			LuaRegisterType<GUITexture>();
			LuaRegisterType<GUIElement>();
			LuaRegisterType<GUILayer>();
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_GameObject", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Input", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Player", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Vector", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Events", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_SLZ_Combat", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_SLZ_NPC", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_SLZ_VoidLogic", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Physics", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Utils", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_BoneMenu", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Audio", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Particles", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_FileAccess", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Random", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.API_Renderer", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaBehaviour", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaGun", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaNPC", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaAPI.BLFileAccess", "LuaMod");
			LuaRegisterTypeByName("LuaMod.LuaResources", "LuaMod");
			LuaRegisterTypeByName("UnityEngine.Vector2", "UnityEngine.CoreModule", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.Vector3", "UnityEngine.CoreModule", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.Vector4", "UnityEngine.CoreModule", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.GameObject", "UnityEngine.CoreModule", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.Object", "UnityEngine.CoreModule", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.Matrix4x4", "UnityEngine.CoreModule", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.Material", "UnityEngine.CoreModule", includeCollections: true);
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Zones.ZoneLink", "Il2CppSLZ.Marrow", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.Transform", "UnityEngine.CoreModule", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.Quaternion", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Component", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MonoBehaviour", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Time", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Mathf", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Color", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Renderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Bounds", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Matrix4x4", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Time", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AudioSource", "UnityEngine.AudioModule");
			LuaRegisterTypeByName("UnityEngine.Physics", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.Rigidbody", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.SphereCollider", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.BoxCollider", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.CapsuleCollider", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.Collision", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ContactPoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.RaycastHit", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.HingeJoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.Joint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("Il2CppSLZ.Bonelab.JointMover", "Assembly-CSharp");
			LuaRegisterTypeByName("UnityEngine.JointMotor", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.JointLimits", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.JointDrive", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.JointSpring", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("Il2CppSLZ.Bonelab.JointVisual", "Assembly-CSharp");
			LuaRegisterTypeByName("UnityEngine.ConfigurableJoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.Collider", "UnityEngine.PhysicsModule", includeCollections: true);
			LuaRegisterTypeByName("UnityEngine.QueryTriggerInteraction", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("Il2CppTMPro.TextMeshPro", "Unity.TextMeshPro");
			LuaRegisterTypeByName("BoneLib.BoneMenu.Page", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.BoolElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.Dialog", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.Element", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.ElementProperties", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.EnumElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.FloatElement", "BoneLib");
			LuaRegisterTypeByName("LuaMod.BoneMenu.LuaFunctionElement", "LuaMod");
			LuaRegisterTypeByName("BoneLib.BoneMenu.PageLinkElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.StringElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.SubPage", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.BackspaceKey", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.DoubleZeroKey", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.EnterKey", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIBoolElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIDialog", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIElementDrawer", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIEnumElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIFloatElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIFunctionElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIInfoBox", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIIntElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIMenu", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIPool", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIPoolee", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.GUIStringElement", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.Key", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.Keyboard", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.ShiftKey", "BoneLib");
			LuaRegisterTypeByName("BoneLib.BoneMenu.UI.SpaceKey", "BoneLib");
			LuaRegisterTypeByName("Il2CppSLZ.Bonelab.EnemyDamageReceiver", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.AI.AIBrain", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.AI.AIManager", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Bonelab.BehaviourCrablet", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourGrabbableBaseNav", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.PuppetMasta.PuppetMaster", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.PuppetMasta.BehaviourBase", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.PuppetMasta.BehaviourBaseNav", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourPowerLegs", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourAnimatedStagger", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourBaseTurret", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourFall", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourGrabbableBaseNav", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourHead", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourTemplate", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppPuppetMasta.BehaviourFall", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppSLZ.Bonelab.AccordionSliderDoor", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppSLZ.Bonelab.ActionDirector", "Assembly-CSharp");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Combat.Attack", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Gun", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Magazine", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.MagazineState", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Interaction.MarrowBody", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Interaction.MarrowEntity", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Interaction.MarrowJoint", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Warehouse.SpawnableCrate", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Hand", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Grip", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.VoidLogic.BaseNode", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.VoidLogic.LeverNode", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.VoidLogic.IVoidLogicActuator", "Il2CppSLZ.Marrow.VoidLogic.Core");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.VoidLogic.IVoidLogicNode", "Il2CppSLZ.Marrow.VoidLogic.Core");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.VoidLogic.IVoidLogicSensor", "Il2CppSLZ.Marrow.VoidLogic.Core");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.Circuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.CircuitSocket", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.AddCircuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.ExternalCircuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.FlipflopCircuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.MultiplyCircuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.RemapCircuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.ValueCircuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.XorCircuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Il2CppSLZ.Marrow.Circuits.ZoneCircuit", "Il2CppSLZ.Marrow");
			LuaRegisterTypeByName("Unity.Jobs.IJob", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Jobs.IJobFor", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Jobs.IJobParallelFor", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Jobs.JobHandle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Burst.BurstDiscardAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PrimitiveType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Space", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RuntimePlatform", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SystemLanguage", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LogType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SortingLayer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Keyframe", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WrapMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.StackTraceLogType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BootConfigData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CachedAssetBundle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Cache", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Caching", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BoundingSphere", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CullingGroupEvent", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CullingGroup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.IExposedPropertyTable", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Bounds", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BoundsInt", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GeometryUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Plane", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Ray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Rect", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectInt", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectOffset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DynamicGI", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightingSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BeforeRenderOrderAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FullScreenMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Screen", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GL", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbes", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTargetSetup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ImageEffectAllowedInSceneView", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapsModeLegacy", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TrailRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LineRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MaterialPropertyBlock", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Renderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Shader", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Material", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Flare", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightBakingOutput", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightShadowCasterMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Light", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Skybox", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MeshFilter", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TransparencySortMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.StereoTargetEyeMask", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CameraType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightShape", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightRenderMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightShadows", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FogMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapBakeType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MixedLightingMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ShadowmaskMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ShadowObjectsFilter", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CameraClearFlags", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DepthTextureMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AnisotropicFiltering", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MeshTopology", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SkinQuality", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ColorSpace", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FilterMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TextureWrapMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TextureFormat", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CubemapFace", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTextureFormat", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.VRTextureUsage", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTextureReadWrite", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTextureMemoryless", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapsMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbeProxyVolume", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LineAlignment", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SkinnedMeshRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MeshRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbeGroup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LODFadeMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LOD", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LODGroup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Mesh", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BoneWeight", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BoneWeight1", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CombineInstance", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture2D", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Cubemap", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture3D", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture2DArray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CubemapArray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTexture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CustomRenderTexture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTextureDescriptor", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Hash128", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CursorMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CursorLockMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Cursor", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.KeyCode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ILogger", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ILogHandler", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Logger", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.UnityLogWriter", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Color", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Color32", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ColorUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GradientColorKey", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GradientAlphaKey", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Gradient", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FrustumPlanes", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Matrix4x4", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector3", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Mathf", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector2", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector2Int", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector3Int", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector4", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PlayerPrefs", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PropertyAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ContextMenuItemAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.InspectorNameAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TooltipAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpaceAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HeaderAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RangeAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MinAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MultilineAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TextAreaAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ColorUsageAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GradientUsageAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DelayedAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.NonReorderableAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PropertyNameUtils", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PropertyName", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ResourceRequest", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ResourcesAPI", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Resources", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AttributeHelperEngine", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DisallowMultipleComponent", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RequireComponent", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AddComponentMenu", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CreateAssetMenuAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ContextMenu", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HideInInspector", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HelpURLAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AssemblyIsEditorAssembly", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ExcludeFromPresetAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Component", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Coroutine", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SetupCoroutine", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ExcludeFromObjectFactoryAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FailedToLoadScriptObject", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GameObject", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LayerMask", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.NoAllocHelpers", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RangeInt", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RuntimeInitializeLoadType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RuntimeInitializeOnLoadMethodAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ScriptableObject", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ScriptingRuntime", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ScriptingUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TextAsset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TrackedReference", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HideFlags", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Object", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitForEndOfFrame", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitForFixedUpdate", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitForSeconds", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitForSecondsRealtime", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitUntil", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitWhile", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SerializeField", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SerializeReference", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ComputeShader", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DisableBatchingType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LowerResBlitTexture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PreloadData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.OperatingSystemFamily", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DeviceType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SystemClock", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Time", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TouchScreenKeyboard", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TouchScreenKeyboardType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Pose", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DrivenTransformProperties", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DrivenRectTransformTracker", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectTransform", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Transform", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteDrawMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteTileMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteMeshType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpritePackingMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteSortPoint", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Sprite", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine._Scripting.APIUpdating.APIUpdaterRuntimeHelpers", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Sprites.DataUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.Light2DBase", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.SpriteBone", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.SpriteChannelInfo", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.SpriteAtlasManager", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.SpriteAtlas", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Profiling.Recorder", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Profiling.Sampler", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Profiling.CustomSampler", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Jobs.IJobParallelForTransform", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Jobs.TransformAccess", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Jobs.TransformAccessArray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.PersistentListenerMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.UnityEventTools", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.ArgumentCache", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.BaseInvokableCall", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.InvokableCall", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.UnityEventCallState", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.PersistentCall", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.PersistentCallGroup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.InvokableCallList", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.UnityEventBase", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.UnityEvent", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.AlwaysLinkAssemblyAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.PreserveAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequireAttributeUsagesAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.APIUpdating.MovedFromAttributeData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.APIUpdating.MovedFromAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.Scene", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.SceneManagerAPI", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.SceneManager", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.LoadSceneMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.LocalPhysicsMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.LoadSceneParameters", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.CreateSceneParameters", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.FrameData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.FrameRate", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.IPlayable", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.IPlayableOutput", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.DirectorWrapMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.Playable", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.IPlayableAsset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableAsset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableBinding", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableTraversalMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.DirectorUpdateMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableGraph", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayState", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableHandle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableOutput", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableOutputHandle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.ScriptPlayableOutput", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("System.Runtime.CompilerServices.IsUnmanagedAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Baselib.ErrorState", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Burst.BurstAuthorizedExternalMethodAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WeightedMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.UnityEventQueueSystem", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LineUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MeshSubsetCombineUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.StaticBatchingUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Ping", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SparseTexture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LensFlare", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Projector", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Halo", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ImageEffectTransformsToLDR", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ImageEffectOpaque", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ImageEffectAfterScale", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.StaticBatchingHelper", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BillboardAsset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BillboardRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ReceiveGI", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.QualityLevel", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ShadowQuality", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TexGenMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BlendWeights", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SkinWeights", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ColorGamut", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.NPOTSupport", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CustomRenderTextureUpdateMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CustomRenderTextureUpdateZoneSpace", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SleepTimeout", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HDROutputSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BatteryStatus", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FlareLayer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SnapAxis", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SnapAxisFilter", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Ray2D", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DrivenPropertyManager", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FullScreenMovieControlMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FullScreenMovieScalingMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AndroidActivityIndicatorStyle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Handheld", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.EnumInfo", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GradientMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.IconAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.iPhoneSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteAlignment", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.Light2DType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequiredMemberAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequireDerivedAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequireImplementorsAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequiredInterfaceAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SearchService.ObjectSelectorHandlerWithLabelsAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SearchService.ObjectSelectorHandlerWithTagsAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Search.SearchViewFlags", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Search.SearchContextAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.DataStreamType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Lumin.UsesLuminPrivilegeAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Lumin.UsesLuminPlatformLevelAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+GateFitMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+GateFitParameters", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+StereoscopicEye", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+MonoOrStereoscopicEye", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+SceneViewFilterMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+RenderRequestMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+RenderRequestOutputSpace", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+RenderRequest", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+CameraCallback", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera+FieldOfViewAxis", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CullingGroup+StateChanged", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BeforeRenderHelper+OrderBlock", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbeProxyVolume+BoundingBoxMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbeProxyVolume+RefreshMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbeProxyVolume+QualityMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbeProxyVolume+DataFormat", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Mesh+MeshData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Mesh+MeshDataArray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture2D+EXRFlags", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpookyHash+U", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Random+State", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ScriptingUtility+TestClass", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TouchScreenKeyboard+Status", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TouchScreenKeyboard+Android", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectTransform+Edge", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectTransform+Axis", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectTransform+ReapplyDrivenProperties", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Transform+Enumerator", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.Scene+LoadingState", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ConfigurableJointMotion", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.SoftJointLimit", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.RigidbodyConstraints", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ForceMode", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.SoftJointLimit", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.SoftJointLimitSpring", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.JointDrive", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.JointMotor", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.JointSpring", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.JointLimits", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ControllerColliderHit", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.PhysicMaterialCombine", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.Physics", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ModifiableContactPair", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ModifiableMassProperties", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ModifiableContact", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ModifiableContactPatch", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.PhysicMaterial", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.RaycastHit", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.Rigidbody", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.Collider", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.CharacterController", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.MeshCollider", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.CapsuleCollider", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.BoxCollider", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.SphereCollider", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.Joint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.HingeJoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.SpringJoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.FixedJoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.CharacterJoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ConfigurableJoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ContactPoint", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.PhysicsScene", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.JointDriveMode", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ConstantForce", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ModifiableContactPatch+Flags", "UnityEngine.PhysicsModule");
			LuaRegisterTypeByName("UnityEngine.ICanvasRaycastFilter", "UnityEngine.UIModule");
			LuaRegisterTypeByName("UnityEngine.CanvasGroup", "UnityEngine.UIModule");
			LuaRegisterTypeByName("UnityEngine.CanvasRenderer", "UnityEngine.UIModule");
			LuaRegisterTypeByName("UnityEngine.RectTransformUtility", "UnityEngine.UIModule");
			LuaRegisterTypeByName("UnityEngine.RenderMode", "UnityEngine.UIModule");
			LuaRegisterTypeByName("UnityEngine.Canvas", "UnityEngine.UIModule");
			LuaRegisterTypeByName("UnityEngine.Canvas+WillRenderCanvases", "UnityEngine.UIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshPathStatus", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshPath", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.ObstacleAvoidanceType", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshAgent", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshObstacleShape", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshObstacle", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.OffMeshLinkType", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.OffMeshLinkData", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshHit", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshData", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshDataInstance", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshLinkData", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshLinkInstance", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshBuildSourceShape", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshCollectGeometry", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshBuildSource", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshBuildMarkup", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMeshBuildSettings", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.OffMeshLink", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.AI.NavMesh+OnNavMeshPreUpdate", "UnityEngine.AIModule");
			LuaRegisterTypeByName("UnityEngine.SharedBetweenAnimatorsAttribute", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.PlayMode", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.QueueMode", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AvatarTarget", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AvatarIKGoal", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AvatarIKHint", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorControllerParameterType", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.StateInfoIndex", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorRecorderMode", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorCullingMode", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorUpdateMode", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorClipInfo", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorStateInfo", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.MatchTargetWeightMask", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.Animator", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorControllerParameter", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorOverrideController", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.HumanBodyBones", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.Avatar", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.SkeletonBone", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.HumanLimit", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.HumanBone", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AvatarMaskBodyPart", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AvatarMask", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.HumanTrait", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.RuntimeAnimatorController", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AvatarBuilder", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.BodyDof", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.HeadDof", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.LegDof", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.ArmDof", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.FingerDof", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.HumanPartDof", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.Dof", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.HumanParameter", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorUtility", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.HumanPoseHandler", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.AnimatorOverrideController+OnOverrideControllerDirtyCallback", "UnityEngine.AnimationModule");
			LuaRegisterTypeByName("UnityEngine.FontStyle", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.TextGenerator", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.TextAlignment", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.TextAnchor", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.HorizontalWrapMode", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.VerticalWrapMode", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.TextMesh", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.CharacterInfo", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.UICharInfo", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.UILineInfo", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.UIVertex", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.Font", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.GUIText", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.Font+FontTextureRebuildCallback", "UnityEngine.TextRenderingModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemRenderMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemSortMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemRenderSpace", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemCurveMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemGradientMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemShapeType", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemMeshShapeType", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemScalingMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemEmitterVelocityMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemInheritVelocityMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemVertexStream", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemCustomData", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemNoiseQuality", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemGameObjectFilter", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemForceFieldShape", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemVertexStreams", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemRenderer", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemForceField", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemJobs.ParticleSystemNativeArray3", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemJobs.ParticleSystemNativeArray4", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemJobs.ParticleSystemJobData", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemJobs.NativeParticleData", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemShapeTextureChannel", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemColliderQueryMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemCullingMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemTriggerEventType", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemCustomDataMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemSubEmitterType", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemSubEmitterProperties", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemTrailMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemTrailTextureMode", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemShapeMultiModeValue", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+MainModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+ShapeModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+TriggerModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+SubEmittersModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+Particle", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+Burst", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+MinMaxCurve", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+MinMaxGradient", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+EmitParams", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+Trails", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+VelocityOverLifetimeModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+LimitVelocityOverLifetimeModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+InheritVelocityModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+LifetimeByEmitterSpeedModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+ForceOverLifetimeModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+ColorOverLifetimeModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+ColorBySpeedModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+SizeOverLifetimeModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+SizeBySpeedModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+ExternalForcesModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+NoiseModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+LightsModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+TrailModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+CustomDataModule", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemJobs.NativeParticleData+Array3", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystemJobs.NativeParticleData+Array4", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+Particle+Flags", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState+Seed", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState+Seed4", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState+Initial", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState+Shape", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState+Force", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState+Noise", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState+Lights", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.ParticleSystem+PlaybackState+Trail", "UnityEngine.ParticleSystemModule");
			LuaRegisterTypeByName("UnityEngine.TerrainRenderFlags", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.Terrain", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TreePrototype", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.DetailPrototype", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.SplatPrototype", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TreeInstance", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.PatchExtents", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainHeightmapSyncControl", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.DetailInstanceTransform", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainData", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainLayer", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainUtils.TerrainMapStatusCode", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainUtils.TerrainTileCoord", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainUtils.TerrainMap", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.DetailRenderMode", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainChangedFlags", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.Tree", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.SpeedTreeWindAsset", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainTools.PaintContext", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainTools.TerrainBuiltinPaintMaterialPasses", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainTools.BrushTransform", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.Terrain+MaterialType", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainCallbacks+HeightmapChangedCallback", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainCallbacks+TextureChangedCallback", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainData+BoundaryValueType", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainTools.PaintContext+TerrainTile", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.TerrainTools.PaintContext+SplatmapUserData", "UnityEngine.TerrainModule");
			LuaRegisterTypeByName("UnityEngine.FFTWindow", "UnityEngine.AudioModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoClip", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoRenderMode", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.Video3DLayout", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoTimeSource", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoTimeReference", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoSource", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoPlayer", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoPlayer+EventHandler", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoPlayer+ErrorEventHandler", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoPlayer+FrameReadyEventHandler", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("UnityEngine.Video.VideoPlayer+TimeEventHandler", "UnityEngine.VideoModule");
			LuaRegisterTypeByName("Unity.Jobs.IJob", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Jobs.IJobFor", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Jobs.IJobParallelFor", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Jobs.JobHandle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Burst.BurstDiscardAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PrimitiveType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Space", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RuntimePlatform", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SystemLanguage", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LogType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SortingLayer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Keyframe", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WrapMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.StackTraceLogType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BootConfigData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CachedAssetBundle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Cache", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Caching", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Camera", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BoundingSphere", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CullingGroupEvent", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CullingGroup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.IExposedPropertyTable", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Bounds", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BoundsInt", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GeometryUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Plane", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Ray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Rect", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectInt", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectOffset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DynamicGI", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightingSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BeforeRenderOrderAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FullScreenMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Screen", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GL", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbes", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTargetSetup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ImageEffectAllowedInSceneView", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapsModeLegacy", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TrailRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LineRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MaterialPropertyBlock", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Renderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Shader", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Flare", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightBakingOutput", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightShadowCasterMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Light", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Skybox", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MeshFilter", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TransparencySortMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.StereoTargetEyeMask", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CameraType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightShape", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightRenderMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightShadows", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FogMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapBakeType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MixedLightingMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ShadowmaskMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ShadowObjectsFilter", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CameraClearFlags", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DepthTextureMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AnisotropicFiltering", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MeshTopology", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SkinQuality", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ColorSpace", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FilterMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TextureWrapMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TextureFormat", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CubemapFace", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTextureFormat", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.VRTextureUsage", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTextureReadWrite", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTextureMemoryless", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightmapsMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbeProxyVolume", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LineAlignment", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SkinnedMeshRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MeshRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LightProbeGroup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LODFadeMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LOD", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LODGroup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Mesh", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BoneWeight", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BoneWeight1", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CombineInstance", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture2D", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Cubemap", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture3D", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Texture2DArray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CubemapArray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTexture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CustomRenderTexture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RenderTextureDescriptor", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Hash128", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CursorMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CursorLockMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Cursor", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.KeyCode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ILogger", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ILogHandler", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Logger", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.UnityLogWriter", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Color", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Color32", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ColorUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GradientColorKey", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GradientAlphaKey", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Gradient", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FrustumPlanes", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Matrix4x4", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector3", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Mathf", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector2", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector2Int", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector3Int", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Vector4", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PlayerPrefs", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PropertyAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ContextMenuItemAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.InspectorNameAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TooltipAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpaceAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HeaderAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RangeAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MinAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MultilineAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TextAreaAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ColorUsageAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GradientUsageAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DelayedAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.NonReorderableAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PropertyNameUtils", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PropertyName", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ResourceRequest", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ResourcesAPI", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Resources", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AttributeHelperEngine", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DisallowMultipleComponent", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RequireComponent", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AddComponentMenu", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CreateAssetMenuAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ContextMenu", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HideInInspector", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HelpURLAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AssemblyIsEditorAssembly", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ExcludeFromPresetAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Component", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Coroutine", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SetupCoroutine", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ExcludeFromObjectFactoryAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FailedToLoadScriptObject", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GameObject", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LayerMask", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.NoAllocHelpers", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RangeInt", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RuntimeInitializeLoadType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RuntimeInitializeOnLoadMethodAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ScriptableObject", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ScriptingRuntime", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ScriptingUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TextAsset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TrackedReference", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HideFlags", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Object", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitForEndOfFrame", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitForFixedUpdate", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitForSeconds", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitForSecondsRealtime", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitUntil", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WaitWhile", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SerializeField", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SerializeReference", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ComputeShader", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DisableBatchingType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LowerResBlitTexture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.PreloadData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.OperatingSystemFamily", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DeviceType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SystemClock", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Time", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TouchScreenKeyboard", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TouchScreenKeyboardType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Pose", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DrivenTransformProperties", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DrivenRectTransformTracker", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.RectTransform", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Transform", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteDrawMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteTileMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteMeshType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpritePackingMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteSortPoint", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Sprite", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine._Scripting.APIUpdating.APIUpdaterRuntimeHelpers", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Sprites.DataUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.Light2DBase", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.SpriteBone", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.SpriteChannelInfo", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.SpriteAtlasManager", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.SpriteAtlas", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Profiling.Recorder", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Profiling.Sampler", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Profiling.CustomSampler", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Jobs.IJobParallelForTransform", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Jobs.TransformAccess", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Jobs.TransformAccessArray", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.PersistentListenerMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.UnityEventTools", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.ArgumentCache", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.BaseInvokableCall", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.InvokableCall", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.UnityEventCallState", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.PersistentCall", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.PersistentCallGroup", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.InvokableCallList", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.UnityEventBase", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Events.UnityEvent", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.AlwaysLinkAssemblyAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.PreserveAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequireAttributeUsagesAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.APIUpdating.MovedFromAttributeData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.APIUpdating.MovedFromAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.Scene", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.SceneManagerAPI", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.SceneManager", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.LoadSceneMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.LocalPhysicsMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.LoadSceneParameters", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SceneManagement.CreateSceneParameters", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.FrameData", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.FrameRate", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.IPlayable", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.IPlayableOutput", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.DirectorWrapMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.Playable", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.IPlayableAsset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableAsset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableBinding", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableTraversalMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.DirectorUpdateMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableGraph", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayState", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableHandle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableOutput", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.PlayableOutputHandle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Playables.ScriptPlayableOutput", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("System.Runtime.CompilerServices.IsUnmanagedAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Baselib.ErrorState", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("Unity.Burst.BurstAuthorizedExternalMethodAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.WeightedMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.UnityEventQueueSystem", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LineUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.MeshSubsetCombineUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.StaticBatchingUtility", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Ping", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SparseTexture", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.LensFlare", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Projector", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Halo", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ImageEffectTransformsToLDR", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ImageEffectOpaque", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ImageEffectAfterScale", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.StaticBatchingHelper", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BillboardAsset", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BillboardRenderer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ReceiveGI", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.QualityLevel", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ShadowQuality", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.TexGenMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BlendWeights", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SkinWeights", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.ColorGamut", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.NPOTSupport", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CustomRenderTextureUpdateMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.CustomRenderTextureUpdateZoneSpace", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SleepTimeout", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.HDROutputSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.BatteryStatus", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FlareLayer", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SnapAxis", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SnapAxisFilter", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Ray2D", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.DrivenPropertyManager", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FullScreenMovieControlMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.FullScreenMovieScalingMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.AndroidActivityIndicatorStyle", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Handheld", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.EnumInfo", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.GradientMode", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.IconAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.iPhoneSettings", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.SpriteAlignment", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.U2D.Light2DType", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequiredMemberAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequireDerivedAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequireImplementorsAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName("UnityEngine.Scripting.RequiredInterfaceAttribute", "UnityEngine.CoreModule");
			LuaRegisterTypeByName(