[
  {
    "path": ".gitignore",
    "content": "[Ll]ibrary/\n[Tt]emp/\n[Oo]bj/\n[Bb]uild/\n\n# Autogenerated VS/MD solution and project files\n*.csproj\n*.unityproj\n*.sln\n*.suo\n*.tmp\n*.user\n*.userprefs\n*.pidb\n*.booproj\n\n# Unity3D generated meta files\n*.pidb.meta\n\n# Unity3D Generated File On Crash Reports\nsysinfo.txt\n/Assets/UnityVS.meta\n/Assets/UnityVS\n/UnityVS.tolua.v11.suo\n/UnityVS.tolua.CSharp.csproj\n/UnityVS.tolua.CSharp.Editor.csproj\n/UnityVS.tolua.sln\n\n.vs/\nPackages\nProjectSettings\n/Assets/Source/Generate\n/Assets/CSharpLuaTemp\n/Assets/CSharpLuaTemp.meta\n/Assets/Lua/.idea/\n/Assets/.lpproj\n/Assets/ThirdParty/\n/Assets/ThirdParty.meta\nLuaDebuggee.dll"
  },
  {
    "path": "Assets/CSharpLua/Base/BaseScripts.asmdef",
    "content": "{\n    \"name\": \"Base\",\n    \"references\": [],\n    \"optionalUnityReferences\": [],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false\n}"
  },
  {
    "path": "Assets/CSharpLua/Base/BaseScripts.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: a74114e4c2e22e5439cffab27da66e88\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Base/CSharpLua/BaseUtility.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing UnityEngine;\n\nnamespace CSharpLua {\n  public interface IProvider {\n    void ConvertCustomMonoBehaviour(ref GameObject prefab);\n  }\n\n  public static class BaseUtility {\n    public static IProvider Provider { get; set; }\n  }\n}\n"
  },
  {
    "path": "Assets/CSharpLua/Base/CSharpLua/BaseUtility.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 926b10807f8340942925508454855bca\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Base/CSharpLua/LuaAutoWrapAttribute.cs",
    "content": "﻿using System;\n\n/// <summary>\n/// 加入此标记,可以自动添加到导出列表\n/// </summary>\n[AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct)]\npublic class LuaAutoWrapAttribute : Attribute {\n  public LuaAutoWrapAttribute() { }\n}\n"
  },
  {
    "path": "Assets/CSharpLua/Base/CSharpLua/LuaAutoWrapAttribute.cs.meta",
    "content": "fileFormatVersion: 2\nguid: dafb7d14d4c87b74da4e18fb257c904d\ntimeCreated: 1526898161\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Base/CSharpLua/Settings.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nusing UnityEngine;\n\nnamespace CSharpLua {\n  public static class Settings {\n#if UNITY_EDITOR\n    public static class Paths {\n      public static readonly string CompiledScriptDir = Application.dataPath + \"/CSharpLua/Compiled\";\n      public static readonly string CompiledOutDir = Application.dataPath + \"/Lua/Compiled\";\n      public static readonly string ToolsDir = Application.dataPath + \"/../Tools\";\n      public const string kTempDir = \"Assets/CSharpLuaTemp\";\n      public const string kCompiledScripts = \"Compiled\";\n      public static readonly string SettingFilePath = Application.dataPath + \"/CSharpLua/Base/CSharpLua/Settings.cs\";\n    }\n\n    public static class Menus {\n      public const string kCompile = \"CharpLua/Compile\";\n      public const string kRunFromCSharp = \"CharpLua/Switch to RunFromCSharp\";\n      public const string kRunFromLua = \"CharpLua/Swicth to RunFromLua\";\n      public const string kGenProtobuf = \"CharpLua/Gen protobuf\";\n    }\n#endif\n\n    public const bool kIsRunFromLua = true;\n  }\n}\n"
  },
  {
    "path": "Assets/CSharpLua/Base/CSharpLua/Settings.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3496baf3649572f44b1d70ef854e729f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Base/CSharpLua.meta",
    "content": "fileFormatVersion: 2\nguid: 344556a0bba10b744aceb8f65773392e\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Base.meta",
    "content": "fileFormatVersion: 2\nguid: 58354dbb9d958af4399ff1a50246b611\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Bridge/BridgeScripts.asmdef",
    "content": "{\n    \"name\": \"Bridge\",\n    \"references\": [\n        \"Base\"\n    ],\n    \"optionalUnityReferences\": [],\n    \"includePlatforms\": [],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false\n}"
  },
  {
    "path": "Assets/CSharpLua/Bridge/BridgeScripts.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: 4c78da7caad00b44ea75ddb210bf7528\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Bridge/TestUtils.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing UnityEngine;\nusing UnityEditor;\n\n[LuaAutoWrap]\npublic sealed class TestUtils {\n  public static GameObject Load(string path) {\n    GameObject prefab = (GameObject)AssetDatabase.LoadMainAssetAtPath(path);\n    CSharpLua.BaseUtility.Provider.ConvertCustomMonoBehaviour(ref prefab);\n    return prefab;\n  }\n}"
  },
  {
    "path": "Assets/CSharpLua/Bridge/TestUtils.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0f7832487e5e88a47b620e14661a1e00\ntimeCreated: 1528447325\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Bridge.meta",
    "content": "fileFormatVersion: 2\nguid: d5c23c299d89e9f47a02659740280a56\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/CSharpLuaClient.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing UnityEngine;\nusing LuaInterface;\n\nnamespace CSharpLua {\n  [LuaAutoWrap]\n  public sealed class BridgeMonoBehaviour : MonoBehaviour {\n    private static readonly YieldInstruction[] updateYieldInstructions_ = new YieldInstruction[] { null, new WaitForFixedUpdate(), new WaitForEndOfFrame() };\n\n    public LuaTable Table { get; private set; }\n    public string LuaClass;\n    public string SerializeData;\n    public UnityEngine.Object[] SerializeObjects;\n\n    public void Bind(LuaTable table, string luaClass) {\n      Table = table;\n      LuaClass = luaClass;\n    }\n\n    public void Bind(LuaTable table) {\n      Table = table;\n    }\n\n    internal void Bind(string luaClass, string serializeData, UnityEngine.Object[] serializeObjects) {\n      LuaClass = luaClass;\n      SerializeData = serializeData;\n      SerializeObjects = serializeObjects;\n    }\n\n    public void RegisterUpdate(int instructionIndex, LuaFunction updateFn) {\n      StartCoroutine(StartUpdate(updateFn, updateYieldInstructions_[instructionIndex]));\n    }\n\n    private IEnumerator StartUpdate(LuaFunction updateFn, YieldInstruction yieldInstruction) {\n      while (true) {\n        yield return yieldInstruction;\n        updateFn.Call(Table);\n      }\n    }\n\n    private void Awake() {\n      if (!string.IsNullOrEmpty(LuaClass)) {\n        if (Table == null) {\n          Table = CSharpLuaClient.Instance.BindLua(this);\n        } else {\n          using (var fn = Table.GetLuaFunction(\"Awake\")) {\n            fn.Call(Table);\n          }\n        }\n      }\n    }\n\n    private void Start() {\n      using (var fn = Table.GetLuaFunction(\"Start\")) {\n        fn.Call(Table);\n      }\n    }\n  }\n\n  internal sealed class LuaIEnumerator : IEnumerator, IDisposable {\n    private LuaTable table_;\n    private LuaFunction current_;\n    private LuaFunction moveNext_;\n\n    private LuaIEnumerator(LuaTable table) {\n      table_ = table;\n      current_ = table.GetLuaFunction(\"getCurrent\");\n      if (current_ == null) {\n        throw new ArgumentNullException();\n      }\n      moveNext_ = table.GetLuaFunction(\"MoveNext\");\n      if (moveNext_ == null) {\n        throw new ArgumentNullException();\n      }\n    }\n\n    public static LuaIEnumerator Create(LuaTable table) {\n      var ret = table.GetTable<LuaIEnumerator>(\"ref\");\n      if (ret == null) {\n        ret = new LuaIEnumerator(table);\n        table.SetTable(\"ref\", ret);\n      }\n      return ret;\n    }\n\n    public void Push(IntPtr L) {\n      table_.Push();\n    }\n\n    public object Current {\n      get {\n        object obj = current_.Invoke<LuaTable, object>(table_);\n        var t = obj as LuaTable;\n        if (t != null && CSharpLuaClient.Instance.IsLuaIEnumerator(t)) {\n          return Create(t);\n        }\n        return obj;\n      }\n    }\n\n    public void Dispose() {\n      if (current_ != null) {\n        current_.Dispose();\n        current_ = null;\n      }\n\n      if (moveNext_ != null) {\n        moveNext_.Dispose();\n        moveNext_ = null;\n      }\n\n      if (table_ != null) {\n        table_.Dispose();\n        table_ = null;\n      }\n    }\n\n    public bool MoveNext() {\n      bool hasNext = moveNext_.Invoke<LuaTable, bool>(table_);\n      if (!hasNext) {\n        Dispose();\n      }\n      return hasNext;\n    }\n\n    public void Reset() {\n      throw new NotSupportedException();\n    }\n  }\n\n  public class CSharpLuaClient : LuaClient, IProvider {\n    public string[] Components;\n    private LuaFunction bindFn_;\n    private LuaFunction isIEnumeratorFn_;\n    public static new CSharpLuaClient Instance { get { return (CSharpLuaClient)LuaClient.Instance; } }\n\n    protected override void OpenLibs() {\n      base.OpenLibs();\n      OpenCJson();\n      OpenPBC();\n    }\n\n    private void OpenPBC() {\n      luaState.OpenLibs(LuaDLL.luaopen_protobuf_c);\n    }\n\n    public override void Destroy() {\n      if (bindFn_ != null) {\n        bindFn_.Dispose();\n        bindFn_ = null;\n      }\n      if (isIEnumeratorFn_ != null) {\n        isIEnumeratorFn_.Dispose();\n        isIEnumeratorFn_ = null;\n      }\n      base.Destroy();\n      BaseUtility.Provider = null;\n    }\n\n    protected override void StartMain() {\n      BaseUtility.Provider = this;\n\n      if (Settings.kIsRunFromLua) {\n        base.StartMain();\n        bindFn_ = luaState.GetFunction(\"UnityEngine.bind\");\n        if (bindFn_ == null) {\n          throw new InvalidProgramException();\n        }\n        if (Components != null && Components.Length > 0) {\n          using (var fn = luaState.GetFunction(\"UnityEngine.addComponent\")) {\n            foreach (string type in Components) {\n              fn.Call(gameObject, type);\n            }\n          }\n        }\n      } else {\n#pragma warning disable 0162\n        if (Components != null) {\n          foreach (string type in Components) {\n            Type componentType = Type.GetType(type, true, false);\n            gameObject.AddComponent(componentType);\n          }\n        }\n#pragma warning restore 0162\n      }\n    }\n\n    internal LuaTable BindLua(BridgeMonoBehaviour bridgeMonoBehaviour) {\n      return bindFn_.Invoke<BridgeMonoBehaviour, string, string, UnityEngine.Object[], LuaTable>(\n        bridgeMonoBehaviour,\n        bridgeMonoBehaviour.LuaClass,\n        bridgeMonoBehaviour.SerializeData,\n        bridgeMonoBehaviour.SerializeObjects);\n    }\n\n    internal bool IsLuaIEnumerator(LuaTable t) {\n      if (isIEnumeratorFn_ == null) {\n        isIEnumeratorFn_ = luaState.GetFunction(\"System.IsIEnumerator\");\n        if (isIEnumeratorFn_ == null) {\n          throw new InvalidProgramException();\n        }\n      }\n      return isIEnumeratorFn_.Invoke<LuaTable, bool>(t);\n    }\n\n\n    public void ConvertCustomMonoBehaviour(ref GameObject prefab) {\n#if UNITY_EDITOR\n      if (Settings.kIsRunFromLua) {\n        UserMonoBehaviourConverter.Default.Do(ref prefab);\n      }\n#endif\n    }\n  }\n}\n\n"
  },
  {
    "path": "Assets/CSharpLua/CSharpLuaClient.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1c379516c224fca4198f4de0962735e4\ntimeCreated: 1528271831\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/CompiledScripts.asmdef",
    "content": "{\n  \"name\": \"Compiled\",\n  \"references\": [\n    \"Bridge\"\n  ],\n  \"optionalUnityReferences\": [],\n  \"includePlatforms\": [],\n  \"excludePlatforms\": [],\n  \"allowUnsafeCode\": false\n}"
  },
  {
    "path": "Assets/CSharpLua/Compiled/CompiledScripts.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: 55be9d1390aba8646b0237dae609af2e\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Protocol/AutoGen/CommonPrototype.cs",
    "content": "//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\n// Generated from: CommonPrototype.proto\n\nusing System;   \nusing System.Collections.Generic;\nusing ProtoBuf;\n    \nnamespace CSharpLua.Project.Protocol\n{\n  [ProtoContract]\n  public partial class SettingProto : IProtocol\n  { \n    [ProtoMember(1, DataFormat = DataFormat.Default)]\n    public List<CSharpLua.Project.Protocol.SettingProto.ValuePairProto> Values { get; set; } = new List<CSharpLua.Project.Protocol.SettingProto.ValuePairProto>();\n  \n    [ProtoMember(2, IsRequired = true, DataFormat = DataFormat.TwosComplement)]\n    public int SettingsMark { get; set; }\n    \n  [ProtoContract]\n  public partial class ValuePairProto : IProtocol\n  { \n    [ProtoMember(1, IsRequired = true, DataFormat = DataFormat.Default)]\n    public string Key { get; set; }\n    \n    [ProtoMember(2, IsRequired = true, DataFormat = DataFormat.Default)]\n    public string Value { get; set; }\n    \n  }\n  \n  }\n  \n}"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Protocol/AutoGen/CommonPrototype.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 78debcec0b8758e4b9dbde7b10c1128a\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Protocol/AutoGen.meta",
    "content": "fileFormatVersion: 2\nguid: b7e6a6d4681331a47b4a8f5228a03018\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Protocol/CommonPrototype.proto",
    "content": "package CSharpLua.Project.Protocol;\n\nmessage SettingProto {\n  message ValuePairProto {\n    required string Key = 1;\n    required string Value = 2;\n  }\n\n  repeated ValuePairProto Values = 1;         \n  required int32 SettingsMark = 2;\n}\n\n\n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Protocol/CommonPrototype.proto.meta",
    "content": "fileFormatVersion: 2\nguid: 07f5e97e19969f74dbd315423dbc49fb\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Protocol/IProtocol.cs",
    "content": "namespace ProtoBuf {\n  public interface IProtocol {\n  }\n}"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Protocol/IProtocol.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3e84cedf7f75dd1488cd80392079610f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Protocol.meta",
    "content": "fileFormatVersion: 2\nguid: e27d3b48940561d4b86687784d596098\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample/TestCoroutine.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing UnityEngine;\n\nnamespace Sample {\n  public class TestCoroutine : MonoBehaviour {\n    private List<int> list = new List<int>();\n\n    public void Awake() {\n      Debug.Log(\"TestCoroutine\");\n      StartCoroutine(OnTick());\n      print(gameObject.name);\n      print(list.Count);\n      StartCoroutine(T1());\n    }\n\n    private IEnumerator OnTick() {\n      while (true) {\n        yield return new WaitForSeconds(1);\n        print(\"TestCoroutine.OnTick\");\n      }\n    }\n\n    public void Test() {\n      print(\"TestCoroutine.Test\");\n    }\n\n\n    private IEnumerator T1() {\n      print(\"a0\");\n      yield return null;\n      print(\"a1\");\n      yield return T2();\n      print(\"a2\");\n    }\n\n    private IEnumerator T2() {\n      print(\"b0\");\n      yield return null;\n      print(\"b1\");\n      yield return null;\n      print(\"b2\");\n    }\n  }\n}\n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample/TestCoroutine.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 729f6a41b84190a4ea3b9a09e6fa57a7\ntimeCreated: 1528274108\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample/TestHangingScript.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing UnityEngine;\n\nnamespace Sample {\n  public class TestHangingScript : MonoBehaviour {\n    public string DataOfString;\n    public int DataOfInt;\n    public string DataOfString2 = \"ddddd\";\n    public int a = 10;\n    public GameObject DataOfGameObject;\n    public UnityEngine.Object DateOfObject;\n    public TestCoroutine HangingMonoBehaviour;\n    public List<int> l = new List<int>();\n    public Vector2 vector2;\n    public Vector3 vector3;\n\n    public void Awake() {\n      print(\"Awake\");\n      print(DataOfString);\n      print(DataOfInt);\n      print(DataOfString2);\n      print(a);\n      print(HangingMonoBehaviour.name);\n      print(string.Join(\",\", l));\n      print($\"{vector2}, {vector3}\");\n    }\n\n    public void Start() {\n      print(\"Start\");\n    }\n  }\n}\n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample/TestHangingScript.cs.meta",
    "content": "fileFormatVersion: 2\nguid: aa1fc193057764b49b4ef3ad042007cd\ntimeCreated: 1528274108\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample/TestHelloWord.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing UnityEngine;\n\nnamespace Sample {\n  public sealed class TestHelloWord : MonoBehaviour {\n    public void Awake() {\n      Debug.Log(\"TestHelloWord\");\n      gameObject.AddComponent<TestCoroutine>();\n      var c = GetComponent<MonoBehaviour>();\n      print(c.name);\n\n      var obj1 = FindObjectOfType<MonoBehaviour>();\n      Destroy(obj1);\n\n      GameObject i = TestUtils.Load(\"Assets/CSharpLua/Examples/01_HelloWorld/TestLoader.prefab\");\n      var obj = Instantiate(i);\n      obj.transform.parent = transform;\n\n      TestProtobuf.Run();\n    }\n\n    private void Start() {\n      print(\"TestHelloWord.Start\");\n    }\n\n    private void Update() {\n      print(\"TestHelloWord.Update\");\n    }\n  }\n}\n\n\n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample/TestHelloWord.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d01266a3cb9c65446aff41f37bc14f67\ntimeCreated: 1528274108\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample/TestProtobuf.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nusing ProtoBuf;\nusing CSharpLua.Project.Protocol;\nusing System.IO;\nusing ProtoBuf.Meta;\n\nnamespace Sample {\n  public static class TestProtobuf {\n    public static void Run() {\n#if __CSharpLua__\n      /*\n      [[\n      protobuf.register_file(\"Assets/Lua/3rd/pbc/Protocol/CommonPrototype.pb\")\n      ]]\n      */\n#endif\n      SettingProto proto = new SettingProto() { SettingsMark = 101 };\n      proto.Values.Add(new SettingProto.ValuePairProto() { Key = \"a\", Value = \"b\" });\n      var bytes = Encode(proto);\n      var t = Decode<SettingProto>(bytes);\n      UnityEngine.Debug.LogFormat(\"ProtobufDecode {0}\", t.SettingsMark);\n    }\n\n    private static byte[] Encode(IProtocol proto) {\n#if !__CSharpLua__\n      using (MemoryStream s = new MemoryStream()) {\n        RuntimeTypeModel.Default.Serialize(s, proto);\n        return s.ToArray();\n      }\n#else\n      byte[] bytes = null;\n      /*\n      [[\n       bytes = encodeProtobuf(proto)\n      ]]\n      */\n      return bytes;\n#endif\n    }\n\n    private static T Decode<T>(byte[] bytes) where T : class {\n#if !__CSharpLua__\n      using (MemoryStream s = new MemoryStream(bytes)) {\n        var t = (T)RuntimeTypeModel.Default.Deserialize(s, null, typeof(T));\n        return t;\n      }\n#else\n      T t = null;\n      /*\n      [[\n       t = decodeProtobuf(bytes, T)\n      ]]\n      */\n      return t;\n#endif\n    }\n\n  }\n}\n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample/TestProtobuf.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 702d00be8d6fcda448f17c8a3eecd43f\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled/Sample.meta",
    "content": "fileFormatVersion: 2\nguid: c756251f944f45b4f91b0d682a8e5811\nfolderAsset: yes\ntimeCreated: 1528272569\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Compiled.meta",
    "content": "fileFormatVersion: 2\nguid: 30775760c22aaf9428e8d40b0574a998\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Editor/Compiler.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Reflection;\nusing System.Linq;\nusing System.Text;\n\nusing UnityEditor;\nusing UnityEngine;\n\nnamespace CSharpLua {\n  public static class Compiler {\n    private sealed class CompiledFail : Exception {\n      public CompiledFail(string message) : base(message) {\n      }\n    }\n\n#if UNITY_EDITOR_WIN\n    private const string kDotnet = \"dotnet\";\n#else\n    private const string kDotnet = \"/usr/local/share/dotnet/dotnet\";\n#endif\n\n    private static readonly string compiledScriptDir_ = Settings.Paths.CompiledScriptDir;\n    private static readonly string outDir_ = Settings.Paths.CompiledOutDir;\n    private static readonly string csharpToolsDir_ = $\"{Settings.Paths.ToolsDir}/CSharpLua\";\n    private static readonly string csharpLua_ = $\"{csharpToolsDir_}/CSharp.lua/CSharp.lua.Launcher.dll\";\n    private static readonly string genProtobuf = $\"{Settings.Paths.ToolsDir}/ProtobufGen/protogen.bat\";\n    private static readonly string settingFilePath_ = Settings.Paths.SettingFilePath;\n\n    [MenuItem(Settings.Menus.kCompile)]\n    public static void Compile() {\n      if (!CheckDotnetInstall()) {\n        return;\n      }\n\n      if (!File.Exists(csharpLua_)) {\n        throw new InvalidProgramException($\"{csharpLua_} not found\");\n      }\n\n      var outDirectoryInfo = new DirectoryInfo(outDir_);\n      if (outDirectoryInfo.Exists) {\n        foreach (var luaFile in outDirectoryInfo.EnumerateFiles(\"*.lua\", SearchOption.AllDirectories)) {\n          luaFile.Delete();\n        }\n      }\n\n      HashSet<string> libs = new HashSet<string>();\n      FillUnityLibraries(libs);\n      AssemblyName assemblyName = new AssemblyName(Settings.Paths.kCompiledScripts);\n      Assembly assembly = Assembly.Load(assemblyName);\n      foreach (var referenced in assembly.GetReferencedAssemblies()) {\n        if (referenced.Name != \"mscorlib\" && !referenced.Name.StartsWith(\"System\")) {\n          string libPath = Assembly.Load(referenced).Location;\n          libs.Add(libPath);\n        }\n      }\n\n      string[] metas = new string[] { $\"{csharpToolsDir_}/UnityEngine.xml\" };\n      string lib = string.Join(\";\", libs.ToArray());\n      string meta = string.Join(\";\", metas);\n      string args = $\"{csharpLua_}  -s \\\"{compiledScriptDir_}\\\" -d \\\"{outDir_}\\\" -l \\\"{lib}\\\" -m {meta} -c\";\n      string definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);\n      if (!string.IsNullOrEmpty(definesString)) {\n        args += $\" -csc -define:{definesString}\";\n      }\n\n      var info = new ProcessStartInfo() {\n        FileName = kDotnet,\n        Arguments = args,\n        UseShellExecute = false,\n        RedirectStandardOutput = true,\n        RedirectStandardError = true,\n        StandardOutputEncoding = Encoding.UTF8,\n        StandardErrorEncoding = Encoding.UTF8,\n      };\n      using (var p = Process.Start(info)) {\n        var output = new StringBuilder();\n        var error = new StringBuilder();\n        p.OutputDataReceived += (sender, eventArgs) => output.AppendLine(eventArgs.Data);\n        p.ErrorDataReceived += (sender, eventArgs) => error.AppendLine(eventArgs.Data);\n        p.BeginOutputReadLine();\n        p.BeginErrorReadLine();\n        p.WaitForExit();\n        if (p.ExitCode == 0) {\n          UnityEngine.Debug.Log(output);\n        } else {\n          throw new CompiledFail($\"Compile fail, {error}\\n{output}\\n{kDotnet} {args}\");\n        }\n      }\n    }\n\n    private static void FillUnityLibraries(HashSet<string> libs) {\n      string unityObjectPath = typeof(UnityEngine.Object).Assembly.Location;\n      string baseDir = Path.GetDirectoryName(unityObjectPath);\n      foreach (string path in Directory.EnumerateFiles(baseDir, \"*.dll\")) {\n        libs.Add(path);\n      }\n    }\n\n    private static bool CheckDotnetInstall() {\n      bool has = InternalCheckDotnetInstall();\n      if (!has) {\n        UnityEngine.Debug.LogWarning(\"not found dotnet\");\n        if (EditorUtility.DisplayDialog(\".NET未安装\", \"未安装.NET 5.0运行环境，点击确定前往安装\", \"确定\", \"取消\")) {\n          Application.OpenURL(\"https://dotnet.microsoft.com/download/dotnet/5.0\");\n        }\n      }\n      return has;\n    }\n\n    private static bool InternalCheckDotnetInstall() {\n      var info = new ProcessStartInfo() {\n        FileName = kDotnet,\n        Arguments = \"--version\",\n        UseShellExecute = false,\n        RedirectStandardOutput = true,\n        RedirectStandardError = true,\n        CreateNoWindow = true,\n        StandardOutputEncoding = Encoding.UTF8,\n        StandardErrorEncoding = Encoding.UTF8,\n      };\n      try {\n        using (var p = Process.Start(info)) {\n          p.WaitForExit();\n          if (p.ExitCode == 0) {\n            string version = p.StandardOutput.ReadToEnd();\n            UnityEngine.Debug.LogFormat(\"found dotnet {0}\", version);\n            int major = version[0] - '0';\n            if (major >= 5) {\n              return true;\n            } else {\n              UnityEngine.Debug.LogErrorFormat(\"dotnet verson {0} must >= 5.0\", version);\n            }\n          }\n          return false;\n        }\n      } catch (Exception e) {\n        UnityEngine.Debug.LogException(e);\n        return false;\n      }\n    }\n\n    [MenuItem(Settings.kIsRunFromLua ? Settings.Menus.kRunFromCSharp : Settings.Menus.kRunFromLua)]\n    public static void Switch() {\n#if UNITY_2018_1_OR_NEWER\n      const string kFieldName = nameof(Settings.kIsRunFromLua);\n#else\n      const string kFieldName = \"kIsRunFromLua\";\n#endif\n\n      string text = File.ReadAllText(settingFilePath_);\n      int begin = text.IndexOf(kFieldName);\n      if (begin != -1) {\n        int end = text.IndexOf(';', begin + kFieldName.Length);\n        if (end != -1) {\n          string s = text.Substring(begin, end - begin);\n          string[] array = s.Split('=');\n          bool v = bool.Parse(array[1]);\n          string replace = kFieldName + \" = \" + (v ? \"false\" : \"true\");\n          text = text.Replace(s, replace);\n          File.WriteAllText(settingFilePath_, text);\n          AssetDatabase.Refresh();\n        } else {\n          throw new InvalidProgramException($\"field {kFieldName} not found end symbol in {settingFilePath_}\");\n        }\n      } else {\n        throw new InvalidProgramException($\"not found field {kFieldName} in {settingFilePath_}\");\n      }\n    }\n\n    [MenuItem(Settings.Menus.kGenProtobuf)]\n    public static void GenProtobuf() {\n      var info = new ProcessStartInfo() {\n        FileName = genProtobuf,\n        UseShellExecute = false,\n        RedirectStandardOutput = true,\n        RedirectStandardError = true,\n        CreateNoWindow = true,\n        StandardOutputEncoding = Encoding.UTF8,\n        StandardErrorEncoding = Encoding.UTF8,\n        WorkingDirectory = $\"{Settings.Paths.ToolsDir}/ProtobufGen/\",\n      };\n      var p = Process.Start(info);\n      p.OutputDataReceived += (sender, eventArgs) => {\n        if (!string.IsNullOrEmpty(eventArgs.Data)) {\n          UnityEngine.Debug.Log(eventArgs.Data);\n        }\n      };\n      p.ErrorDataReceived += (sender, eventArgs) => { \n        if (!string.IsNullOrEmpty(eventArgs.Data)) {\n          UnityEngine.Debug.LogError(eventArgs.Data);\n        }\n      };\n      p.BeginOutputReadLine();\n      p.BeginErrorReadLine();\n    }\n  }\n\n#if UNITY_2018_1_OR_NEWER\n  [InitializeOnLoad]\n  public class EditorQuitHandler {\n    static void Quit() {\n      string tempDir = Settings.Paths.kTempDir;\n      if (Directory.Exists(tempDir)) {\n        Directory.Delete(tempDir, true);\n      }\n    }\n\n    static EditorQuitHandler() {\n      EditorApplication.quitting += Quit;\n    }\n  }\n#endif\n}\n\n"
  },
  {
    "path": "Assets/CSharpLua/Editor/Compiler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 59c6d8baca17a7146b763b1e4fa394d6\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 4fe6f8ae96df5fd45bf9bbab5cb9a8e7\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Examples/01_HelloWorld/HelloWorld.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 44e8c9b1935171746b04903a251c413d\ntimeCreated: 1526899852\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Examples/01_HelloWorld/TestLoader.prefab.meta",
    "content": "fileFormatVersion: 2\nguid: 20c93afce42002a41a008ca942ccb69d\nNativeFormatImporter:\n  externalObjects: {}\n  mainObjectFileID: 100100000\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Examples/01_HelloWorld/testText.txt",
    "content": "hello,word"
  },
  {
    "path": "Assets/CSharpLua/Examples/01_HelloWorld/testText.txt.meta",
    "content": "fileFormatVersion: 2\nguid: a0ac40db8f690ec43aeb9ee683d170f6\nTextScriptImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Examples/01_HelloWorld.meta",
    "content": "fileFormatVersion: 2\nguid: e64303adce0f8d8438e46552eb0f8b84\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/Examples.meta",
    "content": "fileFormatVersion: 2\nguid: 19a7a8aa535d0de4ba63cd62704e83f6\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua/UserMonoBehaviourConverter.cs",
    "content": "﻿#if UNITY_EDITOR  \nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Diagnostics.Contracts;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\nusing System.Reflection;\n\nusing UnityEngine;\nusing UnityEditor;\nusing LuaInterface;\n\nnamespace CSharpLua {\n  public sealed class UserMonoBehaviourConverter {\n    private sealed class StructField {\n      private string s_;\n      public bool HasField { get; set; }\n\n      public StructField(object v) {\n        StringBuilder sb = new StringBuilder();\n        sb.Append('{');\n        Type t = v.GetType();\n        bool isFirst = true;\n        foreach (var field in t.GetFields(BindingFlags.Instance | BindingFlags.Public)) {\n          object x = field.GetValue(v);\n          if (x != null) {\n            var y = Activator.CreateInstance(x.GetType());\n            if (!x.EQ(y)) {\n              if (isFirst) {\n                isFirst = false;\n              } else {\n                sb.Append(',');\n              }\n              sb.Append(field.Name);\n              sb.Append('=');\n              sb.Append(SerializeFieldsInfo.NormalValueToString(x));\n              HasField = true;\n            }\n          }\n        }\n        sb.Append(',');\n        sb.Append(t.FullName);\n        sb.Append('}');\n        s_ = sb.ToString();\n      }\n\n      public override string ToString() {\n        return s_;\n      }\n    }\n\n    private sealed class SerializeFieldsInfo {\n      internal abstract class ObjectField {\n        public string Name;\n        public abstract void FillTo(StringBuilder sb);\n      }\n\n      internal sealed class PoolIndexObjectField : ObjectField {\n        public int PoolIndex;\n\n        public override void FillTo(StringBuilder sb) {\n          sb.Append(PoolIndex);\n        }\n      }\n\n      internal sealed class ArrayObjectField : ObjectField {\n        public bool IsArray;\n        public Type ElementType;\n        public List<int> PoolIndexs = new List<int>();\n\n        public override void FillTo(StringBuilder sb) {\n          string array = ToList(IsArray, ElementType, PoolIndexs, i => i.ToString());\n          sb.Append(array);\n        }\n      }\n\n      internal sealed class MonoBehaviourField {\n        public int PoolIndex;\n        public string ClassName;\n      }\n\n      public Dictionary<string, object> Normals = new Dictionary<string, object>();\n      public List<UnityEngine.Object> ObjectsPool = new List<UnityEngine.Object>();\n      public List<ObjectField> Objects = new List<ObjectField>();\n      public List<MonoBehaviourField> MonoBehaviourFields = new List<MonoBehaviourField>();\n\n      private void AppendNormals(StringBuilder sb) {\n        sb.Append('{');\n        bool isFirst = true;\n        foreach (var normal in Normals) {\n          if (isFirst) {\n            isFirst = false;\n          } else {\n            sb.Append(',');\n          }\n          sb.Append(normal.Key);\n          sb.Append('=');\n          sb.Append(ValueToString(normal.Value));\n        }\n        sb.Append(\"}\");\n      }\n\n      private void AppendObjects(StringBuilder sb) {\n        if (Objects.Count > 0) {\n          sb.Append('{');\n          bool isFirst = true;\n          foreach (var field in Objects) {\n            if (isFirst) {\n              isFirst = false;\n            } else {\n              sb.Append(',');\n            }\n            sb.Append(field.Name);\n            sb.Append('=');\n            field.FillTo(sb);\n          }\n          sb.Append('}');\n        }\n      }\n\n      public string GetSerializeData() {\n        bool isEmpty = Normals.Count == 0 && Objects.Count == 0;\n        StringBuilder sb = new StringBuilder();\n        if (!isEmpty) {\n          sb.Append(\"return{\");\n          AppendNormals(sb);\n          sb.Append(',');\n          AppendObjects(sb);\n          sb.Append('}');\n        }\n        return sb.ToString();\n      }\n\n      public UnityEngine.Object[] GetSerializeObjects() {\n        return ObjectsPool.Count > 0 ? ObjectsPool.ToArray() : null;\n      }\n\n      private static string ToList(bool isArray, Type elementType, IList list, Func<object, string> transfore) {\n        StringBuilder sb = new StringBuilder();\n        sb.Append('{');\n        if (list.Count > 0) {\n          bool isFirst = true;\n          foreach (var i in list) {\n            if (isFirst) {\n              isFirst = false;\n            } else {\n              sb.Append(',');\n            }\n            sb.Append(transfore(i));\n          }\n          sb.Append(',');\n        }\n        if (isArray) {\n          sb.AppendFormat(\"System.Array({0})\", elementType.FullName);\n        } else {\n          sb.AppendFormat(\"System.List({0})\", elementType.FullName);\n        }\n        sb.Append('}');\n        return sb.ToString();\n      }\n\n      internal static string NormalValueToString(object v) {\n        if (v is string) {\n          return \"\\\"\" + v + \"\\\"\";\n        }\n\n        return v.ToString();\n      }\n\n      private static string ValueToString(object v) {\n        if (v is IList) {\n          var list = (IList)v;\n          bool isArray = list is Array;\n          var elementType = isArray ? v.GetType().GetElementType() : v.GetType().GetIListElementType();\n          return ToList(isArray, elementType, list, NormalValueToString);\n        }\n\n        return NormalValueToString(v);\n      }\n    }\n\n    private sealed class MonoBehaviourFieldLazy {\n      public string ClassName;\n      public SerializeFieldsInfo SerializeInfo;\n      public BridgeMonoBehaviour BridgeMonoBehaviour;\n\n      public void Bind() {\n        foreach (var field in SerializeInfo.MonoBehaviourFields) {\n          var gameObject = (GameObject)SerializeInfo.ObjectsPool[field.PoolIndex];\n          var bridges = gameObject.GetComponents<BridgeMonoBehaviour>();\n          var item = bridges.Single(i => i.LuaClass == field.ClassName);\n          SerializeInfo.ObjectsPool[field.PoolIndex] = item;\n        }\n        BridgeMonoBehaviour.Bind(ClassName, SerializeInfo.GetSerializeData(), SerializeInfo.GetSerializeObjects());\n      }\n    }\n\n    private static readonly string tempPrefabDir_ = Settings.Paths.kTempDir + \"/prefabs\";\n    private static readonly string compiledScriptsManifestPath_ = Settings.Paths.CompiledOutDir + \"/manifest.lua\";\n    private static UserMonoBehaviourConverter default_;\n\n    private HashSet<string> userDefinedNames_;\n    private LuaState luaState_;\n\n    public UserMonoBehaviourConverter() {\n      Load();\n    }\n\n    private void Load() {\n      LoadClassNames();\n      luaState_ = LuaClient.GetMainState();\n      if (luaState_ == null) {\n        throw new InvalidProgramException(\"not found MainState\");\n      }\n    }\n\n    public static UserMonoBehaviourConverter Default {\n      get {\n        if (default_ == null) {\n          default_ = new UserMonoBehaviourConverter();\n        }\n        return default_;\n      }\n    }\n\n    private void PauseEdit() {\n      if (Application.isPlaying) {\n        UnityEngine.Debug.Break();\n      }\n    }\n\n    private void LoadClassNames() {\n      const string kBeginToken = \"types = {\";\n      const string kEndToken = \"}\";\n\n      if (!File.Exists(compiledScriptsManifestPath_)) {\n        PauseEdit();\n        throw new InvalidOperationException(\"please compiled scripts first\");\n      }\n\n      string content = File.ReadAllText(compiledScriptsManifestPath_);\n      int begin = content.IndexOf(kBeginToken);\n      if (begin == -1) {\n        throw new InvalidProgramException();\n      }\n      begin += kBeginToken.Length;\n      int end = content.IndexOf(kEndToken, begin);\n      if (end == -1) {\n        throw new InvalidProgramException();\n      }\n\n      var userDefines = content.Substring(begin, end - begin).Split(',').Select(i => i.Trim().Trim('\"')).ToArray();\n      userDefinedNames_ = new HashSet<string>(userDefines);\n    }\n\n    private static void CopyTempPrefab(ref GameObject prefab) {\n      string oldPath = AssetDatabase.GetAssetPath(prefab);\n      string path = Path.Combine(tempPrefabDir_, oldPath);\n      Directory.CreateDirectory(Path.GetDirectoryName(path));\n#if UNITY_2018_3 || UNITY_2018_4\n      prefab = PrefabUtility.SaveAsPrefabAsset(UnityEngine.Object.Instantiate(prefab), path);\n#else\n      prefab = PrefabUtility.CreatePrefab(path, prefab);\n#endif\n\n      /*\n      try {\n        prefab = PrefabUtility.CreatePrefab(path, prefab);\n      } catch (ArgumentException e) when (e.Message == \"Can't save persistent object as a Prefab asset\") {\n        throw new InvalidDataException(\"目前2018.3拷贝预设存在BUG,暂时未发现规避的方法,请使用较低或较高版本\");\n      }*/\n    }\n\n    private bool IsUserMonoBehaviourExists(GameObject prefab) {\n      var childrens = GetChildrenTransform(prefab.transform);\n      foreach (var gameObject in childrens) {\n        var monoBehaviours = gameObject.GetComponents<MonoBehaviour>();\n        foreach (MonoBehaviour monoBehaviour in monoBehaviours) {\n          if (IsUserDefine(monoBehaviour.GetType())) {\n            return true;\n          }\n        }\n      }\n      return false;\n    }\n\n    public bool Do(ref GameObject prefab) {\n      if (IsUserMonoBehaviourExists(prefab)) {\n        CopyTempPrefab(ref prefab);\n\n        List<MonoBehaviourFieldLazy> monoBehaviourFieldLazys = new List<MonoBehaviourFieldLazy>();\n        var childrens = GetChildrenTransform(prefab.transform);\n        foreach (var t in childrens) {\n          Convert(t.gameObject, monoBehaviourFieldLazys);\n        }\n\n        foreach (var i in monoBehaviourFieldLazys) {\n          i.Bind();\n        }\n\n        return true;\n      }\n      return false;\n    }\n\n    private List<Transform> GetChildrenTransform(Transform parent) {\n      List<Transform> list = new List<Transform> { parent };\n      GetChildrenTransform(list, parent);\n      return list;\n    }\n\n    private void GetChildrenTransform(List<Transform> list, Transform parent) {\n      int count = parent.childCount;\n      for (int i = 0; i < count; i++) {\n        Transform child = parent.GetChild(i);\n        list.Add(child);\n        GetChildrenTransform(list, child);\n      }\n    }\n\n    private bool IsUserDefine(Type type) {\n      return userDefinedNames_.Contains(type.FullName);\n    }\n\n    private void Convert(GameObject gameObject, List<MonoBehaviourFieldLazy> lazys) {\n      var monoBehaviours = gameObject.GetComponents<MonoBehaviour>();\n      foreach (MonoBehaviour monoBehaviour in monoBehaviours) {\n        if (IsUserDefine(monoBehaviour.GetType())) {\n          Convert(monoBehaviour, lazys);\n        }\n      }\n    }\n\n    private bool IsSerializedField(FieldInfo field) {\n      if (field.IsPublic) {\n        return !field.IsDefined(typeof(HideInInspector), false);\n      } else {\n        return field.IsDefined(typeof(SerializeField), false);\n      }\n    }\n\n    private void Convert(MonoBehaviour monoBehaviour, List<MonoBehaviourFieldLazy> lazys) {\n      Type type = monoBehaviour.GetType();\n      string className = type.FullName;\n      using (var luaClass = luaState_.GetTable(className)) {\n        if (luaClass == null) {\n          PauseEdit();\n          throw new InvalidOperationException($\"{className} is not found in lua env\");\n        }\n\n        SerializeFieldsInfo info = new SerializeFieldsInfo();\n        FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);\n        foreach (FieldInfo field in fields) {\n          if (IsSerializedField(field)) {\n            Convert(monoBehaviour, luaClass, field, info);\n          }\n        }\n\n        GameObject gameObject = monoBehaviour.gameObject;\n        UnityEngine.Object.DestroyImmediate(monoBehaviour, true);\n        var bridgeMonoBehaviour = gameObject.AddComponent<BridgeMonoBehaviour>();\n        if (info.MonoBehaviourFields.Count == 0) {\n          bridgeMonoBehaviour.Bind(className, info.GetSerializeData(), info.GetSerializeObjects());\n        } else {\n          lazys.Add(new MonoBehaviourFieldLazy() {\n            ClassName = className,\n            SerializeInfo = info,\n            BridgeMonoBehaviour = bridgeMonoBehaviour,\n          });\n        }\n      }\n    }\n\n    private static bool IsSameRootGameObject(GameObject x, GameObject y) {\n      string pathX = AssetDatabase.GetAssetPath(x);\n      string pathY = AssetDatabase.GetAssetPath(y);\n      return pathX == pathY;\n    }\n\n    private static bool IsNormalType(Type type, out TypeCode typeCode) {\n      typeCode = Type.GetTypeCode(type);\n      return typeCode == TypeCode.String || (typeCode >= TypeCode.Boolean && typeCode <= TypeCode.Double);\n    }\n\n    private static bool IsNormalType(Type type) {\n      TypeCode typeCode;\n      return IsNormalType(type, out typeCode);\n    }\n\n    private int ConvertUnityEngineGameObject(MonoBehaviour monoBehaviour, object fieldValue, SerializeFieldsInfo info) {\n      int poolIndex = info.ObjectsPool.Count;\n      var obj = (UnityEngine.Object)fieldValue;\n      if (obj is GameObject) {\n        var gameObject = (GameObject)obj;\n        if (!IsSameRootGameObject(monoBehaviour.gameObject, gameObject)) {\n          bool hasChanged = Do(ref gameObject);\n          if (hasChanged) {\n            obj = gameObject;\n          }\n        }\n      } else if (obj is MonoBehaviour) {\n        var mb = (MonoBehaviour)obj;\n        var gameObject = mb.gameObject;\n        bool isSameRoot = IsSameRootGameObject(monoBehaviour.gameObject, gameObject);\n        if (!isSameRoot) {\n          bool hasChanged = Do(ref gameObject);\n          if (hasChanged) {\n            obj = gameObject;\n          }\n        } else {\n          obj = gameObject;\n        }\n        if (IsUserDefine(mb.GetType())) {\n          if (isSameRoot) {\n            info.MonoBehaviourFields.Add(new SerializeFieldsInfo.MonoBehaviourField() {\n              PoolIndex = poolIndex,\n              ClassName = mb.GetType().FullName,\n            });\n          } else {\n            var bridges = gameObject.GetComponents<BridgeMonoBehaviour>();\n            var mbNew = bridges.Single(i => i.LuaClass == mb.GetType().FullName);\n            Contract.Assert(mbNew != null);\n            obj = mbNew;\n          }\n        } else {\n          var mbNew = gameObject.GetComponent(mb.GetType());\n          obj = mbNew;\n        }\n      }\n\n      info.ObjectsPool.Add(obj);\n      return poolIndex;\n    }\n\n    private void Convert(MonoBehaviour monoBehaviour, LuaTable luaClass, FieldInfo field, SerializeFieldsInfo info) {\n      Type fieldType = field.FieldType;\n      object fieldValue = field.GetValue(monoBehaviour);\n      TypeCode fieldTypeCode;\n\n      if (IsNormalType(fieldType, out fieldTypeCode)) {\n        object x = fieldValue;\n        object y = luaClass.RawGet<string, object>(field.Name);\n        if (y is double) {\n          if (fieldTypeCode == TypeCode.Char) {\n            x = (double)(char)x;\n          } else {\n            x = System.Convert.ToDouble(x);\n          }\n        }\n        if (!x.EQ(y)) {\n          info.Normals.Add(field.Name, x);\n        }\n        return;\n      }\n\n      if (fieldType.IsEnum) {\n        int x = (int)(ValueType)fieldValue;\n        int y = luaClass.RawGet<string, int>(field.Name);\n        if (x != y) {\n          info.Normals.Add(field.Name, x);\n        }\n        return;\n      }\n\n      if (fieldType.IsUnityEngineStruct()) {\n        var structField = new StructField(fieldValue);\n        if (structField.HasField) {\n          info.Normals.Add(field.Name, structField);\n        }\n        return;\n      }\n\n      if (fieldValue == null) {\n        return;\n      }\n\n      if (fieldType.IsUnityEngineObject()) {\n        int poolIndex = ConvertUnityEngineGameObject(monoBehaviour, fieldValue, info);\n        info.Objects.Add(new SerializeFieldsInfo.PoolIndexObjectField() {\n          Name = field.Name,\n          PoolIndex = poolIndex,\n        });\n        return;\n      }\n\n      var elementTypeOfIList = fieldType.GetIListElementType();\n      if (elementTypeOfIList != null) {\n        if (IsNormalType(elementTypeOfIList)) {\n          info.Normals.Add(field.Name, fieldValue);\n          return;\n        } else if (elementTypeOfIList.IsUnityEngineObject()) {\n          SerializeFieldsInfo.ArrayObjectField array = new SerializeFieldsInfo.ArrayObjectField() {\n            Name = field.Name,\n            IsArray = fieldType.IsArray,\n            ElementType = elementTypeOfIList\n          };\n          IList list = (IList)fieldValue;\n          foreach (object v in list) {\n            int poolIndex = ConvertUnityEngineGameObject(monoBehaviour, v, info);\n            array.PoolIndexs.Add(poolIndex);\n          }\n          info.Objects.Add(array);\n          return;\n        }\n      }\n\n      PauseEdit();\n      throw new NotSupportedException($\"{monoBehaviour.GetType()}'s field[{field.Name}] type[{fieldType}] not support serialized\");\n    }\n  }\n\n  public static partial class Extensions {\n    public static Type GetIListElementType(this Type type) {\n      var listType = type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IList<>));\n      return listType != null ? listType.GetGenericArguments().First() : null;\n    }\n\n    public static bool IsUnityEngineObject(this Type type) {\n      return typeof(UnityEngine.Object).IsAssignableFrom(type);\n    }\n\n    public static bool EQ(this object x, object y) {\n      return EqualityComparer<object>.Default.Equals(x, y);\n    }\n    \n    public static bool IsUnityEngineStruct(this Type type) {\n      return type == typeof(Vector2)\n        || type == typeof(Vector3)\n        || type == typeof(Vector4);\n    }\n  }\n}\n\n#endif"
  },
  {
    "path": "Assets/CSharpLua/UserMonoBehaviourConverter.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b7f3e9e39306b8540a8a2420099dec1d\ntimeCreated: 1528353588\nlicenseType: Free\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/CSharpLua.meta",
    "content": "fileFormatVersion: 2\nguid: 25458f95ee0f5374894471ba2a523a15\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Editor/Custom/CustomSettings.cs",
    "content": "﻿using UnityEngine;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing LuaInterface;\nusing UnityEditor;\n\nusing BindType = ToLuaMenu.BindType;\nusing System.Reflection;\n\npublic static class CustomSettings\n{\n    public static string saveDir = Application.dataPath + \"/Source/Generate/\";    \n    public static string toluaBaseType = Application.dataPath + \"/ToLua/BaseType/\";\n    public static string baseLuaDir = Application.dataPath + \"/Tolua/Lua/\";\n    public static string injectionFilesPath = Application.dataPath + \"/ToLua/Injection/\";\n\n    //导出时强制做为静态类的类型(注意customTypeList 还要添加这个类型才能导出)\n    //unity 有些类作为sealed class, 其实完全等价于静态类\n    public static List<Type> staticClassTypes = new List<Type>\n    {        \n        typeof(UnityEngine.Application),\n        typeof(UnityEngine.Time),\n        typeof(UnityEngine.Screen),\n        typeof(UnityEngine.SleepTimeout),\n        typeof(UnityEngine.Input),\n        typeof(UnityEngine.Resources),\n        typeof(UnityEngine.Physics),\n        typeof(UnityEngine.RenderSettings),\n        typeof(UnityEngine.QualitySettings),\n        typeof(UnityEngine.GL),\n        typeof(UnityEngine.Graphics),\n    };\n\n    //附加导出委托类型(在导出委托时, customTypeList 中牵扯的委托类型都会导出， 无需写在这里)\n    public static DelegateType[] customDelegateList = \n    {        \n        _DT(typeof(Action)),                \n        _DT(typeof(UnityEngine.Events.UnityAction)),\n        _DT(typeof(System.Predicate<int>)),\n        _DT(typeof(System.Action<int>)),\n        _DT(typeof(System.Comparison<int>)),\n        _DT(typeof(System.Func<int, int>)),\n    };\n\n  //在这里添加你要导出注册到lua的类型列表\n  public static BindType[] customTypeList_ =\n  {                \n        //------------------------为例子导出--------------------------------\n        //_GT(typeof(TestEventListener)),\n        //_GT(typeof(TestProtol)),\n        //_GT(typeof(TestAccount)),\n        //_GT(typeof(Dictionary<int, TestAccount>)).SetLibName(\"AccountMap\"),\n        //_GT(typeof(KeyValuePair<int, TestAccount>)),\n        //_GT(typeof(Dictionary<int, TestAccount>.KeyCollection)),\n        //_GT(typeof(Dictionary<int, TestAccount>.ValueCollection)),\n        //_GT(typeof(TestExport)),\n        //_GT(typeof(TestExport.Space)),\n        //-------------------------------------------------------------------        \n                        \n        _GT(typeof(LuaInjectionStation)),\n        _GT(typeof(InjectType)),\n        _GT(typeof(Debugger)).SetNameSpace(null),          \n\n#if USING_DOTWEENING\n        _GT(typeof(DG.Tweening.DOTween)),\n        _GT(typeof(DG.Tweening.Tween)).SetBaseType(typeof(System.Object)).AddExtendType(typeof(DG.Tweening.TweenExtensions)),\n        _GT(typeof(DG.Tweening.Sequence)).AddExtendType(typeof(DG.Tweening.TweenSettingsExtensions)),\n        _GT(typeof(DG.Tweening.Tweener)).AddExtendType(typeof(DG.Tweening.TweenSettingsExtensions)),\n        _GT(typeof(DG.Tweening.LoopType)),\n        _GT(typeof(DG.Tweening.PathMode)),\n        _GT(typeof(DG.Tweening.PathType)),\n        _GT(typeof(DG.Tweening.RotateMode)),\n        _GT(typeof(Component)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),\n        _GT(typeof(Transform)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),\n        _GT(typeof(Light)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),\n        _GT(typeof(Material)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),\n        _GT(typeof(Rigidbody)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),\n        _GT(typeof(Camera)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),\n        _GT(typeof(AudioSource)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),\n        //_GT(typeof(LineRenderer)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),\n        //_GT(typeof(TrailRenderer)).AddExtendType(typeof(DG.Tweening.ShortcutExtensions)),    \n#else\n                                         \n        _GT(typeof(Component)),\n        _GT(typeof(Transform)),\n        _GT(typeof(Material)),\n        _GT(typeof(Light)),\n        _GT(typeof(Rigidbody)),\n        _GT(typeof(Camera)),\n        _GT(typeof(AudioSource)),\n        //_GT(typeof(LineRenderer))\n        //_GT(typeof(TrailRenderer))\n#endif\n\n\t\t    _GT(typeof(YieldInstruction)),\n\t\t    _GT(typeof(WaitForEndOfFrame)),\n\t\t    _GT(typeof(WaitForFixedUpdate)),\n\t\t    _GT(typeof(WaitForSeconds)),\n\n\t\t    _GT(typeof(Behaviour)),\n        _GT(typeof(MonoBehaviour)),        \n        _GT(typeof(GameObject)),\n        _GT(typeof(TrackedReference)),\n        _GT(typeof(Application)),\n        _GT(typeof(Physics)),\n        _GT(typeof(Collider)),\n        _GT(typeof(Time)),        \n        _GT(typeof(Texture)),\n        _GT(typeof(Texture2D)),\n        _GT(typeof(Shader)),        \n        _GT(typeof(Renderer)),\n        _GT(typeof(WWW)),\n        _GT(typeof(Screen)),        \n        _GT(typeof(CameraClearFlags)),\n        _GT(typeof(AudioClip)),        \n        _GT(typeof(AssetBundle)),\n        _GT(typeof(ParticleSystem)),\n        _GT(typeof(AsyncOperation)).SetBaseType(typeof(System.Object)),        \n        _GT(typeof(LightType)),\n        _GT(typeof(SleepTimeout)),\n#if UNITY_5_3_OR_NEWER && !UNITY_5_6_OR_NEWER\n        _GT(typeof(UnityEngine.Experimental.Director.DirectorPlayer)),\n#endif\n        _GT(typeof(Animator)),\n        _GT(typeof(Input)),\n        _GT(typeof(KeyCode)),\n        _GT(typeof(SkinnedMeshRenderer)),\n        _GT(typeof(Space)),      \n       \n\n        _GT(typeof(MeshRenderer)),\n#if !UNITY_5_4_OR_NEWER\n        _GT(typeof(ParticleEmitter)),\n        _GT(typeof(ParticleRenderer)),\n        _GT(typeof(ParticleAnimator)), \n#endif\n\n        _GT(typeof(BoxCollider)),\n        _GT(typeof(MeshCollider)),\n        _GT(typeof(SphereCollider)),        \n        _GT(typeof(CharacterController)),\n        _GT(typeof(CapsuleCollider)),\n        \n        _GT(typeof(Animation)),        \n        _GT(typeof(AnimationClip)).SetBaseType(typeof(UnityEngine.Object)),        \n        _GT(typeof(AnimationState)),\n        _GT(typeof(AnimationBlendMode)),\n        _GT(typeof(QueueMode)),  \n        _GT(typeof(PlayMode)),\n        _GT(typeof(WrapMode)),\n\n        _GT(typeof(QualitySettings)),\n        _GT(typeof(RenderSettings)),                                                   \n        _GT(typeof(BlendWeights)),           \n        _GT(typeof(RenderTexture)),\n        _GT(typeof(Resources)),     \n        _GT(typeof(LuaProfiler)),\n    };\n\n    public static List<Type> dynamicList = new List<Type>()\n    {\n        typeof(MeshRenderer),\n#if !UNITY_5_4_OR_NEWER\n        typeof(ParticleEmitter),\n        typeof(ParticleRenderer),\n        typeof(ParticleAnimator),\n#endif\n\n        typeof(BoxCollider),\n        typeof(MeshCollider),\n        typeof(SphereCollider),\n        typeof(CharacterController),\n        typeof(CapsuleCollider),\n\n        typeof(Animation),\n        typeof(AnimationClip),\n        typeof(AnimationState),\n\n        typeof(BlendWeights),\n        typeof(RenderTexture),\n        typeof(Rigidbody),\n    };\n\n    //重载函数，相同参数个数，相同位置out参数匹配出问题时, 需要强制匹配解决\n    //使用方法参见例子14\n    public static List<Type> outList = new List<Type>()\n    {\n        \n    };\n        \n    //ngui优化，下面的类没有派生类，可以作为sealed class\n    public static List<Type> sealedList = new List<Type>()\n    {\n        /*typeof(Transform),\n        typeof(UIRoot),\n        typeof(UICamera),\n        typeof(UIViewport),\n        typeof(UIPanel),\n        typeof(UILabel),\n        typeof(UIAnchor),\n        typeof(UIAtlas),\n        typeof(UIFont),\n        typeof(UITexture),\n        typeof(UISprite),\n        typeof(UIGrid),\n        typeof(UITable),\n        typeof(UIWrapGrid),\n        typeof(UIInput),\n        typeof(UIScrollView),\n        typeof(UIEventListener),\n        typeof(UIScrollBar),\n        typeof(UICenterOnChild),\n        typeof(UIScrollView),        \n        typeof(UIButton),\n        typeof(UITextList),\n        typeof(UIPlayTween),\n        typeof(UIDragScrollView),\n        typeof(UISpriteAnimation),\n        typeof(UIWrapContent),\n        typeof(TweenWidth),\n        typeof(TweenAlpha),\n        typeof(TweenColor),\n        typeof(TweenRotation),\n        typeof(TweenPosition),\n        typeof(TweenScale),\n        typeof(TweenHeight),\n        typeof(TypewriterEffect),\n        typeof(UIToggle),\n        typeof(Localization),*/\n    };\n\n    public static BindType _GT(Type t)\n    {\n        return new BindType(t);\n    }\n\n    public static DelegateType _DT(Type t)\n    {\n        return new DelegateType(t);\n    }    \n\n\n    [MenuItem(\"Lua/Attach Profiler\", false, 151)]\n    static void AttachProfiler()\n    {\n        if (!Application.isPlaying)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"请在运行时执行此功能\", \"确定\");\n            return;\n        }\n\n        LuaClient.Instance.AttachProfiler();\n    }\n\n    [MenuItem(\"Lua/Detach Profiler\", false, 152)]\n    static void DetachProfiler()\n    {\n        if (!Application.isPlaying)\n        {            \n            return;\n        }\n\n        LuaClient.Instance.DetachProfiler();\n    }\n\n  private static bool IsCustomAssembly(string name) {\n      if (name == \"mscorlib\" || name.StartsWith(\"System\") || name.StartsWith(\"UnityEngine\") || name.StartsWith(\"UnityEditor\")) {\n        return false;\n      }\n      return true;\n    }\n\n    public static BindType[] customTypeList {\n      get {\n        const string kBridgeAssemblyName = \"Bridge\";\n        List<BindType> result = new List<BindType>(customTypeList_);\n        var names = Assembly.GetExecutingAssembly().GetReferencedAssemblies().Select(i => i.Name).Where(IsCustomAssembly).ToList();\n        if (!names.Contains(kBridgeAssemblyName)) {\n          names.Add(kBridgeAssemblyName);\n        }\n        foreach (string name in names) {\n          Assembly a = Assembly.Load(name);\n          Type[] types = a.GetExportedTypes();\n          foreach (Type type in types) {\n            if (type.IsDefined(typeof(LuaAutoWrapAttribute), false)) {\n              result.Add(_GT(type));\n            }\n          }\n        }\n        return result.ToArray();\n      }\n    }\n}\n"
  },
  {
    "path": "Assets/Editor/Custom/CustomSettings.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d68e81cfa02de7e44a2ff558bdc3ac89\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/Editor/Custom.meta",
    "content": "fileFormatVersion: 2\nguid: 327fa85d300c38c48836bfee53f47cb0\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 772338ec68e701847a565d981a690787\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Lua/3rd/pbc/Protocol/CommonPrototype.pb",
    "content": "\n\u0001\n\u0015CommonPrototype.proto\u0012\u001aCSharpLua.Project.Protocol\"\u0001\n\fSettingProto\u0012G\n\u0006Values\u0018\u0001 \u0003(\u000b27.CSharpLua.Project.Protocol.SettingProto.ValuePairProto\u0012\u0014\n\fSettingsMark\u0018\u0002 \u0002(\u0005\u001a,\n\u000eValuePairProto\u0012\u000b\n\u0003Key\u0018\u0001 \u0002(\t\u0012\r\n\u0005Value\u0018\u0002 \u0002(\t"
  },
  {
    "path": "Assets/Lua/3rd/pbc/Protocol/CommonPrototype.pb.meta",
    "content": "fileFormatVersion: 2\nguid: 799e7c66ac22f364e9547543461301c4\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/3rd/pbc/Protocol.meta",
    "content": "fileFormatVersion: 2\nguid: a7200e606f253ed44ad5a8801bf7eae2\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/3rd/pbc/protobuf.lua",
    "content": "local c = require \"protobuf.c\"\n\nlocal setmetatable = setmetatable\nlocal type = type\nlocal table = table\nlocal assert = assert\nlocal pairs = pairs\nlocal ipairs = ipairs\nlocal string = string\nlocal print = print\nlocal io = io\nlocal tinsert = table.insert\nlocal rawget = rawget\n\nmodule \"protobuf\"\n\nlocal _pattern_cache = {}\n\n-- skynet clear\nlocal P = c._env_new()\nlocal GC = c._gc(P)\n\nfunction lasterror()\n\treturn c._last_error(P)\nend\n\nlocal decode_type_cache = {}\nlocal _R_meta = {}\n\nfunction _R_meta:__index(key)\n\tlocal v = decode_type_cache[self._CType][key](self, key)\n\tself[key] = v\n\treturn v\nend\n\nlocal _reader = {}\n\nfunction _reader:int(key)\n\treturn c._rmessage_integer(self._CObj , key , 0)\nend\n\nfunction _reader:real(key)\n\treturn c._rmessage_real(self._CObj , key , 0)\nend\n\nfunction _reader:string(key)\n\treturn c._rmessage_string(self._CObj , key , 0)\nend\n\nfunction _reader:bool(key)\n\treturn c._rmessage_integer(self._CObj , key , 0) ~= 0\nend\n\nfunction _reader:message(key, message_type)\n    --  will return default table, we want nil, so comment this function\n    --[[ \n\tlocal rmessage = c._rmessage_message(self._CObj , key , 0)\n\tif rmessage then\n\t\tlocal v = {\n\t\t\t_CObj = rmessage,\n\t\t\t_CType = message_type,\n\t\t\t_Parent = self,\n\t\t}\n\t\treturn setmetatable( v , _R_meta )\n\tend--]]\nend\n\nfunction _reader:int32(key)\n\treturn c._rmessage_int32(self._CObj , key , 0)\nend\n\nfunction _reader:int64(key)\n\treturn c._rmessage_int64(self._CObj , key , 0)\nend\n\nfunction _reader:int52(key)\n\treturn c._rmessage_int52(self._CObj , key , 0)\nend\n\nfunction _reader:uint52(key)\n\treturn c._rmessage_uint52(self._CObj , key , 0)\nend\n\nfunction _reader:int_repeated(key)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\ttinsert(ret,  c._rmessage_integer(cobj , key , i))\n\tend\n\treturn ret\nend\n\nfunction _reader:real_repeated(key)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\ttinsert(ret,  c._rmessage_real(cobj , key , i))\n\tend\n\treturn ret\nend\n\nfunction _reader:string_repeated(key)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\ttinsert(ret,  c._rmessage_string(cobj , key , i))\n\tend\n\treturn ret\nend\n\nfunction _reader:bool_repeated(key)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\ttinsert(ret,  c._rmessage_integer(cobj , key , i) ~= 0)\n\tend\n\treturn ret\nend\n\nfunction _reader:message_repeated(key, message_type)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\tlocal m = {\n\t\t\t_CObj = c._rmessage_message(cobj , key , i),\n\t\t\t_CType = message_type,\n\t\t\t_Parent = self,\n\t\t}\n\t\ttinsert(ret, setmetatable( m , _R_meta ))\n\tend\n\treturn ret\nend\n\nfunction _reader:int32_repeated(key)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\ttinsert(ret,  c._rmessage_int32(cobj , key , i))\n\tend\n\treturn ret\nend\n\nfunction _reader:int64_repeated(key)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\ttinsert(ret,  c._rmessage_int64(cobj , key , i))\n\tend\n\treturn ret\nend\n\nfunction _reader:int52_repeated(key)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\ttinsert(ret,  c._rmessage_int52(cobj , key , i))\n\tend\n\treturn ret\nend\n\nfunction _reader:uint52_repeated(key)\n\tlocal cobj = self._CObj\n\tlocal n = c._rmessage_size(cobj , key)\n\tlocal ret = {}\n\tfor i=0,n-1 do\n\t\ttinsert(ret,  c._rmessage_uint52(cobj , key , i))\n\tend\n\treturn ret\nend\n\n_reader[1] = function(msg) return _reader.int end\n_reader[2] = function(msg) return _reader.real end\n_reader[3] = function(msg) return _reader.bool end\n_reader[4] = function(msg) return _reader.string end\n_reader[5] = function(msg) return _reader.string end\n_reader[6] = function(msg)\n\tlocal message = _reader.message\n\treturn\tfunction(self,key)\n\t\t\treturn message(self, key, msg)\n\t\tend\nend\n_reader[7] = function(msg) return _reader.int64 end\n_reader[8] = function(msg) return _reader.int32 end\n_reader[9] = _reader[5]\n_reader[10] = function(msg) return _reader.int52 end\n_reader[11] = function(msg) return _reader.uint52 end\n\n_reader[128+1] = function(msg) return _reader.int_repeated end\n_reader[128+2] = function(msg) return _reader.real_repeated end\n_reader[128+3] = function(msg) return _reader.bool_repeated end\n_reader[128+4] = function(msg) return _reader.string_repeated end\n_reader[128+5] = function(msg) return _reader.string_repeated end\n_reader[128+6] = function(msg)\n\tlocal message = _reader.message_repeated\n\treturn\tfunction(self,key)\n\t\t\treturn message(self, key, msg)\n\t\tend\nend\n_reader[128+7] = function(msg) return _reader.int64_repeated end\n_reader[128+8] = function(msg) return _reader.int32_repeated end\n_reader[128+9] = _reader[128+5]\n_reader[128+10] = function(msg) return _reader.int52_repeated end\n_reader[128+11] = function(msg) return _reader.uint52_repeated end\n\nlocal _decode_type_meta = {}\n\nfunction _decode_type_meta:__index(key)\n\tlocal t, msg = c._env_type(P, self._CType, key)\n\tlocal func = assert(_reader[t],key)(msg)\n\tself[key] = func\n\treturn func\nend\n\nsetmetatable(decode_type_cache , {\n\t__index = function(self, key)\n\t\tlocal v = setmetatable({ _CType = key } , _decode_type_meta)\n\t\tself[key] = v\n\t\treturn v\n\tend\n})\n\nlocal function decode_message( message , buffer, length)\n\tlocal rmessage = c._rmessage_new(P, message, buffer, length)\n\tif rmessage then\n\t\tlocal self = {\n\t\t\t_CObj = rmessage,\n\t\t\t_CType = message,\n\t\t}\n\t\tc._add_rmessage(GC,rmessage)\n\t\treturn setmetatable( self , _R_meta )\n\tend\nend\n\n----------- encode ----------------\n\nlocal encode_type_cache = {}\n\nlocal function encode_message(CObj, message_type, t)\n\tlocal type = encode_type_cache[message_type]\n\tfor k,v in pairs(t) do\n\t\tlocal func = type[k]\n\t\tfunc(CObj, k , v)\n\tend\nend\n\nlocal _writer = {\n\tint = c._wmessage_integer,\n\treal = c._wmessage_real,\n\tenum = c._wmessage_string,\n\tstring = c._wmessage_string,\n\tint64 = c._wmessage_int64,\n\tint32 = c._wmessage_int32,\n\tint52 = c._wmessage_int52,\n\tuint52 = c._wmessage_uint52,\n}\n\nfunction _writer:bool(k,v)\n\tc._wmessage_integer(self, k, v and 1 or 0)\nend\n\nfunction _writer:message(k, v , message_type)\n\tlocal submessage = c._wmessage_message(self, k)\n\tencode_message(submessage, message_type, v)\nend\n\nfunction _writer:int_repeated(k,v)\n\tfor _,v in ipairs(v) do\n\t\tc._wmessage_integer(self,k,v)\n\tend\nend\n\nfunction _writer:real_repeated(k,v)\n\tfor _,v in ipairs(v) do\n\t\tc._wmessage_real(self,k,v)\n\tend\nend\n\nfunction _writer:bool_repeated(k,v)\n\tfor _,v in ipairs(v) do\n\t\tc._wmessage_integer(self, k, v and 1 or 0)\n\tend\nend\n\nfunction _writer:string_repeated(k,v)\n\tfor _,v in ipairs(v) do\n\t\tc._wmessage_string(self,k,v)\n\tend\nend\n\nfunction _writer:message_repeated(k,v, message_type)\n\tfor _,v in ipairs(v) do\n\t\tlocal submessage = c._wmessage_message(self, k)\n\t\tencode_message(submessage, message_type, v)\n\tend\nend\n\nfunction _writer:int32_repeated(k,v)\n\tfor _,v in ipairs(v) do\n\t\tc._wmessage_int32(self,k,v)\n\tend\nend\n\nfunction _writer:int64_repeated(k,v)\n\tfor _,v in ipairs(v) do\n\t\tc._wmessage_int64(self,k,v)\n\tend\nend\n\nfunction _writer:int52_repeated(k,v)\n\tfor _,v in ipairs(v) do\n\t\tc._wmessage_int52(self,k,v)\n\tend\nend\n\nfunction _writer:uint52_repeated(k,v)\n\tfor _,v in ipairs(v) do\n\t\tc._wmessage_uint52(self,k,v)\n\tend\nend\n\nfunction _writer:enum(k, v) \n    if type(v) == \"number\" then\n        return c._wmessage_integer(self, k, v)\n    end\n    return c._wmessage_string(self, k, v)\nend\n\n_writer[1] = function(msg) return _writer.int end\n_writer[2] = function(msg) return _writer.real end\n_writer[3] = function(msg) return _writer.bool end\n_writer[4] = function(msg) return _writer.enum end\n_writer[5] = function(msg) return _writer.string end\n_writer[6] = function(msg)\n\tlocal message = _writer.message\n\treturn\tfunction(self,key , v)\n\t\t\treturn message(self, key, v, msg)\n\t\tend\nend\n_writer[7] = function(msg) return _writer.int64 end\n_writer[8] = function(msg) return _writer.int32 end\n_writer[9] = _writer[5]\n_writer[10] = function(msg) return _writer.int52 end\n_writer[11] = function(msg) return _writer.uint52 end\n\n_writer[128+1] = function(msg) return _writer.int_repeated end\n_writer[128+2] = function(msg) return _writer.real_repeated end\n_writer[128+3] = function(msg) return _writer.bool_repeated end\n_writer[128+4] = function(msg) return _writer.string_repeated end\n_writer[128+5] = function(msg) return _writer.string_repeated end\n_writer[128+6] = function(msg)\n\tlocal message = _writer.message_repeated\n\treturn\tfunction(self,key, v)\n\t\t\treturn message(self, key, v, msg)\n\t\tend\nend\n_writer[128+7] = function(msg) return _writer.int64_repeated end\n_writer[128+8] = function(msg) return _writer.int32_repeated end\n_writer[128+9] = _writer[128+5]\n_writer[128+10] = function(msg) return _writer.int52_repeated end\n_writer[128+11] = function(msg) return _writer.uint52_repeated end\n\nlocal _encode_type_meta = {}\n\nfunction _encode_type_meta:__index(key)\n\tlocal t, msg = c._env_type(P, self._CType, key)\n\tlocal func = assert(_writer[t],key)(msg)\n\tself[key] = func\n\treturn func\nend\n\nsetmetatable(encode_type_cache , {\n\t__index = function(self, key)\n\t\tlocal v = setmetatable({ _CType = key } , _encode_type_meta)\n\t\tself[key] = v\n\t\treturn v\n\tend\n})\n\nfunction encode( message, t , func , ...)\n\tlocal encoder = c._wmessage_new(P, message)\n\tassert(encoder ,  message)\n\tencode_message(encoder, message, t)\n\tif func then\n\t\tlocal buffer, len = c._wmessage_buffer(encoder)\n\t\tlocal ret = func(buffer, len, ...)\n\t\tc._wmessage_delete(encoder)\n\t\treturn ret\n\telse\n\t\tlocal s = c._wmessage_buffer_string(encoder)\n\t\tc._wmessage_delete(encoder)\n\t\treturn s\n\tend\nend\n\n--------- unpack ----------\n\nlocal _pattern_type = {\n\t[1] = {\"%d\",\"i\"},\n\t[2] = {\"%F\",\"r\"},\n\t[3] = {\"%d\",\"b\"},\n\t[4] = {\"%d\",\"i\"},\n\t[5] = {\"%s\",\"s\"},\n\t[6] = {\"%s\",\"m\"},\n\t[7] = {\"%D\",\"x\"},\n\t[8] = {\"%d\",\"p\"},\n\t[10] =  {\"%D\",\"d\"},\n\t[11] =  {\"%D\",\"u\"},\n\t[128+1] = {\"%a\",\"I\"},\n\t[128+2] = {\"%a\",\"R\"},\n\t[128+3] = {\"%a\",\"B\"},\n\t[128+4] = {\"%a\",\"I\"},\n\t[128+5] = {\"%a\",\"S\"},\n\t[128+6] = {\"%a\",\"M\"},\n\t[128+7] = {\"%a\",\"X\"},\n\t[128+8] = {\"%a\",\"P\"},\n\t[128+10] = {\"%a\", \"D\" },\n\t[128+11] = {\"%a\", \"U\" },\n}\n\n_pattern_type[9] = _pattern_type[5]\n_pattern_type[128+9] = _pattern_type[128+5]\n\n\nlocal function _pattern_create(pattern)\n\tlocal iter = string.gmatch(pattern,\"[^ ]+\")\n\tlocal message = iter()\n\tlocal cpat = {}\n\tlocal lua = {}\n\tfor v in iter do\n\t\tlocal tidx = c._env_type(P, message, v)\n\t\tlocal t = _pattern_type[tidx]\n\t\tassert(t,tidx)\n\t\ttinsert(cpat,v .. \" \" .. t[1])\n\t\ttinsert(lua,t[2])\n\tend\n\tlocal cobj = c._pattern_new(P, message , \"@\" .. table.concat(cpat,\" \"))\n\tif cobj == nil then\n\t\treturn\n\tend\n\tc._add_pattern(GC, cobj)\n\tlocal pat = {\n\t\tCObj = cobj,\n\t\tformat = table.concat(lua),\n\t\tsize = 0\n\t}\n\tpat.size = c._pattern_size(pat.format)\n\n\treturn pat\nend\n\nsetmetatable(_pattern_cache, {\n\t__index = function(t, key)\n\t\tlocal v = _pattern_create(key)\n\t\tt[key] = v\n\t\treturn v\n\tend\n})\n\nfunction unpack(pattern, buffer, length)\n\tlocal pat = _pattern_cache[pattern]\n\treturn c._pattern_unpack(pat.CObj , pat.format, pat.size, buffer, length)\nend\n\nfunction pack(pattern, ...)\n\tlocal pat = _pattern_cache[pattern]\n\treturn c._pattern_pack(pat.CObj, pat.format, pat.size , ...)\nend\n\nfunction check(typename , field)\n\tif field == nil then\n\t\treturn c._env_type(P,typename)\n\telse\n\t\treturn c._env_type(P,typename,field) ~=0\n\tend\nend\n\n--------------\n\nlocal default_cache = {}\n\n-- todo : clear default_cache, v._CObj\n\nlocal function default_table(typename)\n\tlocal v = default_cache[typename]\n\tif v then\n\t\treturn v\n\tend\n\n\tv = { __index = assert(decode_message(typename , \"\")) }\n\n\tdefault_cache[typename]  = v\n\treturn v\nend\n\nlocal decode_message_mt = {}\n\nlocal function decode_message_cb(typename, buffer)\n\treturn setmetatable ( { typename, buffer } , decode_message_mt)\nend\n\nfunction decode(typename, buffer, length)\n\tlocal ret = {}\n\tlocal ok = c._decode(P, decode_message_cb , ret , typename, buffer, length)\n\tif ok then\n\t\treturn setmetatable(ret , default_table(typename))\n\telse\n\t\treturn false , c._last_error(P)\n\tend\nend\n\nlocal function expand(tbl)\n\tlocal typename = rawget(tbl , 1)\n\tlocal buffer = rawget(tbl , 2)\n\ttbl[1] , tbl[2] = nil , nil\n\tassert(c._decode(P, decode_message_cb , tbl , typename, buffer), typename)\n\tsetmetatable(tbl , default_table(typename))\nend\n\nfunction decode_message_mt.__index(tbl, key)\n\texpand(tbl)\n\treturn tbl[key]\nend\n\nfunction decode_message_mt.__pairs(tbl)\n\texpand(tbl)\n\treturn pairs(tbl)\nend\n\nlocal function set_default(typename, tbl)\n\tfor k,v in pairs(tbl) do\n\t\tif type(v) == \"table\" then\n\t\t\tlocal t, msg = c._env_type(P, typename, k)\n\t\t\tif t == 6 then\n\t\t\t\tset_default(msg, v)\n\t\t\telseif t == 128+6 then\n\t\t\t\tfor _,v in ipairs(v) do\n\t\t\t\t\tset_default(msg, v)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn setmetatable(tbl , default_table(typename))\nend\n\nfunction register( buffer)\n\tc._env_register(P, buffer)\nend\n\nfunction register_file(filename)\n\tlocal f = assert(io.open(filename , \"rb\"))\n\tlocal buffer = f:read \"*a\"\n\tc._env_register(P, buffer)\n\tf:close()\nend\n\ndefault=set_default\n"
  },
  {
    "path": "Assets/Lua/3rd/pbc/protobuf.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 1ba29465c7f40ae4aa388cefab41f5e0\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Lua/3rd/pbc.meta",
    "content": "fileFormatVersion: 2\nguid: 4bf5196cb12726f4a9958b8bbffdaffe\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/3rd.meta",
    "content": "fileFormatVersion: 2\nguid: 0921f818f1bc02e499634048e5c59679\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Classloader.lua",
    "content": "local typeof = typeof\ntoluaSystem = System\nlocal isInstanceOfType = typeof(toluaSystem.Object).IsInstanceOfType\nlocal Timer = Timer.New  -- tolua.Timer\n\nlocal function isFromCSharp(T)\n  return T[\".name\"] ~= nil\nend\n\nlocal function isUserdataType(obj, T)\n  if isFromCSharp(T) then\n    return isInstanceOfType(typeof(T), obj)\n  end\n  return true\nend\n\nlocal config = {\n  time = tolua.gettime, \n  setTimeout = function (f, milliseconds)\n    local t = Timer(f, milliseconds / 1000, 1, true)\n    t:Start()\n    return t\n  end,\n  clearTimeout = function (t)\n    t:Stop()\n  end,\n  customTypeCheck = function (T)\n    if isFromCSharp(T) then\n      return isUserdataType\n    end\n  end\n}\n\nUnityEngine.isFromCSharp = isFromCSharp\n\nif jit then\n  -- luajit table.move may causes a crash in a version, do not confirm whether the current version is fixed\n  table.move = function(a1, f, e, t, a2)\n    if a2 == nil then a2 = a1 end\n    if t > f then\n      t = e - f + t\n      while e >= f do\n        a2[t] = a1[e]\n        t = t - 1\n        e = e - 1\n      end\n    else\n      while f <= e do\n        a2[t] = a1[f]\n        t = t + 1\n        f = f + 1\n      end\n    end\n  end\nend\n\nrequire(\"CoreSystemLua.All\")(\"CoreSystemLua\", config)\nrequire(\"UnityAdapter\")\nrequire(\"ProtobufAdapter\")\nrequire(\"Compiled.manifest\")(\"Compiled\")"
  },
  {
    "path": "Assets/Lua/Classloader.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 896a17f3a9cc84246858465cab87a45a\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Protocol/AutoGen/CommonPrototype.lua",
    "content": "-- Generated by CSharp.lua Compiler\n--------------------------------------------------------------------------------\n-- <auto-generated>\n--     This code was generated by a tool.\n--\n--     Changes to this file may cause incorrect behavior and will be lost if\n--     the code is regenerated.\n-- </auto-generated>\n--------------------------------------------------------------------------------\n-- Generated from: CommonPrototype.proto\nlocal System = System\nlocal CSharpLuaSettingProto\nlocal ListValuePairProto\nSystem.import(function (out)\n  CSharpLuaSettingProto = CSharpLua.Project.Protocol.SettingProto\n  ListValuePairProto = System.List(CSharpLuaSettingProto.ValuePairProto)\nend)\nSystem.namespace(\"CSharpLua.Project.Protocol\", function (namespace)\n  namespace.class(\"SettingProto\", function (namespace)\n    local __ctor__\n    namespace.class(\"ValuePairProto\", function (namespace)\n      return {\n        base = function (out)\n          return {\n            out.ProtoBuf.IProtocol\n          }\n        end\n      }\n    end)\n    __ctor__ = function (this)\n      this.Values = ListValuePairProto()\n    end\n    return {\n      base = function (out)\n        return {\n          out.ProtoBuf.IProtocol\n        }\n      end,\n      SettingsMark = 0,\n      __ctor__ = __ctor__\n    }\n  end)\nend)\n"
  },
  {
    "path": "Assets/Lua/Compiled/Protocol/AutoGen/CommonPrototype.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 4c15c22eddb928345a01a9ff7de17cd5\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Protocol/AutoGen.meta",
    "content": "fileFormatVersion: 2\nguid: 1b33b39ff0a98b243be124e052b89741\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Protocol/IProtocol.lua",
    "content": "-- Generated by CSharp.lua Compiler\nlocal System = System\nSystem.namespace(\"ProtoBuf\", function (namespace)\n  namespace.interface(\"IProtocol\", function ()\n    return {}\n  end)\nend)\n"
  },
  {
    "path": "Assets/Lua/Compiled/Protocol/IProtocol.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 8955781becf16fc48b8ec217d536653e\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Protocol.meta",
    "content": "fileFormatVersion: 2\nguid: 839f71ef436eef449a8aa098ab4c8008\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample/TestCoroutine.lua",
    "content": "-- Generated by CSharp.lua Compiler\nlocal System = System\nlocal UnityEngine = UnityEngine\nlocal ListInt32 = System.List(System.Int32)\nSystem.namespace(\"Sample\", function (namespace)\n  namespace.class(\"TestCoroutine\", function (namespace)\n    local Awake, OnTick, Test, T1, T2, __ctor__\n    __ctor__ = function (this)\n      this.list = ListInt32()\n      System.base(this).__ctor__(this)\n    end\n    Awake = function (this)\n      UnityEngine.Debug.Log(\"TestCoroutine\")\n      this:StartCoroutine(OnTick(this))\n      UnityEngine.MonoBehaviour.print(this:getgameObject():getname())\n      UnityEngine.MonoBehaviour.print(#this.list)\n      this:StartCoroutine(T1(this))\n    end\n    OnTick = function (this)\n      return System.yieldIEnumerator(function (this)\n        while true do\n          System.yield(UnityEngine.WaitForSeconds(1))\n          UnityEngine.MonoBehaviour.print(\"TestCoroutine.OnTick\")\n        end\n      end, System.Object, this)\n    end\n    Test = function (this)\n      UnityEngine.MonoBehaviour.print(\"TestCoroutine.Test\")\n    end\n    T1 = function (this)\n      return System.yieldIEnumerator(function (this)\n        UnityEngine.MonoBehaviour.print(\"a0\")\n        System.yield(nil)\n        UnityEngine.MonoBehaviour.print(\"a1\")\n        System.yield(T2(this))\n        UnityEngine.MonoBehaviour.print(\"a2\")\n      end, System.Object, this)\n    end\n    T2 = function (this)\n      return System.yieldIEnumerator(function (this)\n        UnityEngine.MonoBehaviour.print(\"b0\")\n        System.yield(nil)\n        UnityEngine.MonoBehaviour.print(\"b1\")\n        System.yield(nil)\n        UnityEngine.MonoBehaviour.print(\"b2\")\n      end, System.Object, this)\n    end\n    return {\n      base = function (out)\n        return {\n          out.UnityEngine.MonoBehaviour\n        }\n      end,\n      Awake = Awake,\n      OnTick = OnTick,\n      Test = Test,\n      __ctor__ = __ctor__\n    }\n  end)\nend)\n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample/TestCoroutine.lua.meta",
    "content": "fileFormatVersion: 2\nguid: da6a71c38b8b9984c833b5b4ca0e5644\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample/TestHangingScript.lua",
    "content": "-- Generated by CSharp.lua Compiler\nlocal System = System\nlocal UnityEngine = UnityEngine\nlocal ListInt32 = System.List(System.Int32)\nSystem.namespace(\"Sample\", function (namespace)\n  namespace.class(\"TestHangingScript\", function (namespace)\n    local Awake, Start, __ctor__\n    __ctor__ = function (this)\n      this.l = ListInt32()\n      this.vector2 = System.default(UnityEngine.Vector2)\n      this.vector3 = System.default(UnityEngine.Vector3)\n      System.base(this).__ctor__(this)\n    end\n    Awake = function (this)\n      UnityEngine.MonoBehaviour.print(\"Awake\")\n      UnityEngine.MonoBehaviour.print(this.DataOfString)\n      UnityEngine.MonoBehaviour.print(this.DataOfInt)\n      UnityEngine.MonoBehaviour.print(this.DataOfString2)\n      UnityEngine.MonoBehaviour.print(this.a)\n      UnityEngine.MonoBehaviour.print(this.HangingMonoBehaviour:getname())\n      UnityEngine.MonoBehaviour.print(System.String.JoinEnumerable(\",\", this.l))\n      UnityEngine.MonoBehaviour.print(this.vector2:ToString() .. \", \" .. this.vector3:ToString())\n    end\n    Start = function (this)\n      UnityEngine.MonoBehaviour.print(\"Start\")\n    end\n    return {\n      base = function (out)\n        return {\n          out.UnityEngine.MonoBehaviour\n        }\n      end,\n      DataOfInt = 0,\n      DataOfString2 = \"ddddd\",\n      a = 10,\n      Awake = Awake,\n      Start = Start,\n      __ctor__ = __ctor__\n    }\n  end)\nend)\n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample/TestHangingScript.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 1a47e23a7d689fb4c8b535daac4e7506\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample/TestHelloWord.lua",
    "content": "-- Generated by CSharp.lua Compiler\nlocal System = System\nlocal UnityEngine = UnityEngine\nlocal Sample\nSystem.import(function (out)\n  Sample = out.Sample\nend)\nSystem.namespace(\"Sample\", function (namespace)\n  namespace.class(\"TestHelloWord\", function (namespace)\n    local Awake, Start, Update\n    Awake = function (this)\n      UnityEngine.Debug.Log(\"TestHelloWord\")\n      this:getgameObject():AddComponent(Sample.TestCoroutine)\n      local c = this:GetComponent(UnityEngine.MonoBehaviour)\n      UnityEngine.MonoBehaviour.print(c:getname())\n\n      local obj1 = UnityEngine.Object.FindObjectOfType(UnityEngine.MonoBehaviour)\n      UnityEngine.Object.Destroy(obj1)\n\n      local i = TestUtils.Load(\"Assets/CSharpLua/Examples/01_HelloWorld/TestLoader.prefab\")\n      local obj = UnityEngine.Object.Instantiate(i)\n      obj:gettransform():setparent(this:gettransform())\n\n      Sample.TestProtobuf.Run()\n    end\n    Start = function (this)\n      UnityEngine.MonoBehaviour.print(\"TestHelloWord.Start\")\n    end\n    Update = function (this)\n      UnityEngine.MonoBehaviour.print(\"TestHelloWord.Update\")\n    end\n    return {\n      base = function (out)\n        return {\n          out.UnityEngine.MonoBehaviour\n        }\n      end,\n      Awake = Awake,\n      Start = Start,\n      Update = Update\n    }\n  end)\nend)\n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample/TestHelloWord.lua.meta",
    "content": "fileFormatVersion: 2\nguid: d650d1e86eb0ece4981a48b1b0e95878\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample/TestProtobuf.lua",
    "content": "-- Generated by CSharp.lua Compiler\nlocal System = System\nlocal UnityEngine = UnityEngine\nlocal CSharpLuaProjectProtocol\nlocal CSharpLuaSettingProto\nSystem.import(function (out)\n  CSharpLuaProjectProtocol = CSharpLua.Project.Protocol\n  CSharpLuaSettingProto = CSharpLua.Project.Protocol.SettingProto\nend)\nSystem.namespace(\"Sample\", function (namespace)\n  namespace.class(\"TestProtobuf\", function (namespace)\n    local Run, Encode, Decode\n    Run = function ()\n      protobuf.register_file(\"Assets/Lua/3rd/pbc/Protocol/CommonPrototype.pb\")\n\n      local default = CSharpLuaProjectProtocol.SettingProto()\n      default.SettingsMark = 101\n      local proto = default\n      local extern = CSharpLuaSettingProto.ValuePairProto()\n      extern.Key = \"a\"\n      extern.Value = \"b\"\n      proto.Values:Add(extern)\n      local bytes = Encode(proto)\n      local t = Decode(bytes, CSharpLuaProjectProtocol.SettingProto)\n      UnityEngine.Debug.LogFormat(\"ProtobufDecode {0}\", t.SettingsMark)\n    end\n    Encode = function (proto)\n      local bytes = nil\n      bytes = encodeProtobuf(proto)\n      return bytes\n    end\n    Decode = function (bytes, T)\n      local t = nil\n      t = decodeProtobuf(bytes, T)\n      return t\n    end\n    return {\n      Run = Run\n    }\n  end)\nend)\n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample/TestProtobuf.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 73822b2e531795d4d9cca42b4b834d38\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/Sample.meta",
    "content": "fileFormatVersion: 2\nguid: f5664ef679fb2bb4c85569a055f6debd\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled/manifest.lua",
    "content": "-- Generated by CSharp.lua Compiler\nreturn function (path)\n  return System.init({\n    path = path,\n    files = {\n      \"Protocol.AutoGen.CommonPrototype\",\n      \"Protocol.IProtocol\",\n      \"Sample.TestCoroutine\",\n      \"Sample.TestHangingScript\",\n      \"Sample.TestHelloWord\",\n      \"Sample.TestProtobuf\"\n    },\n    types = {\n      \"ProtoBuf.IProtocol\",\n      \"CSharpLua.Project.Protocol.SettingProto\",\n      \"CSharpLua.Project.Protocol.SettingProto.ValuePairProto\",\n      \"Sample.TestCoroutine\",\n      \"Sample.TestHangingScript\",\n      \"Sample.TestHelloWord\",\n      \"Sample.TestProtobuf\"\n    }\n  })\nend\n"
  },
  {
    "path": "Assets/Lua/Compiled/manifest.lua.meta",
    "content": "fileFormatVersion: 2\nguid: d66a9fc55c5de2a459db4893f0db8279\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Compiled.meta",
    "content": "fileFormatVersion: 2\nguid: e7429fd7d84e7a94691ccffa8843d572\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/All.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nreturn function(dir, conf)\n  dir = (dir and #dir > 0) and (dir .. \".CoreSystem.\") or \"CoreSystem.\"\n  local require = require\n  local load = function(module) return require(dir .. module) end\n    \n  load(\"Core\")(conf)\n  load(\"Interfaces\")\n  load(\"Exception\")\n  load(\"Number\")\n  load(\"Char\")\n  load(\"String\")\n  load(\"Boolean\")\n  load(\"Delegate\")\n  load(\"Enum\")\n  load(\"TimeSpan\")\n  load(\"DateTime\")\n  load(\"Collections.EqualityComparer\")\n  load(\"Array\")\n  load(\"Type\")\n  load(\"Collections.List\")\n  load(\"Collections.Dictionary\")\n  load(\"Collections.Queue\")\n  load(\"Collections.Stack\")\n  load(\"Collections.HashSet\")\n  load(\"Collections.LinkedList\")\n  load(\"Collections.Linq\")\n  load(\"Convert\")\n  load(\"Math\")\n  load(\"Random\")\n  load(\"Text.StringBuilder\")\n  load(\"Console\")\n  load(\"IO.File\")\n  load(\"Reflection.Assembly\")\n  load(\"Threading.Timer\")\n  load(\"Threading.Thread\")\n  load(\"Threading.Task\")\n  load(\"Utilities\")\nend\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/All.lua.meta",
    "content": "fileFormatVersion: 2\nguid: f7703f768c9abc748b02b74d42ff099c\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Array.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal div = System.div\nlocal trueFn = System.trueFn\nlocal falseFn = System.falseFn\nlocal lengthFn = System.lengthFn\n\nlocal InvalidOperationException = System.InvalidOperationException\nlocal NullReferenceException = System.NullReferenceException\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal IndexOutOfRangeException = System.IndexOutOfRangeException\nlocal NotSupportedException = System.NotSupportedException\nlocal EqualityComparer = System.EqualityComparer\nlocal Comparer_1 = System.Comparer_1\nlocal IEnumerator_1 = System.IEnumerator_1\n\nlocal assert = assert\nlocal select = select\nlocal getmetatable = getmetatable\nlocal setmetatable = setmetatable\nlocal type = type\nlocal table = table\nlocal tinsert = table.insert\nlocal tremove = table.remove\nlocal tmove = table.move\nlocal tsort = table.sort\nlocal pack = table.pack\nlocal unpack = table.unpack\nlocal error = error\nlocal coroutine = coroutine\nlocal ccreate = coroutine.create\nlocal cresume = coroutine.resume\nlocal cyield = coroutine.yield\n\nlocal null = {}\nlocal arrayEnumerator\nlocal arrayFromTable\n\nlocal versions = setmetatable({}, { __mode = \"k\" })\nSystem.versions = versions\n\nlocal function throwFailedVersion()\n  throw(InvalidOperationException(\"Collection was modified; enumeration operation may not execute.\"))\nend\n\nlocal function checkIndex(t, index) \n  if index < 0 or index >= #t then\n    throw(ArgumentOutOfRangeException(\"index\"))\n  end\nend\n\nlocal function checkIndexAndCount(t, index, count)\n  if t == nil then throw(ArgumentNullException(\"array\")) end\n  if index < 0 or count < 0 or index + count > #t then\n    throw(ArgumentOutOfRangeException(\"index or count\"))\n  end\nend\n\nlocal function wrap(v)\n  if v == nil then \n    return null \n  end\n  return v\nend\n\nlocal function unWrap(v)\n  if v == null then \n    return nil \n  end\n  return v\nend\n\nlocal function ipairs(t)\n  local version = versions[t]\n  return function (t, i)\n    if version ~= versions[t] then\n      throwFailedVersion()\n    end\n    local v = t[i]\n    if v ~= nil then\n      if v == null then\n        v = nil\n      end\n      return i + 1, v\n    end\n  end, t, 1\nend\n\nlocal function eachFn(en)\n  if en:MoveNext() then\n    return true, en:getCurrent()\n  end\n  return nil\nend\n\nlocal function each(t)\n  if t == nil then throw(NullReferenceException(), 1) end\n  local getEnumerator = t.GetEnumerator\n  if getEnumerator == arrayEnumerator then\n    return ipairs(t)\n  end\n  local en = getEnumerator(t)\n  return eachFn, en\nend\n\nfunction System.isArrayLike(t)\n  return type(t) == \"table\" and t.GetEnumerator == arrayEnumerator\nend\n\nfunction System.isEnumerableLike(t)\n  return type(t) == \"table\" and t.GetEnumerator ~= nil\nend\n\nfunction System.toLuaTable(array)\n  local t = {}\n  for i = 1, #array do\n    local item = array[i]\n    if item ~= null then\n      t[i] = item\n    end\n  end   \n  return t\nend\n\nSystem.null = null\nSystem.Void = null\nSystem.each = each\nSystem.ipairs = ipairs\nSystem.throwFailedVersion = throwFailedVersion\n\nSystem.wrap = wrap\nSystem.unWrap = unWrap\nSystem.checkIndex = checkIndex\nSystem.checkIndexAndCount = checkIndexAndCount\n\nlocal Array\nlocal emptys = {}\n\nlocal function get(t, index)\n  local v = t[index + 1]\n  if v == nil then\n    throw(ArgumentOutOfRangeException(\"index\"))\n  end\n  if v ~= null then \n    return v\n  end\n  return nil\nend\n\nlocal function set(t, index, v)\n  index = index + 1\n  if t[index] == nil then\n    throw(ArgumentOutOfRangeException(\"index\"))\n  end\n  t[index] = v == nil and null or v\n  versions[t] = (versions[t] or 0) + 1\nend\n\nlocal function add(t, v)\n  local n = #t\n  t[n + 1] = v == nil and null or v\n  versions[t] = (versions[t] or 0) + 1\n  return n\nend\n\nlocal function addRange(t, collection)\n  if collection == nil then throw(ArgumentNullException(\"collection\")) end\n  local count = #t + 1\n  if collection.GetEnumerator == arrayEnumerator then\n    tmove(collection, 1, #collection, count, t)\n  else\n    for _, v in each(collection) do\n      t[count] = v == nil and null or v\n      count = count + 1\n    end\n  end\n  versions[t] = (versions[t] or 0) + 1\nend\n\nlocal function unset()\n  throw(NotSupportedException(\"Collection is read-only.\"))\nend\n\nlocal function fill(t, f, e, v)\n  while f <= e do\n    t[f] = v\n    f = f + 1\n  end\nend\n\nlocal function buildArray(T, len, t)\n  if t == nil then \n    t = {}\n    if len > 0 then\n      local genericT = T.__genericT__\n      local default = genericT:default()\n      if default == nil then\n        fill(t, 1, len, null)\n      elseif type(default) ~= \"table\" then\n        fill(t, 1, len, default)\n      else\n        for i = 1, len do\n          t[i] = genericT:default()\n        end\n      end\n    end\n  else\n    if len > 0 then\n      local default = T.__genericT__:default()\n      if default == nil then\n        for i = 1, len do\n          if t[i] == nil then\n            t[i] = null\n          end\n        end\n      end\n    end\n  end\n  return setmetatable(t, T)\nend\n\nlocal function indexOf(t, v, startIndex, count)\n  if t == nil then throw(ArgumentNullException(\"array\")) end\n  local len = #t\n  if not startIndex then\n    startIndex, count = 0, len\n  elseif not count then\n    if startIndex < 0 or startIndex > len then\n      throw(ArgumentOutOfRangeException(\"startIndex\"))\n    end\n    count = len - startIndex\n  else\n    if startIndex < 0 or startIndex > len then\n      throw(ArgumentOutOfRangeException(\"startIndex\"))\n    end\n    if count < 0 or count > len - startIndex then\n      throw(ArgumentOutOfRangeException(\"count\"))\n    end\n  end\n  local comparer = EqualityComparer(t.__genericT__).getDefault()\n  local equals = comparer.EqualsOf\n  for i = startIndex + 1, startIndex + count do\n    local item = t[i]\n    if item == null then item = nil end\n    if equals(comparer, item, v) then\n      return i - 1\n    end\n  end\n  return -1\nend\n\nlocal function findIndex(t, startIndex, count, match)\n  if t == nil then throw(ArgumentNullException(\"array\")) end\n  local len = #t\n  if not count then\n    startIndex, count, match = 0, len, startIndex\n  elseif not match then\n    if startIndex < 0 or startIndex > len then\n      throw(ArgumentOutOfRangeException(\"startIndex\"))\n    end\n    count, match = len - startIndex, count\n  else\n    if startIndex < 0 or startIndex > len then\n      throw(ArgumentOutOfRangeException(\"startIndex\"))\n    end\n    if count < 0 or count > len - startIndex then\n      throw(ArgumentOutOfRangeException(\"count\"))\n    end\n  end\n  if match == nil then throw(ArgumentNullException(\"match\")) end\n  local endIndex = startIndex + count\n  for i = startIndex + 1, endIndex  do\n    local item = t[i]\n    if item == null then item = nil end\n    if match(item) then\n      return i - 1\n    end\n  end\n  return -1\nend\n\nlocal function copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length, reliable)\n  if not reliable then\n    checkIndexAndCount(sourceArray, sourceIndex, length)\n    checkIndexAndCount(destinationArray, destinationIndex, length)\n  end\n  tmove(sourceArray, sourceIndex + 1, sourceIndex + length, destinationIndex + 1, destinationArray)\nend\n\nlocal function removeRange(t, index, count)\n  local n = #t\n  if count < 0 or index > n - count then\n    throw(ArgumentOutOfRangeException(\"index or count\"))\n  end\n  if count > 0 then\n    if index + count < n then\n      tmove(t, index + count + 1, n, index + 1)\n    end\n    fill(t, n - count + 1, n, nil)\n    versions[t] = (versions[t] or 0) + 1\n  end\nend\n\nlocal function findAll(t, match)\n  if t == nil then throw(ArgumentNullException(\"array\")) end\n  if match == nil then throw(ArgumentNullException(\"match\")) end\n  local list = {}\n  local count = 1\n  for i = 1, #t do\n    local item = t[i]\n    if (item == null and match(nil)) or match(item) then\n      list[count] = item\n      count = count + 1\n    end\n  end\n  return list\nend\n\nlocal function getComp(t, comparer)\n  local compare\n  if comparer then\n    if type(comparer) == \"function\" then\n      compare = comparer\n    else\n      local Compare = comparer.Compare\n      if Compare then\n        compare = function (x, y) return Compare(comparer, x, y) end\n      else\n        compare = comparer\n      end\n    end\n  else\n    comparer = Comparer_1(t.__genericT__).getDefault()\n    local Compare = comparer.Compare\n    compare = function (x, y) return Compare(comparer, x, y) end\n  end\n  return function(x, y) \n    if x == null then x = nil end\n    if y == null then y = nil end\n    return compare(x, y) < 0\n  end\nend\n\nlocal function sort(t, comparer)\n  if #t > 1 then\n    tsort(t, getComp(t, comparer))\n    versions[t] = (versions[t] or 0) + 1\n  end\nend\n\nlocal ArrayEnumerator = define(\"System.ArrayEnumerator\", function (T)\n  return {\n    base = { IEnumerator_1(T) }\n  }\nend, {\n  getCurrent = System.getCurrent, \n  Dispose = System.emptyFn,\n  Reset = function (this)\n    this.index = 1\n    this.current = nil\n  end,\n  MoveNext = function (this)\n    local t = this.list\n    if this.version ~= versions[t] then\n      throwFailedVersion()\n    end\n    local index = this.index\n    local v = t[index]\n    if v ~= nil then\n      if v == null then\n        this.current = nil\n      else\n        this.current = v\n      end\n      this.index = index + 1\n      return true\n    end\n    this.current = nil\n    return false\n  end\n})\n\narrayEnumerator = function (t, T)\n  if not T then T = t.__genericT__ end\n  return setmetatable({ list = t, index = 1, version = versions[t], currnet = T:default() }, ArrayEnumerator(T))\nend\n\nlocal ArrayReverseEnumerator = define(\"System.ArrayReverseEnumerator\", function (T)\n  return {\n    base = { IEnumerator_1(T) }\n  }\nend, {\n  getCurrent = System.getCurrent, \n  Dispose = System.emptyFn,\n  Reset = function (this)\n    this.index = #this.list\n    this.current = nil\n  end,\n  MoveNext = function (this)\n    local t = this.list\n    if this.version ~= versions[t] then\n      throwFailedVersion()\n    end\n    local index = this.index\n    local v = t[index]\n    if v ~= nil then\n      if v == null then\n        this.current = nil\n      else\n        this.current = v\n      end\n      this.index = index - 1\n      return true\n    end\n    this.current = nil\n    return false\n  end\n})\n\nlocal function reverseEnumerator(t)\n  local T = t.__genericT__\n  return setmetatable({ list = t, index = #t, version = versions[t], currnet = T:default() }, ArrayReverseEnumerator(T))\nend\n\nlocal function checkArrayIndex(index1, index2)\n  if index2 then\n    throw(ArgumentException(\"Indices length does not match the array rank.\"))\n  elseif type(index1) == \"table\" then\n    if #index1 ~= 1 then\n      throw(ArgumentException(\"Indices length does not match the array rank.\"))\n    else\n      index1 = index1[1]\n    end\n  end\n  return index1\nend\n\nArray = {\n  version = 0,\n  new = buildArray,\n  set = set,\n  get = get,\n  ctorList = function (t, ...)\n    local len = select(\"#\", ...)\n    if len == 0 then return end\n    local collection = ...\n    if type(collection) == \"number\" then return end\n    addRange(t, collection)\n  end,\n  add = add,\n  addObj = function (this, item)\n    if not System.is(item, this.__genericT__) then\n      throw(ArgumentException())\n    end\n    return add(this, item)\n  end,\n  addRange = addRange,\n  AsReadOnly = function (t)\n    return System.ReadOnlyCollection(t.__genericT__)(t)\n  end,\n  clear = function (t)\n    local size = #t\n    if size > 0 then\n      for i = 1, size do\n        t[i] = nil\n      end\n      versions[t] = (versions[t] or 0) + 1\n    end\n  end,\n  findAll = function (t, match)\n    return setmetatable(findAll(t, match), System.List(t.__genericT__))\n  end,\n  first = function (t)\n    if #t == 0 then throw(InvalidOperationException()) end\n    local v = t[1]\n    if v ~= null then\n      return v\n    end\n    return nil\n  end,\n  insert = function (t, index, v)\n    if index < 0 or index > #t then\n      throw(ArgumentOutOfRangeException(\"index\"))\n    end\n    tinsert(t, index + 1, v == nil and null or v)\n    versions[t] = (versions[t] or 0) + 1\n  end,\n  insertRange = function (t, index, collection) \n    if collection == nil then throw(ArgumentNullException(\"collection\")) end\n    local len = #t\n    if index < 0 or index > len then\n      throw(ArgumentOutOfRangeException(\"index\"))\n    end\n    if t.GetEnumerator == arrayEnumerator then\n      local count = #collection\n      if count > 0 then\n        if index < len then\n          tmove(t, index + 1, len, index + 1 + count, t)\n        end\n        if t == collection then\n          tmove(t, 1, index, index + 1, t)\n          tmove(t, index + 1 + count, count * 2, index * 2 + 1, t)\n        else\n          tmove(collection, 1, count, index + 1, t)\n        end\n      end\n    else\n      for _, v in each(collection) do\n        index = index + 1\n        tinsert(t, index, v == nil and null or v)\n      end\n    end\n    versions[t] = (versions[t] or 0) + 1\n  end,\n  last = function (t)\n    local n = #t\n    if n == 0 then throw(InvalidOperationException()) end\n    local v = t[n]\n    if v ~= null then\n      return v\n    end\n    return nil\n  end,\n  popFirst = function (t)\n    if #t == 0 then throw(InvalidOperationException()) end\n    local v = t[1]\n    tremove(t, 1)\n    versions[t] = (versions[t] or 0) + 1\n    if v ~= null then\n      return v\n    end\n    return nil\n  end,\n  popLast = function (t)\n    local n = #t\n    if n == 0 then throw(InvalidOperationException()) end\n    local v = t[n]\n    t[n] = nil\n    if v ~= null then\n      return v\n    end\n    return nil\n  end,\n  removeRange = removeRange,\n  remove = function (t, v)\n    local index = indexOf(t, v)\n    if index >= 0 then\n      tremove(t, index + 1)\n      versions[t] = (versions[t] or 0) + 1\n      return true\n    end\n    return false\n  end,\n  removeAll = function (t, match)\n    if match == nil then throw(ArgumentNullException(\"match\")) end\n    local size = #t\n    local freeIndex = 1\n    while freeIndex <= size do\n      local item = t[freeIndex]\n      if item == null then  item = nil end\n      if match(item) then\n        break\n      end\n      freeIndex = freeIndex + 1 \n    end\n    if freeIndex > size then return 0 end\n  \n    local current = freeIndex + 1\n    while current <= size do \n      while current <= size do\n        local item = t[current]\n        if item == null then item = nil end\n        if not match(item) then\n          break\n        end\n        current = current + 1 \n      end\n      if current <= size then\n        t[freeIndex] = t[current]\n        freeIndex = freeIndex + 1\n        current = current + 1\n      end\n    end\n    freeIndex = freeIndex -1\n    local count = size - freeIndex\n    removeRange(t, freeIndex, count)\n    return count\n  end,\n  removeAt = function (t, index)\n    local v = tremove(t, index + 1)\n    if v == nil then\n      throw(ArgumentOutOfRangeException(\"index\"))\n    end\n    versions[t] = (versions[t] or 0) + 1\n  end,\n  getRange = function (t, index, count)\n    if count < 0 or index > #t - count then\n      throw(ArgumentOutOfRangeException(\"index or count\"))\n    end\n    local list = {}\n    tmove(t, index + 1, index + count, 1, list)\n    return setmetatable(list, System.List(t.__genericT__))\n  end,\n  reverseEnumerator = reverseEnumerator,\n  getCount = lengthFn,\n  getSyncRoot = System.identityFn,\n  getLongLength = lengthFn,\n  getLength = lengthFn,\n  getIsSynchronized = falseFn,\n  getIsReadOnly = falseFn,\n  getIsFixedSize = trueFn,\n  getRank = System.oneFn,\n  Add = unset,\n  Clear = unset,\n  Insert = unset,\n  Remove = unset,\n  RemoveAt = unset,\n  BinarySearch = function (t, ...)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    local len = #t\n    local index, count, v, comparer\n    local n = select(\"#\", ...)\n    if n == 1 or n == 2 then\n      index, count, v, comparer = 0, len, ...\n    else\n      index, count, v, comparer = ...\n    end\n    checkIndexAndCount(t, index, count)\n    local compare\n    if comparer == nil then\n      comparer = Comparer_1(t.__genericT__).getDefault()\n      compare = comparer.Compare \n    else\n      compare = comparer.Compare\n    end\n    local lo = index\n    local hi = index + count - 1\n    while lo <= hi do\n      local i = lo + div(hi - lo, 2)\n      local item = t[i + 1]\n      if item == null then item = nil end\n      local order = compare(comparer, item, v);\n      if order == 0 then return i end\n      if order < 0 then\n        lo = i + 1\n      else\n        hi = i - 1\n      end\n    end\n    return -1\n  end,\n  ClearArray = function (t, index, length)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    if index < 0 or length < 0 or index + length > #t then\n      throw(IndexOutOfRangeException())\n    end\n    local default = t.__genericT__:default()\n    if default == nil then default = null end\n    fill(t, index + 1, index + length, default)\n  end,\n  Contains = function (t, v)\n    return indexOf(t, v) ~= -1\n  end,\n  Copy = function (t, ...)\n    local len = select(\"#\", ...)     \n    if len == 2 then\n      local array, length = ...\n      copy(t, 0, array, 0, length)\n    else \n      copy(t, ...)\n    end\n  end,\n  CreateInstance = function (elementType, length)\n    return buildArray(Array(elementType[1]), length)\n  end,\n  Empty = function (T)\n    local t = emptys[T]\n    if t == nil then\n      t = Array(T)()\n      emptys[T] = t\n    end\n    return t\n  end,\n  Exists = function (t, match)\n    return findIndex(t, match) ~= -1\n  end,\n  Fill = function (t, value, startIndex, count)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    local len = #t\n    if not startIndex then\n      startIndex, count = 0, len\n    else\n      if startIndex < 0 or startIndex > len then\n        throw(ArgumentOutOfRangeException(\"startIndex\"))\n      end\n      if count < 0 or count > len - startIndex then\n        throw(ArgumentOutOfRangeException(\"count\"))\n      end\n    end\n    fill(t, startIndex + 1, startIndex + count, value)\n  end,\n  Find = function (t, match)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    if match == nil then throw(ArgumentNullException(\"match\")) end\n    for i = 1, #t do\n      local item = t[i]\n      if item == null then item = nil end\n      if match(item) then\n        return item\n      end\n    end\n    return t.__genericT__:default()\n  end,\n  FindAll = function (t, match)\n    return setmetatable(findAll(t, match), Array(t.__genericT__))\n  end,\n  FindIndex = findIndex,\n  FindLast = function (t, match)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    if match == nil then throw(ArgumentNullException(\"match\")) end\n    for i = #t, 1, -1 do\n      local item = t[i]\n      if item == null then item = nil end\n      if match(item) then\n        return item\n      end\n    end\n    return t.__genericT__:default()\n  end,\n  FindLastIndex = function (t, startIndex, count, match)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    local len = #t\n    if not count then\n      startIndex, count, match = len - 1, len, startIndex\n    elseif not match then\n      count, match = startIndex + 1, count\n    end\n    if match == nil then throw(ArgumentNullException(\"match\")) end\n    if count < 0 or startIndex - count + 1 < 0 then\n      throw(ArgumentOutOfRangeException(\"count\"))\n    end\n    local endIndex = startIndex - count + 1\n    for i = startIndex + 1, endIndex + 1, -1 do\n      local item = t[i]\n      if item == null then\n        item = nil\n      end\n      if match(item) then\n        return i - 1\n      end\n    end\n    return -1\n  end,\n  ForEach = function (t, action)\n    if action == nil then throw(ArgumentNullException(\"action\")) end\n    for i = 1, #t do\n      local item = t[i]\n      if item == null then item = nil end\n      action(item)\n    end\n  end,\n  IndexOf = indexOf,\n  LastIndexOf = function (t, value, startIndex, count)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    local len = #t\n    if not startIndex then\n      startIndex, count = len - 1, len\n    elseif not count then\n      count = len == 0 and 0 or (startIndex + 1)\n    end\n    if len == 0 then\n      if startIndex ~= -1 and startIndex ~= 0 then\n        throw(ArgumentOutOfRangeException(\"startIndex\"))\n      end\n      if count ~= 0 then\n        throw(ArgumentOutOfRangeException(\"count\"))\n      end\n    end\n    if startIndex < 0 or startIndex >= len then\n      throw(ArgumentOutOfRangeException(\"startIndex\"))\n    end\n    if count < 0 or startIndex - count + 1 < 0 then\n      throw(ArgumentOutOfRangeException(\"count\"))\n    end\n    local comparer = EqualityComparer(t.__genericT__).getDefault()\n    local equals = comparer.EqualsOf\n    local endIndex = startIndex - count + 1\n    for i = startIndex + 1, endIndex + 1, -1 do\n      local item = t[i]\n      if item == null then item = nil end\n      if equals(comparer, item, value) then\n        return i - 1\n      end\n    end\n    return -1\n  end,\n  Resize = function (t, newSize, T)\n    if newSize < 0 then throw(ArgumentOutOfRangeException(\"newSize\")) end\n    if t == nil then\n      return buildArray(Array(T), newSize)\n    end\n    local len = #t\n    if len > newSize then\n      fill(t, newSize + 1, len, nil)\n    elseif len < newSize then\n      local default = t.__genericT__:default()\n      if default == nil then default = null end\n      fill(t, len + 1, newSize, default)\n    end\n    return t\n  end,\n  Reverse = function (t, index, count)\n    if not index then\n      index = 0\n      count = #t\n    else\n      if count < 0 or index > #t - count then\n        throw(ArgumentOutOfRangeException(\"index or count\"))\n      end\n    end\n    local i, j = index + 1, index + count\n    while i <= j do\n      t[i], t[j] = t[j], t[i]\n      i = i + 1\n      j = j - 1\n    end\n    versions[t] = (versions[t] or 0) + 1\n  end,\n  Sort = function (t, ...)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    local len = select(\"#\", ...)\n    if len == 0 then\n      sort(t)\n    elseif len == 1 then\n      local comparer = ...\n      sort(t, comparer)\n    else\n      local index, count, comparer = ...\n      if count > 1 then\n        local comp = getComp(t, comparer)\n        if index == 0 and count == #t then\n          tsort(t, comp)\n        else\n          checkIndexAndCount(t, index, count)\n          local arr = {}\n          tmove(t, index + 1, index + count, 1, arr)\n          tsort(arr, comp)\n          tmove(arr, 1, count, index + 1, t)\n        end\n        versions[t] = (versions[t] or 0) + 1\n      end\n    end\n  end,\n  toArray = function (t)\n    local array = {}    \n    if t.GetEnumerator == arrayEnumerator then\n      tmove(t, 1, #t, 1, array)\n    else\n      local count = 1\n      for _, v in each(t) do\n        array[count] = v == nil and null or v\n        count = count + 1\n      end\n    end\n    return arrayFromTable(array, t.__genericT__)\n  end,\n  TrueForAll = function (t, match)\n    if t == nil then throw(ArgumentNullException(\"array\")) end\n    if match == nil then throw(ArgumentNullException(\"match\")) end\n    for i = 1, #t do\n      local item = t[i]\n      if item == null then item = nil end\n      if not match(item) then\n        return false\n      end\n    end\n    return true\n  end,\n  Clone = function (this)\n    local t = setmetatable({}, getmetatable(this))\n    tmove(this, 1, #this, 1, t)\n    return t\n  end,\n  CopyTo = function (this, array, index)\n    local n = #this\n    checkIndexAndCount(array, index, n)\n    local T = this.__genericT__\n    if T.class == \"S\" then\n      local default = T:default()\n      if type(default) == \"table\" then\n        for i = 1, n do\n          array[i + index] = this[i]:__clone__()\n        end\n        return\n      end\n    end\n    tmove(this, 1, n, index + 1, array)\n  end,\n  GetEnumerator = arrayEnumerator,\n  GetLength = function (this, dimension)\n    if dimension ~= 0 then throw(IndexOutOfRangeException()) end\n    return #this\n  end,\n  GetLowerBound = function (this, dimension)\n    if dimension ~= 0 then throw(IndexOutOfRangeException()) end\n    return 0\n  end,\n  GetUpperBound = function (this, dimension)\n    if dimension ~= 0 then throw(IndexOutOfRangeException()) end\n    return #this - 1\n  end,\n  GetValue = function (this, index1, index2)\n    if index1 == nil then throw(ArgumentNullException(\"indices\")) end\n    return get(this, checkArrayIndex(index1, index2))\n  end,\n  SetValue = function (this, value, index1, index2)\n    if index1 == nil then throw(ArgumentNullException(\"indices\")) end\n    set(this, checkArrayIndex(index1, index2), System.castWithNullable(this.__genericT__, value))\n  end,\n  Clone = function (this)\n    local array = {}\n    tmove(this, 1, #this, 1, array)\n    return arrayFromTable(array, this.__genericT__)\n  end\n}\n\nfunction Array.__call(T, ...)\n  return buildArray(T, select(\"#\", ...), { ... })\nend\n\nfunction System.arrayFromList(t)\n  return setmetatable(t, Array(t.__genericT__))\nend\n\narrayFromTable = function (t, T, readOnly)\n  assert(T)\n  local array = setmetatable(t, Array(T))\n  if readOnly then\n    array.set = unset\n  end\n  return array\nend\n\nSystem.arrayFromTable = arrayFromTable\n\nlocal function getIndex(t, ...)\n  local rank = t.__rank__\n  local id = 0\n  local len = #rank\n  for i = 1, len do\n    id = id * rank[i] + select(i, ...)\n  end\n  return id, len\nend\n\nlocal function checkMultiArrayIndex(t, index1, ...)\n  if index1 == nil then throw(ArgumentNullException(\"indices\")) end\n  local rank = t.__rank__\n  local len = #rank\n  if type(index1) == \"table\" then\n    if #index1 ~= len then\n      throw(ArgumentException(\"Indices length does not match the array rank.\"))\n    end\n    local id = 0\n    for i = 1, len do\n      id = id * rank[i] + index1[i]\n    end\n    return id\n  elseif len ~= select(\"#\", ...) + 1 then\n    throw(ArgumentException(\"Indices length does not match the array rank.\"))\n  end\n  return getIndex(t, index1, ...)\nend\n\nlocal MultiArray = { \n  set = function (this, ...)\n    local index, len = getIndex(this, ...)\n    set(this, index, select(len + 1, ...))\n  end,\n  get = function (this, ...)\n    local index = getIndex(this, ...)\n    return get(this, index)\n  end,\n  getRank = function (this)\n    return #this.__rank__\n  end,\n  GetLength = function (this, dimension)\n    local rank = this.__rank__\n    if dimension < 0 or dimension >= #rank then throw(IndexOutOfRangeException()) end\n    return rank[dimension + 1]\n  end,\n  GetLowerBound = function (this, dimension)\n    local rank = this.__rank__\n    if dimension < 0 or dimension >= #rank then throw(IndexOutOfRangeException()) end\n    return 0\n  end,\n  GetUpperBound = function (this, dimension)\n    local rank = this.__rank__\n    if dimension < 0 or dimension >= #rank then throw(IndexOutOfRangeException()) end\n    return rank[dimension + 1] - 1\n  end,\n  GetValue = function (this, ...)\n    return get(this, checkMultiArrayIndex(this, ...))\n  end,\n  SetValue = function (this, value, ...)\n    set(this, checkMultiArrayIndex(this, ...), System.castWithNullable(this.__genericT__, value))\n  end,\n  Clone = function (this)\n    local array = { __rank__ = this.__rank__ }\n    tmove(this, 1, #this, 1, array)\n    return arrayFromTable(array, this.__genericT__)\n  end\n}\n\nfunction MultiArray.__call(T, rank, t)\n  local len = 1\n  for i = 1, #rank do\n    len = len * rank[i]\n  end\n  t = buildArray(T, len, t)\n  t.__rank__ = rank\n  return t\nend\n\nSystem.defArray(\"System.Array\", function(T) \n  return { \n    base = { System.ICloneable, System.IList_1(T), System.IReadOnlyList_1(T), System.IList }, \n    __genericT__ = T\n  }\nend, Array, MultiArray)\n\nlocal cpool = {}\nlocal function createCoroutine(f)\n  local c = tremove(cpool)\n  if c == nil then\n    c = ccreate(function (...)\n      f(...)\n      while true do\n        f = nil\n        cpool[#cpool + 1] = c\n        f = cyield(cpool)\n        f(cyield())\n      end\n    end)\n  else\n    cresume(c, f)\n  end\n  return c\nend\n\nSystem.ccreate = createCoroutine\nSystem.cpool = cpool\nSystem.cresume = cresume\nSystem.yield = cyield\n\nlocal YieldEnumerable\nYieldEnumerable = define(\"System.YieldEnumerable\", function (T)\n  return {\n    base = { System.IEnumerable_1(T), System.IEnumerator_1(T), System.IDisposable },\n    __genericT__ = T\n  }\nend, {\n  getCurrent = System.getCurrent, \n  Dispose = System.emptyFn,\n  GetEnumerator = function (this)\n    return setmetatable({ f = this.f, args = this.args }, YieldEnumerable(this.__genericT__))\n  end,\n  MoveNext = function (this)\n    local c = this.c\n    if c == false then\n      return false\n    end\n  \n    local ok, v\n    if c == nil then\n      c = createCoroutine(this.f)\n      this.c = c\n      local args = this.args\n      ok, v = cresume(c, unpack(args, 1, args.n))\n      this.args = nil\n    else\n      ok, v = cresume(c)\n    end\n  \n    if ok then\n      if v == cpool then\n        this.c = false\n        this.current = nil\n        return false\n      else\n        this.current = v\n        return true\n      end\n    else\n      error(v)\n    end\n  end\n})\n\nlocal function yieldIEnumerable(f, T, ...)\n  return setmetatable({ f = f, args = pack(...) }, YieldEnumerable(T))\nend\n\nSystem.yieldIEnumerable = yieldIEnumerable\nSystem.yieldIEnumerator = yieldIEnumerable\n\nlocal ReadOnlyCollection = {\n  __ctor__ = function (this, list)\n    if not list then throw(ArgumentNullException(\"list\")) end\n    this.list = list\n  end,\n  getCount = function (this)\n    return #this.list\n  end,\n  get = function (this, index)\n    return this.list:get(index)\n  end,\n  Contains = function (this, value)\n    return this.list:Contains(value)\n  end,\n  GetEnumerator = function (this)\n    return this.list:GetEnumerator()\n  end,\n  CopyTo = function (this, array, index)\n    this.list:CopyTo(array, index)\n  end,\n  IndexOf = function (this, value)\n    return this.list:IndexOf(value)\n  end,\n  getIsSynchronized = falseFn,\n  getIsReadOnly = trueFn,\n  getIsFixedSize = trueFn,\n}\n\ndefine(\"System.ReadOnlyCollection\", function (T)\n  return { \n    base = { System.IList_1(T), System.IList, System.IReadOnlyList_1(T) }, \n    __genericT__ = T\n  }\nend, ReadOnlyCollection)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Array.lua.meta",
    "content": "fileFormatVersion: 2\nguid: cfb931ea6b78c994aac377dd25e13e3f\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Boolean.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal debugsetmetatable = System.debugsetmetatable\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal FormatException = System.FormatException\n\nlocal type = type\nlocal setmetatable = setmetatable\n\nlocal function compareTo(this, v)\n  if this == v then\n    return 0\n  elseif this == false then\n    return -1     \n  end\n  return 1\nend\n\nlocal falseString = \"False\"\nlocal trueString = \"True\"\n\nlocal function parse(s)\n  if s == nil then\n    return nil, 1\n  end\n  local i, j, value = s:find(\"^[%s%c%z]*(%a+)[%s%c%z]*$\")\n  if value then\n    s = value:lower()\n    if s == \"true\" then\n      return true\n    elseif s == \"false\" then\n      return false\n    end\n  end\n  return nil, 2\nend\n\nlocal function toString(this)\n  return this and trueString or falseString\nend\n\nlocal Boolean = System.defStc(\"System.Boolean\", {\n  default = System.falseFn,\n  GetHashCode = System.identityFn,\n  Equals = System.equals,\n  CompareTo = compareTo,\n  ToString = toString,\n  FalseString = falseString,\n  TrueString = trueString,\n  CompareToObj = function (this, v)\n    if v == nil then return 1 end\n    if type(v) ~= \"boolean\" then\n      throw(ArgumentException(\"Arg_MustBeBoolean\"))\n    end\n    return compareTo(this, v)\n  end,\n  EqualsObj = function (this, v)\n    if type(v) ~= \"boolean\" then\n      return false\n    end\n    return this == v\n  end,\n  __concat = function (a, b)\n    if type(a) == \"boolean\" then\n      return toString(a) .. b\n    else \n      return a .. toString(b)\n    end\n  end,\n  __tostring = toString,\n  Parse = function (s)\n    local v, err = parse(s)\n    if v == nil then\n      if err == 1 then\n        throw(ArgumentNullException()) \n      else\n        throw(FormatException())\n      end\n    end\n    return v\n  end,\n  TryParse = function (s)\n    local v = parse(s)\n    if v ~= nil then\n      return true, v\n    end\n    return false, false\n  end,\n  base = function (_, T)\n    return { System.IComparable, System.IConvertible, System.IComparable_1(T), System.IEquatable_1(T) }\n  end\n})\nif debugsetmetatable then\n  debugsetmetatable(false, Boolean)\nend\n\nlocal ValueType = System.ValueType\nlocal boolMetaTable = setmetatable({ __index = ValueType, __call = Boolean.default }, ValueType)\nsetmetatable(Boolean, boolMetaTable)"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Boolean.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 1d6746daf7f157440a3bca4ef0d89b5e\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Char.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal Int = System.Int\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\n\nlocal setmetatable = setmetatable\nlocal byte = string.byte\n\nlocal isSeparatorTable = {\n  [32] = true,\n  [160] = true,\n  [0x2028] = true,\n  [0x2029] = true,\n  [0x0020] = true,\n  [0x00A0] = true,\n  [0x1680] = true,\n  [0x180E] = true,\n  [0x202F] = true,\n  [0x205F] = true,\n  [0x3000] = true,\n}\n\nlocal isSymbolTable = {\n  [36] = true,\n  [43] = true,\n  [60] = true, \n  [61] = true, \n  [62] = true, \n  [94] = true, \n  [96] = true,\n  [124] = true,\n  [126] = true,\n  [172] = true, \n  [180] = true,\n  [182] = true,\n  [184] = true,\n  [215] = true,\n  [247] = true,\n}\n\n--https://msdn.microsoft.com/zh-cn/library/t809ektx(v=vs.110).aspx\nlocal isWhiteSpace = {\n  [0x0020] = true,\n  [0x00A0] = true,\n  [0x1680] = true,\n  [0x202F] = true,\n  [0x205F] = true,\n  [0x3000] = true,\n  [0x2028] = true,\n  [0x2029] = true,\n  [0x0085] = true,\n}\n\nlocal function get(s, index)\n  if s == nil then throw(ArgumentNullException(\"s\")) end\n  local c = byte(s, index + 1)\n  if not c then throw(ArgumentOutOfRangeException(\"index\")) end\n  return c\nend\n\nlocal function isDigit(c, index)\n  if index then\n    c = get(c, index)\n  end\n  return (c >= 48 and c <= 57)\nend\n\n-- https://msdn.microsoft.com/zh-cn/library/yyxz6h5w(v=vs.110).aspx\nlocal function isLetter(c, index)    \n  if index then\n    c = get(c, index) \n  end\n  if c < 128 then\n    return (c >= 65 and c <= 90) or (c >= 97 and c <= 122)\n  else  \n    return (c >= 0x0400 and c <= 0x042F) \n      or (c >= 0x03AC and c <= 0x03CE) \n      or (c == 0x01C5 or c == 0x1FFC) \n      or (c >= 0x02B0 and c <= 0x02C1) \n      or (c >= 0x1D2C and c <= 0x1D61) \n      or (c >= 0x05D0 and c <= 0x05EA)\n      or (c >= 0x0621 and c <= 0x063A)\n      or (c >= 0x4E00 and c <= 0x9FC3) \n  end\nend\n\nlocal Char = System.defStc(\"System.Char\", {\n  ToString = string.char,\n  CompareTo = Int.CompareTo,\n  CompareToObj = Int.CompareToObj,\n  Equals = Int.Equals,\n  EqualsObj = Int.EqualsObj,\n  GetHashCode = Int.GetHashCode,\n  default = Int.default,\n  IsControl = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    return (c >=0 and c <= 31) or (c >= 127 and c <= 159)\n  end,\n  IsDigit = isDigit,\n  IsLetter = isLetter,\n  IsLetterOrDigit = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    return isDigit(c) or isLetter(c)\n  end,\n  IsLower = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    return (c >= 97 and c <= 122) or (c >= 945 and c <= 969)\n  end,\n  IsNumber = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    return (c >= 48 and c <= 57) or c == 178 or c == 179 or c == 185 or c == 188 or c == 189 or c == 190\n  end,\n  IsPunctuation = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    if c < 256 then\n      return (c >= 0x0021 and c <= 0x0023) \n        or (c >= 0x0025 and c <= 0x002A) \n        or (c >= 0x002C and c <= 0x002F) \n        or (c >= 0x003A and c <= 0x003B) \n        or (c >= 0x003F and c <= 0x0040)  \n        or (c >= 0x005B and c <= 0x005D)\n        or c == 0x5F or c == 0x7B or c == 0x007D or c == 0x00A1 or c == 0x00AB or c == 0x00AD or c == 0x00B7 or c == 0x00BB or c == 0x00BF\n    end\n    return false\n  end,\n  IsSeparator = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    return (c >= 0x2000 and c <= 0x200A) or isSeparatorTable[c] == true\n  end,\n  IsSymbol = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    if c < 256 then\n      return (c >= 162 and c <= 169) or (c >= 174 and c <= 177) or isSymbolTable(c) == true\n    end\n    return false\n  end,\n  IsUpper = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    return (c >= 65 and c <= 90) or (c >= 913 and c <= 937)\n  end,\n  IsWhiteSpace = function (c, index)\n    if index then\n      c = get(c, index)\n    end\n    return (c >= 0x2000 and c <= 0x200A) or (c >= 0x0009 and c <= 0x000d) or isWhiteSpace[c] == true\n  end,\n  Parse = function (s)\n    if s == nil then\n      throw(System.ArgumentNullException())\n    end\n    if #s ~= 1 then\n      throw(System.FormatException())\n    end\n    return s:byte()\n  end,\n  TryParse = function (s)\n    if s == nil or #s ~= 1 then\n      return false, 0\n    end \n    return true, s:byte()\n  end,\n  ToLower = function (c)\n    if (c >= 65 and c <= 90) or (c >= 913 and c <= 937) then\n      return c + 32\n    end\n    return c\n  end,\n  ToUpper = function (c)\n    if (c >= 97 and c <= 122) or (c >= 945 and c <= 969) then\n      return c - 32\n    end\n    return c\n  end,\n  IsHighSurrogate = function (c, index) \n    if index then\n      c = get(c, index)\n    end\n    return c >= 0xD800 and c <= 0xDBFF\n  end,\n  IsLowSurrogate = function (c, index) \n    if index then\n      c = get(c, index)\n    end\n    return c >= 0xDC00 and c <= 0xDFFF\n  end,\n  IsSurrogate = function (c, index) \n    if index then\n      c = get(c, index)\n    end\n    return c >= 0xD800 and c <= 0xDFFF\n  end,\n  base = function (_, T)\n    return { System.IComparable, System.IComparable_1(T), System.IEquatable_1(T) }\n  end\n})\n\nlocal ValueType = System.ValueType\nlocal charMetaTable = setmetatable({ __index = ValueType, __call = Char.default }, ValueType)\nsetmetatable(Char, charMetaTable)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Char.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 258f15fe832bc224ea63662b03a89289\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/Dictionary.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal null = System.null\nlocal falseFn = System.falseFn\nlocal each = System.each\nlocal lengthFn = System.lengthFn\nlocal versions = System.versions\nlocal Array = System.Array\nlocal checkIndexAndCount = System.checkIndexAndCount\nlocal throwFailedVersion = System.throwFailedVersion\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentException = System.ArgumentException\nlocal KeyNotFoundException = System.KeyNotFoundException\nlocal EqualityComparer = System.EqualityComparer\nlocal NotSupportedException = System.NotSupportedException\n\nlocal assert = assert\nlocal pairs = pairs\nlocal next = next\nlocal select = select\nlocal getmetatable = getmetatable\nlocal setmetatable = setmetatable\nlocal tconcat = table.concat\nlocal tremove = table.remove\nlocal type = type\n\nlocal counts = setmetatable({}, { __mode = \"k\" })\nSystem.counts = counts\n\nlocal function getCount(this)\n  local t = counts[this]\n  if t then\n    return t[1]\n  end\n  return 0\nend\n\nlocal function pairsFn(t, i)\n  local count =  counts[t]\n  if count then\n    if count[2] ~= count[3] then\n      throwFailedVersion()\n    end\n  end\n  local k, v = next(t, i)\n  if v == null then\n    return k\n  end\n  return k, v\nend\n\nfunction System.pairs(t)\n  local count = counts[t]\n  if count then\n    count[3] = count[2]\n  end\n  return pairsFn, t\nend\n\nlocal KeyValuePairFn\nlocal KeyValuePair = {\n  __ctor__ = function (this, ...)\n    if select(\"#\", ...) == 0 then\n      this.Key, this.Value = this.__genericTKey__:default(), this.__genericTValue__:default()\n    else\n      this.Key, this.Value = ...\n    end\n  end,\n  Create = function (key, value, TKey, TValue)\n    return setmetatable({ Key = key, Value = value }, KeyValuePairFn(TKey, TValue))\n  end,\n  Deconstruct = function (this)\n    return this.Key, this.Value\n  end,\n  ToString = function (this)\n    local t = { \"[\" }\n    local count = 2\n    local k, v = this.Key, this.Value\n    if k ~= nil then\n      t[count] = k:ToString()\n      count = count + 1\n    end\n    t[count] = \", \"\n    count = count + 1\n    if v ~= nil then\n      t[count] = v:ToString()\n      count = count + 1\n    end\n    t[count] = \"]\"\n    return tconcat(t)\n  end\n}\n\nKeyValuePairFn = System.defStc(\"System.Collections.Generic.KeyValuePair\", function(TKey, TValue)\n  local cls = {\n    __genericTKey__ = TKey,\n    __genericTValue__ = TValue,\n  }\n  return cls\nend, KeyValuePair)\nSystem.KeyValuePair = KeyValuePairFn\n\nlocal function isKeyValuePair(t)\n  return getmetatable(getmetatable(t)) == KeyValuePair\nend\n\nlocal DictionaryEnumerator = define(\"System.Collections.Generic.DictionaryEnumerator\", {\n  getCurrent = System.getCurrent, \n  Dispose = System.emptyFn,\n  MoveNext = function (this)\n    local t, kind = this.dict, this.kind\n    local count = counts[t]\n    if this.version ~= (count and count[2] or 0) then\n      throwFailedVersion()\n    end\n    local k, v = next(t, this.index)\n    if k ~= nil then\n      if kind then\n        kind.Key = k\n        if v == null then v = nil end\n        kind.Value = v\n      elseif kind == false then\n        if v == null then v = nil end\n        this.current = v\n      else\n        this.current = k\n      end\n      this.index = k\n      return true\n    else\n      if kind then\n        kind.Key, kind.Value = kind.__genericTKey__:default(), kind.__genericTValue__:default()\n      elseif kind == false then\n        this.current = t.__genericTValue__:default()\n      else\n        this.current = t.__genericTKey__:default()\n      end\n      return false\n    end\n  end\n})\n\nlocal function dictionaryEnumerator(t, kind)\n  local current\n  if not kind then\n    local TKey, TValue = t.__genericTKey__, t.__genericTValue__\n    kind = setmetatable({ Key = TKey:default(), Value = TValue:default() }, t.__genericT__)\n    current = kind\n  elseif kind == 1 then\n    local TKey = t.__genericTKey__\n    current = TKey:default()\n    kind = nil\n  else\n    local TValue = t.__genericTValue__\n    current = TValue:default()\n    kind = false\n  end\n  local count = counts[t]\n  local en = {\n    dict = t,\n    version = count and count[2] or 0,\n    kind = kind,\n    current = current\n  }\n  return setmetatable(en, DictionaryEnumerator)\nend\n\nlocal DictionaryCollection = define(\"System.Collections.Generic.DictionaryCollection\", function (T)\n    return {\n      base = { System.ICollection_1(T), System.IReadOnlyCollection_1(T), System.ICollection },\n      __genericT__ = T\n    }\n  end, {\n  __ctor__ = function (this, dict, kind)\n    this.dict = dict\n    this.kind = kind\n  end,\n  getCount = function (this)\n    return getCount(this.dict)\n  end,\n  GetEnumerator = function (this)\n    return dictionaryEnumerator(this.dict, this.kind)\n  end\n})\n\nlocal function add(this, key, value)\n  if key == nil then throw(ArgumentNullException(\"key\")) end\n  if this[key] ~= nil then throw(ArgumentException(\"key already exists\")) end\n  this[key] = value == nil and null or value\n  local t = counts[this]\n  if t then\n    t[1] = t[1] + 1\n    t[2] = t[2] + 1\n  else\n    counts[this] = { 1, 1 }\n  end\nend\n\nlocal function remove(this, key)\n  if key == nil then throw(ArgumentNullException(\"key\")) end\n  if this[key] ~= nil then\n    this[key] = nil\n    local t = counts[this]\n    t[1] = t[1] - 1\n    t[2] = t[2] + 1\n    return true\n  end\n  return false\nend\n\nlocal function buildFromDictionary(this, dictionary)\n  if dictionary == nil then throw(ArgumentNullException(\"dictionary\")) end\n  local count = 0\n  for k, v in pairs(dictionary) do\n    this[k] = v\n    count = count + 1\n  end\n  counts[this] = { count, 0 }\nend\n\nlocal ArrayDictionaryFn\nlocal function buildHasComparer(this, ...)\n   local Dictionary = ArrayDictionaryFn(this.__genericTKey__, this.__genericTValue__)\n   Dictionary.__ctor__(this, ...)\n   return setmetatable(this, Dictionary)\nend\n\nlocal Dictionary = {\n  getIsFixedSize = falseFn,\n  getIsReadOnly = falseFn,\n  __ctor__ = function (this, ...) \n    local n = select(\"#\", ...)\n    if n == 0 then\n    elseif n == 1 then\n      local comparer = ...\n      if comparer == nil or type(comparer) == \"number\" then  \n      else\n        local equals = comparer.EqualsOf\n        if equals == nil then\n          buildFromDictionary(this, comparer)\n        else\n          buildHasComparer(this, ...)\n        end\n      end\n    else\n      local dictionary, comparer = ...\n      if comparer ~= nil then \n        buildHasComparer(this, ...)\n      end\n      if type(dictionary) ~= \"number\" then \n        buildFromDictionary(this, dictionary)\n      end\n    end\n  end,\n  AddKeyValue = add,\n  Add = function (this, ...)\n    local k, v\n    if select(\"#\", ...) == 1 then\n      local pair = ... \n      k, v = pair.Key, pair.Value\n    else\n      k, v = ...\n    end\n    add(this, k ,v)\n  end,\n  Clear = function (this)\n    for k, v in pairs(this) do\n      this[k] = nil\n    end\n    counts[this] = nil\n  end,\n  ContainsKey = function (this, key)\n    if key == nil then throw(ArgumentNullException(\"key\")) end\n    return this[key] ~= nil \n  end,\n  ContainsValue = function (this, value)\n    if value == nil then\n      for _, v in pairs(this) do\n        if v == null then\n          return true\n        end\n      end\n    else\n      local comparer = EqualityComparer(this.__genericTValue__).getDefault()\n      local equals = comparer.EqualsOf\n        for _, v in pairs(this) do\n          if v ~= null then\n            if equals(comparer, value, v ) then\n              return true\n            end\n          end\n      end\n    end\n    return false\n  end,\n  Contains = function (this, pair)\n    local key = pair.Key\n    if key == nil then throw(ArgumentNullException(\"key\")) end\n    local value = this[key]\n    if value ~= nil then\n      if value == null then value = nil end\n      local comparer = EqualityComparer(this.__genericTValue__).getDefault()\n      if comparer:EqualsOf(value, pair.Value) then\n        return true\n      end\n    end\n    return false\n  end,\n  CopyTo = function (this, array, index)\n    local count = getCount(this)\n    checkIndexAndCount(array, index, count)\n    if count > 0 then\n      local KeyValuePair = this.__genericT__\n      index = index + 1\n      for k, v in pairs(this) do\n        if v == null then v = nil end\n        array[index] = setmetatable({ Key = k, Value = v }, KeyValuePair)\n        index = index + 1\n      end\n    end\n  end,\n  RemoveKey = remove,\n  Remove = function (this, key)\n    if isKeyValuePair(key) then\n      local k, v = key.Key, key.Value\n      if k == nil then throw(ArgumentNullException(\"key\")) end\n      local value = this[k]\n      if value ~= nil then\n        if value == null then value = nil end\n        local comparer = EqualityComparer(this.__genericTValue__).getDefault()\n        if comparer:EqualsOf(value, v) then\n          remove(this, k)\n          return true\n        end\n      end\n      return false\n    end\n    return remove(this, key)\n  end,\n  TryGetValue = function (this, key)\n    if key == nil then throw(ArgumentNullException(\"key\")) end\n    local value = this[key]\n    if value == nil then\n      return false, this.__genericTValue__:default()\n    end\n    if value == null then return true end\n    return true, value\n  end,\n  getComparer = function (this)\n    return EqualityComparer(this.__genericTKey__).getDefault()\n  end,\n  getCount = getCount,\n  get = function (this, key)\n    if key == nil then throw(ArgumentNullException(\"key\")) end\n    local value = this[key]\n    if value == nil then throw(KeyNotFoundException()) end\n    if value ~= null then\n      return value\n    end\n    return nil\n  end,\n  set = function (this, key, value)\n    if key == nil then throw(ArgumentNullException(\"key\")) end\n    local t = counts[this]\n    if t then\n      if this[key] == nil then\n        t[1] = t[1] + 1\n      end\n      t[2] = t[2] + 1\n    else\n      counts[this] = { 1, 1 }\n    end\n    this[key] = value == nil and null or value\n  end,\n  GetEnumerator = dictionaryEnumerator,\n  getKeys = function (this)\n    return DictionaryCollection(this.__genericTKey__)(this, 1)\n  end,\n  getValues = function (this)\n    return DictionaryCollection(this.__genericTValue__)(this, 2)\n  end\n}\n\nlocal ArrayDictionaryEnumerator = define(\"System.Collections.Generic.ArrayDictionaryEnumerator\", function (T)\n  return {\n    base = { System.IEnumerator_1(T) }\n  }\nend, {\n  getCurrent = System.getCurrent, \n  Dispose = System.emptyFn,\n  MoveNext = function (this)\n    local t = this.list\n    if this.version ~= versions[t] then\n      throwFailedVersion()\n    end\n    local index = this.index\n    local pair = t[index]\n    if pair ~= nil then\n      if t.kind then\n        this.current = pair.Value\n      else\n        this.current = pair.Key\n      end\n      this.index = index + 1\n      return true\n    end\n    this.current = nil\n    return false\n  end\n})\n\nlocal arrayDictionaryEnumerator = function (t, kind, T)\n  return setmetatable({ list = t, kind = kind, index = 1, version = versions[t], currnet = T:default() }, ArrayDictionaryEnumerator(T))\nend\n\nlocal ArrayDictionaryCollection = define(\"System.Collections.Generic.ArrayDictionaryCollection\", function (T)\n  return {\n    base = { System.ICollection_1(T), System.IReadOnlyCollection_1(T), System.ICollection },\n    __genericT__ = T\n  }\n  end, {\n  __ctor__ = function (this, dict, kind)\n    this.dict = dict\n    this.kind = kind\n  end,\n  getCount = function (this)\n    return getCount(this.dict)\n  end,\n  GetEnumerator = function (this)\n    return arrayDictionaryEnumerator(this.dict, this.kind, this.__genericT__)\n  end\n})\n\nlocal ArrayDictionary = (function ()\n  local function buildFromDictionary(this, dictionary)\n    if dictionary == nil then throw(ArgumentNullException(\"dictionary\")) end\n    local count = 1\n    local KeyValuePair = this.__genericT__\n    for _, pair in each(dictionary) do\n      local k, v = pair.Key, pair.Value\n      if type(k) == \"table\" and k.class == 'S' then\n        k = k:__clone__()\n      end\n      this[count] = setmetatable({ Key = k, Value = v }, KeyValuePair)\n      count = count + 1\n    end\n  end \n  \n  local function add(this, key, value, set)\n    if key == nil then throw(ArgumentNullException(\"key\")) end\n    local len = #this\n    if len > 0 then\n      local comparer = this.comparer\n      local equals = comparer.EqualsOf\n      for i = 1, len do\n        if equals(comparer, this[i].Key, key) then\n          if set then\n            this[i].Value = value\n            return\n          else\n            throw(ArgumentException(\"key already exists\"))\n          end\n        end\n      end\n    end\n    this[len + 1] = setmetatable({ Key = key, Value = value }, this.__genericT__)\n    versions[this] = (versions[this] or 0) + 1\n  end\n  \n  local function remove(this, key)\n    if key == nil then throw(ArgumentNullException(\"key\")) end\n    local len = #this\n    if len > 0 then\n      local comparer = this.comparer\n      local equals = comparer.EqualsOf\n      for i = 1, len do\n        if equals(comparer, this[i].Key, key) then\n          tremove(this, i)\n          versions[this] = (versions[this] or 0) + 1\n          return true\n        end\n      end\n    end\n    return false\n  end\n \n  return {\n    getIsFixedSize = falseFn,\n    getIsReadOnly = falseFn,\n    __ctor__ = function (this, ...)\n      local Comparer\n      local n = select(\"#\", ...)\n      if n == 0 then\n      elseif n == 1 then\n        local comparer = ...\n        if comparer == nil or type(comparer) == \"number\" then  \n        else\n          local equals = comparer.EqualsOf\n          if equals == nil then\n            buildFromDictionary(this, comparer)\n          else\n            Comparer = comparer\n          end\n        end\n      else\n        local dictionary, comparer = ...\n        if type(dictionary) ~= \"number\" then \n           buildFromDictionary(this, dictionary)\n        end\n        Comparer = comparer\n      end\n      this.comparer = Comparer or EqualityComparer(this.__genericTKey__).getDefault()\n    end,\n    AddKeyValue = add,\n    Add = function (this, ...)\n      local k, v\n      if select(\"#\", ...) == 1 then\n        local pair = ... \n        k, v = pair.Key, pair.Value\n      else\n        k, v = ...\n      end\n      add(this, k ,v)\n    end,\n    Clear = Array.clear,\n    ContainsKey = function (this, key)\n      if key == nil then throw(ArgumentNullException(\"key\")) end\n      local len = #this\n      if len > 0 then\n        local comparer = this.comparer\n        local equals = comparer.EqualsOf\n        for i = 1, len do\n          if equals(comparer, this[i].Key, key) then\n            return true\n          end\n        end\n      end\n      return false\n    end,\n    ContainsValue = function (this, value)\n      local len = #this\n      if len > 0 then\n        local comparer = EqualityComparer(this.__genericTValue__).getDefault()\n        local equals = comparer.EqualsOf\n        for i = 1, #this do\n          if equals(comparer, value, this[i].Value) then\n            return true\n          end\n        end\n      end\n      return false\n    end,\n    Contains = function (this, pair)\n      local key = pair.Key\n      if key == nil then throw(ArgumentNullException(\"key\")) end\n      local len = #this\n      if len > 0 then\n        local comparer = this.comparer\n        local equals = comparer.EqualsOf\n        for i = 1, len do\n          local t = this[i]\n          if equals(comparer, t.Key, key) then\n            local comparer = EqualityComparer(this.__genericTValue__).getDefault()\n            if comparer:EqualsOf(t.Value, pair.Value) then\n              return true\n            end \n          end\n        end\n      end\n      return false\n    end,\n    CopyTo = function (this, array, index)\n      local count = #this\n      checkIndexAndCount(array, index, count)\n      if count > 0 then\n        local KeyValuePair = this.__genericT__\n        index = index + 1\n        for i = 1, count do\n          local t = this[i]\n          array[index] = setmetatable({ Key = t.Key:__clone__(), Value = t.Value }, KeyValuePair)\n          index = index + 1\n        end\n      end\n    end,\n    RemoveKey = remove,\n    Remove = function (this, key)\n      if isKeyValuePair(key) then\n        local len = #this\n        local k, v = key.Key, key.Value\n        for i = 1, #this do\n          local pair = this[i]\n          if pair.Key:EqualsObj(k) then\n            local comparer = EqualityComparer(this.__genericTValue__).getDefault()\n            if comparer:EqualsOf(pair.Value, v) then\n              tremove(this, i)\n              return true\n            end\n          end\n        end\n      end\n      return false\n    end,\n    TryGetValue = function (this, key)\n      if key == nil then throw(ArgumentNullException(\"key\")) end\n      local len = #this\n      if len > 0 then\n        local comparer = this.comparer\n        local equals = comparer.EqualsOf\n        for i = 1, len do\n          local pair = this[i]\n          if equals(comparer, pair.Key, key) then\n            return true, pair.Value\n          end\n        end\n      end\n      return false, this.__genericTValue__:default()\n    end,\n    getComparer = function (this)\n      return this.comparer\n    end,\n    getCount = lengthFn,\n    get = function (this, key)\n      if key == nil then throw(ArgumentNullException(\"key\")) end\n      local len = #this\n      if len > 0 then\n        local comparer = this.comparer\n        local equals = comparer.EqualsOf\n        for i = 1, len do\n          local pair = this[i]\n          if equals(comparer, pair.Key, key) then\n            return pair.Value\n          end\n        end\n      end\n      throw(KeyNotFoundException())\n    end,\n    set = function (this, key, value)\n      add(this, key, value, true)\n    end,\n    GetEnumerator = Array.GetEnumerator,\n    getKeys = function (this)\n      return ArrayDictionaryCollection(this.__genericTKey__)(this)\n    end,\n    getValues = function (this)\n      return ArrayDictionaryCollection(this.__genericTValue__)(this, true)\n    end\n  }\nend)()\n\nArrayDictionaryFn = define(\"System.Collections.Generic.ArrayDictionary\", function(TKey, TValue) \n  return { \n    base = { System.IDictionary_2(TKey, TValue), System.IDictionary, System.IReadOnlyDictionary_2(TKey, TValue) },\n    __genericT__ = KeyValuePairFn(TKey, TValue),\n    __genericTKey__ = TKey,\n    __genericTValue__ = TValue,\n  }\nend, ArrayDictionary)\n\nfunction System.dictionaryFromTable(t, TKey, TValue)\n  return setmetatable(t, Dictionary(TKey, TValue))\nend\n\nfunction System.isDictLike(t)\n  return type(t) == \"table\" and t.GetEnumerator == dictionaryEnumerator\nend\n\nlocal DictionaryFn = define(\"System.Collections.Generic.Dictionary\", function(TKey, TValue)\n  local array, len\n  if TKey.class == 'S' and type(TKey:default()) == \"table\" then\n    array = ArrayDictionary\n  else\n    len = getCount\n  end\n  return { \n    base = { System.IDictionary_2(TKey, TValue), System.IDictionary, System.IReadOnlyDictionary_2(TKey, TValue) },\n    __genericT__ = KeyValuePairFn(TKey, TValue),\n    __genericTKey__ = TKey,\n    __genericTValue__ = TValue,\n    __len = len\n  }, array\nend, Dictionary)\n\nSystem.Dictionary = DictionaryFn\n\nlocal Object = System.Object\nSystem.Hashtable = DictionaryFn(Object, Object)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/Dictionary.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 625aaca11aa54a741a84ecf3084a47ad\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/EqualityComparer.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal equalsObj = System.equalsObj\nlocal compareObj = System.compareObj\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentNullException = System.ArgumentNullException\n\nlocal type = type\n\nlocal EqualityComparer\nEqualityComparer = define(\"System.EqualityComparer\", function (T)\n  local equals\n  local Equals = T.Equals\n  if Equals then\n    if T.class == 'S' then\n      equals = Equals \n    else\n      equals = function (x, y) \n        return x:Equals(y) \n      end \n    end\n  else\n    equals = equalsObj\n  end\n  local function getHashCode(x)\n    if type(x) == \"table\" then\n      return x:GetHashCode()\n    end\n    return x\n  end\n  local defaultComparer\n  return {\n    __genericT__ = T,\n    base = { System.IEqualityComparer_1(T), System.IEqualityComparer }, \n    getDefault = function ()\n      local comparer = defaultComparer \n      if comparer == nil then\n        comparer = EqualityComparer(T)()\n        defaultComparer = comparer\n      end\n      return comparer\n    end,\n    EqualsOf = function (this, x, y)\n      if x ~= nil then\n        if y ~= nil then return equals(x, y) end\n        return false\n      end                 \n      if y ~= nil then return false end\n      return true\n    end,\n    GetHashCodeOf = function (this, obj)\n      if obj == nil then return 0 end\n      return getHashCode(obj)\n    end,\n    GetHashCodeObjOf = function (this, obj)\n      if obj == nil then return 0 end\n      if System.is(obj, T) then return getHashCode(obj) end\n      throw(ArgumentException(\"Type of argument is not compatible with the generic comparer.\"))\n      return false\n    end,\n    EqualsObjOf = function (this, x, y)\n      if x == y then return true end\n      if x == nil or y == nil then return false end\n      local is = System.is\n      if is(x, T) and is(y, T) then return equals(x, y) end\n      throw(ArgumentException(\"Type of argument is not compatible with the generic comparer.\"))\n      return false\n    end\n  }\nend)\n\nlocal function compare(this, a, b)\n  return compareObj(a, b)\nend\n\ndefine(\"System.Comparer\", (function ()\n  local Comparer\n  Comparer = {\n    base = { System.IComparer },\n    static = function (this)\n      local default = Comparer()\n      this.Default = default\n      this.DefaultInvariant = default\n    end,\n    Compare = compare\n  }\n  return Comparer\nend)())\n\nlocal Comparer, ComparisonComparer\n\nComparisonComparer = define(\"System.ComparisonComparer\", function (T)\n  return {\n    base = { Comparer(T) },\n    __ctor__ = function (this, comparison)\n      this.comparison = comparison\n    end,\n    Compare = function (this, x, y)\n      return this.comparison(x, y)\n    end\n  }\nend)\n\nComparer = define(\"System.Comparer_1\", function (T)\n  local Compare\n  local compareTo = T.CompareTo\n  if compareTo then\n    if T.class ~= 'S' then\n      compareTo = function (x, y)\n        return x:CompareTo(y)\n      end\n    end\n    Compare = function (this, x, y)\n      if x ~= nil then\n        if y ~= nil then \n          return compareTo(x, y) \n        end\n        return 1\n      end                 \n      if y ~= nil then return -1 end\n      return 0\n    end\n  else\n    Compare = compare\n  end\n\n  local defaultComparer\n  local function getDefault()\n    local comparer = defaultComparer \n    if comparer == nil then\n      comparer = Comparer(T)()\n      defaultComparer = comparer\n    end\n    return comparer\n  end\n\n  local function Create(comparison)\n    if comparison == nil then throw(ArgumentNullException(\"comparison\")) end\n    return ComparisonComparer(T)(comparison)\n  end\n\n  return {\n    __genericT__ = T,\n    base = { System.IComparer_1(T), System.IComparer }, \n    getDefault = getDefault,\n    getDefaultInvariant = getDefault,\n    Compare = Compare,\n    Create = Create\n  }\nend)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/EqualityComparer.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 19a630f833902d243b0634c66042bfb3\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/HashSet.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal each = System.each\nlocal Dictionary = System.Dictionary\nlocal wrap = System.wrap\nlocal unWrap = System.unWrap\nlocal getEnumerator = Dictionary.GetEnumerator \nlocal ArgumentNullException = System.ArgumentNullException\n\nlocal assert = assert\nlocal pairs = pairs\nlocal select = select\n\nlocal counts = System.counts\n\nlocal function build(this, collection, comparer)\n  if comparer ~= nil then\n    assert(false)\n  end\n  if collection == nil then\n    throw(ArgumentNullException(\"collection\"))\n  end\n  this:UnionWith(collection)\nend\n\nlocal function checkUniqueAndUnfoundElements(this, other, returnIfUnfound)\n  if #this == 0 then\n    local numElementsInOther = 0\n    for _, item in each(other) do\n      numElementsInOther = numElementsInOther + 1\n      break\n    end\n    return 0, numElementsInOther\n  end\n  local set, uniqueCount, unfoundCount = {}, 0, 0\n  for _, item in each(other) do\n    item = wrap(item)\n      if this[item] ~= nil then\n        if set[item] == nil then\n          set[item] = true\n          uniqueCount = uniqueCount + 1\n        end\n      else\n      unfoundCount = unfoundCount + 1\n      if returnIfUnfound then\n        break\n      end\n    end\n  end\n  return uniqueCount, unfoundCount\nend\n\nlocal HashSet = {\n  __ctor__ = function (this, ...)\n    local len = select(\"#\", ...)\n    if len == 0 then\n    elseif len == 1 then\n      local collection = ...\n      if collection == nil then return end\n      if collection.getEnumerator ~= nil then\n        build(this, collection, nil)\n      else\n        assert(true)\n      end\n    else \n      build(this, ...)\n    end\n  end,\n  Clear = Dictionary.Clear,\n  getCount = Dictionary.getCount,\n  getIsReadOnly = System.falseFn,\n  Contains = function (this, item)\n    item = wrap(item)\n    return this[item] ~= nil\n  end,\n  Remove = function (this, item)\n    item = wrap(item)\n    if this[item] then\n      this[item] = nil\n      local t = counts[this]\n      t[1] = t[1] - 1\n      t[2] = t[2] + 1\n      return true\n    end\n    return false\n  end,\n  GetEnumerator = function (this)\n    return getEnumerator(this, 1)\n  end,\n  Add = function (this, v)\n    v = wrap(v)\n    if this[v] == nil then\n      this[v] = true\n      local t = counts[this]\n      if t then\n        t[1] = t[1] + 1\n        t[2] = t[2] + 1\n      else\n        counts[this] = { 1, 1 }\n      end\n      return true\n    end\n    return false\n  end,\n  UnionWith = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    local count = 0\n    for _, v in each(collection) do\n      v = wrap(v)\n      if this[v] == nil then\n        this[v] = true\n        count = count + 1\n      end\n    end\n    if count > 0 then\n      local t = counts[this]\n      if t then\n        t[1] = t[1] + count\n        t[2] = t[2] + 1\n      else\n        counts[this] = { count, 1 }  \n      end\n    end\n  end,\n  IntersectWith = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    local set = {}\n    for _, v in each(other) do\n      v = wrap(v)\n      if this[v] ~= nil then\n        set[v] = true\n      end\n    end\n    local count = 0\n    for v, _ in pairs(this) do\n      if set[v] == nil then\n        this[v] = nil\n        count = count + 1\n      end\n    end\n    if count > 0 then\n      local t = counts[this]\n      t[1] = t[1] - count\n      t[2] = t[2] + 1\n    end\n  end,\n  ExceptWith = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    if other == this then\n      this:Clear()\n      return\n    end\n    local count = 0\n    for _, v in each(other) do\n      v = wrap(v)\n      if this[v] ~= nil then\n        this[v] = nil\n        count = count + 1\n      end\n    end\n    if count > 0 then\n      local t = counts[this]\n      t[1] = t[1] - count\n      t[2] = t[2] + 1\n    end\n  end,\n  SymmetricExceptWith = function (this, other)\n    if other == nil then throw(ArgumentNullException(\"other\")) end\n    if other == this then\n      this:Clear()\n      return\n    end\n    local set = {}\n    local count = 0\n    local changed = false\n    for _, v in each(other) do\n      v = wrap(v)\n      if this[v] == nil then\n        this[v] = true\n        count = count + 1\n        changed = true\n        set[v] = true\n      elseif set[v] == nil then \n        this[v] = nil\n        count = count - 1\n        changed = true\n      end\n    end\n    if changed then\n      local t = counts[this]\n      if t then\n        t[1] = t[1] + count\n        t[2] = t[2] + 1\n      else\n        counts[this] = { count, 1 }\n      end\n    end\n  end,\n  IsSubsetOf = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    local count = #this\n    if count == 0 then\n      return true\n    end\n    local uniqueCount, unfoundCount = checkUniqueAndUnfoundElements(this, other, false)\n    return uniqueCount == count and unfoundCount >= 0\n  end,\n  IsProperSubsetOf = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    local uniqueCount, unfoundCount = checkUniqueAndUnfoundElements(this, other, false)\n    return uniqueCount == #this and unfoundCount > 0\n  end,\n  IsSupersetOf = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    for _, element in each(other) do\n      element = wrap(element)\n      if this[element] == nil then\n        return false\n      end\n    end\n    return true\n  end,\n  IsProperSupersetOf = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    local count = #this\n    if count == 0 then\n      return false\n    end\n    local uniqueCount, unfoundCount = checkUniqueAndUnfoundElements(this, other, true)\n    return uniqueCount < count and unfoundCount == 0\n  end,\n  Overlaps = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    if #this == 0 then\n      return false\n    end\n    for _, element in each(other) do\n      element = wrap(element)\n      if this[element] ~= nil then\n        return true\n      end\n    end\n    return false\n  end,\n  SetEquals = function (this, other)\n    if other == nil then\n      throw(ArgumentNullException(\"other\"))\n    end\n    local uniqueCount, unfoundCount = checkUniqueAndUnfoundElements(this, other, true)\n    return uniqueCount == #this and unfoundCount == 0\n  end,\n  RemoveWhere = function (this, match)\n    if match == nil then\n      throw(ArgumentNullException(\"match\"))\n    end\n    local numRemoved = 0\n    for v, _ in pairs(this) do\n      if match(unWrap(v)) then\n        this[v] = nil\n        numRemoved = numRemoved + 1\n      end\n    end\n    if numRemoved > 0 then\n      local t = counts[this]\n      t[1] = t[1] - numRemoved\n      t[2] = t[2] + 1\n    end\n    return numRemoved\n  end,\n  TrimExcess = System.emptyFn\n}\n\nfunction System.hashSetFromTable(t, T)\n  return setmetatable(t, HashSet(T))\nend\n\nSystem.HashSet = System.define(\"System.Collections.Generic.HashSet\", function(T) \n  return { \n    base = { System.ICollection_1(T), System.ISet_1(T) }, \n    __genericT__ = T,\n    __genericTKey__ = T,\n    __len = HashSet.getCount\n  }\nend, HashSet)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/HashSet.lua.meta",
    "content": "fileFormatVersion: 2\nguid: f3fa2f69bd6bf7e498359d7ab15251af\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/LinkedList.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal each = System.each\nlocal checkIndexAndCount = System.checkIndexAndCount\nlocal ArgumentNullException = System.ArgumentNullException\nlocal InvalidOperationException = System.InvalidOperationException\nlocal EqualityComparer = System.EqualityComparer\n\nlocal setmetatable = setmetatable\nlocal select = select\n\nlocal LinkedListNode = define(\"System.Collections.Generic.LinkedListNode\", {\n  __ctor__ = function (this, value)\n    this.Value = value\n  end,\n  getNext = function (this)\n    local next = this.next\n    if next == nil or next == this.List.head then\n      return nil\n    end\n    return next\n  end,\n  getPrevious = function (this)\n    local prev = this.prev\n    if prev == nil or this == this.List.head then\n      return nil\n    end\n    return prev\n  end\n})\nSystem.LinkedListNode = LinkedListNode\n\nlocal function newLinkedListNode(list, value)\n  return setmetatable({ List = assert(list), Value = value }, LinkedListNode)\nend\n\nlocal function vaildateNewNode(this, node)\n  if node == nil then\n    throw(ArgumentNullException(\"node\"))\n  end\n  if node.List ~= nil then\n    throw(InvalidOperationException(\"ExternalLinkedListNode\"))\n  end\nend\n\nlocal function vaildateNode(this, node)\n  if node == nil then\n    throw(ArgumentNullException(\"node\"))\n  end\n  if node.List ~= this then\n    throw(InvalidOperationException(\"ExternalLinkedListNode\"))\n  end\nend\n\nlocal function insertNodeBefore(this, node, newNode)\n  newNode.next = node\n  newNode.prev = node.prev\n  node.prev.next = newNode\n  node.prev = newNode\n  this.Count = this.Count + 1\n  this.version = this.version + 1\nend\n\nlocal function insertNodeToEmptyList(this, newNode)\n  newNode.next = newNode\n  newNode.prev = newNode\n  this.head = newNode\n  this.Count = this.Count + 1\n  this.version = this.version + 1\nend\n\nlocal function invalidate(this)\n  this.List = nil\n  this.next = nil\n  this.prev = nil\nend\n\nlocal function remvoeNode(this, node)\n  if node.next == node then\n    this.head = nil\n  else\n    node.next.prev = node.prev\n    node.prev.next = node.next\n    if this.head == node then\n      this.head = node.next\n    end\n  end\n  invalidate(node)\n  this.Count = this.Count - 1\n  this.version = this.version + 1\nend\n\nlocal LinkedListEnumerator = { \n  __index = false,\n  getCurrent = System.getCurrent, \n  Dispose = System.emptyFn,\n  MoveNext = function (this)\n    local list = this.list\n    local node = this.node\n    if this.version ~= list.version then\n      System.throwFailedVersion()\n    end\n    if node == nil then\n      return false\n    end\n    this.current = node.Value\n    node = node.next\n    if node == list.head then\n      node = nil\n    end\n    this.node = node\n    return true\n  end\n}\nLinkedListEnumerator.__index = LinkedListEnumerator\n\nlocal LinkedList = { \n  Count = 0, \n  version = 0,\n  __ctor__ = function (this, ...)\n    local len = select(\"#\", ...)\n    if len == 1 then\n      local collection = ...\n      if collection == nil then\n        throw(ArgumentNullException(\"collection\"))\n      end\n      for _, item in each(collection) do\n        this:AddLast(item)\n      end\n    end\n  end,\n  getCount = function (this)\n    return this.Count\n  end,\n  getFirst = function(this)    \n    return this.head\n  end,\n  getLast = function (this)\n    local head = this.head\n    return head ~= nil and head.prev or nil\n  end,\n  AddAfterNode = function (this, node, newNode)\n    vaildateNode(this, node)\n    vaildateNewNode(this, newNode)\n    insertNodeBefore(this, node.next, newNode)\n    newNode.List = this\n  end,\n  AddAfter = function (this, node, value)    \n    vaildateNode(this, node)\n    local result = newLinkedListNode(node.List, value)\n    insertNodeBefore(this, node.next, result)\n    return result\n  end,\n  AddBeforeNode = function (this, node, newNode)\n    vaildateNode(this, node)\n    vaildateNewNode(this, newNode)\n    insertNodeBefore(this, node, newNode)\n    newNode.List = this\n    if node == this.head then\n      this.head = newNode\n    end\n  end,\n  AddBefore = function (this, node, value)\n    vaildateNode(this, node)\n    local result = newLinkedListNode(node.List, value)\n    insertNodeBefore(this, node, result)\n    if node == this.head then\n      this.head = result\n    end\n    return result\n  end,\n  AddFirstNode = function (this, node)\n\t  vaildateNewNode(this, node)\n    if this.head == nil then\n      insertNodeToEmptyList(this, node)\n    else\n      insertNodeBefore(this, this.head, node)\n      this.head = node\n    end\n    node.List = this\n  end,\n  AddFirst = function (this, value)\n    local result = newLinkedListNode(this, value)\n    if this.head == nil then\n      insertNodeToEmptyList(this, result)\n    else\n      insertNodeBefore(this, this.head, result)\n      this.head = result\n    end\n    return result\n  end,\n  AddLastNode = function (this, node)\n    vaildateNewNode(this, node)\n    if this.head == nil then\n      insertNodeToEmptyList(this, node)\n    else\n      insertNodeBefore(this, this.head, node)\n    end\n    node.List = this\n  end,\n  AddLast = function (this, value)\n    local result = newLinkedListNode(this, value)\n    if this.head == nil then\n      insertNodeToEmptyList(this, result)\n    else\n      insertNodeBefore(this, this.head, result)\n    end\n    return result\n  end,\n  Clear = function (this)\n    local current = this.head\n    while current ~= nil do\n      local temp = current\n      current = current.next\n      invalidate(temp)\n    end\n    this.head = nil\n    this.Count = 0\n    this.version = this.version + 1\n  end,\n  Contains = function (this, value)\n    return this:Find(value) ~= nil\n  end,\n  CopyTo = function (this, array, index)\n    checkIndexAndCount(array, index, this.Count)\n    local head = this.head\n    local node = head\n    if node then\n      index = index + 1\n      repeat\n        local value = node.Value\n        if value == nil then value = System.null end\n        array[index] = value\n        index = index + 1\n        node = node.next\n      until node == head\n    end\n  end,\n  Find = function (this, value)     \n    local head = this.head\n    local node = head\n    local comparer = EqualityComparer(this.__genericT__).getDefault()\n    local equals = comparer.EqualsOf\n    if node ~= nil then\n      if value ~= nil then\n        repeat\n          if equals(comparer, node.Value, value) then\n            return node\n          end\n          node = node.next\n        until node == head\n      else\n        repeat \n          if node.Value == nil then\n            return node\n          end\n          node = node.next\n        until node == head\n      end\n    end\n    return nil\n  end,\n  FindLast = function (this, value)\n    local head = this.head\n    if head == nil then return nil end\n    local last = head.prev\n    local node = last\n    local comparer = EqualityComparer(this.__genericT__).getDefault()\n    local equals = comparer.EqualsOf\n    if node ~= nil then\n      if value ~= nil then\n        repeat\n          if equals(comparer, node.Value, value) then\n            return node\n          end\n          node = node.prev\n        until node == last\n      else\n        repeat \n          if node.Value == nil then\n            return node\n          end\n          node = node.prev\n         until node == last\n      end\n    end\n    return nil\n  end,\n  RemoveNode = function (this, node)\n    vaildateNode(this, node)\n    remvoeNode(this, node)\n  end,\n  Remove = function (this, node)\n    node = this:Find(node)\n    if node ~= nil then\n      remvoeNode(this, node)\n    end\n    return false\n  end,\n  RemoveFirst = function (this)\n    local head = this.head\n    if head == nil then\n      throw(InvalidOperationException(\"LinkedListEmpty\"))\n    end\n    remvoeNode(this, head)\n  end,\n  RemoveLast = function (this)\n    local head = this.head\n    if head == nil then\n      throw(InvalidOperationException(\"LinkedListEmpty\"))\n    end\n    remvoeNode(this, head.prev)\n  end,\n  GetEnumerator = function (this)\n    return setmetatable({ list = this, version = this.version, node = this.head }, LinkedListEnumerator)\n  end\n}\n\nfunction System.linkedListFromTable(t, T)\n  return setmetatable(t, LinkedList(T))\nend\n\nSystem.LinkedList = define(\"System.Collections.Generic.LinkedList\", function(T) \n  return { \n  base = { System.ICollection_1(T), System.ICollection }, \n  __genericT__ = T,\n  __len = LinkedList.getCount\n  }\nend, LinkedList)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/LinkedList.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 75ca5de6d7b98f747a64607ed526171e\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/Linq.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal each = System.each\nlocal identityFn = System.identityFn\nlocal wrap = System.wrap\nlocal unWrap = System.unWrap\nlocal is = System.is\nlocal cast = System.cast\nlocal Int32 = System.Int32\nlocal isArrayLike = System.isArrayLike\nlocal isDictLike = System.isDictLike\nlocal Array = System.Array\nlocal arrayEnumerator = Array.GetEnumerator\n\nlocal NullReferenceException = System.NullReferenceException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal InvalidOperationException = System.InvalidOperationException\nlocal EqualityComparer = System.EqualityComparer\nlocal Comparer_1 = System.Comparer_1\nlocal Empty = System.Array.Empty\n\nlocal IEnumerable_1 = System.IEnumerable_1\nlocal IEnumerable = System.IEnumerable\nlocal IEnumerator_1 = System.IEnumerator_1\nlocal IEnumerator = System.IEnumerator\n\nlocal assert = assert\nlocal getmetatable = getmetatable\nlocal setmetatable = setmetatable\nlocal select = select\nlocal pairs = pairs\nlocal tsort = table.sort\n\nlocal InternalEnumerable = define(\"System.Linq.InternalEnumerable\", function(T) \n  return {\n    base = { IEnumerable_1(T) }\n  }\nend)\n\nlocal function createEnumerable(T, GetEnumerator)\n  assert(T)\n  return setmetatable({ __genericT__ = T, GetEnumerator = GetEnumerator }, InternalEnumerable(T))\nend\n\nlocal InternalEnumerator = define(\"System.Linq.InternalEnumerator\", function(T) \n  return {\n    base = { IEnumerator_1(T) }\n  }\nend)\n\nlocal function createEnumerator(T, source, tryGetNext, init)\n  assert(T)\n  local state = 1\n  local current\n  local en\n  return setmetatable({\n    MoveNext = function()\n      if state == 1 then\n        state = 2\n        if source then\n          en = source:GetEnumerator() \n        end\n        if init then\n          init(en) \n        end\n      end\n      if state == 2 then\n        local ok, v = tryGetNext(en)\n        if ok then\n          current = v\n          return true\n        elseif en then\n          local dispose = en.Dispose\n          if dispose then\n            dispose(en)\n          end    \n        end\n       end\n       return false\n    end,\n    getCurrent = function()\n      return current\n    end\n  }, InternalEnumerator(T))\nend\n\nlocal Enumerable = {}\ndefine(\"System.Linq.Enumerable\", Enumerable)\n\nfunction Enumerable.Where(source, predicate)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n  local T = source.__genericT__\n  return createEnumerable(T, function() \n    local index = -1\n    return createEnumerator(T, source, function(en)\n      while en:MoveNext() do\n        local current = en:getCurrent()\n        index = index + 1\n        if predicate(current, index) then\n          return true, current\n        end\n      end \n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.Select(source, selector, T)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if selector == nil then throw(ArgumentNullException(\"selector\")) end\n  return createEnumerable(T, function()\n    local index = -1\n    return createEnumerator(T, source, function(en) \n      if en:MoveNext() then\n        index = index + 1\n        return true, selector(en:getCurrent(), index)\n      end\n      return false\n    end)\n  end)\nend\n\nlocal function selectMany(source, collectionSelector, resultSelector, T)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if collectionSelector == nil then throw(ArgumentNullException(\"collectionSelector\")) end\n  if resultSelector == nil then throw(ArgumentNullException(\"resultSelector\")) end\n  return createEnumerable(T, function() \n    local element, midEn\n    local index = -1\n    return createEnumerator(T, source, function(en) \n      while true do\n        if midEn and midEn:MoveNext() then\n          return true, resultSelector(element, midEn:getCurrent())\n        else\n          if not en:MoveNext() then return false end\n          index = index + 1\n          local current = en:getCurrent()\n          midEn = collectionSelector(current, index):GetEnumerator()\n          if midEn == nil then\n            throw(NullReferenceException())\n          end\n          element = current\n        end  \n      end\n    end)\n  end)\nend\n\nlocal function identityFnOfSelectMany(s, x)\n  return x\nend\n\nfunction Enumerable.SelectMany(source, ...)\n  local len = select(\"#\", ...)\n  if len == 2 then\n    local collectionSelector, T = ...\n    return selectMany(source, collectionSelector, identityFnOfSelectMany, T)\n  else\n    return selectMany(source, ...)\n  end\nend\n\nfunction Enumerable.Take(source, count)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local T = source.__genericT__\n  return createEnumerable(T, function()\n    return createEnumerator(T, source, function(en)\n      if count > 0 then\n        if en:MoveNext() then\n          count = count - 1\n          return true, en:getCurrent()\n        end\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.TakeWhile(source, predicate)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n  local T = source.__genericT__\n  return createEnumerable(T, function()\n    local index = -1\n    return createEnumerator(T, source, function(en)\n      if en:MoveNext() then\n        local current = en:getCurrent()\n        index = index + 1\n        if not predicate(current, index) then\n          return false\n        end\n        return true, current\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.Skip(source, count)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local T = source.__genericT__\n  return createEnumerable(T, function()\n    return createEnumerator(T, source, function(en)\n      while count > 0 and en:MoveNext() do count = count - 1 end\n      if count <= 0 then\n        if en:MoveNext() then\n          return true, en:getCurrent() \n        end\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.SkipWhile(source, predicate)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n  local T = source.__genericT__\n  return createEnumerable(T, function()\n    local index = -1\n    local isSkipEnd = false\n    return createEnumerator(T, source, function(en)\n      while not isSkipEnd do\n        if en:MoveNext() then\n          local current = en:getCurrent()\n          index = index + 1\n          if not predicate(current, index) then\n            isSkipEnd = true\n            return true, current\n          end     \n        else \n          return false\n        end\n      end\n      if en:MoveNext() then\n        return true, en:getCurrent()\n      end\n      return false\n    end)\n  end)\nend\n\nlocal IGrouping = System.defInf(\"System.Linq.IGrouping_2\", function (TKey, TElement)\n  return {\n    base = { IEnumerable_1(TElement) } \n  }\nend)\n\nlocal Grouping = define(\"System.Linq.Grouping\", function (TKey, TElement)\n  return {\n    __genericT__ = TElement,\n    base = { IGrouping(TKey, TElement) },\n    GetEnumerator = arrayEnumerator,\n    getKey = function (this)\n      return this.key\n    end,\n    getCount = function (this)\n      return #this\n    end\n  }\nend)\n\nlocal function getGrouping(this, key)\n  local hashCode = this.comparer:GetHashCodeOf(key)\n  local groupIndex = this.indexs[hashCode]\n  return this.groups[groupIndex]\nend\n\nlocal Lookup = {\n  __ctor__ = function (this, comparer)\n    this.comparer = comparer or EqualityComparer(this.__genericTKey__).getDefault()\n    this.groups = {}\n    this.indexs = {}\n  end,\n  get = function (this, key)\n    local grouping = getGrouping(this, key)\n    if grouping ~= nil then return grouping end \n    return Empty(this.__genericTElement__)\n  end,\n  GetCount = function (this)\n    return #this.groups\n  end,\n  Contains = function (this, key)\n    return getGrouping(this, key) ~= nil\n  end,\n  GetEnumerator = function (this)\n    return arrayEnumerator(this.groups, IGrouping)\n  end\n}\n\nlocal LookupFn = define(\"System.Linq.Lookup\", function(TKey, TElement)\n  local cls = {\n    __genericTKey__ = TKey,\n    __genericTElement__ = TElement,\n  }\n  return cls\nend, Lookup)\n\nlocal function addToLookup(this, key, value)\n  local hashCode = this.comparer:GetHashCodeOf(key)\n  local groupIndex = this.indexs[hashCode]\n  local group\n  if groupIndex == nil then\n\t  groupIndex = #this.groups + 1\n\t  this.indexs[hashCode] = groupIndex\n\t  group = setmetatable({ key = key }, Grouping(this.__genericTKey__, this.__genericTElement__))\n\t  this.groups[groupIndex] = group\n  else\n\t  group = this.groups[groupIndex]\n\t  assert(group)\n  end\n  group[#group + 1] = wrap(value)\nend\n\nlocal function createLookup(source, keySelector, elementSelector, comparer, TKey, TElement)\n  local lookup = LookupFn(TKey, TElement)(comparer)\n  for _, item in each(source) do\n    addToLookup(lookup, keySelector(item), elementSelector(item))\n  end\n  return lookup\nend\n\nlocal function createLookupForJoin(source, keySelector, comparer, TKey, TElement)\n  local lookup = LookupFn(TKey, TElement)(comparer)\n  for _, item in each(source) do\n    local key = keySelector(item)\n    if key ~= nil then\n      addToLookup(lookup, key, item)\n    end\n  end\n  return lookup\nend\n\nfunction Enumerable.Join(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, TKey, TResult)\n  if outer == nil then throw(ArgumentNullException(\"outer\")) end\n  if inner == nil then throw(ArgumentNullException(\"inner\")) end\n  if outerKeySelector == nil then throw(ArgumentNullException(\"outerKeySelector\")) end\n  if innerKeySelector == nil then throw(ArgumentNullException(\"innerKeySelector\")) end\n  if resultSelector == nil then throw(ArgumentNullException(\"resultSelector\")) end\n  local lookup = createLookupForJoin(inner, innerKeySelector, comparer, TKey, inner.__genericT__)\n  return createEnumerable(TResult, function ()\n    local item, grouping, index\n    return createEnumerator(TResult, outer, function (en)\n      while true do\n        if grouping ~= nil then\n          index = index + 1\n          if index < #grouping then\n            return true, resultSelector(item, unWrap(grouping[index + 1]))\n          end\n        end\n        if not en:MoveNext() then return false end\n        local current = en:getCurrent()\n        item = current\n        grouping = getGrouping(lookup, outerKeySelector(current))\n        index = -1\n      end\n    end)\n  end)\nend\n\nfunction Enumerable.GroupJoin(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, TKey, TResult)\n  if outer == nil then throw(ArgumentNullException(\"outer\")) end\n  if inner == nil then throw(ArgumentNullException(\"inner\")) end\n  if outerKeySelector == nil then throw(ArgumentNullException(\"outerKeySelector\")) end\n  if innerKeySelector == nil then throw(ArgumentNullException(\"innerKeySelector\")) end\n  if resultSelector == nil then throw(ArgumentNullException(\"resultSelector\")) end\n  local lookup = createLookupForJoin(inner, innerKeySelector, comparer, TKey, inner.__genericT__)\n  return createEnumerable(TResult, function ()\n    return createEnumerator(TResult, outer, function (en)\n      if en:MoveNext() then\n        local item = en:getCurrent()\n        return true, resultSelector(item, lookup:get(outerKeySelector(item)))\n      end\n      return false\n    end)\n  end)\nend\n\nlocal function ordered(source, compare)\n  local T = source.__genericT__\n  local orderedEnumerable = createEnumerable(T, function()\n    local t = {}\n    local index = 0\n    return createEnumerator(T, source, function() \n      index = index + 1\n      local v = t[index]\n      if v ~= nil then\n        return true, unWrap(v)\n      end\n      return false\n    end, \n    function() \n      local count = 1\n      if isDictLike(source) then\n        for k, v in pairs(source) do\n          t[count] = setmetatable({ Key = k, Value = v }, T)\n          count = count + 1\n        end\n      else\n        for _, v in each(source) do\n          t[count] = wrap(v)\n          count = count + 1\n        end\n      end\n      if count > 1 then\n        tsort(t, function(x, y)\n          return compare(unWrap(x), unWrap(y)) < 0 \n        end)\n      end\n    end)\n  end)\n  orderedEnumerable.source = source\n  orderedEnumerable.compare = compare\n  return orderedEnumerable\nend\n\nlocal function orderBy(source, keySelector, comparer, TKey, descending)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if keySelector == nil then throw(ArgumentNullException(\"keySelector\")) end\n  if comparer == nil then comparer = Comparer_1(TKey).getDefault() end \n  local keys = {}\n  local function getKey(t) \n    local k = keys[t]\n    if k == nil then\n      k = keySelector(t)\n      keys[t] = k\n    end\n    return k\n  end\n  local c = comparer.Compare\n  local compare\n  if descending then\n    compare = function(x, y)\n      return -c(comparer, getKey(x), getKey(y))\n    end\n  else\n    compare = function(x, y)\n      return c(comparer, getKey(x), getKey(y))\n    end\n  end\n  return ordered(source, compare)\nend\n\nfunction Enumerable.OrderBy(source, keySelector, comparer, TKey)\n  return orderBy(source, keySelector, comparer, TKey, false)\nend\n\nfunction Enumerable.OrderByDescending(source, keySelector, comparer, TKey)\n  return orderBy(source, keySelector, comparer, TKey, true)\nend\n\nlocal function thenBy(source, keySelector, comparer, TKey, descending)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if keySelector == nil then throw(ArgumentNullException(\"keySelector\")) end\n  if comparer == nil then comparer = Comparer_1(TKey).getDefault() end\n  local keys = {}\n  local function getKey(t) \n    local k = keys[t]\n    if k == nil then\n      k = keySelector(t)\n      keys[t] = k\n    end\n    return k\n  end\n  local c = comparer.Compare\n  local compare\n  local parentSource, parentCompare = source.source, source.compare\n  if descending then\n    compare = function(x, y)\n      local v = parentCompare(x, y)\n      if v ~= 0 then\n        return v\n      else\n        return -c(comparer, getKey(x), getKey(y))\n      end\n    end\n  else\n    compare = function(x, y)\n      local v = parentCompare(x, y)\n      if v ~= 0 then\n        return v\n      else\n        return c(comparer, getKey(x), getKey(y))\n      end\n    end\n  end\n  return ordered(parentSource, compare)\nend\n\nfunction Enumerable.ThenBy(source, keySelector, comparer, TKey)\n  return thenBy(source, keySelector, comparer, TKey, false)\nend\n\nfunction Enumerable.ThenByDescending(source, keySelector, comparer, TKey)\n  return thenBy(source, keySelector, comparer, TKey, true)\nend\n\nlocal function groupBy(source, keySelector, elementSelector, comparer, TKey, TElement)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if keySelector == nil then throw(ArgumentNullException(\"keySelector\")) end\n  if elementSelector == nil then throw(ArgumentNullException(\"elementSelector\")) end\n  return createEnumerable(IGrouping, function()\n    return createLookup(source, keySelector, elementSelector, comparer, TKey, TElement):GetEnumerator()\n  end)\nend\n\nfunction Enumerable.GroupBy(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...)\n  if len == 2 then\n    local keySelector, TKey = ...\n    return groupBy(source, keySelector, identityFn, nil, TKey, source.__genericT__)\n  elseif len == 3 then\n    local keySelector, comparer, TKey = ...\n    return groupBy(source, keySelector, identityFn, comparer, TKey, source.__genericT__)\n  elseif len == 4 then\n    local keySelector, elementSelector, TKey, TElement = ...\n    return groupBy(source, keySelector, elementSelector, nil, TKey, TElement)\n  else\n    return groupBy(source, ...)\n  end\nend\n\nlocal function groupBySelect(source, keySelector, elementSelector, resultSelector, comparer, TKey, TElement, TResult)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if keySelector == nil then throw(ArgumentNullException(\"keySelector\")) end\n  if elementSelector == nil then throw(ArgumentNullException(\"elementSelector\")) end\n  if resultSelector == nil then throw(ArgumentNullException(\"resultSelector\")) end\n  return createEnumerable(TResult, function()\n    local lookup = createLookup(source, keySelector, elementSelector, comparer, TKey, TElement)\n    return createEnumerator(TResult, lookup, function(en)\n      if en:MoveNext() then\n        local current = en:getCurrent()\n        return resultSelector(current.key, current)\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.GroupBySelect(source, ...)\n  local len = select(\"#\", ...)\n  if len == 4 then\n    local keySelector, resultSelector, TKey, TResult = ...\n    return groupBySelect(source, keySelector, identityFn, resultSelector, nil, TKey, source.__genericT__, TResult)\n  elseif len == 5 then\n    local keySelector, resultSelector, comparer, TKey, TResult = ...\n    return groupBySelect(source, keySelector, identityFn, resultSelector, comparer, TKey, source.__genericT__, TResult)\n  elseif len == 6 then\n    local keySelector, elementSelector, resultSelector, TKey, TElement, TResult = ...\n    return groupBySelect(source, keySelector, elementSelector, resultSelector, nil, TKey, TElement, TResult)\n  else\n    return groupBySelect(source, ...)\n  end\nend\n\nfunction Enumerable.Concat(first, second)\n  if first == nil then throw(ArgumentNullException(\"first\")) end\n  if second == nil then throw(ArgumentNullException(\"second\")) end\n  local T = first.__genericT__\n  return createEnumerable(T, function()\n    local secondEn\n    return createEnumerator(T, first, function(en)\n      if secondEn == nil then\n        if en:MoveNext() then\n          return true, en:getCurrent()\n        end\n        secondEn = second:GetEnumerator()\n      end\n      if secondEn:MoveNext() then\n        return true, secondEn:getCurrent()\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.Zip(first, second, resultSelector, TResult) \n  if first == nil then throw(ArgumentNullException(\"first\")) end\n  if second == nil then throw(ArgumentNullException(\"second\")) end\n  if resultSelector == nil then throw(ArgumentNullException(\"resultSelector\")) end\n  return createEnumerable(TResult, function()\n    local e2\n    return createEnumerator(TResult, first, function(e1)\n      if e1:MoveNext() and e2:MoveNext() then\n          return true, resultSelector(e1:getCurrent(), e2:getCurrent())\n      end\n    end, \n    function()\n      e2 = second:GetEnumerator()\n    end)\n  end)\nend\n\nlocal function addToSet(set, v, getHashCode, comparer)\n  local hashCode = getHashCode(comparer, v)\n  if set[hashCode] == nil then\n    set[hashCode] = true\n    return true\n  end\n  return false\nend\n\nlocal function removeFromSet(set, v, getHashCode, comparer)\n  local hashCode = getHashCode(comparer, v)\n  if set[hashCode] ~= nil then\n    set[hashCode] = nil\n    return true\n  end\n  return false\nend\n\nlocal function getComparer(source, comparer)\n  return comparer or EqualityComparer(source.__genericT__).getDefault()\nend\n\nfunction Enumerable.Distinct(source, comparer)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local T = source.__genericT__\n  return createEnumerable(T, function()\n    local set = {}\n    comparer = getComparer(source, comparer)\n    local getHashCode = comparer.GetHashCodeOf\n    return createEnumerator(T, source, function(en)\n      while en:MoveNext() do\n        local current = en:getCurrent()\n        if addToSet(set, current, getHashCode, comparer) then\n          return true, current  \n        end\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.Union(first, second, comparer)\n  if first == nil then throw(ArgumentNullException(\"first\")) end\n  if second == nil then throw(ArgumentNullException(\"second\")) end\n  local T = first.__genericT__\n  return createEnumerable(T, function()\n    local set = {}\n    comparer = getComparer(first, comparer)\n    local getHashCode = comparer.GetHashCodeOf\n    local secondEn\n    return createEnumerator(T, first, function(en)\n      if secondEn == nil then\n        while en:MoveNext() do\n          local current = en:getCurrent()\n          if addToSet(set, current, getHashCode, comparer) then\n            return true, current  \n          end\n        end\n        secondEn = second:GetEnumerator()\n      end\n      while secondEn:MoveNext() do\n        local current = secondEn:getCurrent()\n        if addToSet(set, current, getHashCode, comparer) then\n          return true, current  \n        end\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.Intersect(first, second, comparer)\n  if first == nil then throw(ArgumentNullException(\"first\")) end\n  if second == nil then throw(ArgumentNullException(\"second\")) end\n  local T = first.__genericT__\n  return createEnumerable(T, function()\n    local set = {}\n    comparer = getComparer(first, comparer)\n    local getHashCode = comparer.GetHashCodeOf\n    return createEnumerator(T, first, function(en)\n      while en:MoveNext() do\n        local current = en:getCurrent()\n        if removeFromSet(set, current, getHashCode, comparer) then\n          return true, current\n        end\n      end\n      return false\n    end,\n    function()\n      for _, v in each(second) do\n        addToSet(set, v, getHashCode, comparer)\n      end\n    end)\n  end) \nend\n\nfunction Enumerable.Except(first, second, comparer)\n  if first == nil then throw(ArgumentNullException(\"first\")) end\n  if second == nil then throw(ArgumentNullException(\"second\")) end\n  local T = first.__genericT__\n  return createEnumerable(T, function()\n    local set = {}\n    comparer = getComparer(first, comparer)\n    local getHashCode = comparer.GetHashCodeOf\n    return createEnumerator(T, first, function(en) \n      while en:MoveNext() do\n        local current = en:getCurrent()\n        if addToSet(set, current, getHashCode, comparer) then\n          return true, current  \n        end\n      end\n      return false\n    end,\n    function()\n      for _, v in each(second) do\n        addToSet(set, v, getHashCode, comparer)\n      end\n    end)\n  end)\nend\n\nfunction Enumerable.Reverse(source)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local T = source.__genericT__\n  return createEnumerable(T, function()\n    local t = {}    \n    local index\n    return createEnumerator(T, nil, function() \n      if index > 1 then\n        index = index - 1\n        return true, t[index]\n      end\n      return false\n    end,\n    function()\n      local count = 1\n      for _, v in each(source) do\n        t[count] = v\n        count = count + 1\n      end  \n      index = count\n    end)\n  end)\nend\n\nfunction Enumerable.SequenceEqual(first, second, comparer)\n  if first == nil then throw(ArgumentNullException(\"first\")) end\n  if second == nil then throw(ArgumentNullException(\"second\")) end\n  comparer = getComparer(first, comparer)\n  local equals = comparer.EqualsOf\n  local e1 = first:GetEnumerator()\n  local e2 = second:GetEnumerator()\n  while e1:MoveNext() do\n    if not(e2:MoveNext() and equals(comparer, e1:getCurrent(), e2:getCurrent())) then\n      return false\n    end\n  end\n  if e2:MoveNext() then\n    return false\n  end\n  return true\nend\n\nEnumerable.ToArray = Array.toArray\n\nfunction Enumerable.ToList(source)\n  return System.List(source.__genericT__)(source)\nend\n\nlocal function toDictionary(source, keySelector, elementSelector, comparer, TKey, TValue)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if keySelector == nil then throw(ArgumentNullException(\"keySelector\")) end\n  if elementSelector == nil then throw(ArgumentNullException(\"elementSelector\")) end\n  local dict = System.Dictionary(TKey, TValue)(comparer)\n  for _, v in each(source) do\n    dict:Add(keySelector(v), elementSelector(v))\n  end\n  return dict\nend\n\nfunction Enumerable.ToDictionary(source, ...)\n  local len = select(\"#\", ...)\n  if len == 2 then\n    local keySelector, TKey = ...\n    return toDictionary(source, keySelector, identityFn, nil, TKey, source.__genericT__)\n  elseif len == 3 then\n    local keySelector, comparer, TKey = ...\n    return toDictionary(source, keySelector, identityFn, comparer, TKey, source.__genericT__)\n  elseif len == 4 then\n    local keySelector, elementSelector, TKey, TElement = ...\n    return toDictionary(source, keySelector, elementSelector, nil, TKey, TElement)\n  else\n    return toDictionary(source, ...)\n  end\nend\n\nlocal function toLookup(source, keySelector, elementSelector, comparer, TKey, TElement )\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if keySelector == nil then throw(ArgumentNullException(\"keySelector\")) end\n  if elementSelector == nil then throw(ArgumentNullException(\"elementSelector\")) end\n  return createLookup(source, keySelector, elementSelector, comparer, TKey, TElement)\nend\n\nfunction Enumerable.ToLookup(source, ...)\n  local len = select(\"#\", ...)\n  if len == 2 then\n    local keySelector, TKey = ...\n    return toLookup(source, keySelector, identityFn, nil, TKey, source.__genericT__)\n  elseif len == 3 then\n    local keySelector, comparer, TKey = ...\n    return toLookup(source, keySelector, identityFn, comparer, TKey, source.__genericT__)\n  elseif len == 4 then\n    local keySelector, elementSelector, TKey, TElement = ...\n    return toLookup(source, keySelector, elementSelector, nil, TKey, TElement)\n  else\n    return toLookup(source, ...)\n  end\nend\n\nfunction Enumerable.DefaultIfEmpty(source)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local T = source.__genericT__\n  local state \n  return createEnumerable(T, function()\n    return createEnumerator(T, source, function(en)\n      if not state then\n        if en:MoveNext() then\n          state = 1\n          return true, en:getCurrent()\n        end\n        state = 2\n        return true, T:default()\n      elseif state == 1 then\n        if en:MoveNext() then\n          return true, en:getCurrent()\n        end\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.OfType(source, T)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  return createEnumerable(T, function()\n    return createEnumerator(T, source, function(en) \n      while en:MoveNext() do\n        local current = en:getCurrent()\n        if is(current, T) then\n          return true, current\n        end\n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.Cast(source, T)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if is(source, IEnumerable_1(T)) then return source end\n  return createEnumerable(T, function()\n    return createEnumerator(T, source, function(en) \n      if en:MoveNext() then\n        return true, cast(T, en:getCurrent())\n      end\n      return false\n    end)\n  end)\nend\n\nlocal function first(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...)\n  if len == 0 then\n    if isArrayLike(source) then\n      local count = #source\n      if count > 0 then\n        return true, unWrap(source[1])\n      end\n    else\n      local en = source:GetEnumerator()\n      if en:MoveNext() then \n        return true, en:getCurrent()\n      end\n    end\n    return false, 0\n  else\n    local predicate = ...\n    if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n    for _, v in each(source) do\n      if predicate(v) then \n        return true, v\n      end\n    end\n    return false, 1\n  end\nend\n\nfunction Enumerable.First(source, ...)\n  local ok, result = first(source, ...)\n  if ok then return result end\n  if result == 0 then\n    throw(InvalidOperationException(\"NoElements\"))\n  end\n  throw(InvalidOperationException(\"NoMatch\"))\nend\n\nfunction Enumerable.FirstOrDefault(source, ...)\n  local ok, result = first(source, ...)\n  return ok and result or source.__genericT__:default()\nend\n\nlocal function last(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...)\n  if len == 0 then\n    if isArrayLike(source) then\n      local count = #source\n      if count > 0 then\n        return true, unWrap(source[count])\n      end\n    else\n      local en = source:GetEnumerator()\n      if en:MoveNext() then \n        local result\n        repeat\n          result = en:getCurrent()\n        until not en:MoveNext()\n        return true, result\n      end\n    end\n    return false, 0\n  else\n    local predicate = ...\n    if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n    local result, found\n    for _, v in each(source) do\n      if predicate(v) then\n        result = v\n        found = true\n      end\n    end    \n    if found then return true, result end\n    return false, 1\n  end\nend\n\nfunction Enumerable.Last(source, ...)\n  local ok, result = last(source, ...)\n  if ok then return result end\n  if result == 0 then\n    throw(InvalidOperationException(\"NoElements\"))\n  end\n  throw(InvalidOperationException(\"NoMatch\"))\nend\n\nfunction Enumerable.LastOrDefault(source, ...)\n  local ok, result = last(source, ...)\n  return ok and result or source.__genericT__:default()\nend\n\nlocal function single(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...)\n  if len == 0 then\n    if isArrayLike(source) then\n      local count = #source\n      if count == 0 then\n        return false, 0\n      elseif count == 1 then\n        return true, unWrap(source[1])\n      end\n    else\n      local en = source:GetEnumerator()\n      if not en:MoveNext() then return false, 0 end\n      local result = en:getCurrent()\n      if not en:MoveNext() then\n        return true, result\n      end\n    end\n    return false, 1\n  else\n    local predicate = ...\n    if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n    local result, found\n    for _, v in each(source) do\n      if predicate(v) then\n        result = v\n        if found then\n          return false, 1\n        end\n        found = true\n      end\n    end\n    if foun then return true, result end    \n    return false, 0    \n  end\nend\n\nfunction Enumerable.Single(source, ...)\n  local ok, result = single(source, ...)\n  if ok then return result end\n  if result == 0 then\n    throw(InvalidOperationException(\"NoElements\"))\n  end\n  throw(InvalidOperationException(\"MoreThanOneMatch\"))\nend\n\nfunction Enumerable.SingleOrDefault(source, ...)\n  local ok, result = single(source, ...)\n  return ok and result or source.__genericT__:default()\nend\n\nlocal function elementAt(source, index)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if index >= 0 then\n    if isArrayLike(source) then\n      local count = #source\n      if index < count then\n        return true, unWrap(source[index + 1])\n      end\n    else\n      local en = source:GetEnumerator()\n      while true do\n        if not en:MoveNext() then break end\n        if index == 0 then return true, en:getCurrent() end\n        index = index - 1\n      end\n    end\n  end\n  return false\nend\n\nfunction Enumerable.ElementAt(source, index)\n  local ok, result = elementAt(source, index)\n  if ok then return result end\n  throw(ArgumentOutOfRangeException(\"index\"))\nend\n\nfunction Enumerable.ElementAtOrDefault(source, index)\n  local ok, result = elementAt(source, index)\n  return ok and result or source.__genericT__:default()\nend\n\nfunction Enumerable.Range(start, count)\n  if count < 0 then throw(ArgumentOutOfRangeException(\"count\")) end\n  return createEnumerable(Int32, function()\n    local index = -1\n    return createEnumerator(Int32, nil, function()\n      index = index + 1\n      if index < count then\n        return true, start + index  \n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.Repeat(element, count, T)\n  if count < 0 then throw(ArgumentOutOfRangeException(\"count\")) end\n  return createEnumerable(T, function()\n    local index = -1\n    return createEnumerator(T, nil, function()\n      index = index + 1\n      if index < count then\n        return true, element  \n      end\n      return false\n    end)\n  end)\nend\n\nfunction Enumerable.Any(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...)\n  if len == 0 then\n    local en = source:GetEnumerator()\n    return en:MoveNext()\n  else\n    local predicate = ...\n    if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n    for _, v in each(source) do\n      if predicate(v) then\n        return true\n      end\n    end\n    return false\n  end\nend\n\nfunction Enumerable.All(source, predicate)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n  for _, v in each(source) do\n    if not predicate(v) then\n      return false\n    end\n  end\n  return true\nend\n\nfunction Enumerable.Count(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...)\n  if len == 0 then\n    if isArrayLike(source) then\n      return #source\n    end\n    local count = 0\n    local en = source:GetEnumerator()\n    while en:MoveNext() do \n      count = count + 1 \n    end\n    return count\n  else\n    local predicate = ...\n    if predicate == nil then throw(ArgumentNullException(\"predicate\")) end\n    local count = 0\n    for _, v in each(source) do\n      if predicate(v) then\n        count = count + 1\n      end\n    end\n    return count\n  end\nend\n\nfunction Enumerable.Contains(source, value, comparer)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  comparer = getComparer(source, comparer)\n  local equals = comparer.EqualsOf\n  for _, v in each(source) do\n    if equals(comparer, v, value) then\n      return true\n    end\n  end\n  return false\nend\n\nfunction Enumerable.Aggregate(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...);\n  if len == 1 then\n    local func = ...\n    if func == nil then throw(ArgumentNullException(\"func\")) end\n    local e = source:GetEnumerator()\n    if not e:MoveNext() then throw(InvalidOperationException(\"NoElements\")) end\n    local result = e:getCurrent()\n    while e:MoveNext() do\n      result = func(result, e:getCurrent())\n    end\n    return result\n  elseif len == 2 then\n    local seed, func = ...\n    if func == nil then throw(ArgumentNullException(\"func\")) end\n    local result = seed\n    for _, element in each(source) do\n      result = func(result, element)\n    end\n    return result\n  else \n    local seed, func, resultSelector = ...\n    if func == nil then throw(ArgumentNullException(\"func\")) end\n    if resultSelector == nil then throw(ArgumentNullException(\"resultSelector\")) end\n    local result = seed\n    for _, element in each(source) do\n      result = func(result, element)\n    end\n    return resultSelector(result)\n  end\nend\n\nfunction Enumerable.Sum(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...)\n  if len == 0 then\n    local sum = 0\n    for _, v in each(source) do\n      sum = sum + v\n    end\n    return sum\n  else\n    local selector = ...\n    if selector == nil then throw(ArgumentNullException(\"selector\")) end\n    local sum = 0\n    for _, v in each(source) do\n      sum = sum + selector(v)\n    end\n    return sum\n  end\nend\n\nlocal function minOrMax(compareFn, source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local len = select(\"#\", ...)\n  local selector, T \n  if len == 0 then\n    selector, T = identityFn, source.__genericT__\n  else\n    selector, T = ...\n    if selector == nil then throw(ArgumentNullException(\"selector\")) end\n  end\n  local comparer = Comparer_1(T).getDefault()\n  local compare = comparer.Compare\n  local value = T:default()\n  if value == nil then\n    for _, x in each(source) do\n      x = selector(x)\n      if x ~= nil and (value == nil or compareFn(compare, comparer, x, value)) then\n        value = x\n      end \n    end\n    return value\n  else\n    local hasValue = false\n    for _, x in each(source) do\n      x = selector(x)\n      if hasValue then\n        if compareFn(compare, comparer, x, value) then\n          value = x\n        end\n      else\n        value = x\n        hasValue = true\n      end\n    end\n    if hasValue then return value end\n    throw(InvalidOperationException(\"NoElements\"))\n  end\nend\n\nlocal function minFn(compare, comparer, x, y)\n  return compare(comparer, x, y) < 0\nend\n\nfunction Enumerable.Min(source, ...)\n  return minOrMax(minFn, source, ...)\nend\n\nlocal function maxFn(compare, comparer, x, y)\n  return compare(comparer, x, y) > 0\nend\n\nfunction Enumerable.Max(source, ...)\n  return minOrMax(maxFn, source, ...)\nend\n\nfunction Enumerable.Average(source, ...)\n  if source == nil then throw(ArgumentNullException(\"source\")) end\n  local sum, count = 0, 0\n  local len = select(\"#\", ...)\n  if len == 0 then\n    for _, v in each(source) do\n      sum = sum + v\n      count = count + 1\n    end\n  else\n    local selector = ...\n    if selector == nil then throw(ArgumentNullException(\"selector\")) end\n    for _, v in each(source) do\n      sum = sum + selector(v)\n      count = count + 1\n    end\n  end\n  if count > 0 then\n    return sum / count\n  end\n  throw(InvalidOperationException(\"NoElements\"))\nend\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/Linq.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 406172d729eefcd42b2022990679be11\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/List.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal falseFn = System.falseFn\nlocal lengthFn = System.lengthFn\nlocal Array = System.Array\n\nlocal List = {\n  __ctor__ = Array.ctorList,\n  getCapacity = lengthFn,\n  getCount = lengthFn,\n  getIsFixedSize = falseFn,\n  getIsReadOnly = falseFn,\n  get = Array.get,\n  set = Array.set,\n  Add = Array.add,\n  AddObj = Array.addObj,\n  AddRange = Array.addRange,\n  AsReadOnly = Array.AsReadOnly,\n  BinarySearch = Array.BinarySearch,\n  Clear = Array.clear,\n  Contains = Array.Contains,\n  CopyTo = Array.CopyTo,\n  Exists = Array.Exists,\n  Find = Array.Find,\n  FindAll = Array.findAll,\n  FindIndex = Array.FindIndex,\n  FindLast = Array.FindLast,\n  FindLastIndex = Array.FindLastIndex,\n  ForEach = Array.ForEach,\n  GetEnumerator = Array.GetEnumerator,\n  GetRange = Array.getRange,\n  IndexOf = Array.IndexOf,\n  Insert = Array.insert,\n  InsertRange = Array.insertRange,\n  LastIndexOf = Array.LastIndexOf,\n  Remove = Array.remove,\n  RemoveAll = Array.removeAll,\n  RemoveAt = Array.removeAt,\n  RemoveRange = Array.removeRange,\n  Reverse = Array.Reverse,\n  Sort = Array.Sort,\n  TrimExcess = System.emptyFn,\n  ToArray = Array.toArray,\n  TrueForAll = Array.TrueForAll\n}\n\nfunction System.listFromTable(t, T)\n  return setmetatable(t, List(T))\nend\n\nlocal ListFn = System.define(\"System.Collections.Generic.List\", function(T) \n  return { \n    base = { System.IList_1(T), System.IReadOnlyList_1(T), System.IList }, \n    __genericT__ = T,\n  }\nend, List)\n\nSystem.List = ListFn\nSystem.ArrayList = ListFn(System.Object)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/List.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 7c865abfcba1c6446b184a2b82126f67\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/Queue.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal Array = System.Array\n\nlocal function tryDequeue(this)\n  if #this == 0 then\n    return false\n  end\n  return true, this:Dequeue()\nend\n\nlocal Queue = {\n  __ctor__ = Array.ctorList,\n  getCount = Array.getLength,\n  Clear = Array.clear,\n  Contains = Array.Contains,\n  CopyTo = Array.CopyTo,\n  Dequeue = Array.popFirst,\n  Enqueue = Array.add,\n  GetEnumerator = Array.GetEnumerator,\n  Peek = Array.first,\n  ToArray = Array.toArray,\n  TrimExcess = System.emptyFn,\n  TryDequeue = tryDequeue\n}\n\nfunction System.queueFromTable(t, T)\n  return setmetatable(t, Queue(T))\nend\n\nlocal QueueFn = System.define(\"System.Collections.Generic.Queue\", function(T) \n  return {\n    base = { System.IEnumerable_1(T), System.ICollection },\n    __genericT__ = T,\n  }\nend, Queue)\n\nSystem.Queue = QueueFn\nSystem.queue = QueueFn(System.Object)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/Queue.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 50f419f82317ada4ea81ad0a9e9f5d2d\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/SortedSet.lua",
    "content": "--[[\nCopyright YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\n\nlocal SortedSet = {\n  \n}\n\n\n\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/SortedSet.lua.meta",
    "content": "fileFormatVersion: 2\nguid: cbb8de3cd60559c4a8569173e08c7914\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/Stack.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal Array = System.Array\n\nlocal Stack = {\n  __ctor__ = Array.ctorList,\n  getCount = Array.getLength,\n  Clear = Array.clear,\n  Contains = Array.Contains,\n  GetEnumerator = Array.reverseEnumerator,\n  Push = Array.add,\n  Peek = Array.last,\n  Pop = Array.popLast,\n  ToArray = Array.toArray,\n  TrimExcess = System.emptyFn\n}\n\nfunction System.stackFromTable(t, T)\n  return setmetatable(t, Stack(T))\nend\n\nlocal StackFn = System.define(\"System.Collections.Generic.Stack\", function(T) \n  return {\n    base = { System.IEnumerable_1(T), System.ICollection },\n    __genericT__ = T,\n  }\nend, Stack)\n\nSystem.Stack = StackFn\nSystem.stack = StackFn(System.Object)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections/Stack.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 440302017e524d742a46d9347f06adbe\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Collections.meta",
    "content": "fileFormatVersion: 2\nguid: 6c593174ea67b1c49a59b342c76fe211\nfolderAsset: yes\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Console.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal toString = System.toString\n\nlocal print = print\nlocal select = select\nlocal string = string\nlocal byte = string.byte\nlocal char = string.char\nlocal Format = string.Format\n\nlocal function getWriteValue(v, ...)\n  if select(\"#\", ...) ~= 0 then\n    return Format(v, ...)\n  end\n  return toString(v)\nend\n\nlocal Console = System.define(\"System.Console\", {\n  WriteLine = function (v, ...)\n    print(getWriteValue(v, ...))     \n  end,\n  WriteLineChar = function (v)\n    print(char(v))     \n  end\n})\n\nlocal io = io\nif io then\n  local stdin = io.stdin\n  local stdout = io.stdout\n  local read = stdin.read\n  local write = stdout.write\n\n  function Console.Read()\n    local ch = read(stdin, 1)\n    return byte(ch)\n  end\n\n  function Console.ReadLine()\n     return read(stdin)\n  end\n\n  function Console.Write(v, ...)\n    write(stdout, getWriteValue(v, ...))\n  end\n\n  function Console.WriteChar(v)\n     write(stdout, char(v))\n  end\nend\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Console.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 4fe1932f201910c4e908b248ec1cd570\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Convert.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal cast = System.cast\nlocal as = System.as\nlocal trunc = System.trunc\nlocal define = System.define\nlocal identityFn = System.identityFn\nlocal IConvertible = System.IConvertible\nlocal systemToString = System.toString\n\nlocal OverflowException = System.OverflowException\nlocal FormatException = System.FormatException\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal InvalidCastException = System.InvalidCastException\n\nlocal SByte = System.SByte\nlocal Byte = System.Byte\nlocal Int16 = System.Int16\nlocal UInt16 = System.UInt16\nlocal Int32 = System.Int32\nlocal UInt32 = System.UInt32\nlocal Int64 = System.Int64\nlocal UInt64 = System.UInt64\nlocal Single = System.Single\nlocal Double = System.Double\nlocal Boolean = System.Boolean\nlocal Char = System.Char\nlocal DateTime = System.DateTime\nlocal String = System.String\nlocal Object = System.Object\n\nlocal ParseSByte = SByte.Parse\nlocal ParseByte = Byte.Parse\nlocal ParseInt16 = Int16.Parse\nlocal ParseUInt16 = UInt16.Parse\nlocal ParseInt32 = Int32.Parse\nlocal ParseUInt32 = UInt32.Parse\nlocal ParseInt64 = Int64.Parse\nlocal ParseUInt64 = UInt64.Parse\n\nlocal ParseSingle = Single.Parse\nlocal ParseDouble = Double.Parse\nlocal ParseBoolean = Boolean.Parse\n\nlocal type = type\nlocal string = string\nlocal sbyte = string.byte\nlocal math = math\nlocal floor = math.floor\nlocal tconcat = table.concat\nlocal getmetatable = getmetatable\nlocal tonumber = tonumber\n\nlocal function toBoolean(value)\n  if value == nil then return false end\n  local typename = type(value)\n  if typename == \"number\" then\n    return value ~= 0\n  elseif typename == \"string\" then\n    return ParseBoolean(value)  \n  elseif typename == \"boolean\" then\n    return value\n  else\n    return cast(IConvertible, value):ToBoolean()   \n  end\nend\n\nlocal function toChar(value)\n  if value == nil then return 0 end\n  local typename = type(value)\n  if typename == \"number\" then\n    if value ~= floor(value) or value > 9223372036854775807 or value < -9223372036854775808 then\n      throw(InvalidCastException(\"InvalidCast_FromTo_Char\"))\n    end\n    if value < 0 or value > 65535 then \n      throw(OverflowException(\"Overflow_Char\")) \n    end\n    return value\n  elseif typename == \"string\" then\n    if #value ~= 1 then\n      throw(FormatException(\"Format_NeedSingleChar\"))\n    end\n    return sbyte(value)\n  else\n    return cast(IConvertible, value):ToChar()\n  end\nend\n\nlocal function parseBits(s, p, n)\n  local i, j, v = s:find(p)\n  if not i then\n    throw(FormatException())\n  end\n  v = tonumber(v)\n  for i = j + 1, #s do\n    local ch = sbyte(s, i)\n    local b = ch - 48\n    if b < 0 or b >= n then\n      if not s:find(\"^%s*$\", i) then\n        throw(FormatException())\n      end\n      break\n    end\n    v = v * n + b\n  end\n  return v\nend\n\nlocal function parseNumberFromBase(value, fromBase, min, max)\n  if fromBase == 2 then\n    value = parseBits(value, \"^%s*([01])\", fromBase)\n  elseif fromBase == 8 then\n    value = parseBits(value, \"^%s*([0-7])\", fromBase)\n  elseif fromBase == 16 then\n    local _, _, v = value:find(\"^%s*(%w+)%s*$\")\n    if not v then\n      throw(ArgumentException(\"String cannot contain a minus sign if the base is not 10.\"))\n    end\n    local ch = sbyte(v, 2)\n    if ch == 120 or ch == 88 then\n    else\n      v = \"0x\" .. v\n    end\n    value = tonumber(v)\n    if value == nil then\n      throw(FormatException())\n    end\n  else\n    throw(ArgumentException(\"fromBase\")) \n  end\n  if max == 127 and value <= 255 then\n    return System.toSByte(value)\n  end\n  if max == 32767 and value <= 65535 then\n    return System.toInt16(value)\n  end\n  if max == 2147483647 and value <= 4294967295 then\n    return System.toInt32(value)\n  end\n  if value < min or value > max then\n    throw(OverflowException())\n  end\n  return value\nend\n\nlocal function toNumber(value, min, max, parse, objectTo, sign)\n  if value == nil then return 0 end\n  local typename = type(value)\n  if typename == \"number\" then\n    if sign == false then\n      value = System.ToSingle(value * 1.0)\n    elseif sign == true then\n      value = value * 1.0\n    else\n      local i = value\n      value = trunc(value)\n      if value ~= i then\n        local dif = i - value\n        if value >= 0 then\n          if dif > 0.5 or (dif == 0.5 and value % 2 ~= 0) then\n            value = value + 1  \n          end\n        else\n          if dif < -0.5 or (dif == -0.5 and value % 2 ~= 0) then\n            value = value - 1  \n          end\n        end\n      end\n      if value < min or value > max then\n        throw(OverflowException())\n      end\n    end\n    return value\n  elseif typename == \"string\" then\n    if sign and sign ~= 10 and type(sign) == \"number\" then\n      return parseNumberFromBase(value, sign, min, max)\n    end\n    return parse(value) \n  elseif typename == \"boolean\" then\n    return value and 1 or 0\n  else\n    return objectTo(value)\n  end\nend\n\nlocal function objectToSByte(value)\n  return cast(IConvertible, value):ToSByte()\nend\n\nlocal function toSByte(value, fromBase)\n  return toNumber(value, -128, 127, ParseSByte, objectToSByte, fromBase)\nend\n\nlocal function objectToByte(value)\n  return cast(IConvertible, value):ToByte()\nend\n\nlocal function toByte(value, fromBase)\n  return toNumber(value, 0, 255, ParseByte, objectToByte, fromBase) \nend\n\nlocal function objectToInt16(value)\n  return cast(IConvertible, value):ToInt16()\nend\n\nlocal function toInt16(value, fromBase)\n  return toNumber(value, -32768, 32767, ParseInt16, objectToInt16, fromBase) \nend\n\nlocal function objectToUInt16(value)\n  return cast(IConvertible, value):ToUInt16()\nend\n\nlocal function toUInt16(value, fromBase)\n  return toNumber(value, 0, 65535, ParseUInt16, objectToUInt16, fromBase) \nend\n\nlocal function objectToInt32(value)\n  return cast(IConvertible, value):ToInt32()\nend\n\nlocal function toInt32(value, fromBase)\n  return toNumber(value, -2147483648, 2147483647, ParseInt32, objectToInt32, fromBase) \nend\n\nlocal function objectToUInt32(value)\n  return cast(IConvertible, value):ToUInt32()\nend\n\nlocal function toUInt32(value, fromBase)\n  return toNumber(value, 0, 4294967295, ParseUInt32, objectToUInt32, fromBase) \nend\n\nlocal function objectToInt64(value)\n  return cast(IConvertible, value):ToInt64()\nend\n\nlocal function toInt64(value, fromBase)\n  return toNumber(value, -9223372036854775808, 9223372036854775807, ParseInt64, objectToInt64, fromBase) \nend\n\nlocal function objectToUInt64(value)\n  return cast(IConvertible, value):ToUInt64()\nend\n\nlocal function toUInt64(value, fromBase)\n  return toNumber(value, 0, 18446744073709551615.0, ParseUInt64, objectToUInt64, fromBase) \nend\n\nlocal function objectToSingle(value)\n  return cast(IConvertible, value):ToSingle()\nend\n\nlocal function toSingle(value)\n  return toNumber(value, nil, nil, ParseSingle, objectToSingle, false) \nend\n\nlocal function objectToDouble(value)\n  return cast(IConvertible, value):ToDouble()\nend\n\nlocal function toDouble(value)\n  return toNumber(value, nil, nil, ParseDouble, objectToDouble, true) \nend\n\nlocal function toDateTime(value)\n  if value == nil then return DateTime.MinValue end\n  if getmetatable(value) == DateTime then return value end\n  if type(value) == \"string\" then return DateTime.Parse(value) end\n  return cast(IConvertible, value):ToDateTime()\nend\n\nlocal function toBaseType(ic, targetType)\n  local cls = targetType[1]\n  if cls == Boolean then return ic:ToBoolean() end\n  if cls == Char then return ic:ToChar() end\n  if cls == SByte then return ic:ToSByte() end\n  if cls == Byte then return ic:ToByte() end\n  if cls == Int16 then return ic:ToInt16() end\n  if cls == UInt16 then return ic:ToUInt16() end\n  if cls == Int32 then return ic:ToInt32() end\n  if cls == UInt32 then return ic:ToUInt32() end\n  if cls == Int64 then return ic:ToInt64() end\n  if cls == UInt64 then return ic:ToUInt64() end\n  if cls == Single then return ic:ToSingle() end\n  if cls == Double then return ic:ToDouble() end\n  if cls == DateTime then return ic:ToDateTime() end\n  if cls == String then return ic:ToString() end\n  if cls == Object then return value end\nend\n\nlocal function defaultToType(value, targetType)\n  if targetType == nil then throw(ArgumentNullException(\"targetType\")) end\n  if value:GetType() == targetType then return value end\n  local v = toBaseType(value, targetType)\n  if v ~= nil then\n    return v\n  end\n  throw(InvalidCastException())\nend\n\nlocal function changeType(value, conversionType)\n  if conversionType == nil then\n    throw(ArgumentNullException(\"conversionType\"))\n  end\n  if value == nil then\n    if conversionType:getIsValueType() then\n      throw(InvalidCastException(\"InvalidCast_CannotCastNullToValueType\"))\n    end\n    return nil\n  end\n  local ic = as(value, IConvertible)\n  if ic == nil then\n    if value:GetType() == conversionType then\n      return value\n    end\n    throw(InvalidCastException(\"InvalidCast_IConvertible\"))\n  end\n  local v = toBaseType(ic, conversionType)\n  if v ~= nil then\n    return v\n  end\n  return ic.ToType(conversionType)\nend\n\nlocal function toBits(num, bits)\n  -- returns a table of bits, most significant first.\n  bits = bits or math.max(1, select(2, math.frexp(num)))\n  local t = {} -- will contain the bits        \n  for b = bits, 1, -1 do\n    local i =  num % 2\n    t[b] = i\n    num = System.div(num - i, 2)\n  end\n  if bits == 64 and t[1] == 0 then\n    return tconcat(t, nil, 2, bits)\n  end\n  return tconcat(t)\nend\n\nlocal function toString(value, toBaseOrProvider, cast)\n  if value == nil then\n    return \"\"\n  end\n  if toBaseOrProvider then\n    if type(toBaseOrProvider) == \"number\" then\n      if toBaseOrProvider ~= 10 then\n        if cast and value < 0 then\n          value = cast(value)\n        end\n      end\n      if toBaseOrProvider == 2 then\n        return toBits(value)\n      elseif toBaseOrProvider == 8 then\n        return (\"%o\"):format(value)\n      elseif toBaseOrProvider == 10 then\n        return value .. \"\"\n      elseif toBaseOrProvider == 16 then\n        return (\"%x\"):format(value)\n      else\n        throw(ArgumentException())\n      end\n    end\n  end\n  return systemToString(value)\nend\n\ndefine(\"System.Convert\", {\n  ToBoolean = toBoolean,\n  ToChar = toChar,\n  ToSByte = toSByte,\n  ToByte = toByte,\n  ToInt16 = toInt16,\n  ToUInt16 = toUInt16,\n  ToInt32 = toInt32,\n  ToUInt32 = toUInt32,\n  ToInt64 = toInt64,\n  ToUInt64 = toUInt64,\n  ToSingle = toSingle,\n  ToDouble = toDouble,\n  ToDateTime = toDateTime,\n  ChangeType = changeType,\n  ToString = toString,\n  ToStringFromChar = string.char\n})\n\nString.ToBoolean = toBoolean\nString.ToChar = toChar\nString.ToSByte = toSByte\nString.ToByte = toByte\nString.ToInt16 = toInt16\nString.ToUInt16 = toUInt16\nString.ToInt32 = toInt32\nString.ToUInt32 = toUInt32\nString.ToInt64 = toInt64\nString.ToUInt64 = toUInt64\nString.ToSingle = identityFn\nString.ToDouble = toDouble\nString.ToDateTime = toDateTime\nString.ToType = defaultToType\n\nlocal function throwInvalidCastException()\n  throw(InvalidCastException())\nend\n\nlocal Number = System.Number\nNumber.ToBoolean = toBoolean\nNumber.ToChar = toChar\nNumber.ToSByte = toSByte\nNumber.ToByte = toByte\nNumber.ToInt16 = toInt16\nNumber.ToUInt16 = toUInt16\nNumber.ToInt32 = toInt32\nNumber.ToUInt32 = toUInt32\nNumber.ToInt64 = toInt64\nNumber.ToUInt64 = toUInt64\nNumber.ToSingle = toSingle\nNumber.ToDouble = toDouble\nNumber.ToDateTime = throwInvalidCastException\nNumber.ToType = defaultToType\n\nBoolean.ToBoolean = identityFn\nBoolean.ToChar = throwInvalidCastException\nBoolean.ToSByte = toSByte\nBoolean.ToByte = toByte\nBoolean.ToInt16 = toInt16\nBoolean.ToUInt16 = toUInt16\nBoolean.ToInt32 = toInt32\nBoolean.ToUInt32 = toUInt32\nBoolean.ToInt64 = toInt64\nBoolean.ToUInt64 = toUInt64\nBoolean.ToSingle = toSingle\nBoolean.ToDouble = toDouble\nBoolean.ToDateTime = throwInvalidCastException\nBoolean.ToType = defaultToType\n\nDateTime.ToBoolean = throwInvalidCastException\nDateTime.ToChar = throwInvalidCastException\nDateTime.ToSByte = throwInvalidCastException\nDateTime.ToByte = throwInvalidCastException\nDateTime.ToInt16 = throwInvalidCastException\nDateTime.ToUInt16 = throwInvalidCastException\nDateTime.ToInt32 = throwInvalidCastException\nDateTime.ToUInt32 = throwInvalidCastException\nDateTime.ToInt64 = throwInvalidCastException\nDateTime.ToUInt64 = throwInvalidCastException\nDateTime.ToSingle = throwInvalidCastException\nDateTime.ToDouble = throwInvalidCastException\nDateTime.ToDateTime = identityFn\nDateTime.ToType = defaultToType\n\n\n-- BitConverter\nlocal band = System.band\nlocal bor = System.bor\nlocal sl = System.sl\nlocal sr = System.sr\nlocal div = System.div\nlocal global = System.global\nlocal systemToInt16 = System.toInt16\nlocal systemToInt32 = System.toInt32\nlocal systemToUInt64 = System.toUInt64\nlocal arrayFromTable = System.arrayFromTable\nlocal NotSupportedException = System.NotSupportedException\n\nlocal assert = assert\nlocal rawget = rawget\nlocal unpack = table.unpack\nlocal schar = string.char\n\n-- https://github.com/ToxicFrog/vstruct/blob/master/io/endianness.lua#L30\nlocal isLittleEndian = true\nif rawget(global, \"jit\") then\n  if require(\"ffi\").abi(\"be\") then\n    isLittleEndian = false\n  end\nelse \n  local dump = string.dump\n  if dump and sbyte(dump(System.emptyFn, 7)) == 0x00 then\n    isLittleEndian = false\n  end\nend\n\nlocal function bytes(t)\n  return arrayFromTable(t, Byte)    \nend\n\nlocal function checkIndex(value, startIndex, count)\n  if value == nil then throw(ArgumentNullException(\"value\")) end\n  local len = #value\n  if startIndex < 0 or startIndex >= len then\n    throw(ArgumentOutOfRangeException(\"startIndex\"))\n  end\n  if startIndex > len - count then\n    throw(ArgumentException())\n  end\nend\n\nlocal spack, sunpack, getBytesFromInt64, toInt64\nif System.luaVersion < 5.3 then\n  local struct = rawget(global, \"struct\")\n  if struct then\n    spack, sunpack = struct.pack, struct.upack\n  end\n  if not spack then\n    spack = function ()\n      throw(NotSupportedException(\"not found struct\"), 1) \n    end\n    sunpack = spack\n  end\n\n  getBytesFromInt64 = function (value)\n    if value <= -2147483647 or value >= 2147483647 then\n      local s = spack(\"i8\", value)\n      return bytes({\n        sbyte(s, 1),\n        sbyte(s, 2),\n        sbyte(s, 3),\n        sbyte(s, 4),\n        sbyte(s, 5),\n        sbyte(s, 6),\n        sbyte(s, 7),\n        sbyte(s, 8)\n      })\n    end\n    return bytes({\n      band(value, 0xff),\n      band(sr(value, 8), 0xff),\n      band(sr(value, 16), 0xff),\n      band(sr(value, 24), 0xff),\n      0,\n      0,\n      0,\n      0\n    })\n  end\n\n  toInt64 = function (value, startIndex)\n    checkIndex(value, startIndex, 8)\n    if value <= -2147483647 or value >= 2147483647 then\n      throw(System.NotSupportedException()) \n    end\n    if isLittleEndian then\n      local i = value[startIndex + 1]\n      i = bor(i, sl(value[startIndex + 2], 8))\n      i = bor(i, sl(value[startIndex + 3], 16))\n      i = bor(i, sl(value[startIndex + 4], 24))\n      return i\n    else\n      local i = value[startIndex + 8]\n      i = bor(i, sl(value[startIndex + 7], 8))\n      i = bor(i, sl(value[startIndex + 6], 16))\n      i = bor(i, sl(value[startIndex + 5], 24))\n      return i\n    end\n  end\nelse\n  spack, sunpack = string.pack, string.unpack\n  getBytesFromInt64 = function (value)\n    return bytes({\n      band(value, 0xff),\n      band(sr(value, 8), 0xff),\n      band(sr(value, 16), 0xff),\n      band(sr(value, 24), 0xff),\n      band(sr(value, 32), 0xff),\n      band(sr(value, 40), 0xff),\n      band(sr(value, 48), 0xff),\n      band(sr(value, 56), 0xff)\n    })\n  end\n\n  toInt64 = function (value, startIndex)\n    checkIndex(value, startIndex, 8)\n    if isLittleEndian then\n      local i = value[startIndex + 1]\n      i = bor(i, sl(value[startIndex + 2], 8))\n      i = bor(i, sl(value[startIndex + 3], 16))\n      i = bor(i, sl(value[startIndex + 4], 24))\n      i = bor(i, sl(value[startIndex + 5], 32))\n      i = bor(i, sl(value[startIndex + 6], 40))\n      i = bor(i, sl(value[startIndex + 7], 48))\n      i = bor(i, sl(value[startIndex + 8], 56))\n      return i\n    else\n      local i = value[startIndex + 8]\n      i = bor(i, sl(value[startIndex + 7], 8))\n      i = bor(i, sl(value[startIndex + 6], 16))\n      i = bor(i, sl(value[startIndex + 5], 24))\n      i = bor(i, sl(value[startIndex + 4], 32))\n      i = bor(i, sl(value[startIndex + 3], 40))\n      i = bor(i, sl(value[startIndex + 2], 48))\n      i = bor(i, sl(value[startIndex + 1], 56))\n      return i\n    end\n  end\nend\n\nlocal function getBytesFromBoolean(value)\n  return bytes({ value and 1 or 0 })\nend\n\nlocal function getBytesFromInt16(value)\n  return bytes({\n    band(value, 0xff),\n    band(sr(value, 8), 0xff),\n  })\nend\n\nlocal function getBytesFromInt32(value)\n  return bytes({\n    band(value, 0xff),\n    band(sr(value, 8), 0xff),\n    band(sr(value, 16), 0xff),\n    band(sr(value, 24), 0xff)\n  })\nend\n\nlocal function getBytesFromFloat(value)\n  local s = spack(\"f\", value)\n  return bytes({\n    sbyte(s, 1),\n    sbyte(s, 2),\n    sbyte(s, 3),\n    sbyte(s, 4)\n  })\nend\n\nlocal function getBytesFromDouble(value)\n  local s = spack(\"d\", value)\n  return bytes({\n    sbyte(s, 1),\n    sbyte(s, 2),\n    sbyte(s, 3),\n    sbyte(s, 4),\n    sbyte(s, 5),\n    sbyte(s, 6),\n    sbyte(s, 7),\n    sbyte(s, 8)\n  })\nend\n\nlocal function toBoolean(value, startIndex)\n  checkIndex(value, startIndex, 1)\n  return value[startIndex + 1] ~= 0 and true or false\nend\n\nlocal function toUInt16(value, startIndex)\n  checkIndex(value, startIndex, 2)\n  if isLittleEndian then\n    value = bor(value[startIndex + 1], sl(value[startIndex + 2], 8))\n  else\n    value = bor(sl(value[startIndex + 1], 8), value[startIndex + 2])\n  end\n  return value\nend\n\nlocal function toInt16(value, startIndex)\n  value = toUInt16(value, startIndex)\n  return systemToInt16(value)\nend\n\nlocal function toUInt32(value, startIndex)\n  checkIndex(value, startIndex, 4)\n  local i\n  if isLittleEndian then\n    i = value[startIndex + 1]\n    i = bor(i, sl(value[startIndex + 2], 8))\n    i = bor(i, sl(value[startIndex + 3], 16))\n    i = bor(i, sl(value[startIndex + 4], 24))\n  else\n    local i = value[startIndex + 4]\n    i = bor(i, sl(value[startIndex + 3], 8))\n    i = bor(i, sl(value[startIndex + 2], 16))\n    i = bor(i, sl(value[startIndex + 1], 24))\n  end\n  return i\nend\n\nlocal function toInt32(value, startIndex)\n  value = toUInt32(value, startIndex)\n  return systemToInt32(value)\nend\n\nlocal function toUInt64(value, startIndex)\n  value = toInt64(value, startIndex)\n  return systemToUInt64(value)\nend\n\nlocal function toSingle(value, startIndex)\n  checkIndex(value, startIndex, 4)\n  return sunpack(\"f\", schar(unpack(value, startIndex + 1)))\nend\n\nlocal function toDouble(value, startIndex)\n  checkIndex(value, startIndex, 8)\n  return sunpack(\"d\", schar(unpack(value, startIndex + 1)))\nend\n\nlocal function getHexValue(i)\n  assert(i >= 0 and i < 16, \"i is out of range.\")\n  if i < 10 then\n    return i + 48\n  end\n  return i - 10 + 65\nend\n\nlocal function toString(value, startIndex, length)\n  if value == nil then throw(ArgumentNullException(\"value\")) end\n  local len = #value\n  if not startIndex then\n    startIndex, length = 0, #value\n  elseif not length then\n    length = len - startIndex\n  end\n  if startIndex < 0 or (startIndex >= len and startIndex > 0) then\n    throw(ArgumentOutOfRangeException(\"startIndex\"))\n  end\n  if length < 0 then\n    throw(ArgumentOutOfRangeException(\"length\"))\n  end\n  if startIndex + length > len then\n    throw(ArgumentException())\n  end\n  if length == 0 then\n    return \"\"\n  end\n  local t = {}\n  local len = 1\n  for i = startIndex + 1, startIndex + length  do\n    local b = value[i]\n    t[len] = getHexValue(div(b, 16))\n    t[len + 1] = getHexValue(b % 16)\n    t[len + 2] = 45\n    len = len + 3\n  end\n  return schar(unpack(t, 1, len - 2))\nend\n\nlocal function doubleToInt64Bits(value)\n  assert(isLittleEndian, \"This method is implemented assuming little endian with an ambiguous spec.\")\n  local s = spack(\"d\", value)\n  return (sunpack(\"i8\", s))\nend\n\nlocal function int64BitsToDouble(value)\n  assert(isLittleEndian, \"This method is implemented assuming little endian with an ambiguous spec.\")\n  local s = spack(\"i8\", value)\n  return (sunpack(\"d\", s))\nend\n\ndefine(\"System.BitConverter\", {\n  IsLittleEndian = isLittleEndian,\n  GetBytesFromBoolean = getBytesFromBoolean,\n  GetBytesFromInt16 = getBytesFromInt16,\n  GetBytesFromInt32 = getBytesFromInt32,\n  GetBytesFromInt64 = getBytesFromInt64,\n  GetBytesFromFloat = getBytesFromFloat,\n  GetBytesFromDouble = getBytesFromDouble,\n  ToBoolean = toBoolean,\n  ToChar = toUInt16,\n  ToInt16 = toInt16,\n  ToUInt16 = toUInt16,\n  ToInt32 = toInt32,\n  ToUInt32 = toUInt32,\n  ToInt64 = toInt64,\n  ToUInt64 = toUInt64,\n  ToSingle = toSingle,\n  ToDouble = toDouble,\n  ToString = toString,\n  DoubleToInt64Bits = doubleToInt64Bits,\n  Int64BitsToDouble = int64BitsToDouble\n})\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Convert.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 4484884b9aaf34742b746fe8ebf350be\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Core.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal setmetatable = setmetatable\nlocal getmetatable = getmetatable\nlocal type = type\nlocal pairs  = pairs\nlocal assert = assert\nlocal table = table\nlocal tremove = table.remove\nlocal tconcat = table.concat\nlocal floor = math.floor\nlocal ceil = math.ceil\nlocal error = error\nlocal select = select\nlocal xpcall = xpcall\nlocal rawget = rawget\nlocal rawset = rawset\nlocal rawequal = rawequal\nlocal tostring = tostring\nlocal string = string\nlocal sfind = string.find\nlocal ssub = string.sub\nlocal debug = debug\nlocal next = next\nlocal global = _G\nlocal prevSystem = rawget(global, \"System\")\n\nlocal emptyFn = function() end\nlocal nilFn = function() return nil end\nlocal falseFn = function() return false end\nlocal trueFn = function() return true end\nlocal identityFn = function(x) return x end\nlocal lengthFn = function (t) return #t end\nlocal zeroFn = function() return 0 end\nlocal oneFn = function() return 1 end\nlocal equals = function(x, y) return x == y end\nlocal getCurrent = function(t) return t.current end\nlocal assembly, metadatas\nlocal System, Object, ValueType\n\nlocal function new(cls, ...)\n  local this = setmetatable({}, cls)\n  return this, cls.__ctor__(this, ...)\nend\n\nlocal function throw(e, lv)\n  if e == nil then e = System.NullReferenceException() end\n  e:traceback(lv)\n  error(e)\nend\n\nlocal function xpcallErr(e)\n  if e == nil then\n    e = System.Exception(\"script error\")\n    e:traceback()\n  elseif type(e) == \"string\" then\n    if sfind(e, \"attempt to index\") then\n      e = System.NullReferenceException(e)\n    elseif sfind(e, \"attempt to divide by zero\") then  \n      e = System.DivideByZeroException(e)\n    else\n      e = System.Exception(e)\n    end\n    e:traceback()\n  end\n  return e\nend\n\nlocal function try(try, catch, finally)\n  local ok, status, result = xpcall(try, xpcallErr)\n  if not ok then\n    if catch then\n      if finally then\n        ok, status, result = xpcall(catch, xpcallErr, status)\n      else\n        ok, status, result = true, catch(status)\n      end\n      if ok then\n        if status == 1 then\n          ok = false\n          status = result\n        end\n      end\n    end\n  end\n  if finally then\n    finally()\n  end\n  if not ok then\n    error(status)\n  end\n  return status, result\nend\n\nlocal function set(className, cls)\n  local scope = global\n  local starIndex = 1\n  while true do\n    local pos = sfind(className, \"[%.+]\", starIndex) or 0\n    local name = ssub(className, starIndex, pos -1)\n    if pos ~= 0 then\n      local t = rawget(scope, name)\n      if t == nil then\n        if cls then\n          t = {}\n          rawset(scope, name, t)\n        else\n          return nil\n        end\n      end\n      scope = t\n      starIndex = pos + 1\n    else\n      if cls then\n        assert(rawget(scope, name) == nil, className)\n        rawset(scope, name, cls)\n        return cls\n      else\n        return rawget(scope, name)\n      end\n    end\n  end\nend\n\nlocal function multiKey(t, ...)\n  local n, i, k = select(\"#\", ...), 1\n  while true do\n    k = assert(select(i, ...))\n    if i == n then\n      break\n    end\n    local tk = t[k]\n    if tk == nil then\n      tk = {}\n      t[k] = tk\n    end\n    t = tk\n    i = i + 1\n  end\n  return t, k\nend\n\nlocal function genericName(name, ...)\n  if name:byte(-2) == 95 then\n    name = ssub(name, 1, -3)\n  end\n  local n = select(\"#\", ...)\n  local t = { name, \"`\", n, \"[\" }\n  local count = 5\n  local hascomma\n  for i = 1, n do\n    local cls = select(i, ...)\n    if hascomma then\n      t[count] = \",\"\n      count = count + 1\n    else\n      hascomma = true\n    end\n    t[count] = cls.__name__\n    count = count + 1\n  end\n  t[count] = \"]\"\n  return tconcat(t)\nend\n\nlocal enumMetatable = { class = \"E\", default = zeroFn, __index = false, interface = false, __call = function (_, v) return v or 0 end }\nenumMetatable.__index = enumMetatable\n\nlocal interfaceMetatable = { class = \"I\", default = nilFn, __index = false }\ninterfaceMetatable.__index = interfaceMetatable\n\nlocal ctorMetatable = { __call = function (ctor, ...) return ctor[1](...) end }\n\nlocal function applyExtends(cls)\n  local extends = cls.base\n  if extends then\n    if type(extends) == \"function\" then\n      extends = extends(global, cls)\n    end\n    cls.base = nil\n  end\n  return extends\nend\n\nlocal function applyMetadata(cls)\n  local metadata = cls.__metadata__\n  if metadata then\n    if metadatas then\n      metadatas[#metadatas + 1] = function (global)\n        cls.__metadata__ = metadata(global)\n      end\n    else\n      cls.__metadata__ = metadata(global)\n    end\n  end\nend\n\nlocal function setBase(cls, kind)\n  local ctor = cls.__ctor__\n  if ctor and type(ctor) == \"table\" then\n    setmetatable(ctor, ctorMetatable)\n  end\n  local extends = applyExtends(cls)\n  applyMetadata(cls)\n\n  cls.__index = cls \n  cls.__call = new\n  \n  if kind == \"S\" then\n    if extends then\n      cls.interface = extends\n    end\n    setmetatable(cls, ValueType)\n  else\n    if extends then\n      local base = extends[1]\n      if not base then error(cls.__name__ .. \"'s base is nil\") end\n      if base.class == \"I\" then\n        cls.interface = extends\n        setmetatable(cls, Object)\n      else\n        setmetatable(cls, base)\n        if #extends > 1 then\n          tremove(extends, 1)\n          cls.interface = extends\n        end\n      end\n    else\n      setmetatable(cls, Object)\n    end\n  end\nend\n\nlocal function staticCtorSetBase(cls)\n  setmetatable(cls, nil)\n  local t = cls[cls]\n  for k, v in pairs(t) do\n    cls[k] = v\n  end\n  cls[cls] = nil\n  local kind = cls.class\n  cls.class = nil\n  setBase(cls, kind)\n  cls:static()\n  cls.static = nil\nend\n\nlocal staticCtorMetatable = {\n  __index = function(cls, key)\n    staticCtorSetBase(cls)\n    return cls[key]\n  end,\n  __newindex = function(cls, key, value)\n    staticCtorSetBase(cls)\n    cls[key] = value\n  end,\n  __call = function(cls, ...)\n    staticCtorSetBase(cls)\n    return new(cls, ...)\n  end\n}\n\nlocal function setHasStaticCtor(cls, kind)\n  local name = cls.__name__\n  cls.__name__ = nil\n  local t = {}\n  for k, v in pairs(cls) do\n    t[k] = v\n    cls[k] = nil\n  end\n  cls[cls] = t\n  cls.__name__ = name\n  cls.class = kind\n  cls.__call = new\n  cls.__index = cls\n  setmetatable(cls, staticCtorMetatable)\nend\n\nlocal function defCore(name, kind, cls, generic)\n  cls = cls or {}\n  cls.__name__ = name\n  cls.__assembly__ = assembly\n  if not generic then\n    set(name, cls)\n  end\n  if kind == \"C\" or kind == \"S\" then\n    if cls.static == nil then\n      setBase(cls, kind)\n    else\n      setHasStaticCtor(cls, kind)\n    end\n  elseif kind == \"I\" then\n    local extends = applyExtends(cls)\n    if extends then \n      cls.interface = extends \n    end\n    applyMetadata(cls)\n    setmetatable(cls, interfaceMetatable)\n  elseif kind == \"E\" then\n    applyMetadata(cls)\n    setmetatable(cls, enumMetatable)\n  else\n    assert(false, kind)\n  end\n  return cls\nend\n\nlocal function def(name, kind, cls, generic)\n  if type(cls) == \"function\" then\n    local mt = {}\n    local fn = function(_, ...)\n      local gt, gk = multiKey(mt, ...)\n      local t = gt[gk]\n      if t == nil then\n        local class, super  = cls(...)\n        t = defCore(genericName(name, ...), kind, class or {}, true)\n        if generic then\n          setmetatable(t, super or generic)\n        end\n        gt[gk] = t\n      end\n      return t\n    end\n\n    local base = kind ~= \"S\" and Object or ValueType\n    local caller = setmetatable({ __call = fn, __index = base }, base)\n    if generic then\n      generic.__index = generic\n      generic.__call = new\n    end\n    return set(name, setmetatable(generic or {}, caller))\n  else\n    return defCore(name, kind, cls, generic)\n  end\nend\n\nlocal function defCls(name, cls, generic)\n  return def(name, \"C\", cls, generic)\nend\n\nlocal function defInf(name, cls)\n  return def(name, \"I\", cls)\nend\n\nlocal function defStc(name, cls, generic)\n  return def(name, \"S\", cls, generic)\nend\n\nlocal function defEnum(name, cls)\n  return def(name, \"E\", cls)\nend\n\nlocal function defArray(name, cls, Array, MultiArray)\n  Array.__index = Array\n  MultiArray.__index =  MultiArray\n  setmetatable(MultiArray, Array)\n\n  local mt = {}\n  local function create(Array, T)\n    local ArrayT = mt[T]\n    if ArrayT == nil then\n      ArrayT = defCore(T.__name__ .. \"[]\", \"C\", cls(T), true)\n      setmetatable(ArrayT, Array)\n      mt[T] = ArrayT\n    end\n    return ArrayT\n  end\n\n  local mtMulti = {}\n  local function createMulti(MultiArray, T, dimension)\n    local gt, gk = multiKey(mtMulti, T, dimension)\n    local ArrayT = gt[gk]\n    if ArrayT == nil then\n      local name = T.__name__ .. \"[\" .. (\",\"):rep(dimension - 1) .. \"]\"\n      ArrayT = defCore(name, \"C\", cls(T), true)\n      setmetatable(ArrayT, MultiArray)\n      gt[gk] = ArrayT\n    end\n    return ArrayT\n  end\n\n  return set(name, setmetatable(Array, {\n    __index = Object,\n    __call = function (Array, T, dimension)\n      if not dimension then\n        return create(Array, T)\n      else\n        return createMulti(MultiArray, T, dimension)\n      end\n    end\n  }))\nend\n\nlocal function trunc(num)\n  return num > 0 and floor(num) or ceil(num)\nend\n\nlocal function when(f, ...)\n  local ok, r = pcall(f, ...)\n  return ok and r\nend\n\nSystem = {\n  emptyFn = emptyFn,\n  falseFn = falseFn,\n  trueFn = trueFn,\n  identityFn = identityFn,\n  lengthFn = lengthFn,\n  zeroFn = zeroFn,\n  oneFn = oneFn,\n  equals = equals,\n  getCurrent = getCurrent,\n  try = try,\n  when = when,\n  throw = throw,\n  getClass = set,\n  multiKey = multiKey,\n  define = defCls,\n  defInf = defInf,\n  defStc = defStc,\n  defEnum = defEnum,\n  defArray = defArray,\n  enumMetatable = enumMetatable,\n  trunc = trunc,\n  global = global\n}\nif prevSystem then\n  setmetatable(System, { __index = prevSystem })\nend\nglobal.System = System\n\nlocal debugsetmetatable = debug and debug.setmetatable\nSystem.debugsetmetatable = debugsetmetatable\n\nlocal _, _, version = sfind(_VERSION, \"^Lua (.*)$\")\nversion = tonumber(version)\nSystem.luaVersion = version\n\nif version < 5.3 then\n  local bnot, band, bor, xor, sl, sr\n  local bit = rawget(global, \"bit\")\n  if not bit then\n    local ok, b = pcall(require, \"bit\")\n    if ok then\n      bit = b\n    end\n  end\n  if bit then\n    bnot, band, bor, xor, sl, sr = bit.bnot, bit.band, bit.bor, bit.bxor, bit.lshift, bit.rshift\n  else\n    local function disable()\n      throw(System.NotSupportedException(\"bit operation is not enabled.\"))\n    end\n    bnot, band, bor, xor, sl, sr  = disable, disable, disable, disable, disable, disable\n  end\n\n  System.bnot = bnot\n  System.band = band\n  System.bor = bor\n  System.xor = xor\n  System.sl = sl\n  System.sr = sr\n\n  function System.div(x, y) \n    if y == 0 then throw(System.DivideByZeroException(), 1) end\n    return trunc(x / y)\n  end\n\n  function System.mod(x, y)\n    if y == 0 then throw(System.DivideByZeroException(), 1) end\n    local v = x % y\n    if v ~= 0 and x * y < 0 then\n      return v - y\n    end\n    return v\n  end\n  \n  function System.modf(x, y)\n    local v = x % y\n    if v ~= 0 and x * y < 0 then\n      return v - y\n    end\n    return v\n  end\n\n  function System.toUInt(v, max, mask, checked)\n    if v >= 0 and v <= max then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    return band(v, mask)\n  end\n\n  function System.ToUInt(v, max, mask, checked)\n    v = trunc(v)\n    if v >= 0 and v <= max then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    if v < -2147483648 or v > 2147483647 then\n      return 0\n    end\n    return band(v, mask)\n  end\n\n  local function toInt(v, mask, umask)\n    v = band(v, mask)\n    local uv = band(v, umask)\n    if uv ~= v then\n      v = xor(uv - 1, umask)\n      if uv ~= 0 then\n        v = -v\n      end\n    end\n    return v\n  end\n\n  function System.toInt(v, min, max, mask, umask, checked)\n    if v >= min and v <= max then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    return toInt(v, mask, umask)\n  end\n\n  function System.ToInt(v, min, max, mask, umask, checked)\n    v = trunc(v)\n    if v >= min and v <= max then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    if v < -2147483648 or v > 2147483647 then\n      return 0\n    end\n    return toInt(v, mask, umask)\n  end\n\n  local function toUInt32(v)\n    if v <= -2251799813685248 or v >= 2251799813685248 then  -- 2 ^ 51, Lua BitOp used 51 and 52\n      throw(System.InvalidCastException()) \n    end\n    v = band(v, 0xffffffff)\n    local uv = band(v, 0x7fffffff)\n    if uv ~= v then\n      return uv + 0x80000000\n    end\n    return v\n  end\n\n  function System.toUInt32(v, checked)\n    if v >= 0 and v <= 4294967295 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    return toUInt32(v)\n  end\n\n  function System.ToUInt32(v, checked)\n    v = trunc(v)\n    if v >= 0 and v <= 4294967295 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    return toUInt32(v)\n  end\n\n  function System.toInt32(v, checked)\n    if v >= -2147483648 and v <= 2147483647 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    if v <= -2251799813685248 or v >= 2251799813685248 then  -- 2 ^ 51, Lua BitOp used 51 and 52\n      throw(System.InvalidCastException()) \n    end\n    return band(v, 0xffffffff)\n  end\n\n  function System.toInt64(v, checked) \n    if v >= -9223372036854775808 and v <= 9223372036854775807 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    throw(System.InvalidCastException()) -- 2 ^ 51, Lua BitOp used 51 and 52\n  end\n\n  function System.toUInt64(v, checked)\n    if v >= 0 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    if v >= -2147483648 then\n      return band(v, 0x7fffffff) + 0xffffffff80000000\n    end\n    throw(System.InvalidCastException()) \n  end\n\n  function System.ToUInt64(v, checked)\n    v = trunc(v)\n    if v >= 0 and v <= 18446744073709551615 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    if v >= -2147483648 and v <= 2147483647 then\n      v = band(v, 0xffffffff)\n      local uv = band(v, 0x7fffffff)\n      if uv ~= v then\n        return uv + 0xffffffff80000000\n      end\n      return v\n    end\n    throw(System.InvalidCastException()) \n  end\n\n  if table.pack == nil then\n    table.pack = function(...)\n      return { n = select(\"#\", ...), ... }\n    end\n  end\n\n  if table.unpack == nil then\n    table.unpack = assert(unpack)\n  end\n\n  if table.move == nil then\n    table.move = function(a1, f, e, t, a2)\n      if a2 == nil then a2 = a1 end\n      if t > f then\n        t = e - f + t\n        while e >= f do\n          a2[t] = a1[e]\n          t = t - 1\n          e = e - 1\n        end\n      else\n        while f <= e do\n          a2[t] = a1[f]\n          t = t + 1\n          f = f + 1\n        end\n      end\n    end\n  end\nelse\n  load[[\n  local System = System\n  local throw = System.throw\n  local trunc = System.trunc\n  \n  function System.bnot(x) return ~x end \n  function System.band(x, y) return x & y end\n  function System.bor(x, y) return x | y end\n  function System.xor(x, y) return x ~ y end\n  function System.sl(x, y) return x << y end\n  function System.sr(x, y) return x >> y end\n  function System.div(x, y) if x ~ y < 0 then return -(-x // y) end return x // y end\n\n  function System.mod(x, y)\n    local v = x % y\n    if v ~= 0 and 1.0 * x * y < 0 then\n      return v - y\n    end\n    return v\n  end\n\n  local function toUInt(v, max, mask, checked)  \n    if v >= 0 and v <= max then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 2) \n    end\n    return v & mask\n  end\n  System.toUInt = toUInt\n\n  function System.ToUInt(v, max, mask, checked)\n    v = trunc(v)\n    if v >= 0 and v <= max then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 2) \n    end\n    if v < -2147483648 or v > 2147483647 then\n      return 0\n    end\n    return v & mask\n  end\n  \n  local function toSingedInt(v, mask, umask)\n    v = v & mask\n    local uv = v & umask\n    if uv ~= v then\n      v = (uv - 1) ~ umask\n      if uv ~= 0 then\n        v = -v\n      end\n    end\n    return v\n  end\n  \n  local function toInt(v, min, max, mask, umask, checked)\n    if v >= min and v <= max then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 2) \n    end\n    return toSingedInt(v, mask, umask)\n  end\n  System.toInt = toInt\n  \n  function System.ToInt(v, min, max, mask, umask, checked)\n    v = trunc(v)\n    if v >= min and v <= max then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 2) \n    end\n    if v < -2147483648 or v > 2147483647 then\n      return 0\n    end\n    return toSingedInt(v, mask, umask)\n  end\n\n  function System.toUInt32(v, checked)\n    return toUInt(v, 4294967295, 0xffffffff, checked)\n  end\n  \n  function System.ToUInt32(v, checked)\n    v = trunc(v)\n    if v >= 0 and v <= 4294967295 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    return v & 0xffffffff\n  end\n  \n  function System.toInt32(v, checked)\n    return toInt(v, -2147483648, 2147483647, 0xffffffff, 0x7fffffff, checked)\n  end\n\n  function System.toInt64(v, checked)\n    return toInt(v, -9223372036854775808, 9223372036854775807, 0xffffffffffffffff, 0x7fffffffffffffff, checked)\n  end\n\n  function System.toUInt64(v, checked)\n    if v >= 0 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    return (v & 0x7fffffffffffffff) + 0x8000000000000000\n  end\n\n  function System.ToUInt64(v, checked)\n    v = trunc(v)\n    if v >= 0 and v <= 18446744073709551615 then\n      return v\n    end\n    if checked then\n      throw(System.OverflowException(), 1) \n    end\n    v = v & 0xffffffffffffffff\n    local uv = v & 0x7fffffffffffffff\n    if uv ~= v then\n      return uv + 0x8000000000000000\n    end\n    return v\n  end\n\n  ]]()\nend\n\nlocal toUInt = System.toUInt\nlocal toInt = System.toInt\nlocal ToUInt = System.ToUInt\nlocal ToInt = System.ToInt\n\nfunction System.toByte(v, checked)\n  return toUInt(v, 255, 0xff, checked)\nend\n\nfunction System.toSByte(v, checked)\n  return toInt(v, -128, 127, 0xff, 0x7f, checked)\nend\n\nfunction System.toInt16(v, checked)\n  return toInt(v, -32768, 32767, 0xffff, 0x7fff, checked)\nend\n\nfunction System.toUInt16(v, checked)\n  return toUInt(v, 65535, 0xffff, checked)\nend\n\nfunction System.ToByte(v, checked)\n  return ToUInt(v, 255, 0xff, checked)\nend\n\nfunction System.ToSByte(v, checked)\n  return ToInt(v, -128, 127, 0xff, 0x7f, checked)\nend\n\nfunction System.ToInt16(v, checked)\n  return ToInt(v, -32768, 32767, 0xffff, 0x7fff, checked)\nend\n\nfunction System.ToUInt16(v, checked)\n  return ToUInt(v, 65535, 0xffff, checked)\nend\n\nfunction System.ToInt32(v, checked)\n  v = trunc(v)\n  if v >= -2147483648 and v <= 2147483647 then\n    return v\n  end\n  if checked then\n    throw(System.OverflowException(), 1) \n  end\n  return -2147483648\nend\n\nfunction System.ToInt64(v, checked)\n  v = trunc(v)\n  if v >= -9223372036854775808 and v <= 9223372036854775807 then\n    return v\n  end\n  if checked then\n    throw(System.OverflowException(), 1) \n  end\n  return -9223372036854775808\nend\n\nfunction System.ToSingle(v, checked)\n  if v >= -3.40282347E+38 and v <= 3.40282347E+38 then\n    return v\n  end\n  if checked then\n    throw(System.OverflowException(), 1) \n  end\n  if v > 0 then\n    return 1 / 0 \n  else\n    return -1 / 0\n  end\nend\n\nfunction System.using(t, f)\n  local dispose = t and t.Dispose\n  if dispose ~= nil then\n    local ok, status, ret = xpcall(f, xpcallErr, t)   \n    dispose(t)\n    if not ok then\n      error(status)\n    end\n    return status, ret\n  else\n    return f(t)    \n  end\nend\n\nfunction System.usingX(f, ...)\n  local ok, status, ret = xpcall(f, xpcallErr, ...)\n  for i = 1, select(\"#\", ...) do\n    local t = select(i, ...)\n    if t ~= nil then\n      local dispose = t.Dispose\n      if dispose ~= nil then\n        dispose(t)\n      end\n    end\n  end\n  if not ok then\n    error(status)\n  end\n  return status, ret\nend\n\nfunction System.apply(t, f)\n  f(t)\n  return t\nend\n\nfunction System.default(T)\n  return T:default()\nend\n\nfunction System.property(name)\n  local function g(this)\n    return this[name]\n  end\n  local function s(this, v)\n    this[name] = v\n  end\n  return g, s\nend\n\nfunction System.new(cls, index, ...)\n  local this = setmetatable({}, cls)\n  return this, cls.__ctor__[index](this, ...)\nend\n\nfunction System.base(this)\n  return getmetatable(getmetatable(this))\nend\n\nlocal equalsObj, compareObj, toString\nif debugsetmetatable then\n  equalsObj = function (x, y)\n    if x == y then\n      return true\n    end\n    if x == nil or y == nil then\n      return false\n    end\n    local ix = x.EqualsObj\n    if ix ~= nil then\n      return ix(x, y)\n    end\n    local iy = y.EqualsObj\n    if iy ~= nil then\n      return iy(y, x)\n    end\n    return false\n  end\n\n  compareObj = function (a, b)\n    if a == b then return 0 end\n    if a == nil then return -1 end\n    if b == nil then return 1 end\n    local ia = a.CompareToObj\n    if ia ~= nil then\n      return ia(a, b)\n    end\n    local ib = b.CompareToObj\n    if ib ~= nil then\n      return -ib(b, a)\n    end\n    throw(System.ArgumentException(\"Argument_ImplementIComparable\"))\n  end\n\n  toString = function (t)\n    return t ~= nil and t:ToString() or \"\"\n  end\n\n  debugsetmetatable(nil, {\n    __concat = function(a, b)\n      if a == nil then\n        if b == nil then\n          return \"\"\n        else\n          return b\n        end\n      else\n        return a\n      end\n    end,\n    __add = function (a, b)\n      if a == nil then\n        if b == nil or type(b) == \"number\" then\n          return nil\n        end\n        return b\n      end\n      return nil\n    end,\n    __sub = nilFn,\n    __mul = nilFn,\n    __div = nilFn,\n    __mod = nilFn,\n    __unm = nilFn,\n    __lt = falseFn,\n    __le = falseFn,\n\n    -- lua 5.3\n    __idiv = nilFn,\n    __band = nilFn,\n    __bor = nilFn,\n    __bxor = nilFn,\n    __bnot = nilFn,\n    __shl = nilFn,\n    __shr = nilFn,\n  })\nelse\n  equalsObj = function (x, y)\n    if x == y then\n      return true\n    end\n    if x == nil or y == nil then\n      return false\n    end\n    local t = type(x)\n    if t == \"table\" then\n      local ix = x.EqualsObj\n      if ix ~= nil then\n        return ix(x, y)\n      end\n    elseif t == \"number\" then\n      return System.Number.EqualsObj(x, y)\n    end\n    t = type(y)\n    if t == \"table\" then\n      local iy = y.EqualsObj\n      if iy ~= nil then\n        return iy(y, x)\n      end\n    end\n    return false\n  end\n\n  compareObj = function (a, b)\n    if a == b then return 0 end\n    if a == nil then return -1 end\n    if b == nil then return 1 end\n    local t = type(a)\n    if t == \"number\" then\n      return System.Number.CompareToObj(a, b)\n    elseif t == \"boolean\" then\n      return System.Boolean.CompareToObj(a, b)\n    else\n      local ia = a.CompareToObj\n      if ia ~= nil then\n        return ia(a, b)\n      end\n    end\n    t = type(b)\n    if t == \"number\" then\n      return -System.Number.CompareToObj(b, a)\n    elseif t == \"boolean\" then\n      return -System.Boolean.CompareToObj(a, b)\n    else\n      local ib = b.CompareToObj\n      if ib ~= nil then\n        return -ib(b, a)\n      end\n    end\n    throw(System.ArgumentException(\"Argument_ImplementIComparable\"))\n  end\n\n  toString = function (obj)\n    if obj == nil then return \"\" end\n    local t = type(obj) \n    if t == \"table\" then\n      return obj:ToString()\n    elseif t == \"boolean\" then\n      return obj and \"True\" or \"False\"\n    elseif t == \"function\" then\n      return \"System.Delegate\"\n    end\n    return tostring(obj)\n  end\nend\n\nSystem.equalsObj = equalsObj\nSystem.compareObj = compareObj\nSystem.toString = toString\n\nObject = defCls(\"System.Object\", {\n  __call = new,\n  __ctor__ = emptyFn,\n  default = nilFn,\n  class = \"C\",\n  EqualsObj = equals,\n  ReferenceEquals = rawequal,\n  GetHashCode = identityFn,\n  EqualsStatic = equalsObj,\n  GetType = false,\n  ToString = function(this) return this.__name__ end\n})\nsetmetatable(Object, { __call = new })\n\nValueType = defCls(\"System.ValueType\", {\n  class = \"S\",\n  default = function(T) \n    return T()\n  end,\n  __clone__ = function(this)\n    if type(this) == \"table\" then\n      local cls = getmetatable(this)\n      local t = {}\n      for k, v in pairs(this) do\n        if type(v) == \"table\" and v.class == \"S\" then\n          t[k] = v:__clone__()\n        else\n          t[k] = v\n        end\n      end\n      return setmetatable(t, cls)\n    end\n    return this\n  end,\n  __copy__ = function (this, obj)\n    for k, v in pairs(obj) do\n      if type(v) == \"table\" and v.class == \"S\" then\n        this[k] = v:__clone__()\n      else\n        this[k] = v\n      end\n    end\n    for k, v in pairs(this) do\n      if v ~= nil and rawget(obj, k) == nil then\n        this[k] = nil\n      end\n    end\n  end,\n  EqualsObj = function (this, obj)\n    if getmetatable(this) ~= getmetatable(obj) then return false end\n    for k, v in pairs(this) do\n      if not equalsObj(v, obj[k]) then\n        return false\n      end\n    end\n    return true\n  end,\n  GetHashCode = function (this)\n    throw(System.NotSupportedException(this.__name__ .. \" User-defined struct not support GetHashCode\"), 1)\n  end\n})\n\nlocal AnonymousType\nAnonymousType = defCls(\"System.AnonymousType\", {\n  EqualsObj = function (this, obj)\n    if getmetatable(obj) ~= AnonymousType then return false end\n    for k, v in pairs(this) do\n      if not equalsObj(v, obj[k]) then\n        return false\n      end\n    end\n    return true\n  end\n})\n\nlocal function anonymousTypeCreate(T, t)\n  return setmetatable(t, T)\nend\n\nlocal anonymousTypeMetaTable = setmetatable({ __index = Object, __call = anonymousTypeCreate }, Object)\nsetmetatable(AnonymousType, anonymousTypeMetaTable)\n\nlocal pack, unpack = table.pack, table.unpack\n\nlocal function tupleDeconstruct(t) \n  return unpack(t, 1, t.n)\nend\n\nlocal function tupleEquals(t, other)\n  for i = 1, t.n do\n    if not equalsObj(t[i], other[i]) then\n      return false\n    end\n  end\n  return true\nend\n\nlocal function tupleEqualsObj(t, obj)\n  if getmetatable(obj) ~= getmetatable(t) or t.n ~= obj.n then\n    return false\n  end\n  return tupleEquals(t, obj)\nend\n\nlocal function tupleCompareTo(t, other)\n  for i = 1, t.n do\n    local v = compareObj(t[i], other[i])\n    if v ~= 0 then\n      return v\n    end\n  end\n  return 0\nend\n\nlocal function tupleCompareToObj(t, obj)\n  if obj == nil then return 1 end\n  if getmetatable(obj) ~= getmetatable(t) or t.n ~= obj.n then\n    throw(System.ArgumentException())\n  end\n  return tupleCompareTo(t, obj)\nend\n\nlocal function tupleToString(t)\n  local a = { \"(\" }\n  local count = 2\n  for i = 1, t.n do\n    if i ~= 1 then\n      a[count] = \", \"\n      count = count + 1\n    end\n    local v = t[i]\n    if v ~= nil then\n      a[count] = v:ToString()\n      count = count + 1\n    end\n  end\n  a[count] = \")\"\n  return tconcat(a)\nend\n\nlocal function tupleLength(t)\n  return t.n\nend\n\nlocal function tupleGet(t, index)\n  if index < 0 or index >= t.n then\n    throw(System.IndexOutOfRangeException())\n  end\n  return t[index + 1]\nend\n\nlocal function tupleGetRest(t)\n  return t[8]\nend\n\nlocal function tupleCreate(T, ...)\n  return setmetatable(pack(...), T)\nend\n\nlocal Tuple = defCls(\"System.Tuple\", {\n  Deconstruct = tupleDeconstruct,\n  ToString = tupleToString,\n  EqualsObj = tupleEqualsObj,\n  CompareToObj = tupleCompareToObj,\n  getLength = tupleLength,\n  get = tupleGet,\n  getRest = tupleGetRest\n})\nlocal tupleMetaTable = setmetatable({ __index  = Object, __call = tupleCreate }, Object)\nsetmetatable(Tuple, tupleMetaTable)\n\nlocal ValueTuple = defStc(\"System.ValueTuple\", {\n  Deconstruct = tupleDeconstruct,\n  ToString = tupleToString,\n  __eq = tupleEquals,\n  Equals = tupleEquals,\n  EqualsObj = tupleEqualsObj,\n  CompareTo = tupleCompareTo,\n  CompareToObj = tupleCompareToObj,\n  getLength = tupleLength,\n  get = tupleGet,\n  default = function ()\n    throw(System.NotSupportedException(\"not support default(T) when T is ValueTuple\"))\n  end\n})\nlocal valueTupleMetaTable = setmetatable({ __index  = ValueType, __call = tupleCreate }, ValueType)\nsetmetatable(ValueTuple, valueTupleMetaTable)\n\nlocal function recordEquals(t, other)\n  if getmetatable(t) == getmetatable(other) then\n    for k, v in pairs(t) do\n      if not equalsObj(v, other[k]) then\n        return false\n      end\n    end\n    return true\n  end\n  return false\nend\n\ndefCls(\"System.RecordType\", {\n  __eq = recordEquals,\n  __clone__ = function (this)\n    local cls = getmetatable(this)\n    local t = {}\n    for k, v in pairs(this) do\n      t[k] = v\n    end\n    return setmetatable(t, cls)\n  end,\n  Equals = recordEquals,\n  PrintMembers = function (this, builder)\n    local p = pack(this.__members__())\n    local n = p.n\n    for i = 2, n do\n      local k = p[i]\n      local v = this[k]\n      builder:Append(k)\n      builder:Append(\" = \")\n      if v ~= nil then\n        builder:Append(toString(v))\n      end\n      if i ~= n then\n        builder:Append(\", \")\n      end\n    end\n  end,\n  ToString = function (this)\n    local p = pack(this.__members__())\n    local n = p.n\n    local t = { p[1], \"{\" }\n    local count = 3\n    for i = 2, n do\n      local k = p[i]\n      local v = this[k]\n      t[count] = k\n      t[count + 1] = \"=\"\n      if v ~= nil then\n        if i ~= n then\n          t[count + 2] = toString(v) .. ','\n        else\n          t[count + 2] = toString(v)\n        end\n      else\n        if i ~= n then\n          t[count + 2] = ','\n        end\n      end\n      if v == nil and i == n then\n        count = count + 2\n      else\n        count = count + 3\n      end\n    end\n    t[count] = \"}\"\n    return tconcat(t, ' ')\n  end\n})\n\nlocal Attribute = defCls(\"System.Attribute\")\ndefCls(\"System.FlagsAttribute\", { base = { Attribute } })\n\nlocal Nullable = { \n  default = nilFn,\n  Value = function (this)\n    if this == nil then\n      throw(System.InvalidOperationException(\"Nullable object must have a value.\"))\n    end\n    return this\n  end,\n  EqualsObj = equalsObj,\n  GetHashCode = function (this)\n    if this == nil then\n      return 0\n    end\n    if type(this) == \"table\" then\n      return this:GetHashCode()\n    end\n    return this\n  end,\n  clone = function (t)\n    if type(t) == \"table\" then\n      return t:__clone__()\n    end\n    return t\n  end\n}\n\ndefStc(\"System.Nullable\", function (T)\n  return { \n    __genericT__ = T \n  }\nend, Nullable)\n\nfunction System.isNullable(T)\n  return getmetatable(T) == Nullable\nend\n\nlocal Index = defStc(\"System.Index\", {\n  End = -0.0,\n  Start = 0,\n  IsFromEnd = function (this)\n    return 1 / this < 0 \n  end,\n  GetOffset = function (this, length)\n    if 1 / this < 0 then\n      return length + this\n    end\n    return this\n  end,\n  ToString = function (this)\n    return ((1 / this < 0) and '^' or '') .. this\n  end\n})\nsetmetatable(Index, { \n  __call = function (value, fromEnd)\n    if value < 0 then\n      throw(System.ArgumentOutOfRangeException(\"Non-negative number required.\"))\n    end\n    if fromEnd then\n      if value == 0 then\n        return -0.0\n      end\n      return -value\n    end\n    return value\n  end\n})\n\nlocal function pointerAddress(p)\n  local address = p[3]\n  if address == nil then\n    address = ssub(tostring(p), 7)\n    p[3] = address\n  end\n  return address + p[2]\nend\n\nlocal Pointer\nlocal function newPointer(t, i)\n  return setmetatable({ t, i }, Pointer)\nend\n\nPointer = {\n  __index = false,\n  get = function(this)\n    local t, i = this[1], this[2]\n    return t[i]\n  end,\n  set = function(this, value)\n    local t, i = this[1], this[2]\n    t[i] = value\n  end,\n  __add = function(this, count)\n    return newPointer(this[1], this[2] + count)\n  end,\n  __sub = function(this, count)\n    return newPointer(this[1], this[2] - count)\n  end,\n  __lt = function(t1, t2)\n    return pointerAddress(t1) < pointerAddress(t2)\n  end,\n  __le = function(t1, t2)\n    return pointerAddress(t1) <= pointerAddress(t2)\n  end\n}\nPointer.__index = Pointer\n\nfunction System.stackalloc(t)\n  return newPointer(t, 1)\nend\n\nlocal modules, imports = {}, {}\nfunction System.import(f)\n  imports[#imports + 1] = f\nend\n\nlocal namespace\nlocal function defIn(kind, name, f)\n  local namespaceName, isClass = namespace[1], namespace[2]\n  if #namespaceName > 0 then\n    name = namespaceName .. (isClass and \"+\" or \".\") .. name\n  end\n  assert(modules[name] == nil, name)\n  namespace[1], namespace[2] = name, kind == \"C\" or kind == \"S\"\n  local t = f(assembly)\n  namespace[1], namespace[2] = namespaceName, isClass\n  modules[isClass and name:gsub(\"+\", \".\") or name] = function()\n    return def(name, kind, t)\n  end\nend\n\nnamespace = {\n  \"\",\n  false,\n  __index = false,\n  class = function(name, f) defIn(\"C\", name, f) end,\n  struct = function(name, f) defIn(\"S\", name, f) end,\n  interface = function(name, f) defIn(\"I\", name, f) end,\n  enum = function(name, f) defIn(\"E\", name, f) end,\n  namespace = function(name, f)\n    local namespaceName = namespace[1]\n    name = namespaceName .. \".\" .. name\n    namespace[1] = name\n    f(namespace)\n    namespace[1] = namespaceName\n  end\n}\nnamespace.__index = namespace\n\nfunction System.namespace(name, f)\n  if not assembly then assembly = setmetatable({}, namespace) end\n  namespace[1] = name\n  f(namespace)\n  namespace[1], namespace[2] = \"\", false\nend\n\nfunction System.init(t)\n  local path, files = t.path, t.files\n  if files then\n    path = (path and #path > 0) and (path .. '.') or \"\"\n    for i = 1, #files do\n      require(path .. files[i])\n    end\n  end\n\n  metadatas = {}\n  local types = t.types\n  if types then\n    local classes = {}\n    for i = 1, #types do\n      local name = types[i]\n      local cls = assert(modules[name], name)()\n      classes[i] = cls\n    end\n    assembly.classes = classes\n  end\n\n  for i = 1, #imports do\n    imports[i](global)\n  end\n\n  local b, e = 1, #metadatas\n  while true do\n    for i = b, e do\n      metadatas[i](global)\n    end\n    local len = #metadatas\n    if len == e then\n      break\n    end\n    b, e = e + 1, len\n  end\n\n  local main = t.Main\n  if main then\n    assembly.entryPoint = main\n    System.entryAssembly = assembly\n  end\n\n  local attributes = t.assembly\n  if attributes then\n    if type(attributes) == \"function\" then\n      attributes = attributes(global)\n    end\n    for k, v in pairs(attributes) do\n      assembly[k] = v\n    end\n  end\n\n  local current = assembly\n  modules, imports, assembly, metadatas = {}, {}, nil, nil\n  return current\nend\n\nSystem.config = rawget(global, \"CSharpLuaSystemConfig\") or {}\nlocal isSingleFile = rawget(global, \"CSharpLuaSingleFile\")\nif not isSingleFile then\n  return function (config)\n    if config then\n      System.config = config \n    end\n  end\nend\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Core.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 87416cb6b5e986a48ba26b5391e32fa3\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/DateTime.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal div = System.div\nlocal trunc = System.trunc\n\nlocal TimeSpan = System.TimeSpan\nlocal compare = TimeSpan.Compare\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal FormatException = System.FormatException\n\nlocal assert = assert\nlocal getmetatable = getmetatable\nlocal select = select\nlocal sformat = string.format\nlocal sfind = string.find\nlocal os = os\nlocal ostime = os.time\nlocal osdifftime = os.difftime\nlocal osdate = os.date\nlocal tonumber = tonumber\nlocal math = math\nlocal floor = math.floor\nlocal log10 = math.log10\nlocal modf = math.modf\n\n--http://referencesource.microsoft.com/#mscorlib/system/datetime.cs\nlocal DateTime\nlocal minValue\n\nlocal daysToMonth365 = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }\nlocal daysToMonth366 = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }\n\nlocal function isLeapYear(year) \n  if year < 1 or year > 9999 then \n    throw(ArgumentOutOfRangeException(\"year\", \"ArgumentOutOfRange_Year\"))\n  end\n  return year % 4 == 0 and (year % 100 ~= 0 or year % 400 == 0)\nend\n\nlocal function dateToTicks(year, month, day) \n  if year >= 1 and year <= 9999 and month >= 1 and month <= 12 then\n    local days = isLeapYear(year) and daysToMonth366 or daysToMonth365\n    if day >= 1 and day <= days[month + 1] - days[month] then\n      local y = year - 1\n      local n = y * 365 + div(y, 4) - div(y, 100) + div(y, 400) + days[month] + day - 1\n      return n * 864000000000\n    end\n  end\nend\n\nlocal function timeToTicks(hour, minute, second)\n  if hour >= 0 and hour < 24 and minute >= 0 and minute < 60 and second >=0 and second < 60 then \n    return (((hour * 60 + minute) * 60) + second) * 10000000\n  end\n  throw(ArgumentOutOfRangeException(\"ArgumentOutOfRange_BadHourMinuteSecond\"))\nend\n\nlocal function checkTicks(ticks)\n  if ticks < 0 or ticks > 3155378975999999999 then\n    throw(ArgumentOutOfRangeException(\"ticks\", \"ArgumentOutOfRange_DateTimeBadTicks\"))\n  end\nend\n\nlocal function checkKind(kind) \n  if kind and (kind < 0 or kind > 2) then\n    throw(ArgumentOutOfRangeException(\"kind\"))\n  end\nend\n\nlocal function addTicks(this, value)\n  return DateTime(this.ticks + value, this.kind)\nend\n\nlocal function addTimeSpan(this, ts)\n  return addTicks(this, ts.ticks)\nend\n\nlocal function add(this, value, scale)\n  local millis = trunc(value * scale + (value >= 0 and 0.5 or -0.5))\n  return addTicks(this, millis * 10000)\nend\n\nlocal function subtract(this, v) \n  if getmetatable(v) == DateTime then\n    return TimeSpan(this.ticks - v.ticks)\n  end\n  return DateTime(this.ticks - v.ticks, this.kind) \nend\n\nlocal function getDataPart(ticks, part)\n  local n = div(ticks, 864000000000)\n  local y400 = div(n, 146097)\n  n = n - y400 * 146097\n  local y100 = div(n, 36524)\n  if y100 == 4 then y100 = 3 end\n  n = n - y100 * 36524\n  local y4 = div(n, 1461)\n  n = n - y4 * 1461;\n  local y1 = div(n, 365)\n  if y1 == 4 then y1 = 3 end\n  if part == 0 then\n    return y400 * 400 + y100 * 100 + y4 * 4 + y1 + 1\n  end\n  n = n - y1 * 365\n  if part == 1 then return n + 1 end\n  local leapYear = y1 == 3 and (y4 ~= 24 or y100 == 3)\n  local days = leapYear and daysToMonth366 or daysToMonth365\n  local m = div(n, 32) + 1\n  while n >= days[m + 1] do m = m + 1 end\n  if part == 2 then return m end\n  return n - days[m] + 1\nend\n\nlocal function getDatePart(ticks)\n  local year, month, day\n  local n = div(ticks, 864000000000)\n  local y400 = div(n, 146097)\n  n = n - y400 * 146097\n  local y100 = div(n, 36524)\n  if y100 == 4 then y100 = 3 end\n  n = n - y100 * 36524\n  local y4 = div(n, 1461)\n  n = n - y4 * 1461\n  local y1 = div(n, 365)\n  if y1 == 4 then y1 = 3 end\n  year = y400 * 400 + y100 * 100 + y4 * 4 + y1 + 1\n  n = n - y1 * 365\n  local leapYear = y1 == 3 and (y4 ~= 24 or y100 == 3)\n  local days = leapYear and daysToMonth366 or daysToMonth365\n  local m = div(n, 32) + 1\n  while n >= days[m + 1] do m = m + 1 end\n  month = m\n  day = n - days[m] + 1\n  return year, month, day\nend\n\nlocal function daysInMonth(year, month)\n  if month < 1 or month > 12 then\n    throw(ArgumentOutOfRangeException(\"month\"))\n  end\n  local days = isLeapYear(year) and daysToMonth366 or daysToMonth365\n  return days[month + 1] - days[month]\nend\n\nlocal function addMonths(this, months)\n  if months < -120000 or months > 12000 then\n    throw(ArgumentOutOfRangeException(\"months\"))\n  end\n  local ticks = this.ticks\n  local y, m, d = getDatePart(ticks)\n  local i = m - 1 + months\n  if i >= 0 then\n    m = i % 12 + 1\n    y = y + div(i, 12)\n  else\n    m = 12 + (i + 1) % -12\n    y = y + div(i - 11, 12)\n  end\n  if y < 1 or y > 9999 then\n    throw(ArgumentOutOfRangeException(\"months\")) \n  end\n  local days = daysInMonth(y, m)\n  if d > days then d = days end\n  return DateTime(dateToTicks(y, m, d) + ticks % 864000000000, this.kind)\nend\n\nlocal function getTimeZone()\n  local date = osdate(\"*t\")\n  local dst = date.isdst\n  local now = ostime(date)\n  return osdifftime(now, ostime(osdate(\"!*t\", now))) * 10000000, dst and 3600 * 10000000 or 0 \nend\n\nlocal timeZoneTicks, dstTicks = getTimeZone()\n\nlocal time = System.config.time or ostime\nSystem.time = time\nSystem.currentTimeMillis = function () return trunc(time() * 1000) end\n\nlocal function now()\n  local seconds = time()\n  local ticks = seconds * 10000000 + timeZoneTicks + dstTicks + 621355968000000000\n  return DateTime(ticks, 2)\nend\n\nlocal function parse(s)\n  if s == nil then\n    return nil, 1\n  end\n  local i, j, year, month, day, hour, minute, second, milliseconds\n  i, j, year, month, day = sfind(s, \"^%s*(%d+)%s*/%s*(%d+)%s*/%s*(%d+)%s*\")\n  if i == nil then\n    return nil, 2\n  else\n    year, month, day = tonumber(year), tonumber(month), tonumber(day)\n  end\n  if j < #s then\n    i, j, hour, minute = sfind(s, \"^(%d+)%s*:%s*(%d+)\", j + 1)\n    if i == nil then\n      return nil, 2\n    else\n      hour, minute = tonumber(hour), tonumber(minute)\n    end\n    local next = j + 1\n    i, j, second = sfind(s, \"^:%s*(%d+)\", next)\n    if i == nil then\n      if sfind(s, \"^%s*$\", next) == nil then\n        return nil, 2\n      else\n        second = 0\n        milliseconds = 0\n      end\n    else\n      second = tonumber(second)\n      next = j + 1\n      i, j, milliseconds = sfind(s, \"^%.(%d+)%s*$\", next)\n      if i == nil then\n        if sfind(s, \"^%s*$\", next) == nil then\n          return nil, 2\n        else\n          milliseconds = 0\n        end\n      else\n        milliseconds = tonumber(milliseconds)\n        local n = floor(log10(milliseconds) + 1)\n        if n > 3 then\n          if n <= 7 then\n            milliseconds = milliseconds / (10 ^ (n - 3))\n          else\n            local ticks = milliseconds / (10 ^ (n - 7))\n            local _, decimal = modf(ticks)\n            if decimal > 0.5 then\n              ticks = ticks + 1\n            end\n            milliseconds = floor(ticks) / 10000\n          end\n        end\n      end\n    end\n  end\n  if hour == nil then\n    return DateTime(year, month, day)\n  end\n  return DateTime(year, month, day, hour, minute, second, milliseconds)\nend\n\nDateTime = System.defStc(\"System.DateTime\", {\n  ticks = 0,\n  kind = 0,\n  Compare = compare,\n  CompareTo = compare,\n  CompareToObj = function (this, t)\n    if t == nil then return 1 end\n    if getmetatable(t) ~= DateTime then\n      throw(ArgumentException(\"Arg_MustBeDateTime\"))\n    end\n    return compare(this, t)\n  end,\n  Equals = function (t1, t2)\n    return t1.ticks == t2.ticks\n  end,\n  EqualsObj = function (this, t)\n    if getmetatable(t) == DateTime then\n      return this.ticks == t.ticks\n    end\n    return false\n  end,\n  GetHashCode = function (this)\n    return this.ticks\n  end,\n  IsLeapYear = isLeapYear,\n  __ctor__ = function (this, ...)\n    local len = select(\"#\", ...)\n    if len == 0 then\n    elseif len == 1 then\n      local ticks = ...\n      checkTicks(ticks)\n      this.ticks = ticks\n    elseif len == 2 then\n      local ticks, kind = ...\n      checkTicks(ticks)\n      checkKind(kind)\n      this.ticks = ticks\n      this.kind = kind\n    elseif len == 3 then\n      this.ticks = dateToTicks(...)\n    elseif len == 6 then\n      local year, month, day, hour, minute, second = ...\n      this.ticks = dateToTicks(year, month, day) + timeToTicks(hour, minute, second)\n    elseif len == 7 then\n      local year, month, day, hour, minute, second, millisecond = ...\n      this.ticks = dateToTicks(year, month, day) + timeToTicks(hour, minute, second) + millisecond * 10000\n    elseif len == 8 then\n      local year, month, day, hour, minute, second, millisecond, kind = ...\n      checkKind(kind)\n      this.ticks = dateToTicks(year, month, day) + timeToTicks(hour, minute, second) + millisecond * 10000\n      this.kind = kind\n    else\n      assert(false)\n    end\n  end,\n  AddTicks = addTicks,\n  Add = addTimeSpan,\n  AddDays = function (this, days)\n    return add(this, days, 86400000)\n  end,\n  AddHours = function (this, hours)\n    return add(this, hours, 3600000)\n  end,\n  AddMinutes = function (this, minutes) \n    return add(this, minutes, 60000);\n  end,\n  AddSeconds = function (this, seconds)\n    return add(this, seconds, 1000)\n  end,\n  AddMilliseconds = function (this, milliseconds)\n    return add(this, milliseconds, 1)\n  end,\n  DaysInMonth = daysInMonth,\n  AddMonths = addMonths,\n  AddYears = function (this, years)\n    if years < - 10000 or years > 10000 then\n      throw(ArgumentOutOfRangeException(\"years\")) \n    end\n    return addMonths(this, years * 12)\n  end,\n  SpecifyKind = function (this, kind)\n    return DateTime(this.ticks, kind)\n  end,\n  Subtract = subtract,\n  getDay = function (this)\n    return getDataPart(this.ticks, 3)\n  end,\n  getDate = function (this)\n    local ticks = this.ticks\n    return DateTime(ticks - ticks % 864000000000, this.kind)\n  end,\n  getDayOfWeek = function (this)\n    return (div(this.ticks, 864000000000) + 1) % 7\n  end,\n  getDayOfYear = function (this)\n    return getDataPart(this.ticks, 1)\n  end,\n  getKind = function (this)\n    return this.kind\n  end,\n  getHour = TimeSpan.getHours,\n  getMinute = TimeSpan.getMinutes,\n  getSecond = TimeSpan.getSeconds,\n  getMillisecond = TimeSpan.getMilliseconds,\n  getMonth = function (this)\n    return getDataPart(this.ticks, 2)\n  end,\n  getYear = function (this)\n    return getDataPart(this.ticks, 0)\n  end,\n  getTimeOfDay = function (this)\n    return TimeSpan(this.ticks % 864000000000)\n  end,\n  getTicks = function (this)\n    return this.ticks\n  end,\n  BaseUtcOffset = TimeSpan(timeZoneTicks),\n  getUtcNow = function ()\n    local seconds = time()\n    local ticks = seconds * 10000000 + 621355968000000000\n    return DateTime(ticks, 1)\n  end,\n  getNow = now,\n  getToday = function ()\n    return now():getDate()\n  end,\n  ToLocalTime = function (this)\n    if this.kind == 2 then \n      return this\n    end\n    local ticks = this.ticks + timeZoneTicks + dstTicks\n    return DateTime(ticks, 2)\n  end,\n  ToUniversalTime = function (this)\n    if this.kind == 1 then\n      return this\n    end\n    local ticks = this.ticks - timeZoneTicks - dstTicks\n    return DateTime(ticks, 1)\n  end,\n  IsDaylightSavingTime = function(this)\n    return this.kind == 2 and dstTicks > 0\n  end,\n  ToString = function (this)\n    local year, month, day = getDatePart(this.ticks)\n    return sformat(\"%d/%d/%d %02d:%02d:%02d\", year, month, day, this:getHour(), this:getMinute(), this:getSecond())\n  end,\n  Parse = function (s)\n    local v, err = parse(s)\n    if v then\n      return v\n    end\n    if err == 1 then\n      throw(ArgumentNullException())\n    else\n      throw(FormatException())\n    end\n  end,\n  TryParse = function(s)\n    local v = parse(s)\n    if v then\n      return true, v\n    end\n    return false, minValue\n  end,\n  __add = addTimeSpan,\n  __sub = subtract,\n  __eq = TimeSpan.__eq,\n  __lt = TimeSpan.__lt,\n  __le = TimeSpan.__le,\n  base =  function(_, T)\n    return { System.IComparable, System.IComparable_1(T), System.IConvertible, System.IEquatable_1(T), System.IFormattable }\n  end,\n  default = function ()\n    return minValue\n  end,\n  MinValue = false,\n  MaxValue = false\n})\n\nminValue = DateTime(0)\nDateTime.MinValue = minValue\nDateTime.MaxValue = DateTime(3155378975999999999)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/DateTime.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 5d0c7552cbae5324c9a33be5db8e6125\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Delegate.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal Object = System.Object\nlocal debugsetmetatable = System.debugsetmetatable\nlocal ArgumentNullException = System.ArgumentNullException\n\nlocal setmetatable = setmetatable\nlocal assert = assert\nlocal select = select\nlocal type = type\nlocal unpack = table.unpack\nlocal tmove = table.move\n\nlocal Delegate\nlocal multicast\n\nlocal function appendFn(t, count, f)\n  if type(f) == \"table\" then\n    for i = 1, #f do\n      t[count] = f[i]\n      count = count + 1\n    end\n  else\n    t[count] = f\n    count = count + 1\n  end\n  return count\nend\n\nlocal function combineImpl(fn1, fn2)    \n  local t = setmetatable({}, multicast)\n  local count = 1\n  count = appendFn(t, count, fn1)\n  appendFn(t, count, fn2)\n  return t\nend\n\nlocal function combine(fn1, fn2)\n  if fn1 ~= nil then\n    if fn2 ~= nil then \n      return combineImpl(fn1, fn2) \n    end\n    return fn1 \n  end\n  if fn2 ~= nil then return fn2 end\n  return nil\nend\n\nlocal function equalsMulticast(fn1, fn2, start, count)\n  for i = 1, count do\n    if fn1[start + i] ~= fn2[i] then\n      return false\n    end\n  end\n  return true\nend\n\nlocal function delete(fn, count, deleteIndex, deleteCount)\n  local t =  setmetatable({}, multicast)\n  local len = 1\n  for i = 1, deleteIndex - 1 do\n    t[len] = fn[i]\n    len = len + 1\n  end\n  for i = deleteIndex + deleteCount, count do\n    t[len] = fn[i]\n    len = len + 1\n  end\n  return t\nend\n\nlocal function removeImpl(fn1, fn2) \n  if type(fn2) ~= \"table\" then\n    if type(fn1) ~= \"table\" then\n      if fn1 == fn2 then\n        return nil\n      end\n    else\n      local count = #fn1\n      for i = count, 1, -1 do\n        if fn1[i] == fn2 then\n          if count == 2 then\n            return fn1[3 - i]\n          else\n            return delete(fn1, count, i, 1)\n          end\n        end\n      end\n    end\n  elseif type(fn1) == \"table\" then\n    local count1, count2 = #fn1, # fn2\n    local diff = count1 - count2\n    for i = diff + 1, 1, -1 do\n      if equalsMulticast(fn1, fn2, i - 1, count2) then\n        if diff == 0 then \n          return nil\n        elseif diff == 1 then \n          return fn1[i ~= 1 and 1 or count1] \n        else\n          return delete(fn1, count1, i, count2)\n        end\n      end\n    end\n  end\n  return fn1\nend\n\nlocal function remove(fn1, fn2)\n  if fn1 ~= nil then\n    if fn2 ~= nil then\n      return removeImpl(fn1, fn2)\n    end\n    return fn1\n  end\n  return nil\nend\n\nlocal multiKey = System.multiKey\n\nlocal mt = {}\nlocal function makeGenericTypes(...)\n  local gt, gk = multiKey(mt, ...)\n  local t = gt[gk]\n  if t == nil then\n    t = setmetatable({ ... }, Delegate)\n    gt[gk] = t\n  end\n  return t\nend\n\nDelegate = System.define(\"System.Delegate\", {\n  __add = combine,\n  __sub = remove,\n  EqualsObj = System.equals,\n  Combine = combine,\n  Remove = remove,\n  RemoveAll = function (source, value)\n    local newDelegate\n    repeat\n      newDelegate = source\n      source = remove(source, value)\n    until newDelegate == source\n    return newDelegate\n  end,\n  DynamicInvoke = function (this, ...)\n    return this(...)\n  end,\n  GetType = function (this)\n    return System.typeof(Delegate)\n  end,\n  GetInvocationList = function (this)\n    local t\n    if type(this) == \"table\" then\n      t = {}\n      tmove(this, 1, #this, 1, t)\n    else\n      t = { this }\n    end\n    return System.arrayFromTable(t, Delegate)\n  end\n})\n\nlocal delegateMetaTable = setmetatable({ __index = Object, __call = makeGenericTypes }, Object)\nsetmetatable(Delegate, delegateMetaTable)\nif debugsetmetatable then\n  debugsetmetatable(System.emptyFn, Delegate)\n\n  function System.event(name)\n    local function a(this, v)\n      this[name] = this[name] + v\n    end\n    local function r(this, v)\n      this[name] = this[name] - v\n    end\n    return a, r\n  end\nelse\n  System.DelegateCombine = combine\n  System.DelegateRemove = remove\n\n  function System.event(name)\n    local function a(this, v)\n      this[name] = combine(this[name], v)\n    end\n    local function r(this, v)\n      this[name] = remove(this[name], v)\n    end\n    return a, r\n  end\nend\n\nmulticast = setmetatable({\n  __index = Delegate,\n  __add = combine,\n  __sub = remove,\n  __call = function (t, ...)\n    local result\n    for i = 1, #t do\n      result = t[i](...)\n    end\n    return result\n  end,\n  __eq = function (fn1, fn2)\n    local len1, len2 = #fn1, #fn2\n    if len1 ~= len2 then\n      return false\n    end\n    for i = 1, len1 do\n      if fn1[i] ~= fn2[i] then\n        return false\n      end\n    end\n    return true\n  end\n}, Delegate)\n\nfunction System.fn(target, method)\n  assert(method)\n  if target == nil then throw(ArgumentNullException()) end\n  local f = target[method]\n  if f == nil then\n    f = function (...)\n      return method(target, ...)\n    end\n    target[method] = f\n  end\n  return f\nend\n\nlocal binds = setmetatable({}, { __mode = \"k\" })\n\nfunction System.bind(f, n, ...)\n  assert(f)\n  local gt, gk = multiKey(binds, f, ...)\n  local fn = gt[gk]\n  if fn == nil then\n    local args = { ... }\n    fn = function (...)\n      local len = select(\"#\", ...)\n      if len == n then\n        return f(..., unpack(args))\n      else\n        assert(len > n)\n        local t = { ... }\n        for i = 1, #args do\n          local j = args[i]\n          if type(j) == \"number\" then\n            j = select(n + j, ...)\n            assert(j)\n          end\n          t[n + i] = j\n        end\n        return f(unpack(t, 1, n + #args))\n      end\n    end\n    gt[gk] = fn\n  end\n  return fn\nend\n\nlocal function bind(f, create, ...)\n  assert(f)\n  local gt, gk = multiKey(binds, f, create)\n  local fn = gt[gk]\n  if fn == nil then\n    fn = create(f, ...)\n    gt[gk] = fn\n  end\n  return fn\nend\n\nlocal function create1(f, a)\n  return function (...)\n    return f(..., a)\n  end\nend\n\nfunction System.bind1(f, a)\n  return bind(f, create1, a)\nend\n\nlocal function create2(f, a, b)\n  return function (...)\n    return f(..., a, b)\n  end\nend\n\nfunction System.bind2(f, a, b)\n  return bind(f, create2, a, b)\nend\n\nlocal function create3(f, a, b, c)\n  return function (...)\n    return f(..., a, b, c)\n  end\nend\n\nfunction System.bind3(f, a, b, c)\n return bind(f, create3, a, b, c)\nend\n\nlocal function create2_1(f)\n  return function(x1, x2, T1, T2)\n    return f(x1, x2, T2, T1)\n  end\nend\n\nfunction System.bind2_1(f)\n  return bind(f, create2_1) \nend\n\nlocal function create0_2(f)\n  return function(x1, x2, T1, T2)\n    return f(x1, x2, T2)\n  end\nend\n\nfunction System.bind0_2(f)\n  return bind(f, create0_2) \nend\n\nlocal EventArgs = System.define(\"System.EventArgs\")\nEventArgs.Empty = setmetatable({}, EventArgs)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Delegate.lua.meta",
    "content": "fileFormatVersion: 2\nguid: dd8640b062a392b408bb4b676a336bec\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Enum.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal Int = System.Int\nlocal Number = System.Number\nlocal band = System.band\nlocal bor = System.bor\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentException = System.ArgumentException\n\nlocal assert = assert\nlocal pairs = pairs\nlocal tostring = tostring\nlocal type = type\n\nlocal function toString(this, cls)\n  if this == nil then return \"\" end\n  if cls then\n    for k, v in pairs(cls) do\n      if v == this then\n        return k\n      end\n    end\n  end\n  return tostring(this)\nend\n\nlocal function hasFlag(this, flag)\n  if this == flag then\n    return true\n  end\n  return band(this, flag) ~= 0\nend\n\nNumber.EnumToString = toString\nNumber.HasFlag = hasFlag\nSystem.EnumToString = toString\nSystem.EnumHasFlag = hasFlag\n\nlocal function tryParseEnum(enumType, value, ignoreCase)\n  if enumType == nil then throw(ArgumentNullException(\"enumType\")) end\n  local cls = enumType[1] or enumType\n  if cls.class ~= \"E\" then throw(ArgumentException(\"Arg_MustBeEnum\")) end\n  if value == nil then\n    return\n  end\n  if ignoreCase then\n    value = value:lower()\n  end\n  local i, j, s, r = 1\n  while true do\n    i, j, s = value:find(\"%s*(%a+)%s*\", i)\n    if not i then\n      return\n    end\n    for k, v in pairs(cls) do\n      if ignoreCase then\n        k = k:lower()\n      end\n      if k == s then\n        if not r then\n          r = v\n        else\n          r = bor(r, v)\n        end\n        break\n      end\n    end\n    i = value:find(',', j + 1)\n    if not i then\n      break\n    end\n    i = i + 1\n  end\n  return r\nend\n\nSystem.define(\"System.Enum\", {\n  CompareToObj = Int.CompareToObj,\n  EqualsObj = Int.EqualsObj,\n  default = Int.default,\n  ToString = toString,\n  HasFlag = hasFlag,\n  GetName = function (enumType, value)\n    if enumType == nil then throw(ArgumentNullException(\"enumType\")) end\n    if value == nil then throw(ArgumentNullException(\"value\")) end\n    if not enumType:getIsEnum() then throw(ArgumentException(\"Arg_MustBeEnum\")) end\n    for k, v in pairs(enumType[1]) do\n      if v == value then\n        return k\n      end\n    end\n  end,\n  GetNames = function (enumType)\n    if enumType == nil then throw(ArgumentNullException(\"enumType\")) end\n    if not enumType:getIsEnum() then throw(ArgumentException(\"Arg_MustBeEnum\")) end\n    local t = {}\n    local count = 1\n    for k, v in pairs(enumType[1]) do\n      if type(v) == \"number\" then\n        t[count] = k\n        count = count + 1\n      end\n    end\n    return System.arrayFromTable(t, System.String)\n  end,\n  GetValues = function (enumType)\n    if enumType == nil then throw(ArgumentNullException(\"enumType\")) end\n    if not enumType:getIsEnum() then throw(ArgumentException(\"Arg_MustBeEnum\")) end\n    local t = {}\n    local count = 1\n    for k, v in pairs(enumType[1]) do\n      if type(v) == \"number\" then\n        t[count] = v\n        count = count + 1\n      end\n    end\n    return System.arrayFromTable(t, System.Int32)\n  end,\n  IsDefined = function (enumType, value)\n    if enumType == nil then throw(ArgumentNullException(\"enumType\")) end\n    if value == nil then throw(ArgumentNullException(\"value\")) end\n    if not enumType:getIsEnum() then throw(ArgumentException(\"Arg_MustBeEnum\")) end\n    local cls = enumType[1]\n    local t = type(value)\n    if t == \"string\" then\n      return cls[value] ~= nil\n    elseif t == \"number\" then\n      for k, v in pairs(cls) do\n        if v == value then\n          return true\n        end\n      end\n      return false\n    end\n    throw(System.InvalidOperationException())\n  end,\n  Parse = function (enumType, value, ignoreCase)\n    local result = tryParseEnum(enumType, value, ignoreCase)\n    if result == nil then\n      throw(ArgumentException(\"Requested value '\" .. value .. \"' was not found.\"))\n    end\n    return result\n  end,\n  TryParse = function (type, value, ignoreCase)\n    local result = tryParseEnum(type, value, ignoreCase)\n    if result == nil then\n      return false, 0\n    end\n    return true, result\n  end\n})\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Enum.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 81553c3618b10a14a853d14ccff36ef0\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Exception.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal Object = System.Object\n\nlocal tconcat = table.concat\nlocal type = type\nlocal debug = debug\n\nlocal function getMessage(this)\n  return this.message or (\"Exception of type '%s' was thrown.\"):format(this.__name__)\nend\n\nlocal traceback = (debug and debug.traceback) or System.config.traceback or function () return \"\" end\nSystem.traceback = traceback\n\nlocal function toString(this)\n  local t = { this.__name__ }\n  local count = 2\n  local message, innerException, stackTrace = getMessage(this), this.innerException, this.errorStack\n  t[count] = \": \"\n  t[count + 1] = message\n  count = count + 2\n  if innerException then\n    t[count] = \"---> \"\n    t[count + 1] = innerException:ToString()\n    count = count + 2\n  end\n  if stackTrace then\n    t[count] = stackTrace\n  end\n  return tconcat(t)\nend\n\nlocal function ctorOfException(this, message, innerException)\n  this.message = message\n  this.innerException = innerException\nend\n\nlocal Exception = define(\"System.Exception\", {\n  __tostring = toString,\n  __ctor__ = ctorOfException,\n  ToString = toString,\n  getMessage = getMessage,\n  getInnerException = function(this) \n    return this.innerException\n  end,\n  getStackTrace = function(this) \n    return this.errorStack\n  end,\n  getData = function (this)\n    local data = this.data\n    if not data then\n      data = System.Dictionary(Object, Object)()\n      this.data = data\n    end\n    return data\n  end,\n  traceback = function(this, lv)\n    this.errorStack = traceback(\"\", lv and lv + 3 or 3)\n  end\n})\n\nlocal SystemException = define(\"System.SystemException\", {\n  __tostring = toString,\n  base = { Exception },\n  __ctor__ = function (this, message, innerException)\n    ctorOfException(this, message or \"System error.\", innerException)\n  end\n})\n\nlocal ArgumentException = define(\"System.ArgumentException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, paramName, innerException)\n    if type(paramName) == \"table\" then\n      paramName, innerException = nil, paramName\n    end\n    ctorOfException(this, message or \"Value does not fall within the expected range.\", innerException)\n    this.paramName = paramName\n    if paramName and #paramName > 0 then\n      this.message = this.message .. \"\\nParameter name: \" .. paramName\n    end\n  end,\n  getParamName = function(this) \n    return this.paramName\n  end\n})\n\ndefine(\"System.ArgumentNullException\", {\n  __tostring = toString,\n  base = { ArgumentException },\n  __ctor__ = function(this, paramName, message, innerException) \n    ArgumentException.__ctor__(this, message or \"Value cannot be null.\", paramName, innerException)\n  end\n})\n\ndefine(\"System.ArgumentOutOfRangeException\", {\n  __tostring = toString,\n  base = { ArgumentException },\n  __ctor__ = function(this, paramName, message, innerException, actualValue) \n    ArgumentException.__ctor__(this, message or \"Specified argument was out of the range of valid values.\", paramName, innerException)\n    this.actualValue = actualValue\n  end,\n  getActualValue = function(this) \n    return this.actualValue\n  end\n})\n\ndefine(\"System.IndexOutOfRangeException\", {\n   __tostring = toString,\n   base = { SystemException },\n   __ctor__ = function (this, message, innerException)\n    ctorOfException(this, message or \"Index was outside the bounds of the array.\", innerException)\n  end\n})\n\ndefine(\"System.CultureNotFoundException\", {\n  __tostring = toString,\n  base = { ArgumentException },\n  __ctor__ = function(this, paramName, invalidCultureName, message, innerException, invalidCultureId) \n    if not message then \n      message = \"Culture is not supported.\"\n      if paramName then\n        message = message .. \"\\nParameter name = \" .. paramName\n      end\n      if invalidCultureName then\n        message = message .. \"\\n\" .. invalidCultureName .. \" is an invalid culture identifier.\"\n      end\n    end\n    ArgumentException.__ctor__(this, message, paramName, innerException)\n    this.invalidCultureName = invalidCultureName\n    this.invalidCultureId = invalidCultureId\n  end,\n  getInvalidCultureName = function(this)\n    return this.invalidCultureName\n  end,\n  getInvalidCultureId = function(this) \n    return this.invalidCultureId\n  end\n})\n\nlocal KeyNotFoundException = define(\"System.Collections.Generic.KeyNotFoundException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"The given key was not present in the dictionary.\", innerException)\n  end\n})\nSystem.KeyNotFoundException = KeyNotFoundException\n\nlocal ArithmeticException = define(\"System.ArithmeticException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"Overflow or underflow in the arithmetic operation.\", innerException)\n  end\n})\n\ndefine(\"System.DivideByZeroException\", {\n  __tostring = toString,\n  base = { ArithmeticException },\n  __ctor__ = function(this, message, innerException) \n    ArithmeticException.__ctor__(this, message or \"Attempted to divide by zero.\", innerException)\n  end\n})\n\ndefine(\"System.OverflowException\", {\n  __tostring = toString,\n  base = { ArithmeticException },\n  __ctor__ = function(this, message, innerException) \n    ArithmeticException.__ctor__(this, message or \"Arithmetic operation resulted in an overflow.\", innerException)\n  end\n})\n\ndefine(\"System.FormatException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"Invalid format.\", innerException)\n  end\n})\n\ndefine(\"System.InvalidCastException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"Specified cast is not valid.\", innerException)\n  end\n})\n\nlocal InvalidOperationException = define(\"System.InvalidOperationException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"Operation is not valid due to the current state of the object.\", innerException)\n  end\n})\n\ndefine(\"System.NotImplementedException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"The method or operation is not implemented.\", innerException)\n  end\n})\n\ndefine(\"System.NotSupportedException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"Specified method is not supported.\", innerException)\n  end\n})\n\ndefine(\"System.NullReferenceException\", {\n  __tostring = toString,\n  base = { SystemException },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"Object reference not set to an instance of an object.\", innerException)\n  end\n})\n\ndefine(\"System.RankException\", {\n  __tostring = toString,\n  base = { Exception },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"Attempted to operate on an array with the incorrect number of dimensions.\", innerException)\n  end\n})\n\ndefine(\"System.TypeLoadException\", {\n  __tostring = toString,\n  base = { Exception },\n  __ctor__ = function(this, message, innerException) \n    ctorOfException(this, message or \"Failed when load type.\", innerException)\n  end\n})\n\ndefine(\"System.ObjectDisposedException\", {\n  __tostring = toString,\n  base = { InvalidOperationException },\n  __ctor__ = function(this, objectName, message, innerException)\n    ctorOfException(this, message or \"Cannot access a disposed object.\", innerException)\n    this.objectName = objectName\n    if objectName and #objectName > 0 then\n      this.message = this.message .. \"\\nObject name: '\" .. objectName .. \"'.\"\n    end\n  end\n})\n\nlocal function toStringOfAggregateException(this)\n  local t = { toString(this) }\n  local count = 2\n  for i = 0, this.innerExceptions:getCount() - 1 do\n    t[count] = \"\\n---> (Inner Exception #\"\n    t[count + 1] = i\n    t[count + 2] = \") \"\n    t[count + 3] = this.innerExceptions:get(i):ToString()\n    t[count + 4] = \"<---\\n\"\n    count = count + 5\n  end\n  return tconcat(t)\nend\n\ndefine(\"System.AggregateException\", {\n  ToString = toStringOfAggregateException,\n  __tostring = toStringOfAggregateException,\n  base = { Exception },\n  __ctor__ = function (this, message, innerExceptions)\n    if type(message) == \"table\" then\n      message, innerExceptions = nil, message\n    end\n    Exception.__ctor__(this, message or \"One or more errors occurred.\")\n    local ReadOnlyCollection = System.ReadOnlyCollection(Exception)\n    if innerExceptions then\n      if System.is(innerExceptions, Exception) then\n        local list = System.List(Exception)()\n        list:Add(innerExceptions)\n        this.innerExceptions = ReadOnlyCollection(list)\n      else\n        if not System.isArrayLike(innerExceptions) then\n          innerExceptions = System.Array.toArray(innerExceptions)\n        end\n        this.innerExceptions = ReadOnlyCollection(innerExceptions)\n      end\n    else\n      this.innerExceptions = ReadOnlyCollection(System.Array.Empty(Exception))\n    end\n  end,\n  getInnerExceptions = function (this)\n    return this.innerExceptions\n  end\n})\n\nSystem.SwitchExpressionException = define(\"System.Runtime.CompilerServices\", {\n  __tostring = toString,\n  base = { InvalidOperationException },\n  __ctor__ = function(this, message, innerException)\n    ctorOfException(this, message or \"Non-exhaustive switch expression failed to match its input.\", innerException)\n  end\n})\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Exception.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 06bacb731a81a8442b212c8972952f18\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/IO/File.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal io = io\nif io then\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal each = System.each\n\nlocal open = io.open\nlocal remove = os.remove\n\nlocal IOException = define(\"System.IO.IOException\", {\n  __tostring = System.Exception.ToString,\n  base = { System.Exception },\n  __ctor__ = function(this, message, innerException) \n    System.Exception.__ctor__(this, message or \"I/O error occurred.\", innerException)\n  end,\n})\n\nlocal function openFile(path, mode)\n  local f, err = open(path, mode)\n  if f == nil then\n    throw(IOException(err))\n  end\n  return f\nend\n\nlocal function readAll(path, mode)\n  local f = openFile(path, mode)\n  local bytes = f:read(\"*all\")\n  f:close()\n  return bytes\nend\n\nlocal function writeAll(path, contents, mode)\n  local f = openFile(path, mode)\n  f:write(contents)\n  f:close()\nend\n\ndefine(\"System.IO.File\", {\n  ReadAllBytes = function (path)\n    return readAll(path, \"rb\")\n  end,\n  ReadAllText = function (path)\n    return readAll(path, \"r\")\n  end,\n  ReadAllLines = function (path)\n    local t = {}\n    local count = 1\n    for line in io.lines(path) do\n      t[count] = line\n      count = count + 1\n    end\n    return System.arrayFromTable(t, System.String)\n  end,  \n  WriteAllBytes = function (path, contents)\n    writeAll(path, contents, \"wb\")\n  end,\n  WriteAllText = function (path, contents)\n    writeAll(path, contents, \"w\")\n  end,\n  WriteAllLines = function (path, contents)\n    local f = openFile(path, \"w\")\n    for _, line in each(contents) do\n      if line == nil then\n        f:write(\"\\n\")\n      else\n        f:write(line, \"\\n\")\n      end\n    end\n    f:close()\n  end,\n  Exists = function (path)\n    local file = io.open(path, \"rb\")\n    if file then file:close() end\n    return file ~= nil\n  end,\n  Delete = function (path)\n    local ok, err = remove(path)\n    if not ok then\n      throw(IOException(err))\n    end\n  end\n})\n\nend\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/IO/File.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 7f24d0b1606f2a14685f4fa7e9121232\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/IO.meta",
    "content": "fileFormatVersion: 2\nguid: 8dbc6ed8a3af14d448e678d22a14d94d\nfolderAsset: yes\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Interfaces.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal defInf = System.defInf\nlocal emptyFn = System.emptyFn\n\nlocal IComparable = defInf(\"System.IComparable\")\nlocal IFormattable = defInf(\"System.IFormattable\")\nlocal IConvertible = defInf(\"System.IConvertible\")\ndefInf(\"System.IFormatProvider\")\ndefInf(\"System.ICloneable\")\n\ndefInf(\"System.IComparable_1\", emptyFn)\ndefInf(\"System.IEquatable_1\", emptyFn)\n\ndefInf(\"System.IPromise\")\ndefInf(\"System.IDisposable\")\n\nlocal IEnumerable = defInf(\"System.IEnumerable\")\nlocal IEnumerator = defInf(\"System.IEnumerator\")\n\nlocal ICollection = defInf(\"System.ICollection\", {\n  base = { IEnumerable }\n})\n\ndefInf(\"System.IList\", {\n  base = { ICollection }\n})\n\ndefInf(\"System.IDictionary\", {\n  base = { ICollection }\n})\n\ndefInf(\"System.IEnumerator_1\", function(T) \n  return {\n    base = { IEnumerator }\n  }\nend)\n\nlocal IEnumerable_1 = defInf(\"System.IEnumerable_1\", function(T) \n  return {\n    base = { IEnumerable }\n  }\nend)\n\nlocal ICollection_1 = defInf(\"System.ICollection_1\", function(T) \n  return { \n    base = { IEnumerable_1(T) } \n  }\nend)\n\nlocal IReadOnlyCollection_1 = defInf(\"System.IReadOnlyCollection_1\", function (T)\n  return { \n    base = { IEnumerable_1(T) } \n  }\nend)\n\ndefInf(\"System.IReadOnlyList_1\", function (T)\n  return { \n    base = { IReadOnlyCollection_1(T) } \n  }\nend)\n\ndefInf('System.IDictionary_2', function(TKey, TValue) \n  return {\n    base = { ICollection_1(System.KeyValuePair(TKey, TValue)) }\n  }\nend)\n\ndefInf(\"System.IReadOnlyDictionary_2\", function(TKey, TValue) \n  return {\n    base = { IReadOnlyCollection_1(System.KeyValuePair(TKey, TValue)) }\n  }\nend)\n\ndefInf(\"System.IList_1\", function(T) \n  return {\n    base = { ICollection_1(T) }\n  }\nend)\n\ndefInf(\"System.ISet_1\", function(T) \n  return {\n    base = { ICollection_1(T) }\n  }\nend)\n\ndefInf(\"System.IComparer\")\ndefInf(\"System.IComparer_1\", emptyFn)\ndefInf(\"System.IEqualityComparer\")\ndefInf(\"System.IEqualityComparer_1\", emptyFn)\n\nSystem.enumMetatable.interface = { IComparable, IFormattable, IConvertible }\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Interfaces.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 1c03169af44be8445afa781e14cd3d47\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Math.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal trunc = System.trunc\n\nlocal math = math\nlocal floor = math.floor\nlocal min = math.min\nlocal max = math.max\nlocal abs = math.abs\n\nlocal function bigMul(a, b)\n  return a * b\nend\n\nlocal function divRem(a, b)\n  local remainder = a % b\n  return (a - remainder) / b, remainder\nend\n\nlocal function round(value, digits, mode)\n  local mult = 10 ^ (digits or 0)\n  local i = value * mult\n  if mode == 1 then\n    value = trunc(i + (value >= 0 and 0.5 or -0.5))\n  else\n    value = trunc(i)\n    if value ~= i then\n      local dif = i - value\n      if value >= 0 then\n        if dif > 0.5 or (dif == 0.5 and value % 2 ~= 0) then\n          value = value + 1  \n        end\n      else\n        if dif < -0.5 or (dif == -0.5 and value % 2 ~= 0) then\n          value = value - 1  \n        end\n      end\n    end\n  end\n  return value / mult\nend\n\nlocal function sign(v)\n  return v == 0 and 0 or (v > 0 and 1 or -1) \nend\n\nlocal function IEEERemainder(x, y)\n  if x ~= x then\n    return x\n  end\n  if y ~= y then\n    return y\n  end\n  local regularMod = System.mod(x, y)\n  if regularMod ~= regularMod then\n    return regularMod\n  end\n  if regularMod == 0 and x < 0 then\n    return -0.0\n  end\n  local alternativeResult = regularMod - abs(y) * sign(x)\n  local i, j = abs(alternativeResult), abs(regularMod)\n  if i == j then\n    local divisionResult = x / y\n    local roundedResult = round(divisionResult)\n    if abs(roundedResult) > abs(divisionResult) then\n      return alternativeResult\n    else\n      return regularMod\n    end\n  end\n  if i < j then\n    return alternativeResult\n  else\n    return regularMod\n  end\nend\n\nlocal function clamp(a, b, c)\n  return min(max(a, b), c)\nend\n\nlocal function truncate(d)\n  return trunc(d) * 1.0\nend\n\nlocal exp = math.exp\nlocal cosh = math.cosh or function(x) return (exp(x) + exp(-x)) / 2.0 end\nlocal pow = math.pow or function(x, y) return x ^ y end\nlocal sinh = math.sinh or function(x) return (exp(x) - exp(-x)) / 2.0 end\nlocal tanh = math.tanh or function(x) return sinh(x) / cosh(x) end\n\nlocal Math = math\nMath.Abs = abs\nMath.Acos = math.acos\nMath.Asin = math.asin\nMath.Atan = math.atan\nMath.Atan2 = math.atan2 or math.atan\nMath.BigMul = bigMul\nMath.Ceiling = math.ceil\nMath.Clamp = clamp\nMath.Cos = math.cos\nMath.Cosh = cosh\nMath.DivRem = divRem\nMath.Exp = exp\nMath.Floor = math.floor\nMath.IEEERemainder = IEEERemainder\nMath.Log = math.log\nMath.Log10 = math.log10\nMath.Max = math.max\nMath.Min = math.min\nMath.Pow = pow\nMath.Round = round\nMath.Sign = sign\nMath.Sin = math.sin\nMath.Sinh = sinh\nMath.Sqrt = math.sqrt\nMath.Tan = math.tan\nMath.Tanh = tanh\nMath.Truncate = truncate\n\nSystem.define(\"System.Math\", Math)"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Math.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 1af4aec83bd8a5e46a73731c06f0d5ca\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Number.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal define = System.defStc\nlocal equals = System.equals\nlocal zeroFn = System.zeroFn\nlocal identityFn = System.identityFn\nlocal debugsetmetatable = System.debugsetmetatable\n\nlocal IComparable = System.IComparable\nlocal IComparable_1 = System.IComparable_1\nlocal IEquatable_1 = System.IEquatable_1\nlocal IConvertible = System.IConvertible\nlocal IFormattable = System.IFormattable\n\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal FormatException = System.FormatException\nlocal OverflowException = System.OverflowException\n\nlocal type = type\nlocal tonumber = tonumber\nlocal floor = math.floor\nlocal setmetatable = setmetatable\nlocal tostring = tostring\n\nlocal function hexForamt(x, n)\n  return n == \"\" and \"%\" .. x or \"%0\" .. n .. x\nend\n\nlocal function floatForamt(x, n)\n  return n == \"\" and \"%.f\" or \"%.\" .. n .. 'f'\nend\n\nlocal function integerFormat(x, n)\n  return n == \"\" and \"%d\" or \"%0\" .. n .. 'd'\nend\n\nlocal function exponentialFormat(x, n)\n  return n == \"\" and \"%\" .. x or \"%.\" .. n .. x\nend\n\nlocal formats = {\n  ['x'] = hexForamt,\n  ['X'] = hexForamt,\n  ['f'] = floatForamt,\n  ['F'] = floatForamt,\n  ['d'] = integerFormat,\n  ['D'] = integerFormat,\n  ['e'] = exponentialFormat,\n  ['E'] = exponentialFormat\n}\n\nlocal function toStringWithFormat(this, format)\n  if #format ~= 0 then\n    local i, j, x, n = format:find(\"^%s*([xXdDfFeE])(%d?)%s*$\")\n    if i then\n      local f = formats[x]\n      if f then\n        format = f(x, n)\n      end\n      return format:format(this)\n    end\n  end\n  return tostring(this)\nend\n\nlocal function toString(this, format)\n  if format then\n    return toStringWithFormat(this, format)\n  end\n  return tostring(this)\nend\n\nlocal function compareInt(this, v)\n  if this < v then return -1 end\n  if this > v then return 1 end\n  return 0\nend\n\nlocal function inherits(_, T)\n  return { IComparable, IComparable_1(T), IEquatable_1(T), IConvertible, IFormattable }\nend\n\nlocal Int = define(\"System.Int\", {\n  base = inherits,\n  default = zeroFn,\n  CompareTo = compareInt,\n  Equals = equals,\n  ToString = toString,\n  GetHashCode = identityFn,\n  CompareToObj = function (this, v)\n    if v == nil then return 1 end\n    if type(v) ~= \"number\" then\n      throw(ArgumentException(\"Arg_MustBeInt\"))\n    end\n    return compareInt(this, v)\n  end,\n  EqualsObj = function (this, v)\n    if type(v) ~= \"number\" then\n      return false\n    end\n    return this == v\n  end\n})\nInt.__call = zeroFn\n\nlocal function parseInt(s, min, max)\n  if s == nil then\n    return nil, 1        \n  end\n  local v = tonumber(s)\n  if v == nil or v ~= floor(v) then\n    return nil, 2\n  end\n  if v < min or v > max then\n    return nil, 3\n  end\n  return v\nend\n\nlocal function tryParseInt(s, min, max)\n  local v = parseInt(s, min, max)\n  if v then\n    return true, v\n  end\n  return false, 0\nend\n\nlocal function parseIntWithException(s, min, max)\n  local v, err = parseInt(s, min, max)\n  if v then\n    return v    \n  end\n  if err == 1 then\n    throw(ArgumentNullException())\n  elseif err == 2 then\n    throw(FormatException())\n  else\n    throw(OverflowException())\n  end\nend\n\nlocal SByte = define(\"System.SByte\", {\n  Parse = function (s)\n    return parseIntWithException(s, -128, 127)\n  end,\n  TryParse = function (s)\n    return tryParseInt(s, -128, 127)\n  end\n})\nsetmetatable(SByte, Int)\n\nlocal Byte = define(\"System.Byte\", {\n  Parse = function (s)\n    return parseIntWithException(s, 0, 255)\n  end,\n  TryParse = function (s)\n    return tryParseInt(s, 0, 255)\n  end\n})\nsetmetatable(Byte, Int)\n\nlocal Int16 = define(\"System.Int16\", {\n  Parse = function (s)\n    return parseIntWithException(s, -32768, 32767)\n  end,\n  TryParse = function (s)\n    return tryParseInt(s, -32768, 32767)\n  end\n})\nsetmetatable(Int16, Int)\n\nlocal UInt16 = define(\"System.UInt16\", {\n  Parse = function (s)\n    return parseIntWithException(s, 0, 65535)\n  end,\n  TryParse = function (s)\n    return tryParseInt(s, 0, 65535)\n  end\n})\nsetmetatable(UInt16, Int)\n\nlocal Int32 = define(\"System.Int32\", {\n  Parse = function (s)\n    return parseIntWithException(s, -2147483648, 2147483647)\n  end,\n  TryParse = function (s)\n    return tryParseInt(s, -2147483648, 2147483647)\n  end\n})\nsetmetatable(Int32, Int)\n\nlocal UInt32 = define(\"System.UInt32\", {\n  Parse = function (s)\n    return parseIntWithException(s, 0, 4294967295)\n  end,\n  TryParse = function (s)\n    return tryParseInt(s, 0, 4294967295)\n  end\n})\nsetmetatable(UInt32, Int)\n\nlocal Int64 = define(\"System.Int64\", {\n  Parse = function (s)\n    return parseIntWithException(s, -9223372036854775808, 9223372036854775807)\n  end,\n  TryParse = function (s)\n    return tryParseInt(s, -9223372036854775808, 9223372036854775807)\n  end\n})\nsetmetatable(Int64, Int)\n\nlocal UInt64 = define(\"System.UInt64\", {\n  Parse = function (s)\n    return parseIntWithException(s, 0, 18446744073709551615.0)\n  end,\n  TryParse = function (s)\n    return tryParseInt(s, 0, 18446744073709551615.0)\n  end\n})\nsetmetatable(UInt64, Int)\n\nlocal nan = 0 / 0\nlocal posInf = 1 / 0\nlocal negInf = - 1 / 0\nlocal nanHashCode = {}\n\n--http://lua-users.org/wiki/InfAndNanComparisons\nlocal function isNaN(v)\n  return v ~= v\nend\n\nlocal function compareDouble(this, v)\n  if this < v then return -1 end\n  if this > v then return 1 end\n  if this == v then return 0 end\n  if isNaN(this) then\n    return isNaN(v) and 0 or -1\n  else \n    return 1\n  end\nend\n\nlocal function equalsDouble(this, v)\n  if this == v then return true end\n  return isNaN(this) and isNaN(v)\nend\n\nlocal function equalsObj(this, v)\n  if type(v) ~= \"number\" then\n    return false\n  end\n  return equalsDouble(this, v)\nend\n\nlocal function getHashCode(this)\n  return isNaN(this) and nanHashCode or this\nend\n\nlocal Number = define(\"System.Number\", {\n  base = inherits,\n  default = zeroFn,\n  CompareTo = compareDouble,\n  Equals = equalsDouble,\n  ToString = toString,\n  NaN = nan,\n  IsNaN = isNaN,\n  NegativeInfinity = negInf,\n  PositiveInfinity = posInf,\n  EqualsObj = equalsObj,\n  GetHashCode = getHashCode,\n  CompareToObj = function (this, v)\n    if v == nil then return 1 end\n    if type(v) ~= \"number\" then\n      throw(ArgumentException(\"Arg_MustBeNumber\"))\n    end\n    return compareDouble(this, v)\n  end,\n  IsFinite = function (v)\n    return v ~= posInf and v ~= negInf and not isNaN(v)\n  end,\n  IsInfinity = function (v)\n    return v == posInf or v == negInf\n  end,\n  IsNegativeInfinity = function (v)\n    return v == negInf\n  end,\n  IsPositiveInfinity = function (v)\n    return v == posInf\n  end\n})\nNumber.__call = zeroFn\nif debugsetmetatable then\n  debugsetmetatable(0, Number)\nend\n\nlocal function parseDouble(s)\n  if s == nil then\n    return nil, 1\n  end\n  local v = tonumber(s)\n  if v == nil then\n    return nil, 2\n  end\n  return v\nend\n\nlocal function parseDoubleWithException(s)\n  local v, err = parseDouble(s)\n  if v then\n    return v    \n  end\n  if err == 1 then\n    throw(ArgumentNullException())\n  else\n    throw(FormatException())\n  end\nend\n\nlocal Single = define(\"System.Single\", {\n  Parse = function (s)\n    local v = parseDoubleWithException(s)\n    if v < -3.40282347E+38 or v > 3.40282347E+38 then\n      throw(OverflowException())\n    end\n    return v\n  end,\n  TryParse = function (s)\n    local v = parseDouble(s)\n    if v and v >= -3.40282347E+38 and v < 3.40282347E+38 then\n      return true, v\n    end\n    return false, 0\n  end\n})\nsetmetatable(Single, Number)\n\nlocal Double = define(\"System.Double\", {\n  Parse = parseDoubleWithException,\n  TryParse = function (s)\n    local v = parseDouble(s)\n    if v then\n      return true, v\n    end\n    return false, 0\n  end\n})\nsetmetatable(Double, Number)\n\nif not debugsetmetatable then\n  local NullReferenceException = System.NullReferenceException\n  local systemToString = System.toString\n\n  function System.ObjectEqualsObj(this, obj)\n    if this == nil then throw(NullReferenceException()) end\n    local t = type(this)\n    if t == \"number\" then\n      return equalsObj(this, obj)\n    elseif t == \"table\" then\n      return this:EqualsObj(obj)\n    end\n    return this == obj\n  end\n\n  function System.ObjectGetHashCode(this)\n    if this == nil then throw(NullReferenceException()) end\n    local t = type(this)\n    if t == \"number\" then\n      return getHashCode(this)\n    elseif t == \"table\" then\n      return this:GetHashCode()\n    end\n    return this\n  end\n\n  function System.ObjectToString(this)\n    if this == nil then throw(NullReferenceException()) end\n    return systemToString(this)\n  end\n\n  function System.IComparableCompareTo(this, other)\n    if this == nil then throw(NullReferenceException()) end\n    local t = type(this)\n    if t == \"number\" then\n      return compareDouble(this, other)\n    elseif t == \"boolean\" then\n      return System.Boolean.CompareTo(this, other)\n    end\n    return this:CompareTo(other)\n  end\n\n  function System.IEquatableEquals(this, other)\n    if this == nil then throw(NullReferenceException()) end\n    local t = type(this)\n    if t == \"number\" then\n      return equalsDouble(this, other)\n    elseif t == \"boolean\" then\n      return System.Boolean.Equals(this, other)\n    end\n    return this:Equals(other)\n  end\n\n  function System.IFormattableToString(this, format, formatProvider)\n    if this == nil then throw(NullReferenceException()) end\n    local t = type(this)\n    if t == \"number\" then\n      return toString(this, format, formatProvider)\n    end\n    return this:ToString(format, formatProvider)\n  end\nend\n\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Number.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 2eecf846c651b94499eb8d2a1eab202a\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Random.lua",
    "content": "-- Compiled from https://github.com/dotnet/corefx/blob/master/src/Common/src/CoreLib/System/Random.cs\n-- Generated by CSharp.lua Compiler\n-- Licensed to the .NET Foundation under one or more agreements.\n-- The .NET Foundation licenses this file to you under the MIT license.\n-- See the LICENSE file in the project root for more information.\nlocal System = System\nlocal ArrayInt32 = System.Array(System.Int32)\nSystem.define(\"System.Random\", (function ()\n  local Sample, InternalSample, GenerateSeed, Next, GetSampleForLargeRange, NextDouble, \n  NextBytes, internal, __ctor__, rnd\n  internal = function (this)\n    this._seedArray = ArrayInt32:new(56)\n  end\n  __ctor__ = function (this, Seed)\n    if not Seed then Seed = GenerateSeed() end\n    internal(this)\n    local ii = 0\n    local mj, mk\n\n    --Initialize our Seed array.\n    local subtraction = (Seed == -2147483648 --[[Int32.MinValue]]) and 2147483647 --[[Int32.MaxValue]] or math.Abs(Seed)\n    mj = 161803398 --[[Random.MSEED]] - subtraction\n    this._seedArray:set(55, mj)\n    mk = 1\n    for i = 1, 54 do\n      --Apparently the range [1..55] is special (Knuth) and so we're wasting the 0'th position.\n      ii = ii + 21\n      if ii >= 55 then\n        ii = ii - 55\n      end\n      this._seedArray:set(ii, mk)\n      mk = mj - mk\n      if mk < 0 then\n        mk = mk + 2147483647 --[[Random.MBIG]]\n      end\n      mj = this._seedArray:get(ii)\n    end\n    for k = 1, 4 do\n      for i = 1, 55 do\n        local n = i + 30\n        if n >= 55 then\n          n = n - 55\n        end\n        local v =  this._seedArray:get(i) - this._seedArray:get(1 + n)\n        this._seedArray:set(i, System.toInt32(v))\n        if this._seedArray:get(i) < 0 then\n          this._seedArray:set(i, this._seedArray:get(i) + 2147483647 --[[Random.MBIG]])\n        end\n      end\n    end\n    this._inext = 0\n    this._inextp = 21\n    Seed = 1\n  end\n  Sample = function (this)\n    --Including this division at the end gives us significantly improved\n    --random number distribution.\n    return (InternalSample(this) * (4.6566128752457969E-10 --[[1.0 / MBIG]]))\n  end\n  InternalSample = function (this)\n    local retVal\n    local locINext = this._inext\n    local locINextp = this._inextp\n\n    locINext = locINext + 1\n    if locINext >= 56 then\n      locINext = 1\n    end\n    locINextp = locINextp + 1\n    if locINextp >= 56 then\n      locINextp = 1\n    end\n\n    retVal = this._seedArray:get(locINext) - this._seedArray:get(locINextp)\n\n    if retVal == 2147483647 --[[Random.MBIG]] then\n      retVal = retVal - 1\n    end\n    if retVal < 0 then\n      retVal = retVal + 2147483647 --[[Random.MBIG]]\n    end\n\n    this._seedArray:set(locINext, retVal)\n\n    this._inext = locINext\n    this._inextp = locINextp\n\n    return retVal\n  end\n  GenerateSeed = function ()\n    if not rnd then\n      math.randomseed(os.time())\n      rnd = math.random\n    end\n    return rnd(0, 2147483647)\n  end\n  Next = function (this, minValue, maxValue)\n    if not minValue then\n      return InternalSample(this)\n    end\n\n    if not maxValue then\n      maxValue = minValue\n      if maxValue < 0 then\n        System.throw(System.ArgumentOutOfRangeException(\"maxValue\" --[[nameof(maxValue)]], \"'maxValue' must be greater than zero.\"))\n      end\n      return System.ToInt32((Sample(this) * maxValue))\n    end\n\n    if minValue > maxValue then\n      System.throw(System.ArgumentOutOfRangeException(\"minValue\" --[[nameof(minValue)]], \"'minValue' cannot be greater than maxValue.\"))\n    end\n    local range = maxValue - minValue\n    if range <= 2147483647 --[[Int32.MaxValue]] then\n      return (System.ToInt32((Sample(this) * range)) + minValue)\n    else\n      return System.toInt32((System.ToInt64((GetSampleForLargeRange(this) * range)) + minValue))\n    end\n  end\n  GetSampleForLargeRange = function (this)\n    -- The distribution of double value returned by Sample \n    -- is not distributed well enough for a large range.\n    -- If we use Sample for a range [int.MinValue..int.MaxValue)\n    -- We will end up getting even numbers only.\n\n    local result = InternalSample(this)\n    -- Note we can't use addition here. The distribution will be bad if we do that.\n    local negative = (InternalSample(this) % 2 == 0) and true or false\n    -- decide the sign based on second sample\n    if negative then\n      result = - result\n    end\n    local d = result\n    d = d + (2147483646 --[[int.MaxValue - 1]])\n    -- get a number in range [0 .. 2 * Int32MaxValue - 1)\n    d = d / (4294967293 --[[2 * (uint)int.MaxValue - 1]])\n    return d\n  end\n  NextDouble = function (this)\n    return Sample(this)\n  end\n  NextBytes = function (this, buffer)\n    if buffer == nil then\n      System.throw(System.ArgumentNullException(\"buffer\" --[[nameof(buffer)]]))\n    end\n    do\n      local i = 0\n      while i < #buffer do\n        buffer:set(i, System.toByte(InternalSample(this)))\n        i = i + 1\n      end\n    end\n  end\n  return {\n    _inext = 0,\n    _inextp = 0,\n    Sample = Sample,\n    Next = Next,\n    NextDouble = NextDouble,\n    NextBytes = NextBytes,\n    __ctor__ = __ctor__\n  }\nend)())\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Random.lua.meta",
    "content": "fileFormatVersion: 2\nguid: cd34ae8a3389fae4cbf545d1d2d997b2\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Reflection/Assembly.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal div = System.div\nlocal Type = System.Type\nlocal typeof = System.typeof\nlocal getClass = System.getClass\nlocal is = System.is\nlocal band = System.band\nlocal arrayFromTable = System.arrayFromTable\nlocal toLuaTable = System.toLuaTable\n\nlocal Exception = System.Exception\nlocal NotSupportedException = System.NotSupportedException\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentNullException = System.ArgumentNullException\n\nlocal assert = assert\nlocal pairs = pairs\nlocal getmetatable = getmetatable\nlocal setmetatable = setmetatable\nlocal rawget = rawget\nlocal type = type\nlocal unpack = table.unpack\nlocal select = select\n\nlocal TargetException = define(\"System.Reflection.TargetException\", {\n  __tostring = Exception.ToString,\n  base = { Exception }\n})\n\nlocal TargetParameterCountException = define(\"System.Reflection.TargetParameterCountException\", {\n  __tostring = Exception.ToString,\n  base = { Exception },\n  __ctor__ = function(this, message, innerException) \n    Exception.__ctor__(this, message or \"Parameter count mismatch.\", innerException)\n  end,\n})\n\nlocal AmbiguousMatchException = define(\"System.Reflection.AmbiguousMatchException\", {\n  __tostring = Exception.ToString,\n  base = { System.SystemException },\n  __ctor__ = function(this, message, innerException) \n    Exception.__ctor__(this, message or \"Ambiguous match found.\", innerException)\n  end,\n})\n\nlocal MissingMethodException = define(\"System.MissingMethodException\", {\n  __tostring = Exception.ToString,\n  base = { Exception },\n  __ctor__ = function(this, message, innerException) \n    Exception.__ctor__(this, message or \"Specified method could not be found.\", innerException)\n  end\n})\n\nlocal function throwNoMatadata(sign)\n  throw(NotSupportedException(\"not found metadata for \" .. sign), 1)\nend\n\nlocal function eq(left, right)\n  return left[1] == right[1] and left.name == right.name\nend\n\nlocal function getName(this)\n  return this.name\nend\n\nlocal function isAccessibility(memberInfo, kind)\n  local metadata = memberInfo.metadata\n  if not metadata then\n    throwNoMatadata(memberInfo.c.__name__ .. \".\" .. memberInfo.name)\n  end\n  return band(metadata[2], 0x7) == kind\nend\n\nlocal MemberInfo = define(\"System.Reflection.MemberInfo\", {\n  getName = getName,\n  EqualsObj = function (this, obj)\n    if getmetatable(this) ~= getmetatable(obj) then\n      return false\n    end\n    return eq(this, obj)\n  end,\n  getMemberType = function (this)\n    return this.memberType\n  end,\n  getDeclaringType = function (this)\n    return typeof(this.c)\n  end,\n  getIsStatic = function (this)\n    local metadata = this.metadata\n    if not metadata then\n      throwNoMatadata(this.c.__name__ .. \".\" .. this.name)\n    end\n    return band(metadata[2], 0x8) == 1\n  end,\n  getIsPrivate = function (this)\n    return isAccessibility(this, 1)\n  end,\n  getIsFamilyAndAssembly = function (this)\n    return isAccessibility(this, 2)\n  end,\n  getIsFamily = function (this)\n    return isAccessibility(this, 3)\n  end,\n  getIsAssembly = function (this)\n    return isAccessibility(this, 4)\n  end,\n  getIsFamilyOrAssembly = function (this)\n    return isAccessibility(this, 5)\n  end,\n  getIsPublic = function (this)\n    return isAccessibility(this, 6)\n  end\n})\n\nlocal function getFieldOrPropertyType(this)\n  local metadata = this.metadata\n  if not metadata then\n    throwNoMatadata(this.c.__name__ .. \".\" .. this.name)\n  end\n  return typeof(metadata[3])\nend\n\nlocal function checkObj(obj, cls)\n  if not is(obj, cls) then\n    throw(ArgumentException(\"Object does not match target type.\", \"obj\"), 1)\n  end\nend\n\nlocal function checkTarget(cls, obj, metadata)\n  if band(metadata[2], 0x8) == 0 then\n    if obj == nil then\n      throw(TargetException())\n    end\n    checkObj(obj, cls)\n  else\n    return true\n  end\nend\n\nlocal function checkValue(value, valueClass)\n  if value == nil then\n    if valueClass.class == \"S\" then\n      value = valueClass:default()\n    end\n  else\n    checkObj(value, valueClass)\n  end\n  return value\nend\n\nlocal function getOrSetField(this, obj, isSet, value)\n  local cls, metadata = this.c, this.metadata\n  if metadata then\n    if checkTarget(cls, obj, metadata) then\n      obj = cls\n    end\n    local name = metadata[4]\n    if type(name) ~= \"string\" then\n      name = this.name\n    end\n    if isSet then\n      obj[name] = checkValue(value, metadata[3])\n    else\n      return obj[name]\n    end\n  else\n    if obj ~= nil then\n      checkObj(obj, cls)\n    else\n      obj = cls\n    end\n    if isSet then\n      obj[this.name] = value\n    else\n      return obj[this.name]\n    end\n  end\nend\n\nlocal function isMetadataDefined(metadata, index, attributeType)\n  attributeType = attributeType[1]\n  for i = index, #metadata do\n    if is(metadata[i], attributeType) then\n      return true\n    end\n  end\n  return false\nend\n\nlocal function fillMetadataCustomAttributes(t, metadata, index, attributeType)\n  local count = #t + 1\n  if attributeType then\n    attributeType = attributeType[1]\n    for i = index, #metadata do\n      if is(metadata[i], attributeType) then\n        t[count] = metadata[i]\n        count = count + 1\n      end\n    end\n  else\n    for i = index, #metadata do\n      t[count] = metadata[i]\n      count = count + 1\n    end\n  end\nend\n\nlocal FieldInfo = define(\"System.Reflection.FieldInfo\", {\n  __eq = eq,\n  base = { MemberInfo },\n  memberType = 4,\n  getFieldType = getFieldOrPropertyType,\n  GetValue = getOrSetField,\n  SetValue = function (this, obj, value)\n    getOrSetField(this, obj, true, value)\n  end,\n  IsDefined = function (this, attributeType)\n    if attributeType == nil then throw(ArgumentNullException()) end\n    local metadata = this.metadata\n    if metadata then\n      return isMetadataDefined(metadata, 4, attributeType)\n    end\n    return false\n  end,\n  GetCustomAttributes = function (this, attributeType, inherit)\n    if type(attributeType) == \"boolean\" then\n      attributeType, inherit = nil, attributeType\n    else\n      if attributeType == nil then throw(ArgumentNullException()) end\n    end\n    local t = {}\n    local metadata = this.metadata\n    if metadata then\n      local index = 4\n      if type(metadata[index]) == \"string\" then\n        index = 5\n      end\n      fillMetadataCustomAttributes(t, metadata, index, attributeType)\n    end\n    return arrayFromTable(t, System.Attribute) \n  end\n})\n\nlocal function getOrSetProperty(this, obj, isSet, value)\n  local cls, metadata = this.c, this.metadata\n  if metadata then\n    local isStatic\n    if checkTarget(cls, obj, metadata) then\n      obj = cls\n      isStatic = true\n    end\n    if isSet then\n      value = checkValue(value, metadata[3])\n    end\n    local kind = band(metadata[2], 0x300)\n    if kind == 0 then\n      local name = metadata[4]\n      if type(name) ~= \"string\" then\n        name = this.name\n      end\n      if isSet then\n        obj[name] = value\n      else\n        return obj[name]\n      end\n    else\n      local index\n      if kind == 0x100 then\n        index = isSet and 5 or 4      \n      elseif kind == 0x200 then\n        if isSet then\n          throw(ArgumentException(\"Property Set method was not found.\"))\n        end\n        index = 4\n      else\n        if not isSet then\n          throw(ArgumentException(\"Property Get method was not found.\"))\n        end  \n        index = 4\n      end\n      local fn = metadata[index]\n      if type(fn) == \"table\" then\n        fn = fn[1]\n      end\n      if isSet then\n        if isStatic then\n          fn(value)\n        else\n          fn(obj, value)\n        end  \n      else\n        return fn(obj)\n      end\n    end\n  else\n    local isStatic\n    if obj ~= nil then\n      checkObj(obj, cls)\n    else\n      obj = cls\n      isStatic = true\n    end\n    if this.isField then\n      if isSet then\n        obj[this.name] = value\n      else\n        return obj[this.name]\n      end\n    else\n      if isSet then\n        local fn = obj[\"set\" .. this.name]\n        if fn == nil then\n          throw(ArgumentException(\"Property Set method not found.\"))\n        end\n        if isStatic then\n          fn(value)\n        else\n          fn(obj, value)\n        end\n      else\n        local fn = obj[\"get\" .. this.name]\n        if fn == nil then\n          throw(ArgumentException(\"Property Get method not found.\"))\n        end\n        return fn(obj)\n      end\n    end\n  end\nend\n\nlocal function getPropertyAttributesIndex(metadata)\n  local kind = band(metadata[2], 0x300)\n  local index\n  if kind == 0 then\n    index = 4\n  elseif kind == 0x100 then\n    index = 6\n  else\n    index = 5\n  end\n  return index\nend\n\nlocal PropertyInfo = define(\"System.Reflection.PropertyInfo\", {\n  __eq = eq,\n  base = { MemberInfo },\n  memberType = 16,\n  getPropertyType = getFieldOrPropertyType,\n  GetValue = getOrSetProperty,\n  SetValue = function (this, obj, value)\n    getOrSetProperty(this, obj, true, value)\n  end,\n  IsDefined = function (this, attributeType)\n    if attributeType == nil then throw(ArgumentNullException()) end\n    local metadata = this.metadata\n    if metadata then\n      local index = getPropertyAttributesIndex(metadata)\n      return isMetadataDefined(metadata, index, attributeType)\n    end\n    return false\n  end,\n  GetCustomAttributes = function (this, attributeType, inherit)\n    if type(attributeType) == \"boolean\" then\n      attributeType, inherit = nil, attributeType\n    else\n      if attributeType == nil then throw(ArgumentNullException()) end\n    end\n    local t = {}\n    local metadata = this.metadata\n    if metadata then\n      local index = getPropertyAttributesIndex(metadata)\n      fillMetadataCustomAttributes(t, metadata, index, attributeType)\n    end\n    return arrayFromTable(t, System.Attribute) \n  end\n})\n\nlocal function hasPublicFlag(flags)\n  return band(flags, 0x7) == 6\nend\n\nlocal function getMethodParameterCount(flags)\n  local count = band(flags, 0xFF00)\n  if count ~= 0 then\n    count = count / 256\n  end\n  return count\nend\n\nlocal function getMethodAttributesIndex(metadata)\n  local flags = metadata[2]\n  local index\n  local typeParametersCount = band(flags, 0xFF0000)\n  if typeParametersCount == 0 then\n    local parameterCount = getMethodParameterCount(flags)\n    if band(flags, 0x80) == 0 then\n      index = 4 + parameterCount\n    else\n      index = 5 + parameterCount\n    end\n  else\n    index = 5\n  end\n  return index\nend\n\nlocal MethodInfo = define(\"System.Reflection.MethodInfo\", {\n  __eq = eq,\n  base = { MemberInfo },\n  memberType = 8,\n  getReturnType = function (this)\n    local metadata = this.metadata\n    if not metadata then\n      throwNoMatadata(this.c.__name__ .. \".\" .. this.name)\n    end\n    local flags = metadata[2]\n    if band(flags, 0x80) == 0 then\n      return Type.Void\n    end\n    if band(flags, 0xC00) > 0 then\n      assert(false, \"not implement for generic method\")\n    end\n    local parameterCount = band(flags, 0x300)\n    return typeof(metadata[4 + parameterCount])\n  end,\n  Invoke = function (this, obj, parameters)\n    local cls, metadata = this.c, this.metadata\n    if metadata then\n      local isStatic\n      if checkTarget(cls, obj, metadata) then\n        isStatic = true\n      end\n      local t\n      local parameterCount = band(metadata[2], 0x300)\n      if parameterCount == 0 then\n        if parameters ~= nil and #parameters > 0 then\n          throw(TargetParameterCountException())\n        end\n      else\n        if parameters == nil and #parameters ~= parameterCount then\n          throw(TargetParameterCountException())\n        end\n        for i = 4, 3 + parameterCount do\n          local j = #t\n          t[j + 1] = checkValue(parameters:get(j), metadata[i])\n        end\n      end\n      local f = metadata[3]\n      if isStatic then\n        if t then\n          return f(unpack(t, 1, parameterCount))\n        else\n          return f()\n        end\n      else\n        if t then\n          return f(obj, unpack(t, 1, parameterCount))\n        else\n          return f(obj)\n        end\n      end\n    else\n      local f = assert(this.f)\n      if obj ~= nil then\n        checkObj(obj, cls)\n        if parameters ~= nil then\n          local t = toLuaTable(parameters)\n          return f(obj, unpack(t, 1, #parameters))\n        else\n          return f(obj)\n        end\n      else\n        if parameters ~= nil then\n          local t = toLuaTable(parameters)\n          return f(unpack(t, 1, #parameters))\n        else\n          return f()\n        end\n      end\n    end\n  end,\n  IsDefined = function (this, attributeType, inherit)\n    if attributeType == nil then throw(ArgumentNullException()) end\n    local metadata = this.metadata\n    if metadata then\n      local index = getMethodAttributesIndex(metadata)\n      return isMetadataDefined(metadata, index, attributeType)\n    end\n    return false\n  end,\n  GetCustomAttributes = function (this, attributeType, inherit)\n    if type(attributeType) == \"boolean\" then\n      attributeType, inherit = nil, attributeType\n    else\n      if attributeType == nil then throw(ArgumentNullException()) end\n    end\n    local t = {}\n    local metadata = this.metadata\n    if metadata then\n      local index = getMethodAttributesIndex(metadata)\n      fillMetadataCustomAttributes(t, metadata, index, attributeType)\n    end\n    return arrayFromTable(t, System.Attribute)\n  end\n})\n\nlocal function buildFieldInfo(cls, name, metadata)\n  return setmetatable({ c = cls, name = name, metadata = metadata }, FieldInfo)\nend\n\nlocal function buildPropertyInfo(cls, name, metadata, isField)\n  return setmetatable({ c = cls, name = name, metadata = metadata, isField = isField }, PropertyInfo)\nend\n\nlocal function buildMethodInfo(cls, name, metadata, f)\n  return setmetatable({ c = cls, name = name, metadata = metadata, f = f }, MethodInfo)\nend\n\n-- https://en.cppreference.com/w/cpp/algorithm/lower_bound\nlocal function lowerBound(t, first, last, value, comp)\n  local count = last - first\n  local it, step\n  while count > 0 do\n    it = first\n    step = div(count, 2)\n    it = it + step\n    if comp(t[it], value) then\n      it = it + 1\n      first = it\n      count = count - (step + 1)\n    else\n      count = step\n    end\n  end\n  return first\nend\n\nlocal function metadataItemCompByName(item, name)\n  return item[1] < name\nend\n\nlocal function binarySearchByName(metadata, name)\n  local last = #metadata + 1\n  local index = lowerBound(metadata, 1, last, name, metadataItemCompByName)\n  if index ~= last then\n    return metadata[index], index\n  end\n  return nil\nend\n\nfunction Type.GetField(this, name)\n  if name == nil then throw(ArgumentNullException()) end\n  local cls = this[1]\n  local metadata = cls.__metadata__\n  if metadata then\n    local fields = metadata.fields\n    if fields then\n      local field = binarySearchByName(fields, name)\n      if field then\n        return buildFieldInfo(cls, name, field)\n      end\n      return nil\n    end\n  end\n  if type(cls[name]) ~= \"function\" then\n    return buildFieldInfo(cls, name)\n  end\nend\n\nfunction Type.GetFields(this)\n  local t = {}\n  local cls = this[1]\n  local count = 1\n  repeat\n    local metadata = rawget(cls, \"__metadata__\")\n    if metadata then\n      local fields = metadata.fields\n      if fields then\n        for i = 1, #fields do\n          local field = fields[i]\n          if hasPublicFlag(field[2]) then\n            t[count] = buildFieldInfo(cls, field[1], field)\n            count = count + 1\n          end\n        end\n      else\n        metadata = nil\n      end\n    end\n    if not metadata then\n      for k, v in pairs(cls) do\n        if type(v) ~= \"function\" then\n          t[count] = buildFieldInfo(cls, k)\n          count = count + 1\n        end\n      end\n    end\n    cls = getmetatable(cls)\n  until cls == nil \n  return arrayFromTable(t, FieldInfo)\nend\n\nfunction Type.GetProperty(this, name)\n  if name == nil then throw(ArgumentNullException()) end\n  local cls = this[1]\n  local metadata = cls.__metadata__\n  if metadata then\n    local properties = metadata.properties\n    if properties then\n      local property = binarySearchByName(properties, name)\n      if property then\n        return buildPropertyInfo(cls, name, property)\n      end\n      return nil\n    end\n  end\n  if cls[\"get\" .. name] or cls[\"set\" .. name] then\n    return buildPropertyInfo(cls, name)\n  else\n    return buildPropertyInfo(cls, name, nil, true)\n  end\nend\n\nfunction Type.GetProperties(this)\n  local t = {}\n  local cls = this[1]\n  local count = 1\n  repeat\n    local metadata = rawget(cls, \"__metadata__\")\n    if metadata then\n      local properties = metadata.properties\n      if properties then\n        for i = 1, #properties do\n          local property = properties[i]\n          if hasPublicFlag(property[2]) then\n            t[count] = buildPropertyInfo(cls, property[1], property)\n            count = count + 1\n          end\n        end\n      end\n    end\n    cls = getmetatable(cls)\n  until cls == nil \n  return arrayFromTable(t, PropertyInfo)\nend\n\nfunction Type.GetMethod(this, name)\n  if name == nil then throw(ArgumentNullException()) end\n  local cls = this[1]\n  local metadata = cls.__metadata__\n  if metadata then\n    local methods = metadata.methods\n    if methods then\n      local item, index = binarySearchByName(methods, name)\n      if item then\n        local next = methods[index + 1]\n        if next and next[1] == name then\n          throw(AmbiguousMatchException())\n        end\n        return buildMethodInfo(cls, name, item)\n      end\n      return nil\n    end\n  end\n  local f = cls[name]\n  if type(f) == \"function\" then\n    return buildMethodInfo(cls, name, nil, f)\n  end\nend\n\nfunction Type.GetMethods(this)\n  local t = {}\n  local cls = this[1]\n  local count = 1\n  repeat\n    local metadata = rawget(cls, \"__metadata__\")\n    if metadata then\n      local methods = metadata.methods\n      if methods then\n        for i = 1, #methods do\n          local method = methods[i]\n          if hasPublicFlag(method[2]) then\n            t[count] = buildMethodInfo(cls, method[1], method)\n            count = count + 1\n          end\n        end\n      else\n        metadata = nil\n      end\n    end\n    if not metadata then\n      for k, v in pairs(cls) do\n        if type(v) == \"function\" then\n          t[count] = buildMethodInfo(cls, k, nil, v)\n          count = count + 1\n        end\n      end\n    end\n    cls = getmetatable(cls)\n  until cls == nil \n  return arrayFromTable(t, MethodInfo)\nend\n\nfunction Type.GetMembers(this)\n  local t = arrayFromTable({}, MemberInfo)\n  t:addRange(this:GetFields())\n  t:addRange(this:GetProperties())\n  t:addRange(this:GetMethods())\n  return t\nend\n\nfunction Type.IsDefined(this, attributeType, inherit)\n  if attributeType == nil then throw(ArgumentNullException()) end\n  local cls = this[1]\n  if not inherit then\n    local metadata = rawget(cls, \"__metadata__\")\n    if metadata then\n      local class  = metadata.class\n      if class then\n        return isMetadataDefined(class, 2, attributeType)\n      end\n    end\n    return false\n  else\n    repeat\n      local metadata = rawget(cls, \"__metadata__\")\n      if metadata then\n        local class  = metadata.class\n        if class then\n          if isMetadataDefined(class, 2, attributeType) then\n            return true\n          end\n        end\n      end\n      cls = getmetatable(cls)\n    until cls == nil\n    return false\n  end\nend\n\nfunction Type.GetCustomAttributes(this, attributeType, inherit)\n  if type(attributeType) == \"boolean\" then\n    attributeType, inherit = nil, attributeType\n  else\n    if attributeType == nil then throw(ArgumentNullException()) end\n  end\n  local cls = this[1]\n  local t = {}\n  if not inherit then\n    local metadata = rawget(cls, \"__metadata__\")\n    if metadata then\n      local class  = metadata.class\n      if class then\n        fillMetadataCustomAttributes(t, class, 2, attributeType)\n      end\n    end\n  else\n    repeat\n      local metadata = rawget(cls, \"__metadata__\")\n      if metadata then\n        local class  = metadata.class\n        if class then\n          fillMetadataCustomAttributes(t, class, 2, attributeType)\n        end\n      end\n      cls = getmetatable(cls)\n    until cls == nil\n  end\n  return arrayFromTable(t, System.Attribute)\nend\n\nlocal Assembly, coreSystemAssembly\nlocal function getAssembly(t)\n  local assembly = t[1].__assembly__\n  if assembly then\n    return setmetatable(assembly, Assembly)\n  end\n  return coreSystemAssembly\nend\n\nlocal function getAssemblyName(this)\n  local name = this.name or \"CSharpLua.CoreLib\"\n  return name .. \", Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\"\nend\n\nAssembly = define(\"System.Reflection.Assembly\", {\n  GetName = getAssemblyName,\n  getFullName = getAssemblyName,\n  GetAssembly = getAssembly,\n  GetTypeFrom = Type.GetTypeFrom,\n  GetEntryAssembly = function ()\n    local entryAssembly = System.entryAssembly\n    if entryAssembly then\n      return setmetatable(entryAssembly, Assembly)\n    end\n    return nil\n  end,\n  getEntryPoint = function (this)\n    local entryPoint = this.entryPoint\n    if entryPoint ~= nil then\n      local _, _, t, name = entryPoint:find(\"(.*)%.(.*)\")\n      local cls = getClass(t)\n      local f = assert(cls[name])\n      return buildMethodInfo(cls, name, nil, f)\n    end\n    return nil\n  end,\n  GetExportedTypes = function (this)\n    if this.exportedTypes then\n      return this.exportedTypes\n    end\n    local t = {}\n    local classes = this.classes\n    if classes then\n      for i = 1, #classes do\n        t[i] = typeof(classes[i])\n      end\n    end\n    local array = arrayFromTable(t, Type, true)\n    this.exportedTypes = array\n    return array\n  end\n})\ncoreSystemAssembly = Assembly()\n\nfunction System.GetExecutingAssembly(assembly)\n\treturn setmetatable(assembly, Assembly)\nend\n\nType.getAssembly = getAssembly\n\nfunction Type.getAssemblyQualifiedName(this)\n  return this:getName() .. ', ' .. getName(assembly)\nend\n\nfunction Type.getAttributes(this)\n  local cls = this[1]\n  local metadata = rawget(cls, \"__metadata__\")\n  if metadata then\n    metadata = metadata.class\n    if metadata then\n      return metadata[1]\n    end\n  end\n  throwNoMatadata(cls.__name__)\nend\n\nfunction Type.GetGenericArguments(this)\n  local t = {}\n  local count = 1\n\n  local cls = this[1]\n  local metadata = rawget(cls, \"__metadata__\")\n  if metadata then\n    metadata = metadata.class\n    if metadata then\n      local flags = metadata[1]\n      local typeParameterCount = band(flags, 0xFF00)\n      if typeParameterCount ~= 0 then\n        typeParameterCount = typeParameterCount / 256\n        for i = 2, 1 + typeParameterCount do\n          t[count] = typeof(metadata[i])\n          count = count + 1\n        end\n      end\n      return arrayFromTable(t, Type)\n    end\n  end\n\n  local name = cls.__name__ \n  local i = name:find(\"%[\")\n  if i then\n    while true do\n      i = i + 1\n      local j = name:find(\",\", i) or -1\n      local clsName = name:sub(i, j - 1)\n      t[count] = typeof(System.getClass(clsName))\n      count = count + 1\n      if j == -1 then\n        break\n      end\n    end\n  end\n  return arrayFromTable(t, Type)\nend\n\nlocal Attribute = System.Attribute\n\nfunction Attribute.GetCustomAttribute(element, attributeType, inherit)\n  return element:GetCustomAttribute(attributeType, inherit)\nend\n\nfunction Attribute.GetCustomAttributes(element, attributeType, inherit)\n  return element:GetCustomAttributes(attributeType, inherit)\nend\n\nfunction Attribute.IsDefined(element, attributeType, inherit)\n\treturn element:IsDefined(attributeType, inherit)\nend\n\nlocal function createInstance(T, nonPublic)\n  local metadata = rawget(T, \"__metadata__\")\n  if metadata then\n    local methods = metadata.methods\n    if methods then\n      local ctorMetadata = methods[1]\n      if ctorMetadata[1] == \".ctor\" then\n        local flags = ctorMetadata[2]\n        if nonPublic or hasPublicFlag(flags) then\n          local parameterCount = getMethodParameterCount(flags)\n          if parameterCount == 0 then\n            return T()\n          end\n        end\n        throw(MissingMethodException())\n      end\n    end\n  end\n  return T()\nend\n\nlocal function isCtorMatch(method, n, f, ...)\n  local flags = method[2]\n  if hasPublicFlag(flags) then\n    local parameterCount = getMethodParameterCount(flags)\n    if parameterCount == n then\n      for j = 4, 3 + parameterCount do\n        local p = f(j - 3, ...)\n        if not is(p, method[j]) then\n          return false\n        end\n      end\n      return true\n    end\n  end\n  return false\nend\n\nlocal function findMatchCtor(T, n, f, ...)\n  local metadata = rawget(T, \"__metadata__\")\n  if metadata then\n    local hasCtor\n    local methods = metadata.methods\n    for i = 1, #methods do\n      local method = methods[i]\n      if method[1] == \".ctor\" then\n        if isCtorMatch(method, n, f, ...) then\n          return i\n        end\n        hasCtor = true\n      else\n        break\n      end\n    end\n    if hasCtor then\n      throw(MissingMethodException())\n    end\n  end\nend\n\ndefine(\"System.Activator\", {\n  CreateInstance = function (type, ...)\n    if type == nil then throw(ArgumentNullException(\"type\")) end\n    if getmetatable(type) ~= Type then\n      return createInstance(type)\n    end\n    local T, n = type[1], select(\"#\", ...)\n    if n == 0 then\n      return createInstance(T)\n    elseif n == 1 then\n      local args = ...\n      if System.isArrayLike(args) then\n        n = #args\n        if n == 0 then\n          return createInstance(T)\n        end\n        local i = findMatchCtor(T, n, function (i, args) return args:get(i - 1) end, args)\n        if i and i ~= 1 then\n          return System.new(T, i, unpack(args, 1, n))\n        end\n        return T(unpack(args, 1, n))\n      end\n    end\n    local i = findMatchCtor(T, n, select, ...)\n    if i and i ~= 1 then\n      return System.new(T, i, ...)\n    end\n    return T(...)\n  end,\n  CreateInstance1 = function (type, nonPublic)\n    if type == nil then throw(ArgumentNullException(\"type\")) end\n    return createInstance(type[1], nonPublic)\n  end\n})\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Reflection/Assembly.lua.meta",
    "content": "fileFormatVersion: 2\nguid: c05cd872a9424a24ca906af0a900fbdd\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Reflection.meta",
    "content": "fileFormatVersion: 2\nguid: a35613a01cc419e4d80e4f2a08931462\nfolderAsset: yes\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/String.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal Char = System.Char\nlocal throw = System.throw\nlocal emptyFn = System.emptyFn\nlocal lengthFn = System.lengthFn\nlocal systemToString = System.toString\nlocal debugsetmetatable = System.debugsetmetatable\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal FormatException = System.FormatException\nlocal IndexOutOfRangeException = System.IndexOutOfRangeException\n\nlocal string = string\nlocal char = string.char\nlocal rep = string.rep\nlocal lower = string.lower\nlocal upper = string.upper\nlocal byte = string.byte\nlocal sub = string.sub\nlocal find = string.find\nlocal gsub = string.gsub\n\nlocal table = table\nlocal tconcat = table.concat\nlocal unpack = table.unpack\nlocal getmetatable = getmetatable\nlocal setmetatable = setmetatable\nlocal select = select\nlocal type = type\nlocal String\n\nlocal function toString(t, isch)\n  if isch then return char(t) end\n  return systemToString(t)\nend\n\nlocal function checkIndex(value, startIndex, count)\n  if value == nil then throw(ArgumentNullException(\"value\")) end\n  local len = #value\n  if not startIndex then\n    startIndex, count = 0, len\n  elseif not count then\n    if startIndex < 0 or startIndex > len then\n      throw(ArgumentOutOfRangeException(\"startIndex\"))\n    end\n    count = len - startIndex\n  else\n    if startIndex < 0 or startIndex > len then\n      throw(ArgumentOutOfRangeException(\"startIndex\"))\n    end\n    if count < 0 or count > len - startIndex then\n      throw(ArgumentOutOfRangeException(\"count\"))\n    end\n  end\n  return startIndex, count, len\nend\n\nlocal function ctor(String, value, startIndex, count)\n  if type(value) == \"number\" then\n    if startIndex <= 0 then throw(ArgumentOutOfRangeException(\"count\")) end\n    return rep(char(value), startIndex)\n  end\n  startIndex, count = checkIndex(value, startIndex, count)\n  return char(unpack(value, startIndex + 1, startIndex + count))\nend\n\nlocal function get(this, index)\n  local c = byte(this, index + 1)\n  if not c then\n    throw(IndexOutOfRangeException())\n  end\n  return c\nend\n\nlocal function compare(strA, strB, ignoreCase)\n  if strA == nil then\n    if strB == nil then\n      return 0\n    end\n    return -1\n  elseif strB == nil then\n    return 1\n  end\n\n  if ignoreCase then\n    strA, strB = lower(strA), lower(strB)\n  end\n\n  if strA < strB then return -1 end\n  if strA > strB then return 1 end\n  return 0\nend\n\nlocal function compareFull(...)\n  local n = select(\"#\", ...)\n  if n == 2 then\n    return compare(...)\n  elseif n == 3 then\n    local strA, strB, ignoreCase = ...\n    if type(ignoreCase) == \"number\" then\n      ignoreCase = ignoreCase % 2 ~= 0\n    end\n    return compare(strA, strB, ignoreCase)\n  elseif n == 4 then\n    local strA, strB, ignoreCase, options = ...\n    if type(options) == \"number\" then\n      ignoreCase = options == 1 or options == 268435456\n    end\n    return compare(strA, strB, ignoreCase)\n  else\n    local strA, indexA, strB, indexB, length, ignoreCase, options = ...\n    if type(ignoreCase) == \"number\" then\n      ignoreCase = ignoreCase % 2 ~= 0\n    elseif type(options) == \"number\" then\n      ignoreCase = options == 1 or options == 268435456\n    end\n    checkIndex(strA, indexA, length)\n    checkIndex(strB, indexB, length)\n    strA, strB = sub(strA, indexA + 1, indexA +  length), sub(strB, indexB + 1, indexB + length)\n    return compare(strA, strB, ignoreCase) \n  end\nend\n\nlocal function concat(...)\n  local t = {}\n  local count = 1\n  local len = select(\"#\", ...)\n  if len == 1 then\n    local v = ...\n    if System.isEnumerableLike(v) then\n      local isch = v.__genericT__ == Char\n      for _, v in System.each(v) do\n        t[count] = toString(v, isch)\n        count = count + 1\n      end\n    else\n      return toString(v)\n    end\n  else\n    for i = 1, len do\n      local v = select(i, ...)\n      t[count] = toString(v)\n      count = count + 1\n    end\n  end\n  return tconcat(t)\nend\n\nlocal function equals(this, value, comparisonType)\n  if not comparisonType then\n    return this == value\n  end\n  return compare(this, value, comparisonType % 2 ~= 0) == 0\nend\n\nlocal function throwFormatError()\n  throw(FormatException(\"Input string was not in a correct format.\"))\nend\n\nlocal function formatBuild(format, len, select, ...)\n  local t, count = {}, 1\n  local i, j, s = 1\n  while true do\n    local startPos  = i\n    while true do\n      i, j, s = find(format, \"([{}])\", i)\n      if not i then\n        if count == 1 then\n          return format\n        end\n        t[count] = sub(format, startPos)\n        return table.concat(t)\n      end\n      local pos = i - 1\n      i = i + 1\n      local c = byte(format, i)\n      if not c then throwFormatError() end\n      if s == '{' then\n        if c == 123 then\n          i = i + 1\n        else\n          pos = i - 2\n          if pos >= startPos then\n            t[count] = sub(format, startPos, pos)\n            count = count + 1\n          end\n          break\n        end\n      else\n        if c == 125 then\n          i = i + 1\n        else\n          throwFormatError()\n        end\n      end\n      if pos >= startPos then\n        t[count] = sub(format, startPos, pos)\n        count = count + 1\n      end\n      t[count] = s\n      count = count + 1\n      startPos = i\n    end\n    i, j, s = find(format, \"^(%d+)}\", i)\n    if not i then throwFormatError() end\n    s = s + 1\n    if s > len then throwFormatError() end\n    s = select(s, ...)\n    s = (s ~= nil and s ~= System.null) and toString(s)\n    t[count] = s\n    count = count + 1\n    i = j + 1\n  end\nend\n\nlocal function selectTable(i, t)\n  return t[i]\nend\n\nlocal function format(format, ...)\n  if format == nil then throw(ArgumentNullException()) end\n  local len = select(\"#\", ...)\n  if len == 1 then\n    local args = ...\n    if System.isArrayLike(args) then\n      return formatBuild(format, #args, selectTable, args)\n    end\n  end\n  return formatBuild(format, len, select, ...)\nend\n\nlocal function isNullOrEmpty(value)\n  return value == nil or #value == 0\nend\n\nlocal function isNullOrWhiteSpace(value)\n  return value == nil or find(value, \"^%s*$\") ~= nil\nend\n\nlocal function joinEnumerable(separator, values)\n  if values == nil then throw(ArgumentNullException(\"values\")) end\n  if type(separator) == \"number\" then\n    separator = char(separator)\n  end\n  local isch = values.__genericT__ == Char\n  local t = {}\n  local len = 1\n  for _, v in System.each(values) do\n    if v ~= nil then\n      t[len] = toString(v, isch)\n      len = len + 1\n    end\n  end\n  return tconcat(t, separator)\nend\n\nlocal function joinParams(separator, ...)\n  if type(separator) == \"number\" then\n    separator = char(separator)\n  end\n  local t = {}\n  local len = 1\n  local n = select(\"#\", ...)\n  if n == 1 then\n    local values = ...\n    if System.isArrayLike(values) then\n      for i = 0, #values - 1 do\n        local v = values:get(i)\n        if v ~= nil then\n          t[len] = toString(v)\n          len = len + 1\n        end\n      end\n      return tconcat(t, separator) \n    end\n  end\n  for i = 1, n do\n    local v = select(i, ...)\n    if v ~= nil then\n      t[len] = toString(v)\n      len = len + 1\n    end\n  end\n  return tconcat(t, separator) \nend\n\nlocal function join(separator, value, startIndex, count)\n  if type(separator) == \"number\" then\n    separator = char(separator)\n  end\n  local t = {}\n  local len = 1\n  if startIndex then  \n    checkIndex(value, startIndex, count)\n    for i = startIndex + 1, startIndex + count do\n      local v = value[i]\n      if v ~= System.null then\n        t[len] = v\n        len = len + 1\n      end\n    end\n  else\n    for _, v in System.each(value) do\n      if v ~= nil then\n        t[len] = v\n        len = len + 1\n      end\n    end\n  end\n  return tconcat(t, separator)\nend\n\nlocal function compareToObj(this, v)\n  if v == nil then return 1 end\n  if type(v) ~= \"string\" then\n    throw(ArgumentException(\"Arg_MustBeString\"))\n  end\n  return compare(this, v)\nend\n\nlocal function escape(s)\n  return gsub(s, \"([%%%^%.])\", \"%%%1\")\nend\n\nlocal function contains(this, value, comparisonType)\n  if value == nil then throw(ArgumentNullException(\"value\")) end\n  if type(value) == \"number\" then\n    value = char(value)\n  end\n  if comparisonType then\n    local ignoreCase = comparisonType % 2 ~= 0\n    if ignoreCase then\n      this, value = lower(this), lower(value)\n    end\n  end \n  return find(this, escape(value)) ~= nil\nend\n\nlocal function copyTo(this, sourceIndex, destination, destinationIndex, count)\n  if destination == nil then throw(ArgumentNullException(\"destination\")) end\n  if count < 0 then throw(ArgumentOutOfRangeException(\"count\")) end\n  local len = #this\n  if sourceIndex < 0 or count > len - sourceIndex then throw(ArgumentOutOfRangeException(\"sourceIndex\")) end\n  if destinationIndex > #destination - count or destinationIndex < 0 then throw(ArgumentOutOfRangeException(\"destinationIndex\")) end\n  if count > 0 then\n    destinationIndex = destinationIndex + 1\n    for i = sourceIndex + 1, sourceIndex + count do\n      destination[destinationIndex] = byte(this, i)\n      destinationIndex = destinationIndex + 1\n    end\n  end\nend\n\nlocal function endsWith(this, suffix)\n  return suffix == \"\" or sub(this, -#suffix) == suffix\nend\n\nlocal function equalsObj(this, v)\n  if type(v) == \"string\" then\n    return this == v\n  end\n  return false\nend\n\nlocal CharEnumerator = System.define(\"System.CharEnumerator\", {\n  base = { System.IEnumerator_1(System.Char), System.IDisposable, System.ICloneable },\n  getCurrent = System.getCurrent,\n  Dispose = emptyFn,\n  MoveNext = function (this)\n    local index, s = this.index, this.s\n    if index <= #s then\n      this.current = byte(s, index)\n      this.index = index + 1\n      return true\n    end\n    return false\n  end\n})\n\nlocal function getEnumerator(this)\n  return setmetatable({ s = this, index = 1 }, CharEnumerator)\nend\n\nlocal function getTypeCode()\n  return 18\nend\n\nlocal function indexOf(this, value, startIndex, count, comparisonType)\n  if value == nil then throw(ArgumentNullException(\"value\")) end\n  startIndex, count = checkIndex(this, startIndex, count)\n  if type(value) == \"number\" then value = char(value) end\n  local ignoreCase = comparisonType and comparisonType % 2 ~= 0\n  if ignoreCase then\n    this, value = lower(this), lower(value)\n  end\n  local i, j = find(this, escape(value), startIndex + 1)\n  if i then\n    local e = startIndex + count\n    if j <= e then\n      return i - 1\n    end\n    return - 1\n  end\n  return -1\nend\n\nlocal function indexOfAny(this, anyOf, startIndex, count)\n  if anyOf == nil then throw(ArgumentNullException(\"chars\")) end\n  startIndex, count = checkIndex(this, startIndex, count)\n  anyOf = \"[\" .. escape(char(unpack(anyOf))) .. \"]\"\n  local i, j = find(this, anyOf, startIndex + 1)\n  if i then\n    local e = startIndex + count\n    if j <= e then\n      return i - 1\n    end\n    return - 1\n  end\n  return -1\nend\n\nlocal function insert(this, startIndex, value) \n  if value == nil then throw(ArgumentNullException(\"value\")) end\n  if startIndex < 0 or startIndex > #this then throw(ArgumentOutOfRangeException(\"startIndex\")) end\n  return sub(this, 1, startIndex) .. value .. sub(this, startIndex + 1)\nend\n\nlocal function chechLastIndexOf(value, startIndex, count)\n  if value == nil then throw(ArgumentNullException(\"value\")) end\n  local len = #value\n  if not startIndex then\n    startIndex, count = len - 1, len\n  elseif not count then\n    count = len == 0 and 0 or (startIndex + 1)\n  end\n  if len == 0 then\n    if startIndex ~= -1 and startIndex ~= 0 then\n      throw(ArgumentOutOfRangeException(\"startIndex\"))\n    end\n    if count ~= 0 then\n      throw(ArgumentOutOfRangeException(\"count\"))\n    end\n  end\n  if startIndex < 0 or startIndex >= len then\n    throw(ArgumentOutOfRangeException(\"startIndex\"))\n  end\n  if count < 0 or startIndex - count + 1 < 0 then\n    throw(ArgumentOutOfRangeException(\"count\"))\n  end\n  return startIndex, count, len\nend\n\nlocal function lastIndexOf(this, value, startIndex, count, comparisonType)\n  if value == nil then throw(ArgumentNullException(\"value\")) end\n  startIndex, count = chechLastIndexOf(this, startIndex, count)\n  if type(value) == \"number\" then value = char(value) end\n  local ignoreCase = comparisonType and comparisonType % 2 ~= 0\n  if ignoreCase then\n    this, value = lower(this), lower(value)\n  end\n  value = escape(value)\n  local e = startIndex + 1\n  local f = e - count + 1\n  local index = -1  \n  while true do\n    local i, j = find(this, value, f)\n    if not i or j > e then\n      break\n    end\n    index = i - 1\n    f = j + 1\n  end\n  return index\nend\n\nlocal function lastIndexOfAny(this, anyOf, startIndex, count)\n  if anyOf == nil then throw(ArgumentNullException(\"chars\")) end\n  startIndex, count = chechLastIndexOf(this, startIndex, count)\n  anyOf = \"[\" .. escape(char(unpack(anyOf))) .. \"]\"\n  local f, e = startIndex - count + 1, startIndex + 1\n  local index = -1\n  while true do\n    local i, j = find(this, anyOf, f)\n    if not i or j > e then\n      break\n    end\n    index = i - 1\n    f = j + 1\n  end\n  return index\nend\n\nlocal function padLeft(this, totalWidth, paddingChar) \n  local len = #this;\n  if len >= totalWidth then\n    return this\n  else\n    paddingChar = paddingChar or 0x20\n    return rep(char(paddingChar), totalWidth - len) .. this\n  end\nend\n\nlocal function padRight(this, totalWidth, paddingChar) \n  local len = #this\n  if len >= totalWidth then\n    return this\n  else\n    paddingChar = paddingChar or 0x20\n    return this .. rep(char(paddingChar), totalWidth - len)\n  end\nend\n\nlocal function remove(this, startIndex, count) \n  startIndex, count = checkIndex(this, startIndex, count)\n  return sub(this, 1, startIndex) .. sub(this, startIndex + 1 + count)\nend\n\nlocal function replace(this, a, b)\n  if type(a) == \"number\" then\n    a, b = char(a), char(b)\n  end\n  return gsub(this, escape(a), b)\nend\n\nlocal function findAny(s, strings, startIndex)\n  local findBegin, findEnd\n  for i = 1, #strings do\n    local posBegin, posEnd = find(s, escape(strings[i]), startIndex)\n    if posBegin then\n      if not findBegin or posBegin < findBegin then\n        findBegin, findEnd = posBegin, posEnd\n      else\n        break\n      end\n    end\n  end\n  return findBegin, findEnd\nend\n\nlocal function split(this, strings, count, options) \n  local t = {}\n  local find = find\n  if type(strings) == \"table\" then\n    if #strings == 0 then\n      return t\n    end\n\n    if type(strings[1]) == \"string\" then\n      find = findAny\n    else\n      strings = char(unpack(strings))\n      strings = escape(strings)\n      strings = \"[\" .. strings .. \"]\"\n    end\n  elseif type(strings) == \"string\" then       \n    strings = escape(strings)         \n  else\n    strings = char(strings)\n    strings = escape(strings)\n  end\n\n  local len = 1\n  local startIndex = 1\n  while true do\n    local posBegin, posEnd = find(this, strings, startIndex)\n    posBegin = posBegin or 0\n    local subStr = sub(this, startIndex, posBegin -1)\n    if options ~= 1 or #subStr > 0 then\n      t[len] = subStr\n      len = len + 1\n      if count then\n        count = count -1\n        if count == 0 then\n          if posBegin ~= 0 then\n            t[len - 1] = sub(this, startIndex)\n          end\n          break\n        end\n      end\n    end\n    if posBegin == 0 then\n      break\n    end \n    startIndex = posEnd + 1\n  end   \n  return System.arrayFromTable(t, String) \nend\n\nlocal function startsWith(this, prefix)\n  return sub(this, 1, #prefix) == prefix\nend\n\nlocal function substring(this, startIndex, count)\n  startIndex, count = checkIndex(this, startIndex, count)\n  return sub(this, startIndex + 1, startIndex + count)\nend\n\nlocal function toCharArray(str, startIndex, count)\n  startIndex, count = checkIndex(str, startIndex, count)\n  local t = {}\n  local len = 1\n  for i = startIndex + 1, startIndex + count do\n    t[len] = byte(str, i)\n    len = len + 1\n  end\n  return System.arrayFromTable(t, System.Char)\nend\n\nlocal function trim(this, chars, ...)\n  if not chars then\n    chars = \"^%s*(.-)%s*$\"\n  else\n    if type(chars) == \"table\" then\n      chars = char(unpack(chars))\n    else\n      chars = char(chars, ...)\n    end\n    chars = escape(chars)\n    chars = \"^[\" .. chars .. \"]*(.-)[\" .. chars .. \"]*$\"\n  end\n  return (gsub(this, chars, \"%1\"))\nend\n\nlocal function trimEnd(this, chars, ...)\n  if not chars then\n    chars = \"(.-)%s*$\"\n  else\n    if type(chars) == \"table\" then\n      chars = char(unpack(chars))\n    else\n      chars = char(chars, ...)\n    end\n    chars = escape(chars)\n    chars = \"(.-)[\" .. chars .. \"]*$\"\n  end\n  return (gsub(this, chars, \"%1\"))\nend\n\nlocal function trimStart(this, chars, ...)\n  if not chars then\n    chars = \"^%s*(.-)\"\n  else\n    if type(chars) == \"table\" then\n      chars = char(unpack(chars))\n    else\n      chars = char(chars, ...)\n    end\n    chars = escape(chars)\n    chars = \"^[\" .. chars .. \"]*(.-)\"\n  end\n  return (gsub(this, chars, \"%1\"))\nend\n\nlocal function inherits(_, T)\n  return { System.IEnumerable_1(System.Char), System.IComparable, System.IComparable_1(T), System.IConvertible, System.IEquatable_1(T), System.ICloneable }\nend\n\nstring.traceback = emptyFn  -- make throw(str) not fail\nstring.getLength = lengthFn\nstring.getCount = lengthFn\nstring.get = get\nstring.Compare = compareFull\nstring.CompareOrdinal = compareFull\nstring.Concat = concat\nstring.Copy = System.identityFn\nstring.Equals = equals\nstring.Format = format\nstring.IsNullOrEmpty = isNullOrEmpty\nstring.IsNullOrWhiteSpace = isNullOrWhiteSpace\nstring.JoinEnumerable = joinEnumerable\nstring.JoinParams = joinParams\nstring.Join = join\nstring.CompareTo = compare\nstring.CompareToObj = compareToObj\nstring.Contains = contains\nstring.CopyTo = copyTo\nstring.EndsWith = endsWith\nstring.EqualsObj = equalsObj\nstring.GetEnumerator = getEnumerator\nstring.GetTypeCode = getTypeCode\nstring.IndexOf = indexOf\nstring.IndexOfAny = indexOfAny\nstring.Insert = insert\nstring.LastIndexOf = lastIndexOf\nstring.LastIndexOfAny = lastIndexOfAny\nstring.PadLeft = padLeft\nstring.PadRight = padRight\nstring.Remove = remove\nstring.Replace = replace\nstring.Split = split\nstring.StartsWith = startsWith\nstring.Substring = substring\nstring.ToCharArray = toCharArray\nstring.ToLower = lower\nstring.ToLowerInvariant = lower\nstring.ToString = System.identityFn\nstring.ToUpper = upper\nstring.ToUpperInvariant = upper\nstring.Trim = trim\nstring.TrimEnd = trimEnd\nstring.TrimStart = trimStart\n\nif debugsetmetatable then\n  String = string\n  String.__genericT__ = System.Char\n  String.base = inherits\n  System.define(\"System.String\", String)\n\n  debugsetmetatable(\"\", String)\n  local Object = System.Object\n  local StringMetaTable = setmetatable({ __index = Object, __call = ctor }, Object)\n  setmetatable(String, StringMetaTable)\nelse\n  string.__call = ctor\n  string.__index = string\n  \n  String = getmetatable(\"\")\n  String.__genericT__ = System.Char\n  String.base = inherits\n  System.define(\"System.String\", String)\n  String.__index = string\n  setmetatable(String, string)\n  setmetatable(string, System.Object)  \nend\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/String.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 2df704fc85793bd4fb8aa99961168c75\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Text/StringBuilder.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal clear = System.Array.clear\nlocal toString = System.toString\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal IndexOutOfRangeException = System.IndexOutOfRangeException\n\nlocal table = table\nlocal tconcat = table.concat\nlocal schar = string.char\nlocal ssub = string.sub\nlocal sbyte = string.byte\nlocal type = type\nlocal select = select\n\nlocal function build(this, value, startIndex, length)\n  value = value:Substring(startIndex, length)\n  local len = #value\n  if len > 0 then\n    this[#this + 1] = value\n    this.Length = len\n  end\nend\n\nlocal function getItemIndex(this, index)\n  for i = 1, #this do\n    local s = this[i]\n    local len = #s\n    local begin = index\n    index = index - len\n    if index < 0 then\n      begin = begin + 1\n      local ch = sbyte(s, begin)\n      if not ch then\n        break\n      end\n      return i, s, begin, ch\n    end\n  end\nend\n\nlocal function getLength(this)\n  return this.Length\nend\n\nlocal StringBuilder = System.define(\"System.Text.StringBuilder\", { \n  Length = 0,\n  ToString = tconcat,\n  __tostring = tconcat,\n  __ctor__ = function (this, ...)\n    local len = select(\"#\", ...)\n    if len == 0 then\n    elseif len == 1 or len == 2 then\n      local value = ...\n      if type(value) == \"string\" then\n        build(this, value, 0, #value)\n      else\n        build(this, \"\", 0, 0)\n      end\n    else \n      local value, startIndex, length = ...\n      build(this, value, startIndex, length)\n    end\n  end,\n  get = function (this, index)\n    local _, _, _, ch = getItemIndex(this, index)\n    if not _ then\n      throw(IndexOutOfRangeException())\n    end\n    return ch\n  end,\n  set = function (this, index, value)\n    local i, s, j = getItemIndex(this, index)\n    if not i then\n      throw(ArgumentOutOfRangeException(\"index\"))\n    end\n    this[i] = ssub(s, 1, j - 1) .. schar(value) .. ssub(s, j + 1)\n  end,\n  setCapacity = function (this, value)\n    if value < this.Length then\n      throw(ArgumentOutOfRangeException())\n    end\n  end,\n  getCapacity = getLength,\n  getMaxCapacity = getLength,\n  getLength = getLength,\n  setLength = function (this, value) \n    if value < 0 then throw(ArgumentOutOfRangeException(\"value\")) end\n    if value == 0 then\n      this:Clear()\n      return\n    end\n    local delta = value - this.Length\n    if delta > 0 then\n      this:AppendCharRepeat(0, delta)\n    else\n      local length, remain = #this, value\n      for i = 1, length do\n        local s = this[i]\n        local len = #s\n        if len >= remain then\n          if len ~= remain then\n            s = ssub(s, 0, remain)\n            this[i] = s\n          end\n          for j = i + 1, length do\n            this[j] = nil\n          end\n          break\n        end\n        remain = remain - len\n      end\n      this.Length = this.Length + delta\n    end  \n  end,\n  Append = function (this, value, startIndex, count)\n    if not startIndex then\n      if value ~= nil then\n        value = toString(value)\n        if value ~= nil then\n          this[#this + 1] = value\n          this.Length =  this.Length + #value\n        end\n      end\n    else\n      if value == nil then\n        throw(ArgumentNullException(\"value\"))\n      end\n      value = value:Substring(startIndex, count)\n      this[#this + 1] = value\n      this.Length =  this.Length + #value\n    end\n    return this\n  end,\n  AppendChar = function (this, v) \n    v = schar(v)\n    this[#this + 1] = v\n    this.Length = this.Length + 1\n    return this\n  end,\n  AppendCharRepeat = function (this, v, repeatCount)\n    if repeatCount < 0 then throw(ArgumentOutOfRangeException(\"repeatCount\")) end\n    if repeatCount == 0 then return this end\n    v = schar(v)\n    local count = #this + 1\n    for i = 1, repeatCount do\n      this[count] = v\n      count = count + 1\n    end\n    this.Length = this.Length + repeatCount\n    return this\n  end,\n  AppendFormat = function (this, format, ...)\n    local value = format:Format(...)\n    this[#this + 1] = value\n    this.Length = this.Length + #value\n    return this\n  end,\n  AppendLine = function (this, value)\n    local count = 1\n    local len = #this + 1\n    if value ~= nil then\n      this[len] = value\n      len = len + 1\n      count = count + #value\n    end\n    this[len] = \"\\n\"\n    this.Length = this.Length + count\n    return this\n  end,\n  Clear = function (this)\n    clear(this)\n    this.Length = 0\n    return this\n  end,\n  Insert = function (this, index, value)\n    local length = this.Length\n    if value ~= nil then\n      if index == length then\n        this:Append(value)\n      else\n        value = toString(value)\n        if value ~= nil then\n          local i, s, j = getItemIndex(this, index)\n          if not i then\n            throw(ArgumentOutOfRangeException(\"index\"))\n          end\n          this[i] = ssub(s, 1, j - 1) .. value .. ssub(s, j)\n          this.Length = length + #value\n        end\n      end\n    end\n  end\n})\nSystem.StringBuilder = StringBuilder\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Text/StringBuilder.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 064061fdecc8f34428c91d8c361b02d0\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Text.meta",
    "content": "fileFormatVersion: 2\nguid: 89aaeb8f66fbcee4d96bac4f042d8c99\nfolderAsset: yes\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Threading/Task.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal defStc = System.defStc\nlocal throw = System.throw\nlocal try = System.try\nlocal trunc = System.trunc\nlocal Void = System.Void\nlocal post = System.post\nlocal addTimer = System.addTimer\nlocal removeTimer = System.removeTimer\nlocal waitTask = System.Thread.waitTask\nlocal arrayFromTable = System.arrayFromTable\nlocal Exception = System.Exception\nlocal NullReferenceException = System.NullReferenceException\nlocal NotImplementedException = System.NotImplementedException\nlocal ArgumentException = System.ArgumentException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal InvalidOperationException = System.InvalidOperationException\nlocal AggregateException = System.AggregateException\nlocal ObjectDisposedException = System.ObjectDisposedException\n\nlocal ccreate = System.ccreate\nlocal cpool = System.cpool\nlocal cresume = System.cresume\nlocal cyield = System.yield\n\nlocal type = type\nlocal table = table\nlocal select = select\nlocal assert = assert\nlocal getmetatable = getmetatable\nlocal setmetatable = setmetatable\nlocal tremove = table.remove\nlocal pack = table.pack\nlocal unpack = table.unpack\nlocal error = error\n\nlocal TaskCanceledException = define(\"System.Threading.Tasks.TaskCanceledException\", {\n  __tostring = Exception.ToString,\n  base = { Exception },\n  __ctor__ = function (this, task)\n    this.task = task  \n    Exception.__ctor__(this, \"A task was canceled.\")\n  end,\n  getTask = function(this) \n    return this.task\n  end\n})\nSystem.TaskCanceledException = TaskCanceledException\n\nlocal TaskStatusCreated = 0\nlocal TaskStatusWaitingForActivation = 1\nlocal TaskStatusWaitingToRun = 2\nlocal TaskStatusRunning = 3\nlocal TaskStatusWaitingForChildrenToComplete = 4\nlocal TaskStatusRanToCompletion = 5\nlocal TaskStatusCanceled = 6\nlocal TaskStatusFaulted = 7\n\nSystem.TaskStatus = System.defEnum(\"System.Threading.Tasks.TaskStatus\", {\n  Created = TaskStatusCreated,\n  WaitingForActivation = TaskStatusWaitingForActivation,\n  WaitingToRun = TaskStatusWaitingToRun,\n  Running = TaskStatusRunning,\n  WaitingForChildrenToComplete = TaskStatusWaitingForChildrenToComplete,\n  RanToCompletion = TaskStatusRanToCompletion,\n  Canceled = TaskStatusCanceled,\n  Faulted = TaskStatusFaulted,\n})\n\nlocal UnobservedTaskExceptionEventArgs = define(\"System.Threading.Tasks.UnobservedTaskExceptionEventArgs\", {\n  __ctor__ = function (this, exception)\n    this.exception = exception\n  end,\n  SetObserved = function (this)\n    this.observed = true\n  end,\n  getObserved = function (this)\n    if this.observed then\n      return true\n    end\n    return false\n  end,\n  getException = function (this)\n    return this.exception\n  end\n})\nSystem.UnobservedTaskExceptionEventArgs = UnobservedTaskExceptionEventArgs\n\nlocal unobservedTaskException\nlocal function publishUnobservedTaskException(sender, ueea)\n  local handler = unobservedTaskException\n  if handler then\n    handler(sender, ueea)\n  end\nend\n\nlocal TaskScheduler = define(\"System.Threading.Tasks.TaskScheduler\", {\n  addUnobservedTaskException = function (value)\n    unobservedTaskException = unobservedTaskException + value\n  end,\n  removeUnobservedTaskException = function (value)\n    unobservedTaskException = unobservedTaskException - value\n  end\n})\nSystem.TaskScheduler = TaskScheduler\n\nlocal TaskExceptionHolder = {\n  __index = false,\n  __gc = function (this)\n    if not this.isHandled then\n      local e = this.exception\n      if e then\n        local ueea = UnobservedTaskExceptionEventArgs(e)\n        publishUnobservedTaskException(this.task, ueea)\n        if not ueea.observed then\n          print(\"Warning: TaskExceptionHolder\" , e)\n        end\n      end\n    end\n  end\n}\nTaskExceptionHolder.__index = TaskExceptionHolder\n\nlocal function newTaskExceptionHolder(task, exception) \n  return setmetatable({ task = task, exception = exception }, TaskExceptionHolder)\nend\n\nlocal function getException(task, await)\n  local holder = task.data\n  if not holder.isHandled then\n    holder.isHandled = true\n  end\n  local e = holder.exception\n  if await then\n    return e\n  end\n  return AggregateException(e)\nend\n\nlocal Task\nlocal nextTaskId = 1\nlocal currentTask\nlocal completedTask\n\nlocal function getNewId()\n  local id = nextTaskId\n  nextTaskId = nextTaskId + 1\n  return id\nend\n\nlocal function getId(this)\n  local id = this.id\n  if id == nil then\n    id = getNewId()\n    this.id = id\n  end\n  return id \nend\n\nlocal function isCompleted(this)\n  local status = this.status\n  return status == TaskStatusRanToCompletion or status == TaskStatusFaulted or status == TaskStatusCanceled\nend\n\nlocal function newTask(status, data)\n  return setmetatable({ status = status, data = data }, Task)\nend\n\nlocal function fromResult(result)\n  return newTask(TaskStatusRanToCompletion, result)\nend\n\nlocal function fromCanceled(cancellationToken)\n  if cancellationToken and cancellationToken:getIsCancellationRequested() then \n    throw(ArgumentOutOfRangeException(\"cancellationToken\"))\n  end\n  return newTask(TaskStatusCanceled, cancellationToken)\nend\n\nlocal function fromException(exception)\n  local data = newTaskExceptionHolder(false, exception)\n  local t = newTask(TaskStatusFaulted, data) \n  data.task = t\n  return t\nend\n\nlocal function getCompletedTask()\n  local t = completedTask\n  if t == nil then\n    t = fromResult()\n    completedTask = t\n  end\n  return t\nend\n\nlocal function trySetComplete(this, status, data)\n  if isCompleted(this) then\n    return false\n  end\n\n  this.status = status\n  this.data = data\n\n  local continueActions = this.continueActions\n  if continueActions then\n    for i = 1, #continueActions do\n      continueActions[i](this)\n    end\n    this.continueActions = nil\n  end\n  return true\nend\n\nlocal function trySetResult(this, result)\n  return trySetComplete(this, TaskStatusRanToCompletion, result)\nend\n\nlocal function trySetException(this, exception)\n  if this.data == Void then\n    throw(exception)\n  end\n  return trySetComplete(this, TaskStatusFaulted, newTaskExceptionHolder(this, exception))\nend\n\nlocal function trySetCanceled(this, cancellationToken)\n  return trySetComplete(this, TaskStatusCanceled, cancellationToken)\nend\n\nlocal function newWaitingTask(isVoid)\n  return newTask(TaskStatusWaitingForActivation, isVoid and Void)\nend\n\nlocal function getContinueActions(task) \n  local continueActions = task.continueActions\n  if continueActions == nil then\n    continueActions = {}\n    task.continueActions = continueActions\n  end\n  return continueActions\nend\n\nlocal function addContinueAction(task, f)\n  local continueActions = getContinueActions(task)\n  continueActions[#continueActions + 1] = assert(f)\nend\n\nlocal function checkTasks(...)\n  local tasks\n  local n = select(\"#\", ...)\n  if n == 1 then\n    local args = ...\n    if args == nil then throw(ArgumentNullException(\"tasks\")) end\n    if System.isArrayLike(args) then\n      tasks = args\n    elseif System.isEnumerableLike(args) then\n      tasks = System.Array.toArray(args)\n    end\n  end\n  if not tasks then\n    tasks = System.Array(Task)(...)\n  end\n  for i = 1, #tasks do\n    if tasks[i] == System.null then\n      throw(ArgumentNullException())\n    end\n  end\n  return tasks\nend\n\nlocal function getDelay(delay)\n  if type(delay) == \"table\" then\n    delay = trunc(delay:getTotalMilliseconds())\n    if delay < -1 or delay > 2147483647 then\n      throw(ArgumentOutOfRangeException(\"delay\"))\n    end\n  elseif delay < -1 then\n    throw(ArgumentOutOfRangeException(\"millisecondsDelay\"))  \n  end\n  return delay\nend\n\nlocal waitToken = {}\nlocal function getResult(this, await)\n  local status = this.status\n  if status == TaskStatusRanToCompletion then\n    return this.data\n  elseif status == TaskStatusFaulted then\n    throw(getException(this, await))\n  elseif status == TaskStatusCanceled then\n    local e = TaskCanceledException(this)\n    if not await then e = AggregateException(e) end\n    throw(e)\n  end\n  return waitToken\nend\n\nlocal function getAwaitResult(task)\n  local status = task.status\n  local ok, v\n  if status == TaskStatusRanToCompletion then\n    ok, v = true, task.data\n  elseif status == TaskStatusFaulted then\n    ok, v = false, getException(task, true)\n  elseif status == TaskStatusCanceled then\n    ok, v = false, TaskCanceledException(task)\n  else\n    assert(false)\n  end\n  return ok, v\nend\n\nlocal factory = {\n  StartNew = function (_, f, state)\n    local t = newWaitingTask()\n    post(function ()\n      try(function ()\n        assert(trySetResult(t, f(state)))\n      end, function (e)\n        assert(trySetException(t, e))\n      end)\n    end)\n    return t\n  end\n}\n\nTask = define(\"System.Threading.Tasks.Task\", {\n  Dispose = System.emptyFn,\n  __ctor__ = function (this, action, state)\n    if action == nil then throw(ArgumentNullException(\"action\")) end\n    this.status = TaskStatusCreated\n    this.data = function ()\n      return action(state)\n    end\n  end,\n  getId = getId,\n  getCurrentId = function ()\n    local t = currentTask\n    if t then\n      return getId(t)\n    end\n  end,\n  getFactory = function ()\n    return factory\n  end,\n  getStatus = function (this)\n    return this.status\n  end,\n  getException = function (this)\n    if this.status == TaskStatusFaulted then\n      return getException(this)\n    end\n    return nil\n  end,\n  getResult = function (this)\n    local result = getResult(this)\n    if result == waitToken then\n      waitTask(getContinueActions(this))\n      result = getResult(this)\n      assert(result ~= waitToken)\n    end\n    return result\n  end,\n  getIsCompleted = isCompleted,\n  getIsCanceled = function (this)\n    return this.status == TaskStatusCanceled\n  end,\n  getIsFaulted = function (this)\n    return this.status == TaskStatusFaulted\n  end,\n  FromResult = fromResult,\n  FromCanceled = fromCanceled,\n  FromException = fromException,\n  getCompletedTask = getCompletedTask,\n  Delay = function (delay, cancellationToken)\n    delay = getDelay(delay)\n\n    if cancellationToken and cancellationToken:getIsCancellationRequested() then\n      return fromCanceled(cancellationToken)\n    elseif delay == 0 then\n      return getCompletedTask()\n    end\n\n    local t = newWaitingTask()\n    local timerId, registration  \n\n    if cancellationToken and cancellationToken:getCanBeCanceled() then\n      registration = cancellationToken:Register(function ()\n        local success = trySetCanceled(t, cancellationToken)\n        if success and timerId then\n          removeTimer(timerId)\n        end\n      end)\n    end\n\n    if delay ~= -1 then\n      timerId = addTimer(function ()\n        local success = trySetResult(t)\n        if success and registration then\n          registration:Dispose()\n        end\n      end, delay)\n    end\n\n    return t\n  end,\n  Run = function (f, cancellationToken)\n    local t = Task(f) \n    t:Start()\n    return t\n  end,\n  WhenAll = function (T, ...)\n    local tasks = checkTasks(...)\n    local count = #tasks\n    if count == 0 then\n      return getCompletedTask()\n    end\n    local result, exceptions, cancelled = {}, {}\n    local t = newWaitingTask()\n    local function f(task)\n      local status = task.status\n      if status == TaskStatusRanToCompletion then\n        result[#result + 1] = task.data\n      elseif status == TaskStatusFaulted then\n        local exception = getException(task, true)\n        exceptions[#exceptions + 1] = exception\n      elseif status == TaskStatusCanceled then\n        cancelled = true\n      end\n      count = count - 1\n      if count == 0 then\n        if #exceptions > 0 then\n          trySetException(t, arrayFromTable(exceptions, Exception))\n        elseif cancelled then\n          trySetCanceled(t)\n        else\n          if T then\n            trySetResult(t, arrayFromTable(result, T))\n          end\n            trySetResult(t)\n        end\n      end\n    end\n    for i = 1, count do\n      local task = tasks[i]\n      if isCompleted(task) then\n        post(function ()\n          f(task)\n        end)\n      else\n        addContinueAction(task, f)\n      end\n    end\n    return t\n  end,\n  WhenAny = function (...)\n    local tasks = checkTasks(...)\n    local count = #tasks\n    if count == 0 then\n      throw(ArgumentException())\n    end\n    local t = newWaitingTask()\n    local function f(task)\n      local status = task.status\n      if status == TaskStatusRanToCompletion then\n        trySetResult(t, task)\n      elseif status == TaskStatusFaulted then\n        trySetException(t, getException(task))\n      elseif status == TaskStatusCanceled then\n        trySetCanceled(t)\n      end\n    end\n    for i = 1, count do\n      local task = tasks[i]\n      if isCompleted(task) then\n        post(function ()\n          f(task)\n        end)\n      else\n        addContinueAction(task, f)\n      end\n    end\n    return t\n  end,\n  ContinueWith = function (this, continuationAction)\n    if continuationAction == nil then throw(ArgumentNullException(\"continuationAction\")) end\n    local t = newWaitingTask()\n    local function f(task)\n      try(function ()\n        t.status = TaskStatusRunning\n        assert(trySetResult(t, continuationAction(task)))\n      end, function (e)\n        assert(trySetException(t, e))\n      end)\n    end\n    if isCompleted(this) then\n      post(function ()\n        f(this)\n      end)\n    else\n      addContinueAction(this, f)\n    end\n    return t\n  end,\n  Start = function (this)\n    if this.status ~= TaskStatusCreated then throw(InvalidOperationException(\"Task was already started.\")) end\n    this.status = TaskStatusWaitingToRun\n    post(function ()\n      try(function ()\n        this.status = TaskStatusRunning\n        assert(trySetResult(this, this.data()))\n      end, function (e)\n        assert(trySetException(this, e))\n      end)\n    end)\n  end,\n  Wait = function (this)\n    waitTask(getContinueActions(this))\n  end,\n  Await = function (this, t)\n    local a = t:GetAwaiter()\n    if a:getIsCompleted() then\n      return a:GetResult()\n    end\n    a:OnCompleted(function ()\n      local ok, v\n      try(function ()\n        ok, v = true, a:GetResult()\n      end, function (e)\n        ok, v = false, e\n      end)\n      ok, v = cresume(this.c, ok, v)\n      if not ok then\n        assert(trySetException(this, v))\n      end\n    end)\n    local ok, v = cyield()\n    if ok then\n      return v\n    else\n      error(v)\n    end\n  end,\n  await = function (this, task)\n    if getmetatable(task) ~= Task then\n      return this:Await(task)\n    end\n\n    local result = getResult(task, true)\n    if result ~= waitToken then\n      return result\n    end\n    addContinueAction(task, function (task)\n      local ok, v = getAwaitResult(task)\n      ok, v = cresume(this.c, ok, v)\n      if not ok then\n        assert(trySetException(this, v))\n      end\n    end)\n    local ok, v = cyield()\n    if ok then\n      return v\n    else\n      error(v)\n    end\n  end\n})\nSystem.Task = Task\n\nlocal TaskT_TransitionToFinal_AlreadyCompleted = \"An attempt was made to transition a task to a final state when it had already completed.\"\nlocal TaskCompletionSource = define(\"System.Threading.Tasks.TaskCompletionSource\", {\n  __ctor__ = function (this)\n    this.task = newWaitingTask()\n  end,\n  getTask = function (this)\n    return this.task\n  end,\n  SetCanceled = function (this)\n    if not trySetCanceled(this.task) then\n      throw(InvalidOperationException(TaskT_TransitionToFinal_AlreadyCompleted))\n    end\n  end,\n  SetException = function (this, exception)\n    if exception == nil then throw(ArgumentNullException(\"exception\")) end\n    if not trySetException(this.task, exception) then\n      throw(InvalidOperationException(TaskT_TransitionToFinal_AlreadyCompleted))\n    end\n  end,\n  SetResult = function (this, result)\n    if not trySetResult(this.task, result) then\n      throw(InvalidOperationException(TaskT_TransitionToFinal_AlreadyCompleted))\n    end\n  end,\n  TrySetCanceled = trySetCanceled,\n  TrySetException = trySetException,\n  TrySetResult = trySetResult\n})\nSystem.TaskCompletionSource = TaskCompletionSource\n\nlocal CancellationTokenRegistration = defStc(\"System.Threading.CancellationTokenRegistration\", (function ()\n  local function unregister(this)\n    local token = this.token\n    if token then\n      local f = this.f\n      if f then\n        this.f = nil\n        return token.source:unRegister(f)\n      end\n    end\n    return false\n  end\n  return {\n    base =  function(_, T)\n      return { System.IDisposable, System.IEquatable_1(T) }\n    end,\n    __ctor__ = function (this, token, f)\n      if not token then\n        return\n      end\n      this.token = token\n      this.f = f\n    end,\n    getToken = function (this)\n      return this.token\n    end,\n    Equals = System.equals,\n    Unregister = unregister,\n    Dispose = unregister\n  }\nend)())\nSystem.CancellationTokenRegistration = CancellationTokenRegistration\n\nlocal OperationCanceledException = define(\"System.OperationCanceledException\", {\n  __tostring = Exception.ToString,\n  base = { System.SystemException },\n  __ctor__ = function (this, message, innerException, token)\n    Exception.__ctor__(this, message or \"The operation was canceled.\", innerException)\n    this.tokne = token\n  end,\n  getCancellationToken = function (this)\n    return this.token\n  end\n})\n\nlocal canceledSource\nlocal CancellationToken \nCancellationToken = defStc(\"System.Threading.CancellationToken\", {\n  __ctor__ = function (this, canceled)\n    if canceled == nil then\n      return\n    end\n    if canceled == true then\n      this.source = canceledSource\n    elseif canceled then\n      this.source = canceled\n    end\n  end,\n  getCanBeCanceled = function (this)\n    return this.source ~= nil\n  end,\n  getIsCancellationRequested = function (this)\n    local source = this.source\n    if source then\n      return source:getIsCancellationRequested()\n    end\n    return false\n  end,\n  getNone = function ()\n    return CancellationToken()\n  end,\n  Equals = System.equals,\n  Register = function (this, callback, state)\n    local source = this.source\n    if source then\n      if not source:getIsCancellationRequested() then\n        local function f()\n          callback(state)\n        end\n        this.source:register(f)\n        return CancellationTokenRegistration(this, f)\n      end\n      callback(state)\n    end\n    return CancellationTokenRegistration()\n  end,\n  ThrowIfCancellationRequested = function (this)\n    if this:getIsCancellationRequested() then\n      throw(OperationCanceledException())\n    end\n  end\n})\nSystem.CancellationToken = CancellationToken\n\nlocal CancellationTokenSource \nCancellationTokenSource = define(\"System.Threading.CancellationTokenSource\", (function ()\n  local function clean(this)\n    local timerId = this.timerId\n    if timerId then\n      removeTimer(timerId)\n    end\n    local links = this.links\n    if links then\n      for i = 1, #links do\n        links[i]:Dispose()\n      end\n    end\n  end\n  return  {\n    state = 0,\n    base = { System.IDisposable },\n    __ctor__  = function (this, delay)\n      if delay then\n        delay = getDelay(delay)\n        if delay == 0 then\n          this.state = 1\n        else\n          this.timerId = addTimer(function ()\n            this.Cancel()\n          end, delay)\n        end\n      end\n    end,\n    Cancel = function (this, throwOnFirstException)\n      if this.disposed then throw(ObjectDisposedException()) end\n      if this.state == 1  then\n        return\n      end\n      clean(this)\n      this.state = 1\n      local actions = this.continueActions\n      if actions then\n        local t = {}\n        for i = 1, #actions do\n          try(function ()\n            actions[i]()          \n          end, function (e)\n            if throwOnFirstException then\n              throw(e)\n            end\n            t[#t + 1] = e\n          end)\n        end\n        if #t > 0 then\n          throw(AggregateException(arrayFromTable(t, Exception)))\n        end\n      end\n    end,\n    CancelAfter = function (this, delay)\n      if this.disposed then throw(ObjectDisposedException()) end\n      delay = getDelay(delay)\n      if this.state == 1  then\n        return\n      end\n      local timerId = this.timerId\n      if timerId then\n        removeTimer(timerId)\n      end\n      this.timerId = addTimer(function ()\n        this:Cancel()\n      end, delay)\n    end,\n    Dispose = function (this)\n      if this.disposed then\n        return\n      end\n      clean(this)\n      this.disposed = true\n    end,\n    getIsCancellationRequested = function (this)\n      return this.state == 1\n    end,\n    getToken = function (this)\n      local t = this.token\n      if not t then\n        t = CancellationToken(this)\n        this.token = t\n      end\n      return t\n    end,\n    register = addContinueAction,\n    unRegister = function (this, f)\n      local actions = this.continueActions\n      if actions then\n        for i = 1, #actions do\n          if actions[i] == f then\n            tremove(actions, i)\n            return true\n          end\n        end\n      end\n      return false\n    end,\n    CreateLinkedTokenSource = function (...)\n      local cts, links, count = CancellationTokenSource(), {}, 1\n      cts.links = links\n      local n = select(\"#\", ...)\n      if n == 1 then\n        local args = ...\n        if System.isArrayLike(args) then\n          for i = 1, #args do\n            links[count] = args[i]:Register(cts.Cancel, cts)\n            count = count + 1 \n          end\n          return cts\n        end\n      end\n      for i = 1, n do\n        local token = select(i, ...)\n        links[count] = token:Register(cts.Cancel, cts)\n        count = count + 1 \n      end\n      return cts\n    end\n  }\nend)())\nSystem.CancellationTokenSource = CancellationTokenSource\ncanceledSource = setmetatable({ state = 1 }, CancellationTokenSource)\n\nlocal function taskCoroutineCreate(t, f)\n  local c = ccreate(function (...)\n    local r = f(t, ...)\n    assert(trySetResult(t, r))\n  end)\n  t.c = c\n  return c\nend\n\nfunction System.async(f, void, ...)\n  local t = newWaitingTask(void)\n  local c = taskCoroutineCreate(t, f)\n  local ok, v = cresume(c, ...)\n  if not ok then\n    assert(trySetException(t, v))\n  end\n  return t\nend\n\nlocal IAsyncDisposable = System.defInf(\"System.IAsyncDisposable\")\nlocal IAsyncEnumerable = System.defInf(\"System.Collections.Generic.IAsyncEnumerable\", System.emptyFn)\nlocal IAsyncEnumerator = System.defInf(\"System.Collections.Generic.IAsyncEnumerator\", System.emptyFn)\n\nSystem.IAsyncEnumerable_1 =  IAsyncEnumerable\nSystem.IAsyncEnumerator_1 = IAsyncEnumerator\n\nlocal yieldAsync \nlocal function checkYieldAsync(this, ok, v, current)\n  if ok then\n    if v == yieldAsync then\n      this.e.current = current\n      assert(trySetResult(this.t, true))\n    elseif v == cpool then\n      this.c = nil\n      this.e.current = nil\n      assert(trySetResult(this.t, false))\n    end\n  else\n    assert(trySetException(this.t, v))\n  end\nend\nyieldAsync = {\n  __index = false,\n  await = function (this, task)\n    local result = getResult(task, true)\n    if result ~= waitToken then\n      return result\n    end\n    addContinueAction(task, function (task)\n      local current\n      local ok, v = getAwaitResult(task)\n      ok, v, current = cresume(this.c, ok, v)\n      checkYieldAsync(this, ok, v, current)\n    end)\n    local ok, v = cyield()\n    if ok then\n      return v\n    else\n      error(v)\n    end\n  end,\n  yield = function (this, v)\n    cyield(yieldAsync, v)\n  end\n}\nyieldAsync.__index = yieldAsync\n\nlocal YieldAsyncEnumerable\nYieldAsyncEnumerable = define(\"System.YieldAsyncEnumerable\", function (T)\n   return {\n    base = { IAsyncEnumerable(T), IAsyncEnumerator(T), IAsyncDisposable },\n    __genericT__ = T\n  }\nend, {\n  getCurrent = System.getCurrent, \n  GetAsyncEnumerator = function (this)\n    return setmetatable({ f = this.f, args = this.args }, YieldAsyncEnumerable(this.__genericT__))\n  end,\n  DisposeAsync = function (this)\n    return getCompletedTask()\n  end,\n  MoveNextAsync = function (this)\n    local a = this.a\n    if a and a.c == nil then\n      return fromResult(false)\n    end\n\n    local t = newWaitingTask()\n    local ok, v, current\n    if a == nil then\n      local c = ccreate(this.f)\n      a = setmetatable({ t = t, c = c, e = this }, yieldAsync)\n      this.a = a\n      local args = this.args\n      ok, v, current = cresume(c, a, unpack(args, 1, args.n))\n      this.args = nil\n    else\n      a.t = t\n      ok, v, current = cresume(a.c)\n    end\n    checkYieldAsync(a, ok, v, current)\n    return t\n  end\n})\n\nlocal function yieldIAsyncEnumerable(f, T, ...)\n  return setmetatable({ f = f, args = pack(...) }, YieldAsyncEnumerable(T))\nend\n\nSystem.yieldIAsyncEnumerable = yieldIAsyncEnumerable\nSystem.yieldIAsyncEnumerator = yieldIAsyncEnumerable\n\nlocal function eachFn(en, async)\n  if async:await(en:MoveNextAsync()) then\n    return async, en:getCurrent()\n  end\n  return nil\nend\n\nlocal function each(async, t)\n  if t == nil then throw(NullReferenceException(), 1) end\n  local en = t:GetAsyncEnumerator()\n  return eachFn, en, async\nend\n\nSystem.asynceach = each\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Threading/Task.lua.meta",
    "content": "fileFormatVersion: 2\nguid: b511ea33303bc1846b6900af803a85fc\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Threading/Thread.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal trunc = System.trunc\nlocal post = System.post\nlocal addTimer = System.addTimer\nlocal Exception = System.Exception\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal NotSupportedException = System.NotSupportedException\n\nlocal assert = assert\nlocal type = type\nlocal setmetatable = setmetatable\nlocal coroutine = coroutine\nlocal ccreate = coroutine.create\nlocal cresume = coroutine.resume\nlocal cstatus = coroutine.status\nlocal cyield = coroutine.yield\n\nlocal mainThread\n\nlocal ThreadStateException = define(\"System.Threading.ThreadStateException\", {\n  __tostring = Exception.ToString,\n  base = { Exception },\n\n  __ctor__ = function(this, message, innerException)\n     Exception.__ctor__(this, message or \"Thread is running or terminated; it cannot restart.\", innerException)\n  end\n})\n\nlocal ThreadAbortException = define(\"System.Threading.ThreadAbortException\", {\n  __tostring = Exception.ToString,\n  base = { Exception },\n  __ctor__ = function(this, message, innerException)\n    Exception.__ctor__(this, message or \"Thread aborted.\", innerException)\nend\n})\n\nlocal nextThreadId = 1\nlocal currentThread\n\nlocal function getThreadId()\n  local id = nextThreadId\n  nextThreadId = nextThreadId + 1\n  return id\nend\n\nlocal function checkTimeout(timeout)\n  if type(timeout) == \"table\" then\n    timeout = trunc(timeout:getTotalMilliseconds())\n  end\n  if timeout < -1 or timeout > 2147483647 then\n    throw(ArgumentOutOfRangeException(\"timeout\"))\n  end\n  return timeout\nend\n\nlocal function resume(t, obj)\n  local prevThread = currentThread\n  currentThread = t\n  local co = assert(t.co)\n  local ok, v = cresume(co, obj)\n  currentThread = prevThread\n  if ok then\n    if type(v) == \"function\" then\n      v()\n    elseif cstatus(co) == \"dead\" then\n      local joinThread = t.joinThread\n      if joinThread then\n        resume(joinThread, true)\n      end\n      t.co = false\n    end\n  else\n    t.co = false\n    print(\"Warning: Thread.run\" , v)\n  end\nend\n\nlocal function run(t, obj)\n  post(function ()\n    resume(t, obj)\n  end)\nend\n\nlocal Thread =  define(\"System.Threading.Thread\", {\n  IsBackground = false,\n  IsThreadPoolThread = false,\n  Priority = 2,\n  ApartmentState = 2,\n  Abort = function ()\n    throw(ThreadAbortException())\n  end,\n  getCurrentThread = function ()\n    return currentThread\n  end,\n  __ctor__ = function (this, start)\n\t  if start == nil then throw(ArgumentNullException(\"start\")) end\n    this.start = start\n  end,\n  getIsAlive = function (this)\n    local co = this.co\n    return co and cstatus(co) ~= \"dead\"\n  end,\n  ManagedThreadId = function (this)\n\t  local id = this.id\n    if not id then\n      id = getThreadId()\n      this.id = id\n    end\n    return id\n  end,\n  Sleep = function (timeout)\n    local current = currentThread\n    if current == mainThread then\n      throw(NotSupportedException(\"mainThread not support\"))\n    end\n    timeout = checkTimeout(timeout)\n    local f\n    if timeout ~= -1 then\n      f = function ()\n        addTimer(function () \n          resume(current) \n        end, timeout)\n      end\n    end\n    cyield(f)\n  end,\n  Yield = function ()\n    local current = currentThread\n    if current == mainThread then\n      return false\n    end\n    cyield(function ()\n      run(current)\n    end)\n    return true\n  end,\n  Join = function (this, timeout)\n    if currentThread == mainThread then\n      throw(NotSupportedException(\"mainThread not support\"))\n    end\n    if this.joinThread then\n      throw(ThreadStateException())\n    end\n    this.joinThread = currentThread  \n    if timeout == nil then\n      cyield()\n    else\n      timeout = checkTimeout(timeout)\n      local f\n      if timeout ~= -1 then\n        f = function ()\n          addTimer(function ()\n            resume(currentThread, false)\n          end, timeout)\n        end\n      end\n      return cyield(f)\n    end\n  end,\n  Start = function (this, parameter)\n    if this.co ~= nil then throw(ThreadStateException()) end\n    local co = ccreate(this.start)\n    this.co = co\n    this.start = nil\n    run(this, parameter)\n  end,\n  waitTask = function (taskContinueActions)\n    if currentThread == mainThread then\n      throw(NotSupportedException(\"mainThread not support\"))\n    end\n    taskContinueActions[#taskContinueActions + 1] = function ()\n      resume(currentThread)\n    end\n    cyield()\n  end,\n})\n\nmainThread = setmetatable({ id = getThreadId() }, Thread)\ncurrentThread = mainThread\n\nSystem.ThreadStateException = ThreadStateException\nSystem.ThreadAbortException = ThreadAbortException\nSystem.Thread = Thread\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Threading/Thread.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 879d7ccf94cad2a4abafc063a63417ee\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Threading/Timer.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal define = System.define\nlocal throw = System.throw\nlocal currentTimeMillis = System.currentTimeMillis\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException  = System.ArgumentOutOfRangeException\nlocal NotImplementedException = System.NotImplementedException\nlocal ObjectDisposedException = System.ObjectDisposedException\n\nlocal type = type\n\nlocal config = System.config\nlocal setTimeout = config.setTimeout\nlocal clearTimeout = config.clearTimeout\n\nif setTimeout and clearTimeout then\n\tSystem.post = function (fn) \n\t\tsetTimeout(fn, 0) \n\tend\nelse\n\tSystem.post = function (fn)\n\t\tfn()\n\tend\n\tlocal function notset()\n\t\tthrow(NotImplementedException(\"System.config.setTimeout or clearTimeout is not registered.\"))\n\tend\n  setTimeout = notset\n  clearTimeout = notset\nend\n\nlocal maxExpiration = 9223372036854775807  --[[Int64.MaxValue]]\nlocal LinkedListEvent =  System.LinkedList(System.Object) \nlocal TimeoutQueue = define(\"System.TimeoutQueue\", (function ()\n  local getNextId, Insert, Add, AddRepeating, AddRepeating1, getNextExpiration, Erase, RunLoop, \n  getCount, Contains, IsNext, __ctor__\n  __ctor__ = function (this)\n    this.ids_ = {}\n    this.events_ = LinkedListEvent()\n  end\n  getNextId = function (this)\n    local default = this.nextId_\n    this.nextId_ = default + 1\n    return default\n  end\n  Insert = function (this, e)\n    this.ids_[e.Id] = e\n    local next = this.events_:getFirst()\n    while next ~= nil and next.Value.Expiration <= e.Expiration do\n      next = next:getNext()\n    end\n    if next ~= nil then\n      e.LinkNode = this.events_:AddBefore(next, e)\n    else\n      e.LinkNode = this.events_:AddLast(e)\n    end\n  end\n  Add = function (this, now, delay, callback)\n    return AddRepeating1(this, now, delay, 0, callback)\n  end\n  AddRepeating = function (this, now, interval, callback)\n    return AddRepeating1(this, now, interval, interval, callback)\n  end\n  AddRepeating1 = function (this, now, delay, interval, callback)\n    local id = getNextId(this)\n    Insert(this, {\n      Id = id,\n      Expiration = now + delay,\n      RepeatInterval = interval,\n      Callback = callback\n    })\n    return id\n  end\n  getNextExpiration = function (this)\n    return this.events_.Count > 0 and this.events_:getFirst().Value.Expiration or maxExpiration\n  end\n  Erase = function (this, id)\n    local e = this.ids_[id]\n    if e then\n      this.ids_[id] = nil\n      this.events_:RemoveNode(e.LinkNode)\n      return true\n    end\n    return false\n  end\n  RunLoop = function (this, now)\n    while true do\n      local nextExp = getNextExpiration(this)\n      if nextExp <= now then\n        local e = this.events_:getFirst().Value\n        Erase(this, e.Id)\n        if e.RepeatInterval > 0 then\n          e.Expiration = now + e.RepeatInterval\n          Insert(this, e)\n        end\n        e.Callback(e.Id, now)\n      else\n        return nextExp\n      end\n    end\n  end\n  getCount = function (this)\n    return this.events_.Count\n  end\n  Contains = function (this, id)\n    return this.ids_[id] ~= nil\n  end\n\tIsNext = function (this, id)\n\t\tlocal first = this.events_:getFirst()\n\t\tlocal nextId = first and first.Value.Id\n\t\treturn nextId == id\n\tend\n  return {\n    MaxExpiration = maxExpiration,\n    nextId_ = 1,\n    Add = Add,\n    AddRepeating = AddRepeating,\n    AddRepeating1 = AddRepeating1,\n    getNextExpiration = getNextExpiration,\n    Erase = Erase,\n    RunLoop = RunLoop,\n    getCount = getCount,\n    Contains = Contains,\n    __ctor__ = __ctor__,\n\t\tIsNext = IsNext\n  }\nend)())\n\nlocal timerQueue = TimeoutQueue()\nlocal driverTimer\n\nlocal function runTimerQueue()\n  local now = currentTimeMillis()\n  local nextExpiration = timerQueue:RunLoop(now)\n  if nextExpiration ~= maxExpiration then\n    driverTimer = setTimeout(runTimerQueue, nextExpiration - now)\n  else\n    driverTimer = nil\n  end\nend\n\nlocal function addTimer(fn, dueTime, period)\n  local now = currentTimeMillis()\n  local id = timerQueue:AddRepeating1(now, dueTime, period or 0, fn)\n  if timerQueue:IsNext(id) then\n    if driverTimer then\n      clearTimeout(driverTimer)\n    end\n    driverTimer = setTimeout(runTimerQueue, dueTime)\n  end\n  return id\nend\n\nlocal function removeTimer(id)\n  local isNext = timerQueue:IsNext(id)\n\ttimerQueue:Erase(id)\n\tif isNext then\n\t\tclearTimeout(driverTimer)\n\t\tlocal delay = timerQueue:getNextExpiration() - currentTimeMillis()\n\t\tdriverTimer = setTimeout(runTimerQueue, delay)\n\tend\nend\n\nSystem.addTimer = addTimer\nSystem.removeTimer = removeTimer\n\nlocal function close(this)\n  local id = this.id\n  if id then\n    removeTimer(id)\n  end\nend\n\nlocal function change(this, dueTime, period)\n  if type(dueTime) == \"table\" then\n    dueTime = dueTime:getTotalMilliseconds()\n    period = period:getTotalMilliseconds()\n  end\n  if dueTime < -1 or dueTime > 0xfffffffe then\n    throw(ArgumentOutOfRangeException(\"dueTime\"))\n  end\n  if period < -1 or period > 0xfffffffe then\n    throw(ArgumentOutOfRangeException(\"period\"))\n  end\n  if this.id == -1 then throw(ObjectDisposedException()) end\n  close(this)\n  if dueTime ~= -1 then\n    this.id = addTimer(this.callback, dueTime, period)\n  end\n  return true\nend\n\nSystem.Timer = define(\"System.Threading.Timer\", {\n  __ctor__ =  function (this, callback, state,  dueTime, period)\n    if callback == nil then throw(ArgumentNullException(\"callback\")) end\n    this.callback = function () callback(state) end\n    change(this, dueTime, period)\n  end,\n  Change = change,\n  Dispose = function (this)\n    close(this)\n    this.id = -1\n  end,\n  __gc = close\n})\n\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Threading/Timer.lua.meta",
    "content": "fileFormatVersion: 2\nguid: bdc40b5bf02c0e2418211c3ea4fa4b8e\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Threading.meta",
    "content": "fileFormatVersion: 2\nguid: e91b659d8aba50548b8f6d890ff7e573\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Threads.meta",
    "content": "fileFormatVersion: 2\nguid: d1d009652a7b2644eaf9ca2d19663fa9\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/TimeSpan.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal div = System.div\nlocal trunc = System.trunc\nlocal ArgumentException = System.ArgumentException\nlocal OverflowException = System.OverflowException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal FormatException = System.FormatException\n\nlocal assert = assert\nlocal getmetatable = getmetatable\nlocal select = select\nlocal sformat = string.format\nlocal sfind = string.find\nlocal tostring = tostring\nlocal tonumber = tonumber\nlocal floor = math.floor\nlocal log10 = math.log10\n\nlocal TimeSpan\nlocal zero\n\nlocal function compare(t1, t2)\n  if t1.ticks > t2.ticks then return 1 end\n  if t1.ticks < t2.ticks then return -1 end\n  return 0\nend\n\nlocal function add(this, ts) \n  return TimeSpan(this.ticks + ts.ticks)\nend\n\nlocal function subtract(this, ts) \n  return TimeSpan(this.ticks - ts.ticks)\nend\n\nlocal function negate(this) \n  local ticks = this.ticks\n  if ticks == -9223372036854775808 then\n    throw(OverflowException(\"Overflow_NegateTwosCompNum\"))\n  end\n  return TimeSpan(-ticks)\nend\n\nlocal function interval(value, scale)\n  if value ~= value then \n    throw(ArgumentException(\"Arg_CannotBeNaN\"))\n  end\n  local tmp = value * scale\n  local millis = tmp + (value >=0 and 0.5 or -0.5)\n  if millis > 922337203685477 or millis < -922337203685477 then\n    throw(OverflowException(\"Overflow_TimeSpanTooLong\"))\n  end\n  return TimeSpan(trunc(millis) * 10000)\nend\n\nlocal function getPart(this, i, j)\n  local t = this.ticks\n  local v = div(t, i) % j\n  if v ~= 0 and t < 0 then\n    return v - j\n  end\n  return v\nend\n\nlocal function parse(s)\n  if s == nil then return nil, 1 end\n  local i, j, k, sign, ch\n  local day, hour, minute, second, milliseconds = 0, 0, 0, 0, 0\n  i, j, sign, day = sfind(s, \"^%s*([-]?)(%d+)\")\n  if not i then return end\n  k = j + 1\n  i, j, ch = sfind(s, \"^([%.:])\", k)\n  if not i then \n    i, j = sfind(s, \"^%s*$\", k)\n    if not i then return end\n    k = -1\n  else\n    k = j + 1\n    if ch == '.' then\n      i, j, hour, minute = sfind(s, \"^(%d+):(%d+)\", k)\n      if not i then return end\n      k = j + 1\n      i, j, second = sfind(s, \"^:(%d+)\", k)\n      if not i then return end\n    else\n      i, j, hour = sfind(s, \"^(%d+)\", k)\n      if not i then return end\n      k = j + 1\n      i, j, minute = sfind(s, \"^:(%d+)\", k)\n      if not i then\n        i, j = sfind(s, \"^%s*$\", k)\n        if not i then\n          return\n        end\n        day, hour, minute = 0, day, hour\n        k = -1\n      else\n        k = j\n        i, j, second = sfind(s, \"^:(%d+)\", k + 1)\n        if not i then\n          day, hour, minute, second = 0, day, hour, minute\n          j = k\n        end\n      end\n    end\n  end\n  if k ~= -1 then\n    k = j + 1\n    i, j, milliseconds = sfind(s, \"^%.(%d+)%s*$\", k)\n    if not i then\n      i, j = sfind(s, \"^%s*$\", k)\n      if not i then return end\n      milliseconds = 0\n    else\n      milliseconds = tonumber(milliseconds)\n      local n = floor(log10(milliseconds) + 1)\n      if n > 3 then\n        if n > 7 then return end\n        milliseconds = milliseconds / (10 ^ (n - 3))\n      end\n    end\n  end\n  if sign == '-' then\n    day, hour, minute, second, milliseconds = -day, -hour, -minute, -second, -milliseconds\n  end\n  return TimeSpan(day, hour, minute, second, milliseconds)\nend\n\nTimeSpan = System.defStc(\"System.TimeSpan\", {\n  ticks = 0,\n  __ctor__ = function (this, ...)\n    local ticks\n    local length = select(\"#\", ...)\n    if length == 0 then\n    elseif length == 1 then\n      ticks = ...\n    elseif length == 3 then\n      local hours, minutes, seconds = ...\n      ticks = (((hours * 60 + minutes) * 60) + seconds) * 10000000\n    elseif length == 4 then\n      local days, hours, minutes, seconds = ...\n      ticks = ((((days * 24 + hours) * 60 + minutes) * 60) + seconds) * 10000000\n    elseif length == 5 then\n      local days, hours, minutes, seconds, milliseconds = ...\n      ticks = (((((days * 24 + hours) * 60 + minutes) * 60) + seconds) * 1000 + milliseconds) * 10000\n    else \n      assert(ticks)\n    end\n    this.ticks = ticks\n  end,\n  Compare = compare,\n  CompareTo = compare,\n  CompareToObj = function (this, t)\n    if t == nil then return 1 end\n    if getmetatable(t) ~= TimeSpan then\n      throw(ArgumentException(\"Arg_MustBeTimeSpan\"))\n    end\n    compare(this, t)\n  end,\n  Equals = function (t1, t2)\n    return t1.ticks == t2.ticks\n  end,\n  EqualsObj = function(this, t)\n    if getmetatable(t) == TimeSpan then\n      return this.ticks == t.ticks\n    end\n    return false\n  end,\n  GetHashCode = function (this)\n    return this.ticks\n  end,\n  getTicks = function (this) \n    return this.ticks\n  end,\n  getDays = function (this) \n    return div(this.ticks, 864000000000)\n  end,\n  getHours = function(this)\n    return getPart(this, 36000000000, 24)\n  end,\n  getMinutes = function (this)\n    return getPart(this, 600000000, 60)\n  end,\n  getSeconds = function (this)\n    return getPart(this, 10000000, 60)\n  end,\n  getMilliseconds = function (this)\n    return getPart(this, 10000, 1000)\n  end,\n  getTotalDays = function (this) \n    return this.ticks / 864000000000\n  end,\n  getTotalHours = function (this) \n    return this.ticks / 36000000000\n  end,\n  getTotalMilliseconds = function (this) \n    return this.ticks / 10000\n  end,\n  getTotalMinutes = function (this) \n    return this.ticks / 600000000\n  end,\n  getTotalSeconds = function (this) \n    return this.ticks / 10000000\n  end,\n  Add = add,\n  Subtract = subtract,\n  Duration = function (this) \n    local ticks = this.ticks\n    if ticks == -9223372036854775808 then\n      throw(OverflowException(\"Overflow_Duration\"))\n    end\n    return TimeSpan(ticks >= 0 and ticks or - ticks)\n  end,\n  Negate = negate,\n  ToString = function (this) \n    local day, milliseconds = this:getDays(), this.ticks % 10000000\n    local daysStr = day == 0 and \"\" or (day .. \".\")\n    local millisecondsStr = milliseconds == 0 and \"\" or (\".%07d\"):format(milliseconds)\n    return sformat(\"%s%02d:%02d:%02d%s\", daysStr, this:getHours(), this:getMinutes(), this:getSeconds(), millisecondsStr)\n  end,\n  Parse = function (s)\n    local v, err = parse(s)\n    if v then\n      return v\n    end\n    if err == 1 then\n      throw(ArgumentNullException())\n    else\n      throw(FormatException())\n    end\n  end,\n  TryParse = function (s)\n    local v = parse(s)\n    if v then\n      return true, v\n    end\n    return false, zero\n  end,\n  __add = add,\n  __sub = subtract,\n  __unm = negate,\n  __eq = function (t1, t2)\n    return t1.ticks == t2.ticks\n  end,\n  __lt = function (t1, t2)\n    return t1.ticks < t2.ticks\n  end,\n  __le = function (t1, t2)\n    return t1.ticks <= t2.ticks\n  end,\n  FromDays = function (value) \n    return interval(value, 864e5)\n  end,\n  FromHours = function (value) \n    return interval(value, 36e5)\n  end,\n  FromMilliseconds = function (value) \n    return interval(value, 1)\n  end,\n  FromMinutes = function (value) \n    return interval(value, 6e4)\n  end,\n  FromSeconds = function (value) \n    return interval(value, 1000)\n  end,\n  FromTicks = function (value) \n    return TimeSpan(value)\n  end,\n  base = function (_, T)\n    return { System.IComparable, System.IComparable_1(T), System.IEquatable_1(T) }\n  end,\n  default = function ()\n    return zero\n  end,\n  Zero = false,\n  MaxValue = false,\n  MinValue = false\n})\n\nzero = TimeSpan(0)\nTimeSpan.Zero = zero\nTimeSpan.MaxValue = TimeSpan(9223372036854775807)\nTimeSpan.MinValue = TimeSpan(-9223372036854775808)\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/TimeSpan.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 8d3b7ec8b56191547ab3ab10d026b51b\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Type.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal Object = System.Object\nlocal Boolean = System.Boolean\nlocal Delegate = System.Delegate\nlocal getClass = System.getClass\nlocal arrayFromTable = System.arrayFromTable\n\nlocal InvalidCastException = System.InvalidCastException\nlocal ArgumentNullException = System.ArgumentNullException\nlocal MissingMethodException = System.MissingMethodException\nlocal TypeLoadException = System.TypeLoadException\nlocal NullReferenceException = System.NullReferenceException\n\nlocal Char = System.Char\nlocal SByte = System.SByte\nlocal Byte = System.Byte\nlocal Int16 = System.Int16\nlocal UInt16 = System.UInt16\nlocal Int32 = System.Int32\nlocal UInt32 = System.UInt32\nlocal Int64 = System.Int64\nlocal UInt64 = System.UInt64\nlocal Single = System.Single\nlocal Double = System.Double\nlocal Int = System.Int\nlocal Number = System.Number\nlocal ValueType = System.ValueType\n\nlocal assert = assert\nlocal type = type\nlocal setmetatable = setmetatable\nlocal getmetatable = getmetatable\nlocal select = select\nlocal unpack = table.unpack\nlocal floor = math.floor\n\nlocal Type, typeof\n\nlocal function isGenericName(name)\n  return name:byte(#name) == 93\nend\n\nlocal function getBaseType(this)\n  local baseType = this.baseType\n  if baseType == nil then\n    local baseCls = getmetatable(this[1])\n    if baseCls ~= nil then\n      baseType = typeof(baseCls)\n      this.baseType = baseType\n    end\n  end\n  return baseType\nend\n\nlocal function isSubclassOf(this, c)\n  local p = this\n  if p == c then\n    return false\n  end\n  while p ~= nil do\n    if p == c then\n      return true\n    end\n    p = getmetatable(p)\n  end\n  return false\nend\n\nlocal function getIsInterface(this)\n  return this[1].class == \"I\"\nend\n\nlocal function fillInterfaces(t, cls, set)\n  local base = getmetatable(cls)\n  if base then\n    fillInterfaces(t, base, set)\n  end\n  local interface = cls.interface\n  if interface then\n    for i = 1, #interface do\n      local it = interface[i]\n      if not set[it] then\n        t[#t + 1] = typeof(it)\n        set[it] = true\n      end\n      fillInterfaces(t, it, set)\n    end\n  end\nend\n\nlocal function getInterfaces(this)\n  local t = this.interfaces\n  if t == nil then\n    t = arrayFromTable({}, Type, true)\n    fillInterfaces(t, this[1], {})\n    this.interfaces = t\n  end\n  return t\nend\n\nlocal function implementInterface(this, ifaceType)\n  local t = this\n  while t ~= nil do\n    local interfaces = getInterfaces(this)\n    if interfaces ~= nil then\n      for i = 1, #interfaces do\n        local it = interfaces[i]\n        if it == ifaceType or implementInterface(it, ifaceType) then\n          return true\n        end\n      end\n    end\n    t = getBaseType(t)\n  end\n  return false\nend\n\nlocal function isAssignableFrom(this, c)\n  if c == nil then \n    return false \n  end\n  if this == c then \n    return true\n  end\n  local left, right = this[1], c[1]\n  if left == Object then\n    return true\n  end\n\n  if isSubclassOf(right, left) then\n    return true\n  end\n\n  if left.class == \"I\" then\n    return implementInterface(c, this)\n  end\n\n  return false\nend\n\nlocal function isGenericTypeDefinition(this)\n  return not rawget(this[1], \"__name__\")\nend\n\nType = System.define(\"System.Type\", {\n  Equals = System.equals,\n  getIsGenericType = function (this)\n    return isGenericName(this[1].__name__)\n  end,\n  getContainsGenericParameters = function (this)\n    return isGenericName(this[1].__name__)\n  end,\n  getIsGenericTypeDefinition = isGenericTypeDefinition,\n  GetGenericTypeDefinition = function (this)\n    if isGenericTypeDefinition(this) then\n      return this\n    end\n    local name = this[1].__name__\n    local i = name:find('`')\n    if i then\n      local genericTypeName = name:sub(1, i - 1)\n      return typeof(System.getClass(genericTypeName))\n    end\n    throw(System.InvalidOperationException())\n  end,\n  MakeGenericType = function (this, ...)\n    local args = { ... }\n    for i = 1, #args do\n      args[i] = args[i][1]\n    end\n    return typeof(this[1](unpack(args)))\n  end,\n  getIsEnum = function (this)\n    return this[1].class == \"E\"\n  end,\n  getIsClass = function (this)\n    return this[1].class == \"C\"\n  end,\n  getIsValueType = function (this)\n    return this[1].class == \"S\" \n  end,\n  getName = function (this)\n    local name = this.name\n    if name == nil then\n      local clsName = this[1].__name__\n      local pattern = isGenericName(clsName) and \"^.*()%.(.*)%[.+%]$\" or \"^.*()%.(.*)$\"\n      name = clsName:gsub(pattern, \"%2\")\n      this.name = name\n    end\n    return name\n  end,\n  getFullName = function (this)\n    return this[1].__name__\n  end,\n  getNamespace = function (this)\n    local namespace = this.namespace\n    if namespace == nil then\n      local clsName = this[1].__name__\n      local pattern = isGenericName(clsName) and \"^(.*)()%..*%[.+%]$\" or \"^(.*)()%..*$\"\n      namespace = clsName:gsub(pattern, \"%1\")\n      this.namespace = namespace\n    end\n    return namespace\n  end,\n  getBaseType = function (this)\n    local cls = this[1]\n    if cls.class ~= \"I\" and cls ~= Object then\n      while true do\n        local base = getmetatable(cls)\n        if not base then\n          break\n        end\n        if base.__index == base then\n          return typeof(base)\n        end\n        cls = base\n      end\n    end\n    return nil\n  end,\n  IsSubclassOf = function (this, c)\n    return isSubclassOf(this[1], c[1])\n  end,\n  getIsInterface = getIsInterface,\n  GetInterfaces = getInterfaces,\n  IsAssignableFrom = isAssignableFrom,\n  IsInstanceOfType = function (this, obj)\n    if obj == nil then\n      return false \n    end\n    return isAssignableFrom(this, obj:GetType())\n  end,\n  ToString = function (this)\n    return this[1].__name__\n  end,\n  GetTypeFrom = function (typeName, throwOnError, ignoreCase)\n    if typeName == nil then\n      throw(ArgumentNullException(\"typeName\"))\n    end\n    if #typeName == 0 then\n      if throwOnError then\n        throw(TypeLoadException(\"Arg_TypeLoadNullStr\"))\n      end\n      return nil\n    end\n    assert(not ignoreCase, \"ignoreCase is not support\")\n    local cls = getClass(typeName)\n    if cls ~= nil then\n      return typeof(cls)\n    end\n    if throwOnError then\n      throw(TypeLoadException(typeName .. \": failed to load.\"))\n    end\n    return nil\n  end\n})\n\nlocal NumberType = {\n  __index = Type,\n  __eq = function (a, b)\n    local c1, c2 = a[1], b[1]\n    if c1 == c2 then\n      return true\n    end\n    if c1 == Number or c2 == Number then\n      return true\n    end\n    return false\n  end\n}\n\nlocal function newNumberType(c)\n  return setmetatable({ c }, NumberType)\nend\n\nlocal types = {\n  [Char] = newNumberType(Char),\n  [SByte] = newNumberType(SByte),\n  [Byte] = newNumberType(Byte),\n  [Int16] = newNumberType(Int16),\n  [UInt16] = newNumberType(UInt16),\n  [Int32] = newNumberType(Int32),\n  [UInt32] = newNumberType(UInt32),\n  [Int64] = newNumberType(Int64),\n  [UInt64] = newNumberType(UInt64),\n  [Single] = newNumberType(Single),\n  [Double] = newNumberType(Double),\n  [Int] = newNumberType(Int),\n  [Number] = newNumberType(Number),\n}\n\nlocal customTypeof = System.config.customTypeof\n\nfunction typeof(cls)\n  assert(cls)\n  local t = types[cls]\n  if t == nil then\n    if customTypeof then\n      t = customTypeof(cls)\n      if t then\n        types[cls] = t\n        return t\n      end\n    end\n    t = setmetatable({ cls }, Type)\n    types[cls] = t\n  end\n  return t\nend\n\nlocal function getType(obj)\n  return typeof(getmetatable(obj))\nend\n\nSystem.typeof = typeof\nSystem.Object.GetType = getType\n\nlocal function addCheckInterface(set, cls)\n  local interface = cls.interface\n  if interface then\n    for i = 1, #interface do\n      local it = interface[i]\n      set[it] = true\n      addCheckInterface(set, it)\n    end\n  end\nend\n\nlocal function getCheckSet(cls)\n  local set = {}\n  local p = cls\n  repeat\n    set[p] = true\n    addCheckInterface(set, p)\n    p = getmetatable(p)\n  until not p\n  return set\nend\n\nlocal customTypeCheck = System.config.customTypeCheck\n\nlocal checks = setmetatable({}, {\n  __index = function (checks, cls)\n    if customTypeCheck then\n      local f, add = customTypeCheck(cls)\n      if f then\n        if add then\n          checks[cls] = f\n        end\n        return f\n      end\n    end\n\n    local set = getCheckSet(cls)\n    local function check(obj, T)\n      return set[T] == true\n    end\n    checks[cls] = check\n    return check\n  end\n})\n\nchecks[Number] = function (obj, T)\n  local set = getCheckSet(Number)\n  local numbers = {\n    [Char] = function (obj) return type(obj) == \"number\" and obj >= 0 and obj <= 65535 and floor(obj) == obj end,\n    [SByte] = function (obj) return type(obj) == \"number\" and obj >= -128 and obj <= 127 and floor(obj) == obj end,\n    [Byte] = function (obj) return type(obj) == \"number\" and obj >= 0 and obj <= 255 and floor(obj) == obj end,\n    [Int16] = function (obj) return type(obj) == \"number\" and obj >= -32768 and obj <= 32767 and floor(obj) == obj end,\n    [UInt16] = function (obj) return type(obj) == \"number\" and obj >= 0 and obj <= 32767 and floor(obj) == obj end,\n    [Int32] = function (obj) return type(obj) == \"number\" and obj >= -2147483648 and obj <= 2147483647 and floor(obj) == obj end,\n    [UInt32] = function (obj) return type(obj) == \"number\" and obj >= 0 and obj <= 4294967295 and floor(obj) == obj end,\n    [Int64] = function (obj) return type(obj) == \"number\" and obj >= -9223372036854775808 and obj <= 9223372036854775807 and floor(obj) == obj end,\n    [UInt64] = function (obj) return type(obj) == \"number\" and obj >= 0 and obj <= 18446744073709551615 and floor(obj) == obj end,\n    [Single] = function (obj) return type(obj) == \"number\" and obj >= -3.40282347E+38 and obj <= 3.40282347E+38 end,\n    [Double] = function (obj) return type(obj) == \"number\" end\n  }\n  local function check(obj, T)\n    local number = numbers[T]\n    if number then\n      return number(obj)\n    end\n    return set[T] == true\n  end\n  checks[Number] = check\n  return check(obj, T)\nend\n\nlocal is, getName\n\nif System.debugsetmetatable then\n  is = function (obj, T)\n    return checks[getmetatable(obj)](obj, T)\n  end\n\n  getName = function (obj)\n    return obj.__name__\n  end\n\n  System.getClassFromObj = getmetatable\nelse\n  local function getClassFromObj(obj)\n    local t = type(obj)\n    if t == \"number\" then\n      return Number\n    elseif t == \"boolean\" then\n      return Boolean\n    elseif t == \"function\" then\n      return Delegate\n    end\n    return getmetatable(obj)\n  end\n\n  function System.ObjectGetType(this)\n    if this == nil then throw(NullReferenceException()) end\n    return typeof(getClassFromObj(this))\n  end\n\n  is = function (obj, T)\n    local base = getClassFromObj(obj)\n    if base then\n      return checks[base](obj, T)\n    end\n    return false\n  end\n\n  getName = function (obj)\n    return getClassFromObj(obj).__name__\n  end\n\n  System.getClassFromObj = getClassFromObj\nend\n\nSystem.is = is\n\nfunction System.as(obj, cls)\n  if obj ~= nil and is(obj, cls) then\n    return obj\n  end\n  return nil\nend\n\nlocal function cast(cls, obj, nullable)\n  if obj ~= nil then\n    if is(obj, cls) then\n      return obj\n    end\n    throw(InvalidCastException((\"Unable to cast object of type '%s' to type '%s'.\"):format(getName(obj), cls.__name__)), 1)\n  else\n    if cls.class ~= \"S\" or nullable then\n      return nil\n    end\n    throw(NullReferenceException(), 1)\n  end\nend\n\nSystem.cast = cast\n\nfunction System.castWithNullable(cls, obj)\n  if System.isNullable(cls) then\n    return cast(cls.__genericT__, obj, true)\n  end\n  return cast(cls, obj)\nend\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Type.lua.meta",
    "content": "fileFormatVersion: 2\nguid: e04c3d45c30677947a46f7bae4c7aadd\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Utilities.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nlocal System = System\nlocal throw = System.throw\nlocal define = System.define\nlocal trunc = System.trunc\nlocal sl = System.sl\nlocal bor = System.bor\nlocal TimeSpan = System.TimeSpan\nlocal ArgumentNullException = System.ArgumentNullException\n\nlocal select = select\nlocal type = type\nlocal os = os\nlocal clock = os.clock\nlocal tostring = tostring\nlocal collectgarbage = collectgarbage\n\ndefine(\"System.Environment\", {\n  Exit = os.exit,\n  getStackTrace = System.traceback,\n  getTickCount = function ()\n    return System.currentTimeMillis() % 2147483648\n  end\n})\n\ndefine(\"System.GC\", {\n  Collect = function ()\n    collectgarbage(\"collect\")\n  end,\n  GetTotalMemory = function (forceFullCollection)\n    if forceFullCollection then \n      collectgarbage(\"collect\")\n    end\n    return collectgarbage(\"count\") * 1024\n  end\n})\n\nlocal Lazy = {\n  created = false,\n  __ctor__ = function (this, ...)\n    local n = select(\"#\", ...)\n    if n == 0 then\n    elseif n == 1 then\n      local valueFactory = ...\n      if valueFactory == nil then\n        throw(ArgumentNullException(\"valueFactory\"))\n      elseif type(valueFactory) ~= \"boolean\" then\n        this.valueFactory = valueFactory\n      end\n    elseif n == 2 then\n      local valueFactory = ...\n      if valueFactory == nil then\n        throw(ArgumentNullException(\"valueFactory\"))\n      end\n      this.valueFactory = valueFactory\n    end\n  end,\n  getIsValueCreated = function (this)\n    return this.created\n  end,\n  getValue = function (this)\n    if not this.created then\n      local valueFactory = this.valueFactory\n      if valueFactory then\n        this.value = valueFactory()\n        this.valueFactory = nil\n      else\n        this.value = this.__genericT__()\n      end\n      this.created = true\n    end\n    return this.value\n  end,\n  ToString = function (this)\n    if this.created then\n      return this.value:ToString()\n    end\n    return \"Value is not created.\"\n  end\n}\n\ndefine(\"System.Lazy\", function (T)\n  return { \n    __genericT__ = T \n  }\nend, Lazy)\n\nlocal ticker, frequency\nlocal time = System.config.time\nif time then\n  ticker = time\n  frequency = 10000\nelse\n  ticker = clock\n  frequency = 1000\nend\n\nlocal function getRawElapsedSeconds(this)\n  local timeElapsed = this.elapsed\n  if this.running then\n    local currentTimeStamp = ticker()\n    local elapsedUntilNow  = currentTimeStamp - this.startTimeStamp\n    timeElapsed = timeElapsed + elapsedUntilNow\n  end\n  return timeElapsed\nend\n\nlocal Stopwatch\nStopwatch = define(\"System.Diagnostics.Stopwatch\", {\n  elapsed = 0,\n  running = false,\n  IsHighResolution = false,\n  Frequency = frequency,\n  StartNew = function ()\n    local t = Stopwatch()\n    t:Start()\n    return t\n  end,\n  GetTimestamp = function ()\n    return trunc(ticker() * frequency)\n  end,\n  Start = function (this)\n    if not this.running then\n      this.startTimeStamp = ticker()\n      this.running = true\n    end\n  end,\n  Stop = function (this)\n    if this.running then\n      local endTimeStamp = ticker()\n      local elapsedThisPeriod = endTimeStamp - this.startTimeStamp\n      local elapsed = this.elapsed + elapsedThisPeriod\n      this.running = false\n      if elapsed < 0 then\n        -- os.clock may be return negative value\n        elapsed = 0\n      end\n      this.elapsed = elapsed\n    end\n  end,\n  Reset = function (this)\n    this.elapsed = 0\n    this.running = false\n    this.startTimeStamp = 0\n  end,\n  Restart = function (this)\n    this.elapsed = 0\n    this.startTimeStamp = ticker()\n    this.running = true\n  end,\n  getIsRunning = function (this)\n    return this.running\n  end,\n  getElapsed = function (this)\n    return TimeSpan(trunc(getRawElapsedSeconds(this) * 1e7))\n  end,\n  getElapsedMilliseconds = function (this)\n    return trunc(getRawElapsedSeconds(this) * 1000)\n  end,\n  getElapsedTicks = function (this)\n    return trunc(getRawElapsedSeconds(this) * frequency)\n  end\n})\nSystem.Stopwatch = Stopwatch\n\nlocal weaks = setmetatable({}, { __mode = \"kv\" })\n\nlocal function setWeakTarget(this, target)\n  weaks[this] = target\nend\n\ndefine(\"System.WeakReference\", {\n  trackResurrection = false,\n  SetTarget = setWeakTarget,\n  setTarget = setWeakTarget,\n  __ctor__ = function (this, target, trackResurrection)\n    if trackResurrection then\n      this.trackResurrection = trackResurrection\n    end\n    weaks[this] = target\n  end,\n  TryGetTarget = function (this)\n    local target = weaks[this]\n    return target ~= nil, target\n  end,\n  getIsAlive = function (this)\n    return weaks[this] ~= nil\n  end,\n  getTrackResurrection = function (this)\n    return this.trackResurrection\n  end,\n  getTarget = function (this)\n    return weaks[this]\n  end\n})\n\ndefine(\"System.Guid\", {})\ndefine(\"System.ArraySegment\", {})\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem/Utilities.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 78d6ea4ba4295854389822aa7fb53ca5\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/CoreSystem.meta",
    "content": "fileFormatVersion: 2\nguid: 2138a9006de9313498422cd95a8c4124\nfolderAsset: yes\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/Sample/test.lua",
    "content": "require('mobdebug').coro()\nrequire(\"strict\")\nlocal socket = require(\"socket\")\n\nlocal now = 0\nlocal timeoutQueue\n\nlocal conf = {\n  time = socket and socket.gettime or os.time,\n  setTimeout = function (f, delay)\n    if not timeoutQueue then\n      timeoutQueue = System.TimeoutQueue()\n    end\n    return timeoutQueue:Add(now, delay, f)\n  end,\n  clearTimeout = function (t)\n    timeoutQueue:Erase(t)\n  end\n}\n\nlocal function runTimeout()\n  if timeoutQueue then\n    while true do\n      local nextExpiration = timeoutQueue:getNextExpiration()\n      if nextExpiration ~= timeoutQueue.MaxExpiration then\n        now = nextExpiration\n        timeoutQueue:RunLoop(now)\n      else\n        break\n      end\n    end\n  end\nend\n\npackage.path = package.path .. \";CSharp.lua/Coresystem.lua/?.lua\"\nrequire(\"All\")(\"\", conf)\ncollectgarbage(\"collect\")\nprint(collectgarbage(\"count\"))\n\nlocal function test(f, name) \n  print(\"-----------------------------\", name)\n  f()\n  print(\"\\n\")\nend\n\nlocal function printList(list)\n  assert(list)\n  local t = {}\n  for _, i in System.each(list) do\n    table.insert(t, i:ToString())\n  end\n  print(table.concat(t, \" \"))\nend\n\nlocal function testDateTimeAndTimeSpan() \n  local date = System.DateTime.getNow()\n  print(date:getTicks())\n  print(date:ToString(), date:getYear(), date:getMonth(), date:getDay(), date:getHour(), date:getMinute(), date:getSecond())\n    \n  local ts = System.TimeSpan.FromSeconds(20)\n  print(ts:ToString())\n    \n  date = date + System.TimeSpan.FromDays(2)\n  print(date:ToString())\n  \n  date = date:AddMonths(2);\n  print(date:ToString())\n    \n  local baseTime = System.DateTime(1970, 1, 1) \n  print(baseTime:ToString())\n  print(baseTime:AddMilliseconds(1458032204643):ToString())\nend\n\nlocal function testArray() \n  local arr = System.Array(System.Int32):new(10)\n  print(arr:ToString(), #arr)\n  printList(arr)\n  arr:set(0, 2)\n  arr:set(6, 4)\n  printList(arr)\n  print(arr:get(0), arr:get(6), arr:get(9))\nend\n\nlocal function testList()\n  local list = System.List(System.Int)()\n  list:Add(20)\n  list:Add(15)\n  list:Add(6)\n  print(list:ToString(), #list)\n  printList(list)\n  local subList = list:GetRange(1, 2)\n  printList(subList)\n  list:set(1, 8)\n  list:Sort()\n  printList(list)\n  print(list:Contains(10), list:Contains(15), list:IndexOf(20))\n  list:RemoveAll(function(i) return i >= 10 end)\n  print(#list, list:get(1))\n  printList(list)\nend\n\nlocal function testDictionary()\n  local dict = System.Dictionary(System.String, System.Int)()\n  dict:Add(\"a\", 1)\n  dict:Add(\"b\", 12)\n  dict:Add(\"c\", 25)\n  dict:Add(\"d\", 30)\n  for _,  pair in System.each(dict) do\n    print(pair.Key, pair.Value)\n  end\n  print(\"-------------\")\n  for k, v in System.pairs(dict) do\n     print(k, v)\n  end\nend\n\nlocal function testYeild()\n  local enumerable = function (begin, _end) \n    return System.yieldIEnumerable(function (begin, _end)\n      while begin < _end do\n        System.yield(begin)\n        begin = begin + 1\n      end\n    end, System.Int, begin, _end)\n  end\n  local e = enumerable(1, 10)\n  printList(e)\n  printList(e)\nend\n\nlocal function testDelegate()\n  local prints = \"\"\n  local function printExt(s)\n    prints = prints .. s\n    print(s)\n  end\n\n  local function assertExt(s)\n    assert(prints == s, s)\n    prints = \"\"\n  end\n\n  local d1 = function() printExt(\"d1\") end\n  local d2 = function() printExt(\"d2\") end\n  local d3 = function() printExt(\"d3\") end\n\n  local f = nil + d1 \n  f()\n  assertExt(\"d1\") \n  print(\"--\")\n  \n  f = d1 + nil\n  f()\n  assertExt(\"d1\")\n  print(\"--\")\n  \n  f = d1 + d2\n  f()\n  assertExt(\"d1d2\")\n  print(\"--\")\n   \n  f = d1 + (d2 + d3) \n  f()\n  assertExt(\"d1d2d3\")\n  print(\"--\")\n     \n  f = (d1 + d2) + (d2 + d3)  \n  f()\n  assertExt(\"d1d2d2d3\")\n  print(\"--\")\n  \n  f = d1 + d2 - d1  \n  f()\n  assertExt(\"d2\")\n  print(\"--\")\n   \n  f = d1 + d2 - d2 \n  f()\n  assertExt(\"d1\")\n  print(\"--\")\n   \n  f = d1 + d2 + d1 - d1\n  f()\n  assertExt(\"d1d2\")\n  print(\"--\")\n  \n  f = d1 + d2 + d3 - (d1 + d2) \n  f()\n  assertExt(\"d3\")\n  print(\"--\")\n    \n  f = d1 + d2 + d3 - (d2 + d1)\n  f()\n  assertExt(\"d1d2d3\")\n  print(\"--\")\n   \n  f = (d1 + d2) + (d3 + d1 + d2) \n  local f1 = d1 + d2\n  f = f - f1\n  f()\n  assertExt(\"d1d2d3\")\n    \n  print(\"--\")\n  f = (d1 + d2) - (d1 + d2)\n  print(f == nil)\nend\n\nlocal function testLinq()\n  local Linq = System.Linq.Enumerable\n  local list = System.List(System.Int)()\n  list:Add(10) list:Add(2) list:Add(30) list:Add(4) list:Add(5) list:Add(6) list:Add(7) list:Add(8)\n  printList(Linq.Where(list, function(i) return i >= 4 end))\n  printList(Linq.Take(list, 4))\n  printList(Linq.Select(list, function(i) return i + 2 end, System.Int))\n  print(Linq.Min(list), Linq.Max(list))\n  print(Linq.ElementAtOrDefault(Linq.Where(list, function(i) return i <= 4 end), 5))\n  local ll = Linq.Where(list, function(i) return i <= 4 end)\n  print(Linq.Count(ll))\n  Linq.Any(ll)\n  print(Linq.Count(ll))\n    \n  printList(Linq.OrderByDescending(list, function(i) return i end, nil, System.Int))  \n  list = System.List(System.Object)()\n  local super = { \n    ToString = function(t)\n      return t[1] .. ',' .. t[2] .. ',' .. t[3] .. '|'\n    end\n  }\n  super.__index = super \n    \n  list:Add(setmetatable({ 4, 2, 3 }, super))\n  list:Add(setmetatable({ 3, 1, 3 }, super))\n  list:Add(setmetatable({ 1, 2, 3 }, super))\n  list:Add(setmetatable({ 3, 2, 4 }, super))\n  list:Add(setmetatable({ 3, 2, 3 }, super))\n    \n  local t1 = Linq.OrderBy(list, function(i) return i[1] end, nil, System.Int)  \n  printList(t1)\n  t1 = Linq.ThenBy(t1, function(i) return i[2] end, nil, System.Int)\n  t1 = Linq.ThenBy(t1, function(i) return i[3] end, nil, System.Int)\n  printList(t1)\nend \n\nlocal function testGroupBy() \n  local Linq = System.Linq.Enumerable\n  local list = System.List(System.Object)()\n  list:Add({ id = 5, Template = 30 })\n  list:Add({ id = 6, Template = 30 })\n  list:Add({ id = 1, Template = 1 })\n  list:Add({ id = 2, Template = 2 })\n  list:Add({ id = 3, Template = 1 })\n  list:Add({ id = 4, Template = 2 })\n  local groups = Linq.GroupBy(list, function (i) return i.Template end, System.Int)\n  local s = \"\"\n  for _,  group in System.each(groups) do\n    for _, item in System.each(group) do\n      s = s .. item.id\n    end\n  end\n  print(s)\n  assert(s == \"561324\");\nend\n\nlocal function testType()\n  local ins = 2\n  print(System.is(ins, System.Double))\n  local t = ins:GetType()\n  print(t:getName())\n  print(System.is(\"ddd\", System.String))\n  print(System.as(\"ddd\", System.String))\n  print(System.cast(System.String, \"ddd\"))\nend\n\nlocal function testNumCast()\n  assert(System.toInt32(-2147483659) == 2147483637)\n  assert(System.toUInt32(-2147483659) == 2147483637)\n  assert(System.toUInt64(-1) == 18446744073709551615)\nend\n\nlocal function testSplit()\n  local a = \"a, b\"\n  local aa = a:Split(44 --[[',']])\n  printList(aa)\nend\n\nlocal function testConsole()\n  print(\"enter your name\")\n  local name = System.Console.ReadLine()\n  print(\"enter your age\")\n  local age = System.Console.ReadLine()\n  System.Console.WriteLine(\"name {0}, age {1}\", name, age)\nend\n\nlocal function testIO()\n  local path = \"iotest.txt\"\n  local s = \"hero, CSharp.lua\\nIO\"\n  local File = System.IO.File\n  File.WriteAllText(path, s)\n  local text = File.ReadAllText(path)\n  assert(text == s)\n  File.Delete(path)\nend\n\nlocal function testStringBuilder()\n  local sb = System.StringBuilder()\n  sb:Append(\"aa\")\n  sb:Append(\"bbcc\")\n  sb:setLength(5)  \n  print(sb, sb:getLength())\nend\n\nlocal function testAsync()  \n\t-- Generated by CSharp.lua Compiler\n\tlocal System = System\n\tlocal Test\n\tSystem.import(function (global)\n\t\tTest = global.Test\n\tend)\n\tSystem.namespace(\"Test\", function (namespace)\n\t\tnamespace.class(\"TestAsync\", function (namespace)\n\t\t\tlocal f, __ctor__\n\t\t\t__ctor__ = function (this)\n\t\t\t\tlocal t = f(this)\n\t\t\t\tSystem.Console.WriteLine((\"{0}, {1}\"):Format(t:getStatus():EnumToString(System.TaskStatus), t:getException()))\n\t\t\tend\n\t\t\tf = function (this)\n\t\t\t\treturn System.async(function (async, this)\n\t\t\t\t\tlocal t = System.Task.Delay(2000)\n\t\t\t\t\tasync:await(t)\n\t\t\t\t\tasync:await(t)\n\t\t\t\t\tSystem.Console.WriteLine((\"Delay {0}\"):Format(t:getStatus():ToEnumString(System.TaskStatus)))\n\t\t\t\tend, nil, this)\n\t\t\tend\n\t\t\treturn {\n\t\t\t\tf = f,\n\t\t\t\t__ctor__ = __ctor__\n\t\t\t}\n\t\tend)\n\n\t\tnamespace.class(\"Program\", function (namespace)\n\t\t\tlocal Main\n\t\t\tMain = function ()\n\t\t\t\tTest.TestAsync()\n\t\t\tend\n\t\t\treturn {\n\t\t\t\tMain = Main\n\t\t\t}\n\t\tend)\n\tend)\n\n\tSystem.init({\n\t\t\"Test.Program\",\n\t\t\"Test.TestAsync\"\n\t}, {\n\t\tMain = \"Test.Program.Main\"\n\t})\n\n\tTest.Program.Main() \n  runTimeout()\nend\n\nlocal function testAsyncForeach()\n  local System = System\n  local ListInt32 = System.List(System.Int32)\n  System.namespace(\"Test\", function (namespace)\n    namespace.class(\"Program\", function (namespace)\n      local GenerateSequence, Main, Test\n      GenerateSequence = function (n)\n        return System.yieldIAsyncEnumerable(function (async, n)\n          for i = 0, n - 1 do\n            async:yield(i)\n          end\n        end, System.Int32, n)\n      end\n      Main = function (args)\n        Test()\n      end\n      Test = function ()\n        System.async(function (async)\n          local l = ListInt32()\n          for _, number in System.asynceach(async, GenerateSequence(10)) do\n            System.Console.WriteLine(number)\n            l:Add(number)\n          end\n          async:await(System.Task.Delay(200))\n          System.Console.WriteLine(System.String.JoinEnumerable(\",\", l))\n        end, true)\n      end\n      return {\n        GenerateSequence = GenerateSequence,\n        Main = Main\n      }\n    end)\n  end)\n\n    System.init({\n      \"Test.Program\"\n    }, {\n      Main = \"Test.Program.Main\"\n    })\n\n    Test.Program.Main() \n    runTimeout()\nend\n\ntest(testDateTimeAndTimeSpan, \"DateTime & TimeSpan\")\ntest(testArray, \"Array\")\ntest(testList, \"List\")\ntest(testDictionary, \"Dictionary\")\ntest(testYeild, \"Yeild\")\ntest(testDelegate, \"Delegate\")\ntest(testLinq, \"Linq\")\ntest(testGroupBy, \"GroupBy\")\ntest(testType, \"Type\")\ntest(testNumCast, \"NumCast\")\ntest(testSplit, \"testSplit\")\ntest(testStringBuilder, \"StringBuilder\")\ntest(testIO, \"IO\")\n--test(testConsole, \"Console\")\n--test(testAsync, \"Async\")\n--test(testAsyncForeach, \"testAsyncForeach\")\n\n\n\n      \n\n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/Sample/test.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 629a921622d88ad4592c0de841bdb4cb\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua/Sample.meta",
    "content": "fileFormatVersion: 2\nguid: 1888b99286c3c2f48af9dee1c96c1581\nfolderAsset: yes\ntimeCreated: 1526899278\nlicenseType: Free\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/CoreSystemLua.meta",
    "content": "fileFormatVersion: 2\nguid: 473f2c916afc7094d96142fec01bf9a9\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/Main.lua",
    "content": "require(\"Classloader\")\n\n--主入口函数。从这里开始lua逻辑\nfunction Main()\t\t\t\t\t\n\tprint(\"logic start\")\t \t\t\nend\n\n--场景切换通知\nfunction OnLevelWasLoaded(level)\n\tcollectgarbage(\"collect\")\n\tTime.timeSinceLevelLoad = 0\nend\n\nfunction OnApplicationQuit()\nend"
  },
  {
    "path": "Assets/Lua/Main.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 091b02c3490daac4f8ed8cd5b62090b1\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Lua/ProtobufAdapter.lua",
    "content": "require(\"3rd.pbc.protobuf\")\n\nlocal protobuf = protobuf\nlocal pairs = pairs\nlocal ipairs = ipairs\nlocal protobuf = protobuf\nlocal type = type\nlocal getmetatable = getmetatable\nlocal assert = assert\nlocal enums = {}\n\nlocal function toEnumInt(name, T, str)\n  local t = enums[T]\n  if t then\n    local v = t[str]\n    if v then\n      return v\n    end\n  else\n    t = {}\n    enums[T] = t\n  end\n  for k, cls in pairs(T) do\n    if cls.class == \"E\" then\n      local v = cls[str]\n      if v then\n        t[str] = v\n        return v\n      end\n    end\n  end\n  assert(false, str .. \" is not in \" .. name)\nend\n\nlocal function decode(name, data)\n  local proto, error = protobuf.decode(name, data)\n  assert(proto, error)\n  local T = System.getClass(name)\n  local t = T()\n  for k, v in pairs(proto) do\n    if type(v) == \"table\" then\n      if getmetatable(v) ~= nil then   \n        v = decode(v[1], v[2])\n        t[k] = v\n      else \n        local list = t[k]\n        assert(list)\n        for _, v in ipairs(v) do\n          if type(v) == \"table\" then\n            v = decode(v[1], v[2])\n          end\n          list:Add(v)\n        end\n      end\n    else \n       --is enum string\n      if type(v) == \"string\" and type(T[k]) == \"number\" then \n        v = toEnumInt(name, T, v)\n      end\n      t[k] = v\n    end\n  end\n  return t\nend\n\nfunction encodeProtobuf(t)\n  local name = t.__name__\n  return protobuf.encode(name, t)\nend\n\nfunction decodeProtobuf(data, T)\n  return decode(T.__name__, data)\nend"
  },
  {
    "path": "Assets/Lua/ProtobufAdapter.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 3b3987b905cf20f43ab7c46782a49808\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua/UnityAdapter.Lua",
    "content": "local System = System\nlocal throw = System.throw\nlocal emptyFn = System.emptyFn\nlocal getClass = System.getClass\nlocal is = System.is\nlocal NotSupportedException = System.NotSupportedException\nlocal SystemType = System.Type\nlocal SystemListObject = System.List(System.Object)\nlocal SystemTypeof = System.typeof\nlocal SystemIEnumerator = System.IEnumerator\nlocal arrayFromList = System.arrayFromList\nlocal ArgumentNullException = System.ArgumentNullException\nlocal ArgumentOutOfRangeException = System.ArgumentOutOfRangeException\nlocal CSharpLua = CSharpLua\n\nlocal assert = assert\nlocal setmetatable = setmetatable\nlocal getmetatable = getmetatable\nlocal rawget = rawget\nlocal rawset = rawset\nlocal type = type\nlocal tinsert = table.insert\nlocal sformat = string.format\nlocal sbyte = string.byte\nlocal loadstring = loadstring\nlocal ipairs = ipairs\nlocal pairs = pairs\nlocal typeof = typeof\nlocal pcall = pcall\n\nlocal Clamp01 = Mathf.Clamp01\n\nlocal Debugger = Debugger\nlocal BridgeMonoBehaviour = CSharpLua.BridgeMonoBehaviour\nlocal UnityEngine = UnityEngine\nlocal toluaSystem = toluaSystem\nlocal isFromCSharp = UnityEngine.isFromCSharp\n\nSystem.define(\"UnityEngine.Debug\", {\n  Log = Debugger.Log,\n  LogFormat = function (format, ...)\n    Debugger.Log(format:Format(...))\n  end,\n  LogErrorFormat = function (format, ...)\n    Debugger.LogError(format:Format(...))\n  end,\n})\n\nSystem.typeof = function (cls)\n  if isFromCSharp(cls) then\n    return typeof(cls)\n  end\n  return SystemTypeof(cls)\nend\n\nlocal UnityEngineMonoBehaviour = UnityEngine.MonoBehaviour\nUnityEngine.MonoBehaviour = nil\n\nlocal MonoBehaviour = System.define(\"UnityEngine.MonoBehaviour\", {\n  __ctor__ = emptyFn,\n  class = \"C\",\n  GetType = System.Object.GetType,\n  print = UnityEngineMonoBehaviour.print,\n  Awake = emptyFn,\n  Start = emptyFn,\n  Update = emptyFn,\n  FixedUpdate = emptyFn,\n  LateUpdate = emptyFn,\n  ToString = function (this)\n    return sformat(\"%s (%s)\", this.ref.gameObject.name, this.__name__)\n  end,\n})\nSystemTypeof(MonoBehaviour)[1] = UnityEngineMonoBehaviour\n\nlocal function getMonoBehaviourFunction(metatableOfMonoBehaviour, name)\n  return metatableOfMonoBehaviour[name]   \nend\n\nlocal metatableOfMonoBehaviour = getmetatable(BridgeMonoBehaviour) \nsetmetatable(MonoBehaviour, {\n  __index = function (t, k)\n    if type(k) == \"string\" then\n      local c = sbyte(k, 1)\n      if c ~= 95 and c ~= 46 then -- not '.' or '_'\n        local ok, f = pcall(getMonoBehaviourFunction, metatableOfMonoBehaviour, k)\n        if ok then\n          local v = function (this, ...)\n            return f(this.ref, ...)\n          end\n          t[k] = v\n          return v\n        end\n      end\n    end\n    return nil\n  end\n})\n\nlocal updateIndexs = { Update = 0, FixedUpdate = 1, LateUpdate = 2 }\n\nlocal function registerUpdate(this, bridgeMonoBehaviour, nameOfFn)\n  local f = this[nameOfFn]\n  if f ~= emptyFn and type(f) == \"function\" then\n    bridgeMonoBehaviour:RegisterUpdate(updateIndexs[nameOfFn], f)\n  end\nend\n\nlocal typeofBridgeMonoBehaviour = typeof(BridgeMonoBehaviour)\nlocal isInstanceOfType = typeofBridgeMonoBehaviour.IsInstanceOfType \n\nlocal function isBridgeInstance(t)\n  return isInstanceOfType(typeofBridgeMonoBehaviour, t)\nend\n\nlocal makeBridge\nlocal function checkBridgeMonoBehaviour(t)\n  if isBridgeInstance(t) then\n    local bridge = t\n    t = bridge.Table\n    if t == nil then\n      local luaClass = bridge.LuaClass\n      local T = getClass(luaClass)\n      assert(T, luaClass .. \" is not found\")\n      t = setmetatable({}, T)\n      T.__ctor__(t)\n      makeBridge(t, bridge, true, bridge.SerializeData, bridge.SerializeObjects)\n      bridge:Bind(t)\n    end\n  end\n  return t\nend\n\nfunction makeBridge(this, bridgeMonoBehaviour, state, serializeData, serializeObjects)\n  this.ref = assert(bridgeMonoBehaviour)\n  if not state then\n    bridgeMonoBehaviour:Bind(this, this.__name__)\n  else\n    if serializeData and #serializeData > 0 then\n      local datas = loadstring(serializeData)()\n      local normals = datas[1]\n      if normals then\n        for k, v in pairs(normals) do\n          if type(v) == \"table\" then\n            local n = #v\n            local T = v[n]\n            v[n] = nil\n            setmetatable(v, T)\n          end\n          this[k] = v\n        end\n      end\n      local objects = datas[2]\n      if objects then\n        for k, v in pairs(objects) do\n          if type(v) == \"table\" then\n            local n = #v\n            local T = v[n]\n            v[n] = nil\n            for i = 1, n - 1 do\n              v[i] = checkBridgeMonoBehaviour(serializeObjects[v[i]])\n            end\n            setmetatable(v, T)\n          else\n            v = checkBridgeMonoBehaviour(serializeObjects[v])\n          end\n          this[k] = v\n        end\n      end\n    end\n  end\n  registerUpdate(this, bridgeMonoBehaviour, \"Update\")\n  registerUpdate(this, bridgeMonoBehaviour, \"FixedUpdate\")\n  registerUpdate(this, bridgeMonoBehaviour, \"LateUpdate\")\nend\n\nlocal function newMonoBehaviour(T, bridgeMonoBehaviour, state, serializeData, serializeObjects)\n  local this = setmetatable({}, T)\n  T.__ctor__(this)\n  makeBridge(this, bridgeMonoBehaviour, state, serializeData, serializeObjects)\n  this:Awake()\n  return this\nend\n\nfunction System.IsIEnumerator(t)\n  return is(t, SystemIEnumerator)\nend\n\nlocal function isSystemType(t)\n  return getmetatable(t) == SystemType\nend\n\nlocal metatableOfGameObject = getmetatable(UnityEngine.GameObject)\nlocal sourceAddComponent = rawget(metatableOfGameObject, \"AddComponent\")\nlocal sourceGetComponent = rawget(metatableOfGameObject, \"GetComponent\")\nlocal sourceGetComponentInChildren = rawget(metatableOfGameObject, \"GetComponentInChildren\")\nlocal sourceGetComponentInParent = rawget(metatableOfGameObject, \"GetComponentInParent\")\nlocal sourceGetComponents = rawget(metatableOfGameObject, \"GetComponents\")\nlocal sourceGetComponentsInChildren = rawget(metatableOfGameObject, \"GetComponentsInChildren\")\nlocal sourceGetComponentsInParent = rawget(metatableOfGameObject, \"GetComponentsInParent\")\n\nlocal function addBridgeMonoBehaviour(gameObject, T)\n  local monoBehaviour = sourceAddComponent(gameObject, typeofBridgeMonoBehaviour)\n  return newMonoBehaviour(T, monoBehaviour)\nend\n\nlocal function addComponent(gameObject, T)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    T = T[1]\n  end\n  if isFromCSharp(T) then\n    if type(T) ~= \"userdata\" then\n      T = typeof(T)\n    end\n    return sourceAddComponent(gameObject, T)\n  elseif type(T) == \"string\" then\n    local cls = getClass(T)  \n    if cls ~= nil and not isFromCSharp(cls) then\n      return addBridgeMonoBehaviour(gameObject, cls)\n    end\n    local type_ = typeof(T)\n    assert(type_, T .. \" is not found\")\n    return sourceAddComponent(gameObject, type_)\n  else\n    return addBridgeMonoBehaviour(gameObject, T)\n  end\nend\n\nrawset(metatableOfGameObject, \"AddComponent\", addComponent)\n\nlocal function getBridgeComponent(sourceGetComponents, component, T, ...)\n  local coms = sourceGetComponents(component, typeofBridgeMonoBehaviour, ...)\n  for i = 0, coms.Length - 1 do\n    local t = assert(coms[i].Table)\n    if is(t, T) then\n      return t\n    end\n  end\nend\n\nlocal function getComponent(component, T)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    T = T[1]\n  end  \n  if isFromCSharp(T) then\n    if type(T) ~= \"userdata\" then\n      T = typeof(T)\n    end\n    return sourceGetComponent(component, T) \n  elseif type(T) == \"string\" then\n    local cls = getClass(T)\n    if cls ~= nil and not isFromCSharp(cls) then\n      return getBridgeComponent(sourceGetComponents, component, cls)\n    end\n    return sourceGetComponent(component, T)\n  else\n    return getBridgeComponent(sourceGetComponents, component, T)\n  end\nend\n\nrawset(metatableOfGameObject, \"GetComponent\", getComponent)\n\nlocal function getComponentInChildren(component, T, includeInactive)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    if includeInactive == nil then\n      includeInactive = false\n    end\n    T = T[1]\n  else\n    if type(T) == \"boolean\" then\n      T, includeInactive = includeInactive, T\n    else\n      includeInactive = false\n    end\n  end\n  if isFromCSharp(T) then\n    if type(T) ~= \"userdata\" then\n      T = typeof(T)\n    end\n    return checkBridgeMonoBehaviour(sourceGetComponentInChildren(component, T, includeInactive))\n  end\n    return getBridgeComponent(sourceGetComponentsInChildren, component, T, includeInactive)\nend\n\nrawset(metatableOfGameObject, \"GetComponentInChildren\", getComponentInChildren)\n\nlocal function getComponentInParent(component, T)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    T = T[1] \n  end\n  if isFromCSharp(T) then\n    if type(T) ~= \"userdata\" then\n      T = typeof(T)\n    end\n    return checkBridgeMonoBehaviour(sourceGetComponentInParent(component, T))\n  else\n    return getBridgeComponent(sourceGetComponentsInParent, component, T, false)\n  end  \nend\n\nrawset(metatableOfGameObject, \"GetComponentInParent\", getComponentInParent)\n\nlocal function getBridgeComponents(sourceGetComponents, component, T, results, ...)\n  local hasReturn = results == nil\n  if hasReturn then\n    results = SystemListObject()\n  end\n  if isFromCSharp(T) then\n    if type(T) ~= \"userdata\" then\n      T = typeof(T)\n    end\n    local coms = sourceGetComponents(component, T, ...)\n    for i = 0, coms.Length - 1 do\n      local t = coms[i]\n      results:Add(t)\n    end\n  else\n    local coms = sourceGetComponents(component, typeofBridgeMonoBehaviour, ...)\n    for i = 0, coms.Length - 1 do\n      local t = coms[i].Table\n      if is(t, T) then\n        results:Add(t)\n      end\n    end\n  end\n  if hasReturn then\n    return arrayFromList(results)\n  end\nend\n\nlocal function getComponents(component, T, results)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    T = T[1]\n  elseif results then\n    T, results = results, T\n  end\n  return getBridgeComponents(sourceGetComponents, component, T, results)\nend\n\nrawset(metatableOfGameObject, \"GetComponents\", getComponents)\n\nlocal function getComponentsInChildren(component, T, includeInactive, results)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    T = T[1]\n    if includeInactive == nil then\n      includeInactive = false\n    end\n  elseif isFromCSharp(T) then\n    if includeInactive == nil then\n      includeInactive = false\n    end\n  else\n    if type(T) == \"boolean\" then\n      if not results then\n        T, includeInactive = includeInactive, T\n      else\n        T, includeInactive, results = results, T, includeInactive    \n      end\n    else\n      if not includeInactive then\n        includeInactive = false\n      else\n        T, includeInactive, results = includeInactive, false, T\n      end\n    end\n  end\n  return getBridgeComponents(sourceGetComponentsInChildren, component, T, results, includeInactive)\nend\n\nrawset(metatableOfGameObject, \"GetComponentsInChildren\", getComponentsInChildren)\n\nlocal function getComponentsInParent(component, T, includeInactive, results)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    T = T[1]\n    if includeInactive == nil then\n      includeInactive = false\n    end\n  elseif isFromCSharp(T) then\n    if includeInactive == nil then\n      includeInactive = false\n    end\n  else\n    if type(T) == \"boolean\" then\n      if not results then\n        T, includeInactive = includeInactive, T\n      else\n        T, includeInactive, results = results, T, includeInactive    \n      end\n    else\n      includeInactive = false\n    end\n  end\n  return getBridgeComponents(sourceGetComponentsInParent, component, T, results, includeInactive)\nend\n\nrawset(metatableOfGameObject, \"GetComponentsInParent\", getComponentsInParent)\n\n\nlocal metatableOfComponent = getmetatable(UnityEngine.Component)\n\nrawset(metatableOfComponent, \"GetComponent\", function (this, ...)\n  return this.gameObject:GetComponent(...)\nend)\n\nrawset(metatableOfComponent, \"GetComponentInChildren\", function (this, ...)\n  return this.gameObject:GetComponentInChildren(...)\nend)\n\nrawset(metatableOfComponent, \"GetComponentInParent\", function (this, ...)\n  return this.gameObject:GetComponentInParent(...)\nend)\n\nrawset(metatableOfComponent, \"GetComponents\", function (this, ...)\n  return this.gameObject:GetComponents(...)\nend)\n\nrawset(metatableOfComponent, \"GetComponentsInChildren\", function (this, ...)\n  return this.gameObject:GetComponentsInChildren(...)\nend)\n\nrawset(metatableOfComponent, \"GetComponentsInParent\", function (this, ...)\n  return this.gameObject:GetComponentsInParent(...)\nend)\n\nlocal metatableOfObject = getmetatable(UnityEngine.Object)\nlocal sourceDestroy = rawget(metatableOfObject, \"Destroy\")\nlocal sourceDestroyImmediate = rawget(metatableOfObject, \"DestroyImmediate\")\nlocal sourceDontDestroyOnLoad = rawget(metatableOfObject, \"DontDestroyOnLoad\")\nlocal sourceFindObjectOfType = rawget(metatableOfObject, \"FindObjectOfType\")\nlocal sourceFindObjectsOfType = rawget(metatableOfObject, \"FindObjectsOfType\")\nlocal sourceFindObjectsOfTypeAll = rawget(metatableOfObject, \"FindObjectsOfTypeAll\")\nlocal sourceFindObjectsOfTypeIncludingAssets = rawget(metatableOfObject, \"FindObjectsOfTypeIncludingAssets\")\nlocal sourceFindSceneObjectsOfType = rawget(metatableOfObject, \"FindSceneObjectsOfType\")\nlocal source__eq = rawget(metatableOfObject, \"__eq\")\n\nlocal function destroy(obj, t)\n  if obj and not isFromCSharp(obj) then\n    obj = assert(obj.ref)\n  end\n  if t then\n    sourceDestroy(obj, t)\n  else\n    sourceDestroy(obj)  \n  end  \nend\n\nlocal function destroyImmediate(obj, t)\n  if obj and not isFromCSharp(obj) then\n    obj = assert(obj.ref)\n  end\n  if t then\n    sourceDestroyImmediate(obj, t)\n  else\n    sourceDestroyImmediate(obj)  \n  end  \nend\n\nlocal function dontDestroyOnLoad(obj)\n  if obj and not isFromCSharp(obj) then\n    obj = assert(obj.ref)\n  end\n  sourceDontDestroyOnLoad(obj)\nend\n\nlocal function findObjectOfType(T)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    T = T[1]\n  end\n  if isFromCSharp(T) then\n    if type(T) ~= \"userdata\" then\n      T = typeof(T)\n    end\n    return checkBridgeMonoBehaviour(sourceFindObjectOfType(T))\n  else\n    local objs = sourceFindObjectsOfType(typeofBridgeMonoBehaviour)\n    for i = 0, objs.Length - 1 do\n      local t = objs[i].Table\n      if is(t, T) then\n        return t\n      end\n    end\n  end\nend\n\nlocal function findBridgeObjectsOfType(sourceFindObjectsOfType, T)\n  local results = SystemListObject()\n  if isFromCSharp(T) then\n    if type(T) ~= \"userdata\" then\n      T = typeof(T)\n    end\n    local objs = sourceFindObjectsOfType(T)\n    for i = 0, objs.Length - 1 do\n      local t = objs[i]\n      results:Add(checkBridgeMonoBehaviour(t))\n    end\n  else\n    local objs = sourceFindObjectsOfType(typeofBridgeMonoBehaviour)\n    for i = 0, objs.Length - 1 do\n      local t = objs[i].Table\n      if is(t, T) then\n        results:Add(t)\n      end\n    end\n  end\n  return arrayFromList(results)\nend\n\nlocal function findObjectsOfType(T)\n  if T == nil then throw(ArgumentNullException(\"type\")) end\n  if isSystemType(T) then\n    T = T[1]\n  end\n  return findBridgeObjectsOfType(sourceFindObjectsOfType, T)\nend\n\nlocal function findObjectsOfTypeAll(t)\n  if t == nil then throw(ArgumentNullException(\"type\")) end\n  return findBridgeObjectsOfType(sourceFindObjectsOfTypeAll, t[1])\nend\n\nlocal function findObjectsOfTypeIncludingAssets(t)\n  if t == nil then throw(ArgumentNullException(\"type\")) end\n  return findBridgeObjectsOfType(sourceFindObjectsOfTypeIncludingAssets, t[1])\nend\n\nlocal function findSceneObjectsOfType(t)\n  if t == nil then throw(ArgumentNullException(\"type\")) end\n  return findBridgeObjectsOfType(sourceFindSceneObjectsOfType, t[1])\nend\n\nlocal function op_Equality(x, y)\n  if x == nil and y == nil then\n    return true\n  end\n  if x and not isFromCSharp(x) then\n    x = assert(x.ref)\n  end\n  if y and not isFromCSharp(y) then\n    y = assert(y.ref)\n  end\n  return source__eq(x, y)\nend\n\nlocal function op_Inequality(x, y)\n  return not op_Equality(x, y)\nend\n\nlocal function op_Implicit(x)\n  return not op_Equality(x, nil)\nend\n\nlocal function equalsObj(this, other)\n  if other ~= nil then\n    if not isFromCSharp(other) then\n      other = other.ref\n      if other == nil or not isFromCSharp(other) then\n        return false\n      end\n    end\n  end\n  this:Equals(other)\nend\n\nrawset(metatableOfObject, \"Destroy\", destroy)\nrawset(metatableOfObject, \"DestroyImmediate\", destroyImmediate)\nrawset(metatableOfObject, \"DontDestroyOnLoad\", dontDestroyOnLoad)\nrawset(metatableOfObject, \"FindObjectOfType\", findObjectOfType)\nrawset(metatableOfObject, \"FindObjectsOfType\", findObjectsOfType)\nrawset(metatableOfObject, \"FindObjectsOfTypeAll\", findObjectsOfTypeAll)\nrawset(metatableOfObject, \"FindObjectsOfTypeIncludingAssets\", findObjectsOfTypeIncludingAssets)\nrawset(metatableOfObject, \"FindSceneObjectsOfType\", findSceneObjectsOfType)\nrawset(metatableOfObject, \"EqualsObj\", equalsObj)\n\nlocal metatableOfSystemObject = getmetatable(toluaSystem.Object)\nlocal equals = rawget(metatableOfSystemObject, \"Equals\")\n\nlocal function getType(this)\n  local name = assert(this.__name__)\n  local cls = getClass(name)\n  return SystemTypeof(cls)\nend\n\nrawset(metatableOfSystemObject, \"class\", \"C\")\nrawset(metatableOfSystemObject, \"default\", System.emptyFn)\nrawset(metatableOfSystemObject, \"EqualsObj\", equals)\nrawset(metatableOfSystemObject, \"GetType\", getType)\n\nfunction UnityEngine.addComponent(gameObject, componentString)\n  local pos = componentString:find(\",\")\n  if pos then\n    local name = componentString:sub(1, pos - 1)\n    local cls = getClass(name)  \n    if cls ~= nil and not isFromCSharp(cls) then\n      return addBridgeMonoBehaviour(gameObject, cls)\n    end\n  end\n  local type_ = typeof(componentString)\n  assert(type_, componentString .. \" is not found\")\n  return sourceAddComponent(gameObject, type_)\nend\n\nUnityEngine.op_Equality = op_Equality\nUnityEngine.op_Inequality = op_Inequality\nUnityEngine.op_Implicit = op_Implicit\n\nfunction UnityEngine.bind(monoBehaviour, luaClass, serializeData, serializeObjects)\n  local T = getClass(luaClass)\n  assert(T, luaClass .. \" is not found\")\n  return newMonoBehaviour(T, monoBehaviour, true, serializeData, serializeObjects)\nend\n\nlocal cjson = require(\"cjson\")\nlocal cjsonDecode = cjson.decode\n\nlocal function fromJsonTable(t, T)\n  for k, v in pairs(t) do\n    if v == cjson.null then\n      t[k] = nil\n    elseif type(v) == \"table\" then\n      if #v > 0 then  -- is list\n        fromJsonTable(v, System.List(System.Object))\n      else\n        fromJsonTable(v, System.Object)\n      end\n    end\n  end\n  setmetatable(t, T)\nend\n\nSystem.define(\"UnityEngine.JsonUtility\", {\n  ToJson = cjson.encode,\n  FromJson = function (json, T)\n    if T == nil then throw(ArgumentNullException(\"type\")) end\n    if isSystemType(T) then\n      T = T[1]\n    end\n    local t = cjsonDecode(json)\n    fromJsonTable(t, T)\n    return t\n  end\n})\n\nlocal function defineUnityStruct(name, T)\n  local __call = T.__call\n  local __index = T.__index\n  setmetatable(T, nil)\n  System.defStc(name, T)\n   \n  local super = getmetatable(T)\n  setmetatable(T, { \n    __call = __call,\n    __index = function (t, k)\n      local v = __index(t, k)\n      if v == nil then\n        v = super[k]\n      end\n      return v\n    end\n  })\nend\n\nlocal function inherits(_, T)\n  return { System.IEquatable_1(T) } \nend\n\nlocal Vector2 = UnityEngine.Vector2\nVector2.x, Vector2.y = 0, 0\nlocal newVector2 = Vector2.New\nUnityEngine.Vector2 = nil\n\nfunction Vector2.get(this, index)\n  if index < 0 or index > 1 then\n    throw(ArgumentOutOfRangeException(\"Invalid Vector2 index!\"))\n  end\n  return index == 0 and this.x or this.y\nend\n\nfunction Vector2.set(this, index, value)\n  if index < 0 or index > 1 then\n    throw(ArgumentOutOfRangeException(\"Invalid Vector2 index!\"))\n  end\n  if index == 0 then\n    this.x = value\n  else\n    this.y = value\n  end\nend\n\nlocal PositiveInfinity = System.Double.PositiveInfinity\nlocal NegativeInfinity = System.Double.NegativeInfinity\n\nVector2.getdown = function() return newVector2(0, -1) end\nVector2.getleft = function() return newVector2(-1, 0) end\nVector2.getup = function() return newVector2(0, 1) end\nVector2.getright = function() return newVector2(1, 0) end\nVector2.getzero = function() return newVector2(0, 0) end\nVector2.getone = function() return newVector2(1, 1) end\nVector2.getpositiveInfinityVector = function() return newVector2(PositiveInfinity, PositiveInfinity) end\nVector2.getnegativeInfinityVector = function() return newVector2(NegativeInfinity, NegativeInfinity) end\n\nVector2.getmagnitude = Vector2.Magnitude\nVector2.getsqrMagnitude = Vector2.SqrMagnitude\nVector2.getnormalized = Vector2.Normalize\n\nlocal function equalsOfVector2(this, other)\n  return this.x:Equals(other.x) and this.y:Equals(other.y)\nend\n\nfunction Vector2.EqualsObj(this, other)\n  if getmetatable(other) ~= Vector2 then\n    return false\n  end\n  return equalsOfVector2(this, other)\nend\n\nVector2.Equals = equalsOfVector2\nVector2.ToString = Vector2.__tostring\nVector2.__clone__ = Vector2.Clone\nVector2.base = inherits\n\ndefineUnityStruct(\"UnityEngine.Vector2\", Vector2)\n\nlocal Vector3 = UnityEngine.Vector3\nVector3.x, Vector3.y, Vector3.z = 0, 0, 0\nlocal newVector3 = Vector3.New\nUnityEngine.Vector3 = nil\n\nfunction Vector3.get(this, index)\n  if index < 0 or index > 2 then\n    throw(ArgumentOutOfRangeException(\"Invalid Vector3 index!\"))\n  end\n  if index == 0 then\n    return this.x\n  elseif index == 1 then\n    return this.y\n  else\n    return this.z\n  end\nend\n\nfunction Vector3.set(this, index, value) \n  if index < 0 or index > 2 then\n    throw(ArgumentOutOfRangeException(\"Invalid Vector3 index!\"))\n  end\n  if index == 0 then\n    this.x = value\n  elseif index == 1 then\n    this.y = value\n  else\n    this.z = value\n  end\nend\n\nVector3.getup = function() return newVector3(0, 1, 0) end\nVector3.getdown = function() return newVector3(0, -1, 0) end\nVector3.getright = function() return newVector3(1, 0, 0) end\nVector3.getleft = function() return newVector3(-1, 0, 0) end\nVector3.getforward = function() return newVector3(0, 0, 1) end\nVector3.getback = function() return newVector3(0, 0, -1) end\nVector3.getzero = function() return newVector3(0, 0, 0) end\nVector3.getone = function() return newVector3(1, 1, 1) end\n\nVector3.getmagnitude = Vector3.Magnitude\nVector3.getsqrMagnitude = Vector3.SqrMagnitude\nVector3.getnormalized = Vector3.Normalize\n\nfunction Vector3.LerpUnclamped(a, b, t)\n  return newVector3(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t)\nend\n\nlocal function equalsOfVector3(this, other)\n  return this.x:Equals(other.x) and this.y:Equals(other.y) and this.z:Equals(other.z)\nend\n\nfunction Vector3.EqualsObj(this, other)\n  if getmetatable(other) ~= Vector3 then\n    return false\n  end\n  return equalsOfVector3(this, other)\nend\n\nVector3.Equals = equalsOfVector3\nVector3.ToString = Vector3.__tostring\nVector3.__clone__ = Vector3.Clone\nVector3.base = inherits\n\ndefineUnityStruct(\"UnityEngine.Vector3\", Vector3)\n\nlocal Vector4 = UnityEngine.Vector4\nVector4.x, Vector4.y, Vector4.z, Vector4.w = 0, 0, 0, 0\nlocal newVector4 = Vector4.New\nUnityEngine.Vector4 = nil\n\nlocal function getOfVector4(this, index, error)\n  if index < 0 or index > 2 then\n    throw(ArgumentOutOfRangeException(error), 1)\n  end\n  if index == 0 then\n    return this.x\n  elseif index == 1 then\n    return this.y\n  elseif index == 2 then\n    return this.z\n  else \n    return this.w\n  end\nend\n\nfunction Vector4.get(this, index)\n  return getOfVector4(this, index, \"Invalid Vector4 index!\")\nend\n\nlocal function setOfVector4(this, index, value, error)\n  if index < 0 or index > 2 then\n    throw(ArgumentOutOfRangeException(error), 1)\n  end\n  if index == 0 then\n    this.x = value\n  elseif index == 1 then\n    this.y = value\n  elseif index == 2 then\n    this.z = value\n  else \n    this.w = value\n  end\nend\n\nfunction Vector4.set(this, index, value) \n  setOfVector4(this, index, value, \"Invalid Vector4 index!\")\nend\n\nVector4.getzero = function() return newVector4(0, 0, 0, 0) end\nVector4.getone\t = function() return newVector4(1, 1, 1, 1) end\nVector4.getsqrMagnitude = Vector4.SqrMagnitude\nVector4.getmagnitude = Vector4.Magnitude\nVector4.getnormalized = Vector4.Normalize\n\nlocal function equalsOfVector4(this, other)\n  return this.x:Equals(other.x) and this.y:Equals(other.y) and this.z:Equals(other.z) and this.w:Equals(other.w)\nend\n\nfunction Vector4.EqualsObj(this, other)\n  if getmetatable(other) ~= Vector4 then\n    return false\n  end\n  return equalsOfVector4(this, other)\nend\n\nVector4.Equals = equalsOfVector4\nVector4.ToString = Vector4.__tostring\nVector4.__clone__ = Vector4.Clone\nVector4.base = inherits\n\ndefineUnityStruct(\"UnityEngine.Vector4\", Vector4)\n\nfunction UnityEngine.ToVector2(v)\n  return newVector2(v.x, v.y)\nend\n\nfunction UnityEngine.ToVector3(v)\n  return newVector3(v.x, v.y, v.z)\nend\n\nfunction UnityEngine.ToVector4(v)\n  return newVector4(v.x, v.y, v.z, v.w)\nend\n\nlocal Color = UnityEngine.Color\nlocal newColor = Color.New\nUnityEngine.Color = nil\n\nfunction Color.get(this, index)\n  if index < 0 or index > 2 then\n    throw(ArgumentOutOfRangeException(\"Invalid Color index!\"))\n  end\n  if index == 0 then\n    return this.r\n  elseif index == 1 then\n    return this.g\n  elseif index == 2 then\n    return this.b\n  else \n    return this.a\n  end\nend\n\nfunction Color.set(this, index, value) \n  if index < 0 or index > 2 then\n    throw(ArgumentOutOfRangeException(\"Invalid Color index!\"))\n  end\n  if index == 0 then\n    this.r = value\n  elseif index == 1 then\n    this.g = value\n  elseif index == 2 then\n    this.b = value\n  else \n    this.a = value\n  end\nend\n\nlocal Mathf = Mathf\nlocal LinearToGammaSpace = Mathf.LinearToGammaSpace\nlocal GammaToLinearSpace = Mathf.GammaToLinearSpace\nlocal Max = Mathf.Max\n\nColor.getred \t= function() return newColor(1, 0, 0, 1) end\nColor.getgreen\t= function() return newColor(0, 1, 0, 1) end\nColor.getblue\t= function() return newColor(0, 0, 1, 1) end\nColor.getwhite\t= function() return newColor(1, 1, 1, 1) end\nColor.getblack\t= function() return newColor(0, 0, 0, 1) end\nColor.getyellow\t= function() return newColor(1, 0.9215686, 0.01568628, 1) end\nColor.getcyan\t= function() return newColor(0, 1, 1, 1) end\nColor.getmagenta\t= function() return newColor(1, 0, 1, 1) end\nColor.getgray\t= function() return newColor(0.5, 0.5, 0.5, 1) end\nColor.getclear\t= function() return newColor(0, 0, 0, 0) end\nColor.getgrey = Color.gray\nColor.getgrayscale = Color.GrayScale\nColor.getgamma = function(c) return newColor(LinearToGammaSpace(c.r), LinearToGammaSpace(c.g), LinearToGammaSpace(c.b), c.a) end\nColor.getlinear = function(c) return newColor(GammaToLinearSpace(c.r), GammaToLinearSpace(c.g), GammaToLinearSpace(c.b), c.a) end\nColor.getmaxColorComponent = function(c) return Max(Max(c.r, c.g), c.b) end\n\nlocal function equalsOfColor(this, other)\n  return this.r:Equals(other.r) and this.g:Equals(other.g) and this.b:Equals(other.b) and this.a:Equals(other.a)\nend\n\nfunction Color.EqualsObj(this, other)\n  if getmetatable(other) ~= Color then\n    return false\n  end\n  return equalsOfColor(this, other)\nend\n\nColor.Equals = equalsOfColor\nColor.ToString = Color.__tostring\nColor.__clone__ = function(this) return newColor(this.r, this.g, this.b, this.a) end\nColor.base = inherits\n\ndefineUnityStruct(\"UnityEngine.Color\", Color)\n\nfunction UnityEngine.ToColorFromVector4(v)\n  return newColor(v.x ,v.y, v.z, v.w)\nend\n\nfunction UnityEngine.ToVector4FromColor(v)\n  return newVector4(v.r, v.g, v.b, b.a)\nend\n\nlocal Color32 = UnityEngine.Color32\nlocal newColor32 = Color32.New\nlocal equalsOfColor32 = Color32.Equals\nUnityEngine.Color32 = nil\n\nColor32.ToString = Color32.__tostring\nColor32.__clone__ = function (this) return newColor32(this.r, this.g, this.b, this.a) end\nColor32.base = System.emptyFn\n\nfunction Color32.EqualsObj(this, other)\n  if getmetatable(other) ~= Color32 then\n    return false\n  end\n  return equalsOfColor32(this, other)\nend\n\ndefineUnityStruct(\"UnityEngine.Color32\", Color32)\n\nfunction UnityEngine.ToColor32FromColor(c)\n  return newColor32(Clamp01(c.r) * 255, Clamp01(c.g) * 255, Clamp01(c.b) * 255, Clamp01(c.a) * 255)\nend\n\nfunction UnityEngine.ToColorFromColor32(c)\n  return newColor(c.r / 255, c.g / 255, c.b / 255, c.a / 255) \nend\n\nlocal Quaternion = UnityEngine.Quaternion\nlocal newQuaternion = Quaternion.New\nUnityEngine.Quaternion = nil\n\nfunction Quaternion.get(this, index)\n  return getOfVector4(this, index, \"Invalid Quaternion index!\") \nend\n\nfunction Quaternion.set(this, index, value)\n  setOfVector4(this, index, value, \"Invalid Quaternion index!\")\nend\n\nQuaternion.getidentity = function() return newQuaternion(0, 0, 0, 1) end\nQuaternion.geteulerAngles = Quaternion.ToEulerAngles\nQuaternion.seteulerAngles = Quaternion.SetEuler\nQuaternion.getnormalized = Quaternion.Normalize\n\nfunction Quaternion.EqualsObj(this, other)\n  if getmetatable(other) ~= Quaternion then\n    return false\n  end\n  return equalsOfVector4(this, other)\nend\n\nQuaternion.Equals = equalsOfVector4\nQuaternion.ToString = Quaternion.__tostring\nQuaternion.__clone__ = Quaternion.Clone\nQuaternion.base = inherits\n\ndefineUnityStruct(\"UnityEngine.Quaternion\", Quaternion)\n\nlocal Bounds = UnityEngine.Bounds\nlocal newBounds = Bounds.New\nUnityEngine.Bounds = nil\n\nBounds.getsize = Bounds.GetSize\nBounds.getmin = Bounds.GetMin\nBounds.getmax = Bounds.GetMax\n\nlocal function equalsOfBounds(this, other)\n  return this.center:Equals(other.center) and this.extents:Equals(other.extents)\nend\n\nfunction Bounds.EqualsObj(this, other)\n  if getmetatable(other) ~= Bounds then\n    return false\n  end\n  return equalsOfBounds(this, other)\nend\n\nBounds.Equals = equalsOfBounds\nBounds.ToString = Quaternion.__tostring\nBounds.__clone__ = function (this) return newBounds(this.center, this.extents) end\nBounds.base = inherits\n\ndefineUnityStruct(\"UnityEngine.Bounds\", Bounds)\n\nlocal Plane = UnityEngine.Plane\nlocal newPlane = Plane.New\nUnityEngine.Plane = nil\n\nPlane.ToString = function (this) \n  local normal = this.normal\n  return sformat(\"(normal:(%.1f, %.1f, %.1f), distance:%1.f)\", normal.x, normal.y, normal.z, this.distance)  \nend\n\nPlane.__clone__ = function (this) return newPlane(this.normal, this.distance) end\n\nlocal Set3Points = Plane.Set3Points\nlocal SetNormalAndPosition = Plane.SetNormalAndPosition\n\nPlane.__call = function (cls, a, b, c)\n  if c ~= nil then\n    local this = setmetatable({ normal = false, distance = false }, Plane)\n    Set3Points(this, a, b, c)\n    return this\n  elseif type(b) == \"number\" then\n    return newPlane(a, b)  \n  else\n    local this = setmetatable({ normal = false, distance = false }, Plane)\n    SetNormalAndPosition(this, a, b)\n    return this\n  end\nend\n\nPlane.base = System.emptyFn\ndefineUnityStruct(\"UnityEngine.Plane\", Plane)\n\nlocal LayerMask = UnityEngine.LayerMask\nlocal newLayerMask = LayerMask.New\nUnityEngine.LayerMask = nil\n\nLayerMask.__clone__ = function (this) return newLayerMask(this.value) end\nUnityEngine.ToLayerMask = newLayerMask\n\nLayerMask.base = System.emptyFn\ndefineUnityStruct(\"UnityEngine.LayerMask\", LayerMask)\n\nlocal Ray = UnityEngine.Ray\nlocal newRay = Ray.New\nUnityEngine.Ray = nil\n\nRay.__clone__ = function (this) return newRay(this.direction, this.origin) end\nRay.ToString = Ray.__tostring\nRay.base = System.emptyFn\ndefineUnityStruct(\"UnityEngine.Ray\", Ray)\n\nlocal RaycastHit = UnityEngine.RaycastHit\nlocal newRaycastHit = RaycastHit.New\nUnityEngine.RaycastHit = nil\n\nRaycastHit.distance = 0.0\nRaycastHit.normal = Vector3.zero\nRaycastHit.point = Vector3.zero\nRaycastHit.__clone__ = function (this) return newRaycastHit(this.collider, this.distance, this.normal, this.point, this.rigidbody, this.transform) end\nRaycastHit.base = System.emptyFn\ndefineUnityStruct(\"UnityEngine.RaycastHit\", RaycastHit)\n\n"
  },
  {
    "path": "Assets/Lua/UnityAdapter.Lua.meta",
    "content": "fileFormatVersion: 2\nguid: d6dad4765632b864f8a13b8a7e96eddc\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Lua.meta",
    "content": "fileFormatVersion: 2\nguid: 379b0ef2d43e1bd4fa5da0ccdf1f8bbd\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Plugins/3rd/protobuf-net.dll.meta",
    "content": "fileFormatVersion: 2\nguid: ca3ef49e23838bb4a9371c975ff18748\ntimeCreated: 1517916505\nlicenseType: Free\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      Any: \n    second:\n      enabled: 1\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 0\n      settings:\n        DefaultValueInitialized: true\n  - first:\n      Windows Store Apps: WindowsStoreApps\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/3rd.meta",
    "content": "fileFormatVersion: 2\nguid: 60b870ca8c7b92f49bf9ccd5243a1a74\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/Android/libs/arm64-v8a/libtolua.so.meta",
    "content": "fileFormatVersion: 2\nguid: 2b0ac09514a9a424daeda08c003864b0\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      Android: Android\n    second:\n      enabled: 1\n      settings:\n        CPU: ARM64\n  - first:\n      Any: \n    second:\n      enabled: 0\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 0\n      settings:\n        DefaultValueInitialized: true\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/Android/libs/arm64-v8a.meta",
    "content": "fileFormatVersion: 2\nguid: 0aad78b86e3fe134db823a509dd8971e\nfolderAsset: yes\ntimeCreated: 1557889915\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/Android/libs/armeabi-v7a/libtolua.so.meta",
    "content": "fileFormatVersion: 2\nguid: 4fb9a29f65e536b4293f7f9affd19158\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      Android: Android\n    second:\n      enabled: 1\n      settings:\n        CPU: ARMv7\n  - first:\n      Any: \n    second:\n      enabled: 0\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 0\n      settings:\n        DefaultValueInitialized: true\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/Android/libs/armeabi-v7a.meta",
    "content": "fileFormatVersion: 2\nguid: 034154e518117d842b99fd1f19efa3a3\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Plugins/Android/libs/x86/libtolua.so.meta",
    "content": "fileFormatVersion: 2\nguid: 3bf04aa9e8715d047898e94157e2decd\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      Android: Android\n    second:\n      enabled: 1\n      settings:\n        CPU: x86\n  - first:\n      Any: \n    second:\n      enabled: 0\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 0\n      settings:\n        DefaultValueInitialized: true\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/Android/libs/x86.meta",
    "content": "fileFormatVersion: 2\nguid: d76e3311efeac224996b0cb7a06a7a3a\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Plugins/Android/libs.meta",
    "content": "fileFormatVersion: 2\nguid: 72b436146481b3f40b05eb161ca7f39c\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Plugins/Android.meta",
    "content": "fileFormatVersion: 2\nguid: 729c01aec7bba814d88608249c8a170b\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Plugins/CString.dll.meta",
    "content": "fileFormatVersion: 2\nguid: 4f630c0f54674a246a65918d24eeab8a\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      Any: \n    second:\n      enabled: 1\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 0\n      settings:\n        DefaultValueInitialized: true\n  - first:\n      Windows Store Apps: WindowsStoreApps\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/Debugger.dll.meta",
    "content": "fileFormatVersion: 2\nguid: c33668af923d0aa4ebd48ebe80ef943a\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      Any: \n    second:\n      enabled: 1\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 0\n      settings:\n        DefaultValueInitialized: true\n  - first:\n      Windows Store Apps: WindowsStoreApps\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/iOS/libtolua.a.meta",
    "content": "fileFormatVersion: 2\nguid: 8492849dccfbfce4485d383c0ce84651\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      '': Any\n    second:\n      enabled: 0\n      settings:\n        Exclude Android: 1\n        Exclude Editor: 1\n        Exclude Linux: 1\n        Exclude Linux64: 1\n        Exclude LinuxUniversal: 1\n        Exclude OSXUniversal: 1\n        Exclude Win: 1\n        Exclude Win64: 1\n  - first:\n      Android: Android\n    second:\n      enabled: 0\n      settings:\n        CPU: ARMv7\n  - first:\n      Any: \n    second:\n      enabled: 0\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n        DefaultValueInitialized: true\n        OS: AnyOS\n  - first:\n      Facebook: Win\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  - first:\n      Facebook: Win64\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  - first:\n      Standalone: Linux\n    second:\n      enabled: 0\n      settings:\n        CPU: x86\n  - first:\n      Standalone: Linux64\n    second:\n      enabled: 0\n      settings:\n        CPU: x86_64\n  - first:\n      Standalone: LinuxUniversal\n    second:\n      enabled: 0\n      settings:\n        CPU: None\n  - first:\n      Standalone: OSXUniversal\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  - first:\n      Standalone: Win\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  - first:\n      Standalone: Win64\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/iOS.meta",
    "content": "fileFormatVersion: 2\nguid: 48e42b60abfb25b488c56d81b63e4646\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>BuildMachineOSBuild</key>\n\t<string>18A391</string>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>English</string>\n\t<key>CFBundleExecutable</key>\n\t<string>tolua</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>ameng.tolua</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>tolua</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleSupportedPlatforms</key>\n\t<array>\n\t\t<string>MacOSX</string>\n\t</array>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>CFPlugInDynamicRegisterFunction</key>\n\t<string></string>\n\t<key>CFPlugInDynamicRegistration</key>\n\t<string>NO</string>\n\t<key>CFPlugInFactories</key>\n\t<dict>\n\t\t<key>00000000-0000-0000-0000-000000000000</key>\n\t\t<string>MyFactoryFunction</string>\n\t</dict>\n\t<key>CFPlugInTypes</key>\n\t<dict>\n\t\t<key>00000000-0000-0000-0000-000000000000</key>\n\t\t<array>\n\t\t\t<string>00000000-0000-0000-0000-000000000000</string>\n\t\t</array>\n\t</dict>\n\t<key>CFPlugInUnloadFunction</key>\n\t<string></string>\n\t<key>DTCompiler</key>\n\t<string>com.apple.compilers.llvm.clang.1_0</string>\n\t<key>DTPlatformBuild</key>\n\t<string>10B61</string>\n\t<key>DTPlatformVersion</key>\n\t<string>GM</string>\n\t<key>DTSDKBuild</key>\n\t<string>18B71</string>\n\t<key>DTSDKName</key>\n\t<string>macosx10.14</string>\n\t<key>DTXcode</key>\n\t<string>1010</string>\n\t<key>DTXcodeBuild</key>\n\t<string>10B61</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2013 topameng. All rights reserved.</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Info.plist.meta",
    "content": "fileFormatVersion: 2\nguid: c70484778b37241228e041d528df2f81\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/MacOS/tolua.meta",
    "content": "fileFormatVersion: 2\nguid: 3ad2d3f39b17a4505951dcdc9ef15320\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/MacOS.meta",
    "content": "fileFormatVersion: 2\nguid: 9bd8f6fa32a614c10b4789e20b57ff8f\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2014 codingnow.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/LICENSE.meta",
    "content": "fileFormatVersion: 2\nguid: 686e4b0c52e6bc54a8c42c0477db291c\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/README.md",
    "content": "Introduction\n======\n\nSproto is an efficient serialization library for C, and focuses on lua binding. It's like Google protocol buffers, but much faster.\n\nThe design is simple. It only supports a few types that lua supports. It can be easily bound to other dynamic languages, or be used directly in C.\n\nIn my i5-2500 @3.3GHz CPU, the benchmark is below:\n\nThe schema in sproto:\n\n```\n.Person {\n    name 0 : string\n    id 1 : integer\n    email 2 : string\n\n    .PhoneNumber {\n        number 0 : string\n        type 1 : integer\n    }\n\n    phone 3 : *PhoneNumber\n}\n\n.AddressBook {\n    person 0 : *Person\n}\n```\n\nIt's equal to:\n\n```\nmessage Person {\n  required string name = 1;\n  required int32 id = 2;\n  optional string email = 3;\n\n  message PhoneNumber {\n    required string number = 1;\n    optional int32 type = 2 ;\n  }\n\n  repeated PhoneNumber phone = 4;\n}\n\nmessage AddressBook {\n  repeated Person person = 1;\n}\n```\n\nUse the data:\n```lua\nlocal ab = {\n    person = {\n        {\n            name = \"Alice\",\n            id = 10000,\n            phone = {\n                { number = \"123456789\" , type = 1 },\n                { number = \"87654321\" , type = 2 },\n            }\n        },\n        {\n            name = \"Bob\",\n            id = 20000,\n            phone = {\n                { number = \"01234567890\" , type = 3 },\n            }\n        }\n    }\n}\n```\n\nlibrary| encode 1M times | decode 1M times | size\n-------| --------------- | --------------- | ----\nsproto | 2.15s           | 7.84s           | 83 bytes\nsproto (nopack) |1.58s   | 6.93s           | 130 bytes\npbc-lua\t  | 6.94s        | 16.9s           | 69 bytes\nlua-cjson | 4.92s        | 8.30s           | 183 bytes\n\n* pbc-lua is a google protocol buffers library https://github.com/cloudwu/pbc\n* lua-cjson is a json library https://github.com/efelix/lua-cjson\n\nParser\n=======\n\n```lua\nlocal parser = require \"sprotoparser\"\n```\n\n* `parser.parse` parses a sproto schema to a binary string.\n\nThe parser is needed for parsing the sproto schema. You can use it to generate binary string offline. The schema text and the parser is not needed when your program is running.\n\nLua API\n=======\n\n```lua\nlocal sproto = require \"sproto\"\nlocal sprotocore = require \"sproto.core\" -- optional\n```\n\n* `sproto.new(spbin)` creates a sproto object by a schema binary string (generates by parser).\n* `sprotocore.newproto(spbin)` creates a sproto c object by a schema binary string (generates by parser).\n* `sproto.sharenew(spbin)` share a sproto object from a sproto c object (generates by sprotocore.newproto).\n* `sproto.parse(schema)` creares a sproto object by a schema text string (by calling parser.parse)\n* `sproto:exist_type(typename)` detect whether a type exist in sproto object.\n* `sproto:encode(typename, luatable)` encodes a lua table with typename into a binary string.\n* `sproto:decode(typename, blob [,sz])` decodes a binary string generated by sproto.encode with typename. If blob is a lightuserdata (C ptr), sz (integer) is needed.\n* `sproto:pencode(typename, luatable)` The same with sproto:encode, but pack (compress) the results.\n* `sproto:pdecode(typename, blob [,sz])` The same with sproto.decode, but unpack the blob (generated by sproto:pencode) first.\n* `sproto:default(typename, type)` Create a table with default values of typename. Type can be nil , \"REQUEST\", or \"RESPONSE\".\n\nRPC API\n=======\n\nThere is a lua wrapper for the core API for RPC .\n\n`sproto:host([packagename])` creates a host object to deliver the rpc message.\n\n`host:dispatch(blob [,sz])` unpack and decode (sproto:pdecode) the binary string with type the host created (packagename). \n\nIf .type is exist, it's a REQUEST message with .type , returns \"REQUEST\", protoname, message, responser, .ud. The responser is a function for encode the response message. The responser will be nil when .session is not exist.\n\nIf .type is not exist, it's a RESPONSE message for .session . Returns \"RESPONSE\", .session, message, .ud .\n\n`host:attach(sprotoobj)` creates a function(protoname, message, session, ud) to pack and encode request message with sprotoobj.\n\nIf you don't want to use host object, you can also use these following apis to encode and decode the rpc message:\n\n`sproto:request_encode(protoname, tbl)` encode a request message with protoname.\n\n`sproto:response_encode(protoname, tbl)` encode a response message with protoname.\n\n`sproto:request_decode(protoname, blob [,sz])` decode a request message with protoname.\n\n`sproto:response_decode(protoname, blob [,sz]` decode a response message with protoname.\n\nRead testrpc.lua for detail.\n\nSchema Language\n==========\n\nLike Protocol Buffers (but unlike json), sproto messages are strongly-typed and are not self-describing. You must define your message structure in a special language.\n\nYou can use sprotoparser library to parse the schema text to a binary string, so that the sproto library can use it. \nYou can parse them offline and save the string, or you can parse them during your program running.\n\nThe schema text is like this:\n\n```\n# This is a comment.\n\n.Person {\t# . means a user defined type \n    name 0 : string\t# string is a build-in type.\n    id 1 : integer\n    email 2 : string\n\n    .PhoneNumber {\t# user defined type can be nest.\n        number 0 : string\n        type 1 : integer\n    }\n\n    phone 3 : *PhoneNumber\t# *PhoneNumber means an array of PhoneNumber.\n    height 4 : integer(2)\t# (2) means a 1/100 fixed-point number.\n    data 5 : binary\t\t# Some binary data\n}\n\n.AddressBook {\n    person 0 : *Person(id)\t# (id) is optional, means Person.id is main index.\n}\n\nfoobar 1 {\t# define a new protocol (for RPC used) with tag 1\n    request Person\t# Associate the type Person with foobar.request\n    response {\t# define the foobar.response type\n        ok 0 : boolean\n    }\n}\n\n```\n\nA schema text can be self-described by the sproto schema language.\n\n```\n.type {\n    .field {\n        name 0 : string\n        buildin\t1 : integer\n        type 2 : integer\t# type is fixed-point number precision when buildin is SPROTO_TINTEGER; When buildin is SPROTO_TSTRING, it means binary string when type is 1.\n        tag 3 : integer\n        array 4\t: boolean\n        key 5 : integer # If key exists, array must be true, and it's a map.\n    }\n    name 0 : string\n    fields 1 : *field\n}\n\n.protocol {\n    name 0 : string\n    tag 1 : integer\n    request 2 : integer # index\n    response 3 : integer # index\n    confirm 4 : boolean # response nil where confirm == true\n}\n\n.group {\n    type 0 : *type\n    protocol 1 : *protocol\n}\n```\n\nTypes\n=======\n\n* **string** : string\n* **binary** : binary string (it's a sub type of string)\n* **integer** : integer, the max length of an integer is signed 64bit. It can be a fixed-point number with specified precision.\n* **boolean** : true or false\n\nYou can add * before the typename to declare an array. \n\nYou can also specify a main index, the array whould be encode as an unordered map.\n\nUser defined type can be any name in alphanumeric characters except the build-in typenames, and nested types are supported.\n\n* Where are double or real types?\n\nI have been using Google protocol buffers for many years in many projects, and I found the real types were seldom used. If you really need it, you can use string to serialize the double numbers. When you need decimal, you can specify the fixed-point presision.\n\n* Where is enum?\n\nIn lua, enum types are not very useful. You can use integer to define an enum table in lua.\n\nWire protocol\n========\n\nEach integer number must be serialized in little-endian format.\n\nThe sproto message must be a user defined type struct, and a struct is encoded in three parts. The header, the field part, and the data part. \nThe tag and small integer or boolean will be encoded in field part, and others are in data part.\n\nAll the fields must be encoded in ascending order (by tag, base 0). The tags of fields can be discontinuous, if a field is nil. (default value in lua), don't encode it in message.\n\nThe header is a 16bit integer. It is the number of fields.\n\nEach field in field part is a 16bit integer (n). If n is zero, that means the field data is encoded in data part ;\n\nIf n is even (and not zero), the value of this field is n/2-1 , and the tag increases 1;\n\nIf n is odd, that means the tags is not continuous, and we should add current tag by (n+1)/2 .\n\nArrays are always encode in data part, 4 bytes header for the size, and the following bytes is the contents. See the example 2 for the struct array; example 3/4 for the integer array ; example 5 for the boolean array.\n\nFor integer array, an additional byte (4 or 8) to indicate the value is 32bit or 64bit.\n\nRead the examples below to see more details.\n\nNotice: If the tag is not declared in schema, the decoder will simply ignore the field for protocol version compatibility.\n\n```\n.Person {\n    name 0 : string\n    age 1 : integer\n    marital 2 : boolean\n    children 3 : *Person\n}\n\n.Data {\n\tnumbers 0 : *integer\n\tbools 1 : *boolean\n\tnumber 2 : integer\n\tbignumber 3 : integer\n}\n```\n\nExample 1:\n\n```\nperson { name = \"Alice\" ,  age = 13, marital = false } \n\n03 00 (fn = 3)\n00 00 (id = 0, value in data part)\n1C 00 (id = 1, value = 13)\n02 00 (id = 2, value = false)\n05 00 00 00 (sizeof \"Alice\")\n41 6C 69 63 65 (\"Alice\")\n```\n\nExample 2:\n\n```\nperson {\n    name = \"Bob\",\n    age = 40,\n    children = {\n        { name = \"Alice\" ,  age = 13 },\n        { name = \"Carol\" ,  age = 5 },\n    }\n}\n\n04 00 (fn = 4)\n00 00 (id = 0, value in data part)\n52 00 (id = 1, value = 40)\n01 00 (skip id = 2)\n00 00 (id = 3, value in data part)\n\n03 00 00 00 (sizeof \"Bob\")\n42 6F 62 (\"Bob\")\n\n26 00 00 00 (sizeof children)\n\n0F 00 00 00 (sizeof child 1)\n02 00 (fn = 2)\n00 00 (id = 0, value in data part)\n1C 00 (id = 1, value = 13)\n05 00 00 00 (sizeof \"Alice\")\n41 6C 69 63 65 (\"Alice\")\n\n0F 00 00 00 (sizeof child 2)\n02 00 (fn = 2)\n00 00 (id = 0, value in data part)\n0C 00 (id = 1, value = 5)\n05 00 00 00 (sizeof \"Carol\")\n43 61 72 6F 6C (\"Carol\")\n```\n\nExample 3:\n\n```\ndata {\n    numbers = { 1,2,3,4,5 }\n}\n\n01 00 (fn = 1)\n00 00 (id = 0, value in data part)\n\n15 00 00 00 (sizeof numbers)\n04 ( sizeof int32 )\n01 00 00 00 (1)\n02 00 00 00 (2)\n03 00 00 00 (3)\n04 00 00 00 (4)\n05 00 00 00 (5)\n```\n\nExample 4:\n```\ndata {\n    numbers = {\n        (1<<32)+1,\n        (1<<32)+2,\n        (1<<32)+3,\n    }\n}\n\n01 00 (fn = 1)\n00 00 (id = 0, value in data part)\n\n19 00 00 00 (sizeof numbers)\n08 ( sizeof int64 )\n01 00 00 00 01 00 00 00 ( (1<32) + 1)\n02 00 00 00 01 00 00 00 ( (1<32) + 2)\n03 00 00 00 01 00 00 00 ( (1<32) + 3)\n```\n\nExample 5:\n```\ndata {\n    bools = { false, true, false }\n}\n\n02 00 (fn = 2)\n01 00 (skip id = 0)\n00 00 (id = 1, value in data part)\n\n03 00 00 00 (sizeof bools)\n00 (false)\n01 (true)\n00 (false)\n```\n\nExample 6:\n```\ndata {\n    number = 100000,\n    bignumber = -10000000000,\n}\n\n03 00 (fn = 3)\n03 00 (skip id = 1)\n00 00 (id = 2, value in data part)\n00 00 (id = 3, value in data part)\n\n04 00 00 00 (sizeof number, data part)\nA0 86 01 00 (100000, 32bit integer)\n\n08 00 00 00 (sizeof bignumber, data part)\n00 1C F4 AB FD FF FF FF (-10000000000, 64bit integer)\n```\n\n0 Packing\n=======\n\nThe algorithm is very similar to [Cap'n proto](http://kentonv.github.io/capnproto/), but 0x00 is not treated specially. \n\nIn packed format, the message is padding to 8. Each 8 byte is reduced to a tag byte followed by zero to eight content bytes. \nThe bits of the tag byte correspond to the bytes of the unpacked word, with the least-significant bit corresponding to the first byte. \nEach zero bit indicates that the corresponding byte is zero. The non-zero bytes are packed following the tag.\n\nFor example:\n\n```\nunpacked (hex):  08 00 00 00 03 00 02 00   19 00 00 00 aa 01 00 00\npacked (hex):  51 08 03 02   31 19 aa 01\n```\n\nTag 0xff is treated specially. A number N is following the 0xff tag. N means (N+1)\\*8 bytes should be copied directly. \nThe bytes may or may not contain zeros. Because of this rule, the worst-case space overhead of packing is 2 bytes per 2 KiB of input.\n\nFor example:\n\n```\nunpacked (hex):  8a (x 30 bytes)\npacked (hex):  ff 03 8a (x 30 bytes) 00 00\n```\n\nC API\n=====\n\n```C\nstruct sproto * sproto_create(const void * proto, size_t sz);\n```\n\nCreate a sproto object with a schema string encoded by sprotoparser:\n\n```C\nvoid sproto_release(struct sproto *);\n```\n\nRelease the sproto object:\n\n```C\nint sproto_prototag(struct sproto *, const char * name);\nconst char * sproto_protoname(struct sproto *, int proto);\n// SPROTO_REQUEST(0) : request, SPROTO_RESPONSE(1): response\nstruct sproto_type * sproto_protoquery(struct sproto *, int proto, int what);\n```\n\nConvert between tag and name of a protocol, and query the type object of it:\n\n```C\nstruct sproto_type * sproto_type(struct sproto *, const char * typename);\n```\n\nQuery the type object from a sproto object:\n\n```C\nstruct sproto_arg {\n\tvoid *ud;\n\tconst char *tagname;\n\tint tagid;\n\tint type;\n\tstruct sproto_type *subtype;\n\tvoid *value;\n\tint length;\n\tint index;\t// array base 1\n\tint mainindex;\t// for map\n\tint extra; // SPROTO_TINTEGER: fixed-point presision ; SPROTO_TSTRING 0:utf8 string 1:binary\n};\n\ntypedef int (*sproto_callback)(const struct sproto_arg *args);\n\nint sproto_decode(struct sproto_type *, const void * data, int size, sproto_callback cb, void *ud);\nint sproto_encode(struct sproto_type *, void * buffer, int size, sproto_callback cb, void *ud);\n```\n\nencode and decode the sproto message with a user defined callback function. Read the implementation of lsproto.c for more details.\n\n```C\nint sproto_pack(const void * src, int srcsz, void * buffer, int bufsz);\nint sproto_unpack(const void * src, int srcsz, void * buffer, int bufsz);\n```\n\npack and unpack the message with the 0 packing algorithm.\n\nOther Implementions and bindings\n=====\nSee Wiki https://github.com/cloudwu/sproto/wiki\n\nQuestion?\n==========\n\n* Send me an email: http://www.codingnow.com/2000/gmail.gif\n* My Blog: http://blog.codingnow.com\n* Design: http://blog.codingnow.com/2014/07/ejoyproto.html (in Chinese)\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/README.md.meta",
    "content": "fileFormatVersion: 2\nguid: 67caed6d2702fdb4684d0884268df1c1\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/print_r.lua",
    "content": "local print = print\nlocal tconcat = table.concat\nlocal tinsert = table.insert\nlocal srep = string.rep\nlocal type = type\nlocal pairs = pairs\nlocal tostring = tostring\nlocal next = next\n\nlocal function print_r(root)\n\tlocal cache = {  [root] = \".\" }\n\tlocal function _dump(t,space,name)\n\t\tlocal temp = {}\n\t\tfor k,v in pairs(t) do\n\t\t\tlocal key = tostring(k)\n\t\t\tif cache[v] then\n\t\t\t\ttinsert(temp,\"+\" .. key .. \" {\" .. cache[v]..\"}\")\n\t\t\telseif type(v) == \"table\" then\n\t\t\t\tlocal new_key = name .. \".\" .. key\n\t\t\t\tcache[v] = new_key\n\t\t\t\ttinsert(temp,\"+\" .. key .. _dump(v,space .. (next(t,k) and \"|\" or \" \" ).. srep(\" \",#key),new_key))\n\t\t\telse\n\t\t\t\ttinsert(temp,\"+\" .. key .. \" [\" .. tostring(v)..\"]\")\n\t\t\tend\n\t\tend\n\t\treturn tconcat(temp,\"\\n\"..space)\n\tend\n\tprint(_dump(root, \"\",\"\"))\nend\n\nreturn print_r"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/print_r.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 39f7f75a80c0f32498f199fdb0da24a5\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.lua",
    "content": "local core = require \"sproto.core\"\nlocal assert = assert\n\nlocal sproto = {}\nlocal host = {}\n\nlocal weak_mt = { __mode = \"kv\" }\nlocal sproto_mt = { __index = sproto }\nlocal sproto_nogc = { __index = sproto }\nlocal host_mt = { __index = host }\n\nfunction sproto_mt:__gc()\n\tcore.deleteproto(self.__cobj)\nend\n\nfunction sproto.new(bin)\n\tlocal cobj = assert(core.newproto(bin))\n\tlocal self = {\n\t\t__cobj = cobj,\n\t\t__tcache = setmetatable( {} , weak_mt ),\n\t\t__pcache = setmetatable( {} , weak_mt ),\n\t}\n\treturn setmetatable(self, sproto_mt)\nend\n\nfunction sproto.sharenew(cobj)\n\tlocal self = {\n\t\t__cobj = cobj,\n\t\t__tcache = setmetatable( {} , weak_mt ),\n\t\t__pcache = setmetatable( {} , weak_mt ),\n\t}\n\treturn setmetatable(self, sproto_nogc)\nend\n\nfunction sproto.parse(ptext)\n\tlocal parser = require \"sprotoparser\"\n\tlocal pbin = parser.parse(ptext)\n\treturn sproto.new(pbin)\nend\n\nfunction sproto:host( packagename )\n\tpackagename = packagename or  \"package\"\n\tlocal obj = {\n\t\t__proto = self,\n\t\t__package = assert(core.querytype(self.__cobj, packagename), \"type package not found\"),\n\t\t__session = {},\n\t}\n\treturn setmetatable(obj, host_mt)\nend\n\nlocal function querytype(self, typename)\n\tlocal v = self.__tcache[typename]\n\tif not v then\n\t\tv = assert(core.querytype(self.__cobj, typename), \"type not found\")\n\t\tself.__tcache[typename] = v\n\tend\n\n\treturn v\nend\n\nfunction sproto:exist_type(typename)\n\tlocal v = self.__tcache[typename]\n\tif not v then\n\t\treturn core.querytype(self.__cobj, typename) ~= nil\n\telse\n\t\treturn true\n\tend\nend\n\nfunction sproto:encode(typename, tbl)\n\tlocal st = querytype(self, typename)\n\treturn core.encode(st, tbl)\nend\n\nfunction sproto:decode(typename, ...)\n\tlocal st = querytype(self, typename)\n\treturn core.decode(st, ...)\nend\n\nfunction sproto:pencode(typename, tbl)\n\tlocal st = querytype(self, typename)\n\treturn core.pack(core.encode(st, tbl))\nend\n\nfunction sproto:pdecode(typename, ...)\n\tlocal st = querytype(self, typename)\n\treturn core.decode(st, core.unpack(...))\nend\n\nlocal function queryproto(self, pname)\n\tlocal v = self.__pcache[pname]\n\tif not v then\n\t\tlocal tag, req, resp = core.protocol(self.__cobj, pname)\n\t\tassert(tag, pname .. \" not found\")\n\t\tif tonumber(pname) then\n\t\t\tpname, tag = tag, pname\n\t\tend\n\t\tv = {\n\t\t\trequest = req,\n\t\t\tresponse =resp,\n\t\t\tname = pname,\n\t\t\ttag = tag,\n\t\t}\n\t\tself.__pcache[pname] = v\n\t\tself.__pcache[tag]  = v\n\tend\n\n\treturn v\nend\n\nfunction sproto:exist_proto(pname)\n\tlocal v = self.__pcache[pname]\n\tif not v then\n\t\treturn core.protocol(self.__cobj, pname) ~= nil\n\telse\n\t\treturn true\n\tend\nend\n\nfunction sproto:request_encode(protoname, tbl)\n\tlocal p = queryproto(self, protoname)\n\tlocal request = p.request\n\tif request then\n\t\treturn core.encode(request,tbl) , p.tag\n\telse\n\t\treturn \"\" , p.tag\n\tend\nend\n\nfunction sproto:response_encode(protoname, tbl)\n\tlocal p = queryproto(self, protoname)\n\tlocal response = p.response\n\tif response then\n\t\treturn core.encode(response,tbl)\n\telse\n\t\treturn \"\"\n\tend\nend\n\nfunction sproto:request_decode(protoname, ...)\n\tlocal p = queryproto(self, protoname)\n\tlocal request = p.request\n\tif request then\n\t\treturn core.decode(request,...) , p.name\n\telse\n\t\treturn nil, p.name\n\tend\nend\n\nfunction sproto:response_decode(protoname, ...)\n\tlocal p = queryproto(self, protoname)\n\tlocal response = p.response\n\tif response then\n\t\treturn core.decode(response,...)\n\tend\nend\n\nsproto.pack = core.pack\nsproto.unpack = core.unpack\n\nfunction sproto:default(typename, type)\n\tif type == nil then\n\t\treturn core.default(querytype(self, typename))\n\telse\n\t\tlocal p = queryproto(self, typename)\n\t\tif type == \"REQUEST\" then\n\t\t\tif p.request then\n\t\t\t\treturn core.default(p.request)\n\t\t\tend\n\t\telseif type == \"RESPONSE\" then\n\t\t\tif p.response then\n\t\t\t\treturn core.default(p.response)\n\t\t\tend\n\t\telse\n\t\t\terror \"Invalid type\"\n\t\tend\n\tend\nend\n\nlocal header_tmp = {}\n\nlocal function gen_response(self, response, session)\n\treturn function(args, ud)\n\t\theader_tmp.type = nil\n\t\theader_tmp.session = session\n\t\theader_tmp.ud = ud\n\t\tlocal header = core.encode(self.__package, header_tmp)\n\t\tif response then\n\t\t\tlocal content = core.encode(response, args)\n\t\t\treturn core.pack(header .. content)\n\t\telse\n\t\t\treturn core.pack(header)\n\t\tend\n\tend\nend\n\nfunction host:dispatch(...)\n\tlocal bin = core.unpack(...)\n\theader_tmp.type = nil\n\theader_tmp.session = nil\n\theader_tmp.ud = nil\n\tlocal header, size = core.decode(self.__package, bin, header_tmp)\n\tlocal content = bin:sub(size + 1)\n\tif header.type then\n\t\t-- request\n\t\tlocal proto = queryproto(self.__proto, header.type)\n\t\tlocal result\n\t\tif proto.request then\n\t\t\tresult = core.decode(proto.request, content)\n\t\tend\n\t\tif header_tmp.session then\n\t\t\treturn \"REQUEST\", proto.name, result, gen_response(self, proto.response, header_tmp.session), header.ud\n\t\telse\n\t\t\treturn \"REQUEST\", proto.name, result, nil, header.ud\n\t\tend\n\telse\n\t\t-- response\n\t\tlocal session = assert(header_tmp.session, \"session not found\")\n\t\tlocal response = assert(self.__session[session], \"Unknown session\")\n\t\tself.__session[session] = nil\n\t\tif response == true then\n\t\t\treturn \"RESPONSE\", session, nil, header.ud\n\t\telse\n\t\t\tlocal result = core.decode(response, content)\n\t\t\treturn \"RESPONSE\", session, result, header.ud\n\t\tend\n\tend\nend\n\nfunction host:attach(sp)\n\treturn function(name, args, session, ud)\n\t\tlocal proto = queryproto(sp, name)\n\t\theader_tmp.type = proto.tag\n\t\theader_tmp.session = session\n\t\theader_tmp.ud = ud\n\t\tlocal header = core.encode(self.__package, header_tmp)\n\n\t\tif session then\n\t\t\tself.__session[session] = proto.response or true\n\t\tend\n\n\t\tif proto.request then\n\t\t\tlocal content = core.encode(proto.request, args)\n\t\t\treturn core.pack(header ..  content)\n\t\telse\n\t\t\treturn core.pack(header)\n\t\tend\n\tend\nend\n\nreturn sproto\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 4fb76b30430c9454c9a05c22fc014d63\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2014 codingnow.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/LICENSE.meta",
    "content": "fileFormatVersion: 2\nguid: 0b6dfee1e673bca4eae9a6d22a86a4a7\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/Makefile",
    "content": ".PHONY : all win clean\n\nall : linux\nwin : sproto.dll\n\n# For Linux\nlinux:\n\tmake sproto.so \"DLLFLAGS = -shared -fPIC\"\n# For Mac OS\nmacosx:\n\tmake sproto.so \"DLLFLAGS = -bundle -undefined dynamic_lookup\"\n\nsproto.so : sproto.c lsproto.c\n\tenv gcc -O2 -Wall $(DLLFLAGS) -o $@ $^\n\nsproto.dll : sproto.c lsproto.c\n\tgcc -O2 -Wall --shared -o $@ $^ -I/usr/local/include -L/usr/local/bin -llua53\n\nclean :\n\trm -f sproto.so sproto.dll\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/Makefile.meta",
    "content": "fileFormatVersion: 2\nguid: d5ac1a9b0e7cf2e40b29b7e6fe75a1a2\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/README.md",
    "content": "Introduction\n======\n\nSproto is an efficient serialization library for C, and focuses on lua binding. It's like Google protocol buffers, but much faster.\n\nThe design is simple. It only supports a few types that lua supports. It can be easily bound to other dynamic languages, or be used directly in C.\n\nIn my i5-2500 @3.3GHz CPU, the benchmark is below:\n\nThe schema in sproto:\n\n```\n.Person {\n    name 0 : string\n    id 1 : integer\n    email 2 : string\n\n    .PhoneNumber {\n        number 0 : string\n        type 1 : integer\n    }\n\n    phone 3 : *PhoneNumber\n}\n\n.AddressBook {\n    person 0 : *Person\n}\n```\n\nIt's equal to:\n\n```\nmessage Person {\n  required string name = 1;\n  required int32 id = 2;\n  optional string email = 3;\n\n  message PhoneNumber {\n    required string number = 1;\n    optional int32 type = 2 ;\n  }\n\n  repeated PhoneNumber phone = 4;\n}\n\nmessage AddressBook {\n  repeated Person person = 1;\n}\n```\n\nUse the data:\n```lua\nlocal ab = {\n    person = {\n        {\n            name = \"Alice\",\n            id = 10000,\n            phone = {\n                { number = \"123456789\" , type = 1 },\n                { number = \"87654321\" , type = 2 },\n            }\n        },\n        {\n            name = \"Bob\",\n            id = 20000,\n            phone = {\n                { number = \"01234567890\" , type = 3 },\n            }\n        }\n    }\n}\n```\n\nlibrary| encode 1M times | decode 1M times | size\n-------| --------------- | --------------- | ----\nsproto | 2.15s           | 7.84s           | 83 bytes\nsproto (nopack) |1.58s   | 6.93s           | 130 bytes\npbc-lua\t  | 6.94s        | 16.9s           | 69 bytes\nlua-cjson | 4.92s        | 8.30s           | 183 bytes\n\n* pbc-lua is a google protocol buffers library https://github.com/cloudwu/pbc\n* lua-cjson is a json library https://github.com/efelix/lua-cjson\n\nParser\n=======\n\n```lua\nlocal parser = require \"sprotoparser\"\n```\n\n* `parser.parse` parses a sproto schema to a binary string.\n\nThe parser is needed for parsing the sproto schema. You can use it to generate binary string offline. The schema text and the parser is not needed when your program is running.\n\nLua API\n=======\n\n```lua\nlocal sproto = require \"sproto\"\nlocal sprotocore = require \"sproto.core\" -- optional\n```\n\n* `sproto.new(spbin)` creates a sproto object by a schema binary string (generates by parser).\n* `sprotocore.newproto(spbin)` creates a sproto c object by a schema binary string (generates by parser).\n* `sproto.sharenew(spbin)` share a sproto object from a sproto c object (generates by sprotocore.newproto).\n* `sproto.parse(schema)` creares a sproto object by a schema text string (by calling parser.parse)\n* `sproto:exist_type(typename)` detect whether a type exist in sproto object.\n* `sproto:encode(typename, luatable)` encodes a lua table with typename into a binary string.\n* `sproto:decode(typename, blob [,sz])` decodes a binary string generated by sproto.encode with typename. If blob is a lightuserdata (C ptr), sz (integer) is needed.\n* `sproto:pencode(typename, luatable)` The same with sproto:encode, but pack (compress) the results.\n* `sproto:pdecode(typename, blob [,sz])` The same with sproto.decode, but unpack the blob (generated by sproto:pencode) first.\n* `sproto:default(typename, type)` Create a table with default values of typename. Type can be nil , \"REQUEST\", or \"RESPONSE\".\n\nRPC API\n=======\n\nThere is a lua wrapper for the core API for RPC .\n\n`sproto:host([packagename])` creates a host object to deliver the rpc message.\n\n`host:dispatch(blob [,sz])` unpack and decode (sproto:pdecode) the binary string with type the host created (packagename). \n\nIf .type is exist, it's a REQUEST message with .type , returns \"REQUEST\", protoname, message, responser, .ud. The responser is a function for encode the response message. The responser will be nil when .session is not exist.\n\nIf .type is not exist, it's a RESPONSE message for .session . Returns \"RESPONSE\", .session, message, .ud .\n\n`host:attach(sprotoobj)` creates a function(protoname, message, session, ud) to pack and encode request message with sprotoobj.\n\nIf you don't want to use host object, you can also use these following apis to encode and decode the rpc message:\n\n`sproto:request_encode(protoname, tbl)` encode a request message with protoname.\n\n`sproto:response_encode(protoname, tbl)` encode a response message with protoname.\n\n`sproto:request_decode(protoname, blob [,sz])` decode a request message with protoname.\n\n`sproto:response_decode(protoname, blob [,sz]` decode a response message with protoname.\n\nRead testrpc.lua for detail.\n\nSchema Language\n==========\n\nLike Protocol Buffers (but unlike json), sproto messages are strongly-typed and are not self-describing. You must define your message structure in a special language.\n\nYou can use sprotoparser library to parse the schema text to a binary string, so that the sproto library can use it. \nYou can parse them offline and save the string, or you can parse them during your program running.\n\nThe schema text is like this:\n\n```\n# This is a comment.\n\n.Person {\t# . means a user defined type \n    name 0 : string\t# string is a build-in type.\n    id 1 : integer\n    email 2 : string\n\n    .PhoneNumber {\t# user defined type can be nest.\n        number 0 : string\n        type 1 : integer\n    }\n\n    phone 3 : *PhoneNumber\t# *PhoneNumber means an array of PhoneNumber.\n    height 4 : integer(2)\t# (2) means a 1/100 fixed-point number.\n    data 5 : binary\t\t# Some binary data\n}\n\n.AddressBook {\n    person 0 : *Person(id)\t# (id) is optional, means Person.id is main index.\n}\n\nfoobar 1 {\t# define a new protocol (for RPC used) with tag 1\n    request Person\t# Associate the type Person with foobar.request\n    response {\t# define the foobar.response type\n        ok 0 : boolean\n    }\n}\n\n```\n\nA schema text can be self-described by the sproto schema language.\n\n```\n.type {\n    .field {\n        name 0 : string\n        buildin\t1 : integer\n        type 2 : integer\t# type is fixed-point number precision when buildin is SPROTO_TINTEGER; When buildin is SPROTO_TSTRING, it means binary string when type is 1.\n        tag 3 : integer\n        array 4\t: boolean\n        key 5 : integer # If key exists, array must be true, and it's a map.\n    }\n    name 0 : string\n    fields 1 : *field\n}\n\n.protocol {\n    name 0 : string\n    tag 1 : integer\n    request 2 : integer # index\n    response 3 : integer # index\n    confirm 4 : boolean # response nil where confirm == true\n}\n\n.group {\n    type 0 : *type\n    protocol 1 : *protocol\n}\n```\n\nTypes\n=======\n\n* **string** : string\n* **binary** : binary string (it's a sub type of string)\n* **integer** : integer, the max length of an integer is signed 64bit. It can be a fixed-point number with specified precision.\n* **boolean** : true or false\n\nYou can add * before the typename to declare an array. \n\nYou can also specify a main index, the array whould be encode as an unordered map.\n\nUser defined type can be any name in alphanumeric characters except the build-in typenames, and nested types are supported.\n\n* Where are double or real types?\n\nI have been using Google protocol buffers for many years in many projects, and I found the real types were seldom used. If you really need it, you can use string to serialize the double numbers. When you need decimal, you can specify the fixed-point presision.\n\n* Where is enum?\n\nIn lua, enum types are not very useful. You can use integer to define an enum table in lua.\n\nWire protocol\n========\n\nEach integer number must be serialized in little-endian format.\n\nThe sproto message must be a user defined type struct, and a struct is encoded in three parts. The header, the field part, and the data part. \nThe tag and small integer or boolean will be encoded in field part, and others are in data part.\n\nAll the fields must be encoded in ascending order (by tag, base 0). The tags of fields can be discontinuous, if a field is nil. (default value in lua), don't encode it in message.\n\nThe header is a 16bit integer. It is the number of fields.\n\nEach field in field part is a 16bit integer (n). If n is zero, that means the field data is encoded in data part ;\n\nIf n is even (and not zero), the value of this field is n/2-1 , and the tag increases 1;\n\nIf n is odd, that means the tags is not continuous, and we should add current tag by (n+1)/2 .\n\nArrays are always encode in data part, 4 bytes header for the size, and the following bytes is the contents. See the example 2 for the struct array; example 3/4 for the integer array ; example 5 for the boolean array.\n\nFor integer array, an additional byte (4 or 8) to indicate the value is 32bit or 64bit.\n\nRead the examples below to see more details.\n\nNotice: If the tag is not declared in schema, the decoder will simply ignore the field for protocol version compatibility.\n\n```\n.Person {\n    name 0 : string\n    age 1 : integer\n    marital 2 : boolean\n    children 3 : *Person\n}\n\n.Data {\n\tnumbers 0 : *integer\n\tbools 1 : *boolean\n\tnumber 2 : integer\n\tbignumber 3 : integer\n}\n```\n\nExample 1:\n\n```\nperson { name = \"Alice\" ,  age = 13, marital = false } \n\n03 00 (fn = 3)\n00 00 (id = 0, value in data part)\n1C 00 (id = 1, value = 13)\n02 00 (id = 2, value = false)\n05 00 00 00 (sizeof \"Alice\")\n41 6C 69 63 65 (\"Alice\")\n```\n\nExample 2:\n\n```\nperson {\n    name = \"Bob\",\n    age = 40,\n    children = {\n        { name = \"Alice\" ,  age = 13 },\n        { name = \"Carol\" ,  age = 5 },\n    }\n}\n\n04 00 (fn = 4)\n00 00 (id = 0, value in data part)\n52 00 (id = 1, value = 40)\n01 00 (skip id = 2)\n00 00 (id = 3, value in data part)\n\n03 00 00 00 (sizeof \"Bob\")\n42 6F 62 (\"Bob\")\n\n26 00 00 00 (sizeof children)\n\n0F 00 00 00 (sizeof child 1)\n02 00 (fn = 2)\n00 00 (id = 0, value in data part)\n1C 00 (id = 1, value = 13)\n05 00 00 00 (sizeof \"Alice\")\n41 6C 69 63 65 (\"Alice\")\n\n0F 00 00 00 (sizeof child 2)\n02 00 (fn = 2)\n00 00 (id = 0, value in data part)\n0C 00 (id = 1, value = 5)\n05 00 00 00 (sizeof \"Carol\")\n43 61 72 6F 6C (\"Carol\")\n```\n\nExample 3:\n\n```\ndata {\n    numbers = { 1,2,3,4,5 }\n}\n\n01 00 (fn = 1)\n00 00 (id = 0, value in data part)\n\n15 00 00 00 (sizeof numbers)\n04 ( sizeof int32 )\n01 00 00 00 (1)\n02 00 00 00 (2)\n03 00 00 00 (3)\n04 00 00 00 (4)\n05 00 00 00 (5)\n```\n\nExample 4:\n```\ndata {\n    numbers = {\n        (1<<32)+1,\n        (1<<32)+2,\n        (1<<32)+3,\n    }\n}\n\n01 00 (fn = 1)\n00 00 (id = 0, value in data part)\n\n19 00 00 00 (sizeof numbers)\n08 ( sizeof int64 )\n01 00 00 00 01 00 00 00 ( (1<32) + 1)\n02 00 00 00 01 00 00 00 ( (1<32) + 2)\n03 00 00 00 01 00 00 00 ( (1<32) + 3)\n```\n\nExample 5:\n```\ndata {\n    bools = { false, true, false }\n}\n\n02 00 (fn = 2)\n01 00 (skip id = 0)\n00 00 (id = 1, value in data part)\n\n03 00 00 00 (sizeof bools)\n00 (false)\n01 (true)\n00 (false)\n```\n\nExample 6:\n```\ndata {\n    number = 100000,\n    bignumber = -10000000000,\n}\n\n03 00 (fn = 3)\n03 00 (skip id = 1)\n00 00 (id = 2, value in data part)\n00 00 (id = 3, value in data part)\n\n04 00 00 00 (sizeof number, data part)\nA0 86 01 00 (100000, 32bit integer)\n\n08 00 00 00 (sizeof bignumber, data part)\n00 1C F4 AB FD FF FF FF (-10000000000, 64bit integer)\n```\n\n0 Packing\n=======\n\nThe algorithm is very similar to [Cap'n proto](http://kentonv.github.io/capnproto/), but 0x00 is not treated specially. \n\nIn packed format, the message is padding to 8. Each 8 byte is reduced to a tag byte followed by zero to eight content bytes. \nThe bits of the tag byte correspond to the bytes of the unpacked word, with the least-significant bit corresponding to the first byte. \nEach zero bit indicates that the corresponding byte is zero. The non-zero bytes are packed following the tag.\n\nFor example:\n\n```\nunpacked (hex):  08 00 00 00 03 00 02 00   19 00 00 00 aa 01 00 00\npacked (hex):  51 08 03 02   31 19 aa 01\n```\n\nTag 0xff is treated specially. A number N is following the 0xff tag. N means (N+1)\\*8 bytes should be copied directly. \nThe bytes may or may not contain zeros. Because of this rule, the worst-case space overhead of packing is 2 bytes per 2 KiB of input.\n\nFor example:\n\n```\nunpacked (hex):  8a (x 30 bytes)\npacked (hex):  ff 03 8a (x 30 bytes) 00 00\n```\n\nC API\n=====\n\n```C\nstruct sproto * sproto_create(const void * proto, size_t sz);\n```\n\nCreate a sproto object with a schema string encoded by sprotoparser:\n\n```C\nvoid sproto_release(struct sproto *);\n```\n\nRelease the sproto object:\n\n```C\nint sproto_prototag(struct sproto *, const char * name);\nconst char * sproto_protoname(struct sproto *, int proto);\n// SPROTO_REQUEST(0) : request, SPROTO_RESPONSE(1): response\nstruct sproto_type * sproto_protoquery(struct sproto *, int proto, int what);\n```\n\nConvert between tag and name of a protocol, and query the type object of it:\n\n```C\nstruct sproto_type * sproto_type(struct sproto *, const char * typename);\n```\n\nQuery the type object from a sproto object:\n\n```C\nstruct sproto_arg {\n\tvoid *ud;\n\tconst char *tagname;\n\tint tagid;\n\tint type;\n\tstruct sproto_type *subtype;\n\tvoid *value;\n\tint length;\n\tint index;\t// array base 1\n\tint mainindex;\t// for map\n\tint extra; // SPROTO_TINTEGER: fixed-point presision ; SPROTO_TSTRING 0:utf8 string 1:binary\n};\n\ntypedef int (*sproto_callback)(const struct sproto_arg *args);\n\nint sproto_decode(struct sproto_type *, const void * data, int size, sproto_callback cb, void *ud);\nint sproto_encode(struct sproto_type *, void * buffer, int size, sproto_callback cb, void *ud);\n```\n\nencode and decode the sproto message with a user defined callback function. Read the implementation of lsproto.c for more details.\n\n```C\nint sproto_pack(const void * src, int srcsz, void * buffer, int bufsz);\nint sproto_unpack(const void * src, int srcsz, void * buffer, int bufsz);\n```\n\npack and unpack the message with the 0 packing algorithm.\n\nOther Implementions and bindings\n=====\nSee Wiki https://github.com/cloudwu/sproto/wiki\n\nQuestion?\n==========\n\n* Send me an email: http://www.codingnow.com/2000/gmail.gif\n* My Blog: http://blog.codingnow.com\n* Design: http://blog.codingnow.com/2014/07/ejoyproto.html (in Chinese)\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/README.md.meta",
    "content": "fileFormatVersion: 2\nguid: eea3f95ffce580c488d1c0da8487c18b\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/lsproto.c",
    "content": "#define LUA_LIB\n\n#include <string.h>\n#include <stdlib.h>\n#include \"msvcint.h\"\n\n#include \"lua.h\"\n#include \"lauxlib.h\"\n#include \"sproto.h\"\n\n#define MAX_GLOBALSPROTO 16\n#define ENCODE_BUFFERSIZE 2050\n\n#define ENCODE_MAXSIZE 0x1000000\n#define ENCODE_DEEPLEVEL 64\n\n#ifndef luaL_newlib /* using LuaJIT */\n/*\n** set functions from list 'l' into table at top - 'nup'; each\n** function gets the 'nup' elements at the top as upvalues.\n** Returns with only the table at the stack.\n\nLUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {\n#ifdef luaL_checkversion\n\tluaL_checkversion(L);\n#endif\n\tluaL_checkstack(L, nup, \"too many upvalues\");\n\tfor (; l->name != NULL; l++) {  // fill the table with given functions\n\t\tint i;\n\t\tfor (i = 0; i < nup; i++)  // copy upvalues to the top\n\t\t\tlua_pushvalue(L, -nup);\n\t\tlua_pushcclosure(L, l->func, nup);  // closure with those upvalues\n\t\tlua_setfield(L, -(nup + 2), l->name);\n\t}\n\tlua_pop(L, nup);  // remove upvalues \n}\n*/\n\n#define luaL_newlibtable(L,l) \\\n  lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)\n\n#define luaL_newlib(L,l)  (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))\n#endif\n\n#if LUA_VERSION_NUM < 503\n\n/*if LUA_VERSION_NUM < 502\nstatic lua_Integer lua_tointegerx(lua_State *L, int idx, int *isnum) {\n\tif (lua_isnumber(L, idx)) {\n\t\tif (isnum) *isnum = 1;\n\t\treturn lua_tointeger(L, idx);\n\t}\n\telse {\n\t\tif (isnum) *isnum = 0;\n\t\treturn 0;\n\t}\n}\n#endif\n*/\n\n// work around , use push & lua_gettable may be better\n#define lua_geti lua_rawgeti\n#define lua_seti lua_rawseti\n\n#endif\n\nstatic int\nlnewproto(lua_State *L) {\n\tstruct sproto * sp;\n\tsize_t sz;\n\tvoid * buffer = (void *)luaL_checklstring(L,1,&sz);\n\tsp = sproto_create(buffer, sz);\n\tif (sp) {\n\t\tlua_pushlightuserdata(L, sp);\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nstatic int\nldeleteproto(lua_State *L) {\n\tstruct sproto * sp = lua_touserdata(L,1);\n\tif (sp == NULL) {\n\t\treturn luaL_argerror(L, 1, \"Need a sproto object\");\n\t}\n\tsproto_release(sp);\n\treturn 0;\n}\n\nstatic int\nlquerytype(lua_State *L) {\n\tconst char * type_name;\n\tstruct sproto *sp = lua_touserdata(L,1);\n\tstruct sproto_type *st;\n\tif (sp == NULL) {\n\t\treturn luaL_argerror(L, 1, \"Need a sproto object\");\n\t}\n\ttype_name = luaL_checkstring(L,2);\n\tst = sproto_type(sp, type_name);\n\tif (st) {\n\t\tlua_pushlightuserdata(L, st);\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nstruct encode_ud {\n\tlua_State *L;\n\tstruct sproto_type *st;\n\tint tbl_index;\n\tconst char * array_tag;\n\tint array_index;\n\tint deep;\n\tint iter_index;\n};\n\nstatic int\nencode(const struct sproto_arg *args) {\n\tstruct encode_ud *self = args->ud;\n\tlua_State *L = self->L;\n\tif (self->deep >= ENCODE_DEEPLEVEL)\n\t\treturn luaL_error(L, \"The table is too deep\");\n\tif (args->index > 0) {\n\t\tif (args->tagname != self->array_tag) {\n\t\t\t// a new array\n\t\t\tself->array_tag = args->tagname;\n\t\t\tlua_getfield(L, self->tbl_index, args->tagname);\n\t\t\tif (lua_isnil(L, -1)) {\n\t\t\t\tif (self->array_index) {\n\t\t\t\t\tlua_replace(L, self->array_index);\n\t\t\t\t}\n\t\t\t\tself->array_index = 0;\n\t\t\t\treturn SPROTO_CB_NOARRAY;\n\t\t\t}\n\t\t\tif (!lua_istable(L, -1)) {\n\t\t\t\treturn luaL_error(L, \".*%s(%d) should be a table (Is a %s)\",\n\t\t\t\t\targs->tagname, args->index, lua_typename(L, lua_type(L, -1)));\n\t\t\t}\n\t\t\tif (self->array_index) {\n\t\t\t\tlua_replace(L, self->array_index);\n\t\t\t} else {\n\t\t\t\tself->array_index = lua_gettop(L);\n\t\t\t}\n\t\t}\n\t\tif (args->mainindex >= 0) {\n\t\t\t// use lua_next to iterate the table\n\t\t\t// todo: check the key is equal to mainindex value\n\n\t\t\tlua_pushvalue(L,self->iter_index);\n\t\t\tif (!lua_next(L, self->array_index)) {\n\t\t\t\t// iterate end\n\t\t\t\tlua_pushnil(L);\n\t\t\t\tlua_replace(L, self->iter_index);\n\t\t\t\treturn SPROTO_CB_NIL;\n\t\t\t}\n\t\t\tlua_insert(L, -2);\n\t\t\tlua_replace(L, self->iter_index);\n\t\t} else {\n\t\t\tlua_geti(L, self->array_index, args->index);\n\t\t}\n\t} else {\n\t\tlua_getfield(L, self->tbl_index, args->tagname);\n\t}\n\tif (lua_isnil(L, -1)) {\n\t\tlua_pop(L,1);\n\t\treturn SPROTO_CB_NIL;\n\t}\n\tswitch (args->type) {\n\tcase SPROTO_TINTEGER: {\n\t\tlua_Integer v;\n\t\tlua_Integer vh;\n\t\tint isnum;\n\t\tif (args->extra) {\n\t\t\t// It's decimal.\n\t\t\tlua_Number vn = lua_tonumber(L, -1);\n\t\t\tv = (lua_Integer)(vn * args->extra + 0.5);\n\t\t} else {\n\t\t\tv = lua_tointegerx(L, -1, &isnum);\n\t\t\tif(!isnum) {\n\t\t\t\treturn luaL_error(L, \".%s[%d] is not an integer (Is a %s)\", \n\t\t\t\t\targs->tagname, args->index, lua_typename(L, lua_type(L, -1)));\n\t\t\t}\n\t\t}\n\t\tlua_pop(L,1);\n\t\t// notice: in lua 5.2, lua_Integer maybe 52bit\n\t\tvh = v >> 31;\n\t\tif (vh == 0 || vh == -1) {\n\t\t\t*(uint32_t *)args->value = (uint32_t)v;\n\t\t\treturn 4;\n\t\t}\n\t\telse {\n\t\t\t*(uint64_t *)args->value = (uint64_t)v;\n\t\t\treturn 8;\n\t\t}\n\t}\n\tcase SPROTO_TBOOLEAN: {\n\t\tint v = lua_toboolean(L, -1);\n\t\tif (!lua_isboolean(L,-1)) {\n\t\t\treturn luaL_error(L, \".%s[%d] is not a boolean (Is a %s)\",\n\t\t\t\targs->tagname, args->index, lua_typename(L, lua_type(L, -1)));\n\t\t}\n\t\t*(int *)args->value = v;\n\t\tlua_pop(L,1);\n\t\treturn 4;\n\t}\n\tcase SPROTO_TSTRING: {\n\t\tsize_t sz = 0;\n\t\tconst char * str;\n\t\tif (!lua_isstring(L, -1)) {\n\t\t\treturn luaL_error(L, \".%s[%d] is not a string (Is a %s)\", \n\t\t\t\targs->tagname, args->index, lua_typename(L, lua_type(L, -1)));\n\t\t} else {\n\t\t\tstr = lua_tolstring(L, -1, &sz);\n\t\t}\n\t\tif (sz > args->length)\n\t\t\treturn SPROTO_CB_ERROR;\n\t\tmemcpy(args->value, str, sz);\n\t\tlua_pop(L,1);\n\t\treturn sz;\n\t}\n\tcase SPROTO_TSTRUCT: {\n\t\tstruct encode_ud sub;\n\t\tint r;\n\t\tint top = lua_gettop(L);\n\t\tif (!lua_istable(L, top)) {\n\t\t\treturn luaL_error(L, \".%s[%d] is not a table (Is a %s)\", \n\t\t\t\targs->tagname, args->index, lua_typename(L, lua_type(L, -1)));\n\t\t}\n\t\tsub.L = L;\n\t\tsub.st = args->subtype;\n\t\tsub.tbl_index = top;\n\t\tsub.array_tag = NULL;\n\t\tsub.array_index = 0;\n\t\tsub.deep = self->deep + 1;\n\t\tlua_pushnil(L);\t// prepare an iterator slot\n\t\tsub.iter_index = sub.tbl_index + 1;\n\t\tr = sproto_encode(args->subtype, args->value, args->length, encode, &sub);\n\t\tlua_settop(L, top-1);\t// pop the value\n\t\tif (r < 0) \n\t\t\treturn SPROTO_CB_ERROR;\n\t\treturn r;\n\t}\n\tdefault:\n\t\treturn luaL_error(L, \"Invalid field type %d\", args->type);\n\t}\n}\n\nstatic void *\nexpand_buffer(lua_State *L, int osz, int nsz) {\n\tvoid *output;\n\tdo {\n\t\tosz *= 2;\n\t} while (osz < nsz);\n\tif (osz > ENCODE_MAXSIZE) {\n\t\tluaL_error(L, \"object is too large (>%d)\", ENCODE_MAXSIZE);\n\t\treturn NULL;\n\t}\n\toutput = lua_newuserdata(L, osz);\n\tlua_replace(L, lua_upvalueindex(1));\n\tlua_pushinteger(L, osz);\n\tlua_replace(L, lua_upvalueindex(2));\n\n\treturn output;\n}\n\n/*\n\tlightuserdata sproto_type\n\ttable source\n\n\treturn string\n */\nstatic int\nlencode(lua_State *L) {\n\tstruct encode_ud self;\n\tvoid * buffer = lua_touserdata(L, lua_upvalueindex(1));\n\tint sz = lua_tointeger(L, lua_upvalueindex(2));\n\tint tbl_index = 2;\n\tstruct sproto_type * st = lua_touserdata(L, 1);\n\tif (st == NULL) {\n\t\tluaL_checktype(L, tbl_index, LUA_TNIL);\n\t\tlua_pushstring(L, \"\");\n\t\treturn 1;\t// response nil\n\t}\n\tluaL_checktype(L, tbl_index, LUA_TTABLE);\n\tluaL_checkstack(L, ENCODE_DEEPLEVEL*2 + 8, NULL);\n\tself.L = L;\n\tself.st = st;\n\tself.tbl_index = tbl_index;\n\tfor (;;) {\n\t\tint r;\n\t\tself.array_tag = NULL;\n\t\tself.array_index = 0;\n\t\tself.deep = 0;\n\n\t\tlua_settop(L, tbl_index);\n\t\tlua_pushnil(L);\t// for iterator (stack slot 3)\n\t\tself.iter_index = tbl_index+1;\n\n\t\tr = sproto_encode(st, buffer, sz, encode, &self);\n\t\tif (r<0) {\n\t\t\tbuffer = expand_buffer(L, sz, sz*2);\n\t\t\tsz *= 2;\n\t\t} else {\n\t\t\tlua_pushlstring(L, buffer, r);\n\t\t\treturn 1;\n\t\t}\n\t}\n}\n\nstruct decode_ud {\n\tlua_State *L;\n\tconst char * array_tag;\n\tint array_index;\n\tint result_index;\n\tint deep;\n\tint mainindex_tag;\n\tint key_index;\n};\n\nstatic int\ndecode(const struct sproto_arg *args) {\n\tstruct decode_ud * self = args->ud;\n\tlua_State *L = self->L;\n\tif (self->deep >= ENCODE_DEEPLEVEL)\n\t\treturn luaL_error(L, \"The table is too deep\");\n\tif (args->index != 0) {\n\t\t// It's array\n\t\tif (args->tagname != self->array_tag) {\n\t\t\tself->array_tag = args->tagname;\n\t\t\tlua_newtable(L);\n\t\t\tlua_pushvalue(L, -1);\n\t\t\tlua_setfield(L, self->result_index, args->tagname);\n\t\t\tif (self->array_index) {\n\t\t\t\tlua_replace(L, self->array_index);\n\t\t\t} else {\n\t\t\t\tself->array_index = lua_gettop(L);\n\t\t\t}\n\t\t\tif (args->index < 0) {\n\t\t\t\t// It's a empty array, return now.\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tswitch (args->type) {\n\tcase SPROTO_TINTEGER: {\n\t\t// notice: in lua 5.2, 52bit integer support (not 64)\n\t\tif (args->extra) {\n\t\t\t// lua_Integer is 32bit in small lua.\n\t\t\tint64_t v = *(int64_t*)args->value;\n\t\t\tlua_Number vn = (lua_Number)v;\n\t\t\tvn /= args->extra;\n\t\t\tlua_pushnumber(L, vn);\n\t\t} else {\n\t\t\tlua_Integer v = *(int64_t*)args->value;\n\t\t\tlua_pushinteger(L, v);\n\t\t}\n\t\tbreak;\n\t}\n\tcase SPROTO_TBOOLEAN: {\n\t\tint v = *(uint64_t*)args->value;\n\t\tlua_pushboolean(L,v);\n\t\tbreak;\n\t}\n\tcase SPROTO_TSTRING: {\n\t\tlua_pushlstring(L, args->value, args->length);\n\t\tbreak;\n\t}\n\tcase SPROTO_TSTRUCT: {\n\t\tstruct decode_ud sub;\n\t\tint r;\n\t\tlua_newtable(L);\n\t\tsub.L = L;\n\t\tsub.result_index = lua_gettop(L);\n\t\tsub.deep = self->deep + 1;\n\t\tsub.array_index = 0;\n\t\tsub.array_tag = NULL;\n\t\tif (args->mainindex >= 0) {\n\t\t\t// This struct will set into a map, so mark the main index tag.\n\t\t\tsub.mainindex_tag = args->mainindex;\n\t\t\tlua_pushnil(L);\n\t\t\tsub.key_index = lua_gettop(L);\n\n\t\t\tr = sproto_decode(args->subtype, args->value, args->length, decode, &sub);\n\t\t\tif (r < 0)\n\t\t\t\treturn SPROTO_CB_ERROR;\n\t\t\tif (r != args->length)\n\t\t\t\treturn r;\n\t\t\tlua_pushvalue(L, sub.key_index);\n\t\t\tif (lua_isnil(L, -1)) {\n\t\t\t\tluaL_error(L, \"Can't find main index (tag=%d) in [%s]\", args->mainindex, args->tagname);\n\t\t\t}\n\t\t\tlua_pushvalue(L, sub.result_index);\n\t\t\tlua_settable(L, self->array_index);\n\t\t\tlua_settop(L, sub.result_index-1);\n\t\t\treturn 0;\n\t\t} else {\n\t\t\tsub.mainindex_tag = -1;\n\t\t\tsub.key_index = 0;\n\t\t\tr = sproto_decode(args->subtype, args->value, args->length, decode, &sub);\n\t\t\tif (r < 0)\n\t\t\t\treturn SPROTO_CB_ERROR;\n\t\t\tif (r != args->length)\n\t\t\t\treturn r;\n\t\t\tlua_settop(L, sub.result_index);\n\t\t\tbreak;\n\t\t}\n\t}\n\tdefault:\n\t\tluaL_error(L, \"Invalid type\");\n\t}\n\tif (args->index > 0) {\n\t\tlua_seti(L, self->array_index, args->index);\n\t} else {\n\t\tif (self->mainindex_tag == args->tagid) {\n\t\t\t// This tag is marked, save the value to key_index\n\t\t\t// assert(self->key_index > 0);\n\t\t\tlua_pushvalue(L,-1);\n\t\t\tlua_replace(L, self->key_index);\n\t\t}\n\t\tlua_setfield(L, self->result_index, args->tagname);\n\t}\n\n\treturn 0;\n}\n\nstatic const void *\ngetbuffer(lua_State *L, int index, size_t *sz) {\n\tconst void * buffer = NULL;\n\tint t = lua_type(L, index);\n\tif (t == LUA_TSTRING) {\n\t\tbuffer = lua_tolstring(L, index, sz);\n\t} else {\n\t\tif (t != LUA_TUSERDATA && t != LUA_TLIGHTUSERDATA) {\n\t\t\tluaL_argerror(L, index, \"Need a string or userdata\");\n\t\t\treturn NULL;\n\t\t}\n\t\tbuffer = lua_touserdata(L, index);\n\t\t*sz = luaL_checkinteger(L, index+1);\n\t}\n\treturn buffer;\n}\n\n/*\n\tlightuserdata sproto_type\n\tstring source\t/  (lightuserdata , integer)\n\treturn table\n */\nstatic int\nldecode(lua_State *L) {\n\tstruct sproto_type * st = lua_touserdata(L, 1);\n\tconst void * buffer;\n\tstruct decode_ud self;\n\tsize_t sz;\n\tint r;\n\tif (st == NULL) {\n\t\t// return nil\n\t\treturn 0;\n\t}\n\tsz = 0;\n\tbuffer = getbuffer(L, 2, &sz);\n\tif (!lua_istable(L, -1)) {\n\t\tlua_newtable(L);\n\t}\n\tluaL_checkstack(L, ENCODE_DEEPLEVEL*3 + 8, NULL);\n\tself.L = L;\n\tself.result_index = lua_gettop(L);\n\tself.array_index = 0;\n\tself.array_tag = NULL;\n\tself.deep = 0;\n\tself.mainindex_tag = -1;\n\tself.key_index = 0;\n\tr = sproto_decode(st, buffer, (int)sz, decode, &self);\n\tif (r < 0) {\n\t\treturn luaL_error(L, \"decode error\");\n\t}\n\tlua_settop(L, self.result_index);\n\tlua_pushinteger(L, r);\n\treturn 2;\n}\n\nstatic int\nldumpproto(lua_State *L) {\n\tstruct sproto * sp = lua_touserdata(L, 1);\n\tif (sp == NULL) {\n\t\treturn luaL_argerror(L, 1, \"Need a sproto_type object\");\n\t}\n\tsproto_dump(sp);\n\n\treturn 0;\n}\n\n\n/*\n\tstring source\t/  (lightuserdata , integer)\n\treturn string\n */\nstatic int\nlpack(lua_State *L) {\n\tsize_t sz=0;\n\tconst void * buffer = getbuffer(L, 1, &sz);\n\t// the worst-case space overhead of packing is 2 bytes per 2 KiB of input (256 words = 2KiB).\n\tsize_t maxsz = (sz + 2047) / 2048 * 2 + sz + 2;\n\tvoid * output = lua_touserdata(L, lua_upvalueindex(1));\n\tint bytes;\n\tint osz = lua_tointeger(L, lua_upvalueindex(2));\n\tif (osz < maxsz) {\n\t\toutput = expand_buffer(L, osz, maxsz);\n\t}\n\tbytes = sproto_pack(buffer, sz, output, maxsz);\n\tif (bytes > maxsz) {\n\t\treturn luaL_error(L, \"packing error, return size = %d\", bytes);\n\t}\n\tlua_pushlstring(L, output, bytes);\n\n\treturn 1;\n}\n\nstatic int\nlunpack(lua_State *L) {\n\tsize_t sz=0;\n\tconst void * buffer = getbuffer(L, 1, &sz);\n\tvoid * output = lua_touserdata(L, lua_upvalueindex(1));\n\tint osz = lua_tointeger(L, lua_upvalueindex(2));\n\tint r = sproto_unpack(buffer, sz, output, osz);\n\tif (r < 0)\n\t\treturn luaL_error(L, \"Invalid unpack stream\");\n\tif (r > osz) {\n\t\toutput = expand_buffer(L, osz, r);\n\t\tr = sproto_unpack(buffer, sz, output, r);\n\t\tif (r < 0)\n\t\t\treturn luaL_error(L, \"Invalid unpack stream\");\n\t}\n\tlua_pushlstring(L, output, r);\n\treturn 1;\n}\n\nstatic void\npushfunction_withbuffer(lua_State *L, const char * name, lua_CFunction func) {\n\tlua_newuserdata(L, ENCODE_BUFFERSIZE);\n\tlua_pushinteger(L, ENCODE_BUFFERSIZE);\n\tlua_pushcclosure(L, func, 2);\n\tlua_setfield(L, -2, name);\n}\n\nstatic int\nlprotocol(lua_State *L) {\n\tstruct sproto * sp = lua_touserdata(L, 1);\n\tstruct sproto_type * request;\n\tstruct sproto_type * response;\n\tint t;\n\tint tag;\n\tif (sp == NULL) {\n\t\treturn luaL_argerror(L, 1, \"Need a sproto_type object\");\n\t}\n\tt = lua_type(L,2);\n\tif (t == LUA_TNUMBER) {\n\t\tconst char * name;\n\t\ttag = lua_tointeger(L, 2);\n\t\tname = sproto_protoname(sp, tag);\n\t\tif (name == NULL)\n\t\t\treturn 0;\n\t\tlua_pushstring(L, name);\n\t} else {\n\t\tconst char * name = lua_tostring(L, 2);\n\t\tif (name == NULL) {\n\t\t\treturn luaL_argerror(L, 2, \"Should be number or string\");\n\t\t}\n\t\ttag = sproto_prototag(sp, name);\n\t\tif (tag < 0)\n\t\t\treturn 0;\n\t\tlua_pushinteger(L, tag);\n\t}\n\trequest = sproto_protoquery(sp, tag, SPROTO_REQUEST);\n\tif (request == NULL) {\n\t\tlua_pushnil(L);\n\t} else {\n\t\tlua_pushlightuserdata(L, request);\n\t}\n\tresponse = sproto_protoquery(sp, tag, SPROTO_RESPONSE);\n\tif (response == NULL) {\n\t\tif (sproto_protoresponse(sp, tag)) {\n\t\t\tlua_pushlightuserdata(L, NULL);\t// response nil\n\t\t} else {\n\t\t\tlua_pushnil(L);\n\t\t}\n\t} else {\n\t\tlua_pushlightuserdata(L, response);\n\t}\n\treturn 3;\n}\n\n/* global sproto pointer for multi states\n   NOTICE : It is not thread safe\n */\nstatic struct sproto * G_sproto[MAX_GLOBALSPROTO];\n\nstatic int\nlsaveproto(lua_State *L) {\n\tstruct sproto * sp = lua_touserdata(L, 1);\n\tint index = luaL_optinteger(L, 2, 0);\n\tif (index < 0 || index >= MAX_GLOBALSPROTO) {\n\t\treturn luaL_error(L, \"Invalid global slot index %d\", index);\n\t}\n\t/* TODO : release old object (memory leak now, but thread safe)*/\n\tG_sproto[index] = sp;\n\treturn 0;\n}\n\nstatic int\nlloadproto(lua_State *L) {\n\tint index = luaL_optinteger(L, 1, 0);\n\tstruct sproto * sp;\n\tif (index < 0 || index >= MAX_GLOBALSPROTO) {\n\t\treturn luaL_error(L, \"Invalid global slot index %d\", index);\n\t}\n\tsp = G_sproto[index];\n\tif (sp == NULL) {\n\t\treturn luaL_error(L, \"nil sproto at index %d\", index);\n\t}\n\n\tlua_pushlightuserdata(L, sp);\n\n\treturn 1;\n}\n\nstatic int\nencode_default(const struct sproto_arg *args) {\n\tlua_State *L = args->ud;\n\tlua_pushstring(L, args->tagname);\n\tif (args->index > 0) {\n\t\tlua_newtable(L);\n\t\tlua_rawset(L, -3);\n\t\treturn SPROTO_CB_NOARRAY;\n\t} else {\n\t\tswitch(args->type) {\n\t\tcase SPROTO_TINTEGER:\n\t\t\tlua_pushinteger(L, 0);\n\t\t\tbreak;\n\t\tcase SPROTO_TBOOLEAN:\n\t\t\tlua_pushboolean(L, 0);\n\t\t\tbreak;\n\t\tcase SPROTO_TSTRING:\n\t\t\tlua_pushliteral(L, \"\");\n\t\t\tbreak;\n\t\tcase SPROTO_TSTRUCT:\n\t\t\tlua_createtable(L, 0, 1);\n\t\t\tlua_pushstring(L, sproto_name(args->subtype));\n\t\t\tlua_setfield(L, -2, \"__type\");\n\t\t\tbreak;\n\t\t}\n\t\tlua_rawset(L, -3);\n\t\treturn SPROTO_CB_NIL;\n\t}\n}\n\n/*\n\tlightuserdata sproto_type\n\treturn default table\n */\nstatic int\nldefault(lua_State *L) {\n\tint ret;\n\t// 64 is always enough for dummy buffer, except the type has many fields ( > 27).\n\tchar dummy[64];\n\tstruct sproto_type * st = lua_touserdata(L, 1);\n\tif (st == NULL) {\n\t\treturn luaL_argerror(L, 1, \"Need a sproto_type object\");\n\t}\n\tlua_newtable(L);\n\tret = sproto_encode(st, dummy, sizeof(dummy), encode_default, L);\n\tif (ret<0) {\n\t\t// try again\n\t\tint sz = sizeof(dummy) * 2;\n\t\tvoid * tmp = lua_newuserdata(L, sz);\n\t\tlua_insert(L, -2);\n\t\tfor (;;) {\n\t\t\tret = sproto_encode(st, tmp, sz, encode_default, L);\n\t\t\tif (ret >= 0)\n\t\t\t\tbreak;\n\t\t\tsz *= 2;\n\t\t\ttmp = lua_newuserdata(L, sz);\n\t\t\tlua_replace(L, -3);\n\t\t}\n\t}\n\treturn 1;\n}\n\nint\nluaopen_sproto_core(lua_State *L) {\n#ifdef luaL_checkversion\n\tluaL_checkversion(L);\n#endif\n\tluaL_Reg l[] = {\n\t\t{ \"newproto\", lnewproto },\n\t\t{ \"deleteproto\", ldeleteproto },\n\t\t{ \"dumpproto\", ldumpproto },\n\t\t{ \"querytype\", lquerytype },\n\t\t{ \"decode\", ldecode },\n\t\t{ \"protocol\", lprotocol },\n\t\t{ \"loadproto\", lloadproto },\n\t\t{ \"saveproto\", lsaveproto },\n\t\t{ \"default\", ldefault },\n\t\t{ NULL, NULL },\n\t};\n\t//luaL_newlib(L,l);\n\tluaL_register(L, \"sproto.core\", l);\n\tpushfunction_withbuffer(L, \"encode\", lencode);\n\tpushfunction_withbuffer(L, \"pack\", lpack);\n\tpushfunction_withbuffer(L, \"unpack\", lunpack);\n\treturn 1;\n}\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/lsproto.c.meta",
    "content": "fileFormatVersion: 2\nguid: 6a348fc15e22d9f4e87804b9da6b4164\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/msvcint.h",
    "content": "#ifndef msvc_int_h\n#define msvc_int_h\n\n#ifdef _MSC_VER\n# define inline __inline\n# ifndef _MSC_STDINT_H_\n#  if (_MSC_VER < 1300)\ntypedef signed char       int8_t;\ntypedef signed short      int16_t;\ntypedef signed int        int32_t;\ntypedef unsigned char     uint8_t;\ntypedef unsigned short    uint16_t;\ntypedef unsigned int      uint32_t;\n#  else\ntypedef signed __int8     int8_t;\ntypedef signed __int16    int16_t;\ntypedef signed __int32    int32_t;\ntypedef unsigned __int8   uint8_t;\ntypedef unsigned __int16  uint16_t;\ntypedef unsigned __int32  uint32_t;\n#  endif\ntypedef signed __int64       int64_t;\ntypedef unsigned __int64     uint64_t;\n# endif\n\n#else\n\n#include <stdint.h>\n\n#endif\n\n#endif\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/msvcint.h.meta",
    "content": "fileFormatVersion: 2\nguid: 8582e4d772778894ab36a7c59347e48f\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/print_r.lua",
    "content": "local print = print\nlocal tconcat = table.concat\nlocal tinsert = table.insert\nlocal srep = string.rep\nlocal type = type\nlocal pairs = pairs\nlocal tostring = tostring\nlocal next = next\n\nlocal function print_r(root)\n\tlocal cache = {  [root] = \".\" }\n\tlocal function _dump(t,space,name)\n\t\tlocal temp = {}\n\t\tfor k,v in pairs(t) do\n\t\t\tlocal key = tostring(k)\n\t\t\tif cache[v] then\n\t\t\t\ttinsert(temp,\"+\" .. key .. \" {\" .. cache[v]..\"}\")\n\t\t\telseif type(v) == \"table\" then\n\t\t\t\tlocal new_key = name .. \".\" .. key\n\t\t\t\tcache[v] = new_key\n\t\t\t\ttinsert(temp,\"+\" .. key .. _dump(v,space .. (next(t,k) and \"|\" or \" \" ).. srep(\" \",#key),new_key))\n\t\t\telse\n\t\t\t\ttinsert(temp,\"+\" .. key .. \" [\" .. tostring(v)..\"]\")\n\t\t\tend\n\t\tend\n\t\treturn tconcat(temp,\"\\n\"..space)\n\tend\n\tprint(_dump(root, \"\",\"\"))\nend\n\nreturn print_r"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/print_r.lua.meta",
    "content": "fileFormatVersion: 2\nguid: f158e5a0852b8e347ac6a433f28fbc83\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.c",
    "content": "#include <stdlib.h>\n#include <string.h>\n#include <stdio.h>\n#include <assert.h>\n#include \"msvcint.h\"\n\n#include \"sproto.h\"\n\n#define SPROTO_TARRAY 0x80\n#define CHUNK_SIZE 1000\n#define SIZEOF_LENGTH 4\n#define SIZEOF_HEADER 2\n#define SIZEOF_FIELD 2\n\nstruct field {\n\tint tag;\n\tint type;\n\tconst char * name;\n\tstruct sproto_type * st;\n\tint key;\n\tint extra;\n};\n\nstruct sproto_type {\n\tconst char * name;\n\tint n;\n\tint base;\n\tint maxn;\n\tstruct field *f;\n};\n\nstruct protocol {\n\tconst char *name;\n\tint tag;\n\tint confirm;\t// confirm == 1 where response nil\n\tstruct sproto_type * p[2];\n};\n\nstruct chunk {\n\tstruct chunk * next;\n};\n\nstruct pool {\n\tstruct chunk * header;\n\tstruct chunk * current;\n\tint current_used;\n};\n\nstruct sproto {\n\tstruct pool memory;\n\tint type_n;\n\tint protocol_n;\n\tstruct sproto_type * type;\n\tstruct protocol * proto;\n};\n\nstatic void\npool_init(struct pool *p) {\n\tp->header = NULL;\n\tp->current = NULL;\n\tp->current_used = 0;\n}\n\nstatic void\npool_release(struct pool *p) {\n\tstruct chunk * tmp = p->header;\n\twhile (tmp) {\n\t\tstruct chunk * n = tmp->next;\n\t\tfree(tmp);\n\t\ttmp = n;\n\t}\n}\n\nstatic void *\npool_newchunk(struct pool *p, size_t sz) {\n\tstruct chunk * t = malloc(sz + sizeof(struct chunk));\n\tif (t == NULL)\n\t\treturn NULL;\n\tt->next = p->header;\n\tp->header = t;\n\treturn t+1;\n}\n\nstatic void *\npool_alloc(struct pool *p, size_t sz) {\n\t// align by 8\n\tsz = (sz + 7) & ~7;\n\tif (sz >= CHUNK_SIZE) {\n\t\treturn pool_newchunk(p, sz);\n\t}\n\tif (p->current == NULL) {\n\t\tif (pool_newchunk(p, CHUNK_SIZE) == NULL)\n\t\t\treturn NULL;\n\t\tp->current = p->header;\n\t}\n\tif (sz + p->current_used <= CHUNK_SIZE) {\n\t\tvoid * ret = (char *)(p->current+1) + p->current_used;\n\t\tp->current_used += sz;\n\t\treturn ret;\n\t}\n\n\tif (sz >= p->current_used) {\n\t\treturn pool_newchunk(p, sz);\n\t} else {\n\t\tvoid * ret = pool_newchunk(p, CHUNK_SIZE);\n\t\tp->current = p->header;\n\t\tp->current_used = sz;\n\t\treturn ret;\n\t}\n}\n\nstatic inline int\ntoword(const uint8_t * p) {\n\treturn p[0] | p[1]<<8;\n}\n\nstatic inline uint32_t\ntodword(const uint8_t *p) {\n\treturn p[0] | p[1]<<8 | p[2]<<16 | p[3]<<24;\n}\n\nstatic int\ncount_array(const uint8_t * stream) {\n\tuint32_t length = todword(stream);\n\tint n = 0;\n\tstream += SIZEOF_LENGTH;\n\twhile (length > 0) {\n\t\tuint32_t nsz;\n\t\tif (length < SIZEOF_LENGTH)\n\t\t\treturn -1;\n\t\tnsz = todword(stream);\n\t\tnsz += SIZEOF_LENGTH;\n\t\tif (nsz > length)\n\t\t\treturn -1;\n\t\t++n;\n\t\tstream += nsz;\n\t\tlength -= nsz;\n\t}\n\n\treturn n;\n}\n\nstatic int\nstruct_field(const uint8_t * stream, size_t sz) {\n\tconst uint8_t * field;\n\tint fn, header, i;\n\tif (sz < SIZEOF_LENGTH)\n\t\treturn -1;\n\tfn = toword(stream);\n\theader = SIZEOF_HEADER + SIZEOF_FIELD * fn;\n\tif (sz < header)\n\t\treturn -1;\n\tfield = stream + SIZEOF_HEADER;\n\tsz -= header;\n\tstream += header;\n\tfor (i=0;i<fn;i++) {\n\t\tint value= toword(field + i * SIZEOF_FIELD);\n\t\tuint32_t dsz;\n\t\tif (value != 0)\n\t\t\tcontinue;\n\t\tif (sz < SIZEOF_LENGTH)\n\t\t\treturn -1;\n\t\tdsz = todword(stream);\n\t\tif (sz < SIZEOF_LENGTH + dsz)\n\t\t\treturn -1;\n\t\tstream += SIZEOF_LENGTH + dsz;\n\t\tsz -= SIZEOF_LENGTH + dsz;\n\t}\n\n\treturn fn;\n}\n\nstatic const char *\nimport_string(struct sproto *s, const uint8_t * stream) {\n\tuint32_t sz = todword(stream);\n\tchar * buffer = pool_alloc(&s->memory, sz+1);\n\tmemcpy(buffer, stream+SIZEOF_LENGTH, sz);\n\tbuffer[sz] = '\\0';\n\treturn buffer;\n}\n\nstatic int\ncalc_pow(int base, int n) {\n\tint r;\n\tif (n == 0)\n\t\treturn 1;\n\tr = calc_pow(base * base , n / 2);\n\tif (n&1) {\n\t\tr *= base;\n\t}\n\treturn r;\n}\n\nstatic const uint8_t *\nimport_field(struct sproto *s, struct field *f, const uint8_t * stream) {\n\tuint32_t sz;\n\tconst uint8_t * result;\n\tint fn;\n\tint i;\n\tint array = 0;\n\tint tag = -1;\n\tf->tag = -1;\n\tf->type = -1;\n\tf->name = NULL;\n\tf->st = NULL;\n\tf->key = -1;\n\tf->extra = 0;\n\n\tsz = todword(stream);\n\tstream += SIZEOF_LENGTH;\n\tresult = stream + sz;\n\tfn = struct_field(stream, sz);\n\tif (fn < 0)\n\t\treturn NULL;\n\tstream += SIZEOF_HEADER;\n\tfor (i=0;i<fn;i++) {\n\t\tint value;\n\t\t++tag;\n\t\tvalue = toword(stream + SIZEOF_FIELD * i);\n\t\tif (value & 1) {\n\t\t\ttag+= value/2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (tag == 0) { // name\n\t\t\tif (value != 0)\n\t\t\t\treturn NULL;\n\t\t\tf->name = import_string(s, stream + fn * SIZEOF_FIELD);\n\t\t\tcontinue;\n\t\t}\n\t\tif (value == 0)\n\t\t\treturn NULL;\n\t\tvalue = value/2 - 1;\n\t\tswitch(tag) {\n\t\tcase 1: // buildin\n\t\t\tif (value >= SPROTO_TSTRUCT)\n\t\t\t\treturn NULL;\t// invalid buildin type\n\t\t\tf->type = value;\n\t\t\tbreak;\n\t\tcase 2: // type index\n\t\t\tif (f->type == SPROTO_TINTEGER) {\n\t\t\t\tf->extra = calc_pow(10, value);\n\t\t\t} else if (f->type == SPROTO_TSTRING) {\n\t\t\t\tf->extra = value;\t// string if 0 ; binary is 1\n\t\t\t} else {\n\t\t\t\tif (value >= s->type_n)\n\t\t\t\t\treturn NULL;\t// invalid type index\n\t\t\t\tif (f->type >= 0)\n\t\t\t\t\treturn NULL;\n\t\t\t\tf->type = SPROTO_TSTRUCT;\n\t\t\t\tf->st = &s->type[value];\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 3: // tag\n\t\t\tf->tag = value;\n\t\t\tbreak;\n\t\tcase 4: // array\n\t\t\tif (value)\n\t\t\t\tarray = SPROTO_TARRAY;\n\t\t\tbreak;\n\t\tcase 5:\t// key\n\t\t\tf->key = value;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn NULL;\n\t\t}\n\t}\n\tif (f->tag < 0 || f->type < 0 || f->name == NULL)\n\t\treturn NULL;\n\tf->type |= array;\n\n\treturn result;\n}\n\n/*\n.type {\n\t.field {\n\t\tname 0 : string\n\t\tbuildin 1 : integer\n\t\ttype 2 : integer\n\t\ttag 3 : integer\n\t\tarray 4 : boolean\n\t}\n\tname 0 : string\n\tfields 1 : *field\n}\n*/\nstatic const uint8_t *\nimport_type(struct sproto *s, struct sproto_type *t, const uint8_t * stream) {\n\tconst uint8_t * result;\n\tuint32_t sz = todword(stream);\n\tint i;\n\tint fn;\n\tint n;\n\tint maxn;\n\tint last;\n\tstream += SIZEOF_LENGTH;\n\tresult = stream + sz;\n\tfn = struct_field(stream, sz);\n\tif (fn <= 0 || fn > 2)\n\t\treturn NULL;\n\tfor (i=0;i<fn*SIZEOF_FIELD;i+=SIZEOF_FIELD) {\n\t\t// name and fields must encode to 0\n\t\tint v = toword(stream + SIZEOF_HEADER + i);\n\t\tif (v != 0)\n\t\t\treturn NULL;\n\t}\n\tmemset(t, 0, sizeof(*t));\n\tstream += SIZEOF_HEADER + fn * SIZEOF_FIELD;\n\tt->name = import_string(s, stream);\n\tif (fn == 1) {\n\t\treturn result;\n\t}\n\tstream += todword(stream)+SIZEOF_LENGTH;\t// second data\n\tn = count_array(stream);\n\tif (n<0)\n\t\treturn NULL;\n\tstream += SIZEOF_LENGTH;\n\tmaxn = n;\n\tlast = -1;\n\tt->n = n;\n\tt->f = pool_alloc(&s->memory, sizeof(struct field) * n);\n\tfor (i=0;i<n;i++) {\n\t\tint tag;\n\t\tstruct field *f = &t->f[i];\n\t\tstream = import_field(s, f, stream);\n\t\tif (stream == NULL)\n\t\t\treturn NULL;\n\t\ttag = f->tag;\n\t\tif (tag <= last)\n\t\t\treturn NULL;\t// tag must in ascending order\n\t\tif (tag > last+1) {\n\t\t\t++maxn;\n\t\t}\n\t\tlast = tag;\n\t}\n\tt->maxn = maxn;\n\tt->base = t->f[0].tag;\n\tn = t->f[n-1].tag - t->base + 1;\n\tif (n != t->n) {\n\t\tt->base = -1;\n\t}\n\treturn result;\n}\n\n/*\n.protocol {\n\tname 0 : string\n\ttag 1 : integer\n\trequest 2 : integer\n\tresponse 3 : integer\n}\n*/\nstatic const uint8_t *\nimport_protocol(struct sproto *s, struct protocol *p, const uint8_t * stream) {\n\tconst uint8_t * result;\n\tuint32_t sz = todword(stream);\n\tint fn;\n\tint i;\n\tint tag;\n\tstream += SIZEOF_LENGTH;\n\tresult = stream + sz;\n\tfn = struct_field(stream, sz);\n\tstream += SIZEOF_HEADER;\n\tp->name = NULL;\n\tp->tag = -1;\n\tp->p[SPROTO_REQUEST] = NULL;\n\tp->p[SPROTO_RESPONSE] = NULL;\n\tp->confirm = 0;\n\ttag = 0;\n\tfor (i=0;i<fn;i++,tag++) {\n\t\tint value = toword(stream + SIZEOF_FIELD * i);\n\t\tif (value & 1) {\n\t\t\ttag += (value-1)/2;\n\t\t\tcontinue;\n\t\t}\n\t\tvalue = value/2 - 1;\n\t\tswitch (i) {\n\t\tcase 0: // name\n\t\t\tif (value != -1) {\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tp->name = import_string(s, stream + SIZEOF_FIELD *fn);\n\t\t\tbreak;\n\t\tcase 1: // tag\n\t\t\tif (value < 0) {\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\tp->tag = value;\n\t\t\tbreak;\n\t\tcase 2: // request\n\t\t\tif (value < 0 || value>=s->type_n)\n\t\t\t\treturn NULL;\n\t\t\tp->p[SPROTO_REQUEST] = &s->type[value];\n\t\t\tbreak;\n\t\tcase 3: // response\n\t\t\tif (value < 0 || value>=s->type_n)\n\t\t\t\treturn NULL;\n\t\t\tp->p[SPROTO_RESPONSE] = &s->type[value];\n\t\t\tbreak;\n\t\tcase 4:\t// confirm\n\t\t\tp->confirm = value;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tif (p->name == NULL || p->tag<0) {\n\t\treturn NULL;\n\t}\n\n\treturn result;\n}\n\nstatic struct sproto *\ncreate_from_bundle(struct sproto *s, const uint8_t * stream, size_t sz) {\n\tconst uint8_t * content;\n\tconst uint8_t * typedata = NULL;\n\tconst uint8_t * protocoldata = NULL;\n\tint fn = struct_field(stream, sz);\n\tint i;\n\tif (fn < 0 || fn > 2)\n\t\treturn NULL;\n\n\tstream += SIZEOF_HEADER;\n\tcontent = stream + fn*SIZEOF_FIELD;\n\n\tfor (i=0;i<fn;i++) {\n\t\tint value = toword(stream + i*SIZEOF_FIELD);\n\t\tint n;\n\t\tif (value != 0)\n\t\t\treturn NULL;\n\t\tn = count_array(content);\n\t\tif (n<0)\n\t\t\treturn NULL;\n\t\tif (i == 0) {\n\t\t\ttypedata = content+SIZEOF_LENGTH;\n\t\t\ts->type_n = n;\n\t\t\ts->type = pool_alloc(&s->memory, n * sizeof(*s->type));\n\t\t} else {\n\t\t\tprotocoldata = content+SIZEOF_LENGTH;\n\t\t\ts->protocol_n = n;\n\t\t\ts->proto = pool_alloc(&s->memory, n * sizeof(*s->proto));\n\t\t}\n\t\tcontent += todword(content) + SIZEOF_LENGTH;\n\t}\n\n\tfor (i=0;i<s->type_n;i++) {\n\t\ttypedata = import_type(s, &s->type[i], typedata);\n\t\tif (typedata == NULL) {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\tfor (i=0;i<s->protocol_n;i++) {\n\t\tprotocoldata = import_protocol(s, &s->proto[i], protocoldata);\n\t\tif (protocoldata == NULL) {\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\treturn s;\n}\n\nstruct sproto *\nsproto_create(const void * proto, size_t sz) {\n\tstruct pool mem;\n\tstruct sproto * s;\n\tpool_init(&mem);\n\ts = pool_alloc(&mem, sizeof(*s));\n\tif (s == NULL)\n\t\treturn NULL;\n\tmemset(s, 0, sizeof(*s));\n\ts->memory = mem;\n\tif (create_from_bundle(s, proto, sz) == NULL) {\n\t\tpool_release(&s->memory);\n\t\treturn NULL;\n\t}\n\treturn s;\n}\n\nvoid\nsproto_release(struct sproto * s) {\n\tif (s == NULL)\n\t\treturn;\n\tpool_release(&s->memory);\n}\n\nvoid\nsproto_dump(struct sproto *s) {\n\tint i,j;\n\tprintf(\"=== %d types ===\\n\", s->type_n);\n\tfor (i=0;i<s->type_n;i++) {\n\t\tstruct sproto_type *t = &s->type[i];\n\t\tprintf(\"%s\\n\", t->name);\n\t\tfor (j=0;j<t->n;j++) {\n\t\t\tchar array[2] = { 0, 0 };\n\t\t\tconst char * type_name = NULL;\n\t\t\tstruct field *f = &t->f[j];\n\t\t\tint type = f->type & ~SPROTO_TARRAY;\n\t\t\tif (f->type & SPROTO_TARRAY) {\n\t\t\t\tarray[0] = '*';\n\t\t\t} else {\n\t\t\t\tarray[0] = 0;\n\t\t\t}\n\t\t\tif (type == SPROTO_TSTRUCT) {\n\t\t\t\ttype_name = f->st->name;\n\t\t\t} else {\n\t\t\t\tswitch(type) {\n\t\t\t\tcase SPROTO_TINTEGER:\n\t\t\t\t\tif (f->extra) {\n\t\t\t\t\t\ttype_name = \"decimal\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttype_name = \"integer\";\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase SPROTO_TBOOLEAN:\n\t\t\t\t\ttype_name = \"boolean\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase SPROTO_TSTRING:\n\t\t\t\t\tif (f->extra == SPROTO_TSTRING_BINARY)\n\t\t\t\t\t\ttype_name = \"binary\";\n\t\t\t\t\telse\n\t\t\t\t\t\ttype_name = \"string\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\ttype_name = \"invalid\";\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"\\t%s (%d) %s%s\", f->name, f->tag, array, type_name);\n\t\t\tif (type == SPROTO_TINTEGER && f->extra > 0) {\n\t\t\t\tprintf(\"(%d)\", f->extra);\n\t\t\t}\n\t\t\tif (f->key >= 0) {\n\t\t\t\tprintf(\"[%d]\", f->key);\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t}\n\tprintf(\"=== %d protocol ===\\n\", s->protocol_n);\n\tfor (i=0;i<s->protocol_n;i++) {\n\t\tstruct protocol *p = &s->proto[i];\n\t\tif (p->p[SPROTO_REQUEST]) {\n\t\t\tprintf(\"\\t%s (%d) request:%s\", p->name, p->tag, p->p[SPROTO_REQUEST]->name);\n\t\t} else {\n\t\t\tprintf(\"\\t%s (%d) request:(null)\", p->name, p->tag);\n\t\t}\n\t\tif (p->p[SPROTO_RESPONSE]) {\n\t\t\tprintf(\" response:%s\", p->p[SPROTO_RESPONSE]->name);\n\t\t} else if (p->confirm) {\n\t\t\tprintf(\" response nil\");\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n}\n\n// query\nint\nsproto_prototag(const struct sproto *sp, const char * name) {\n\tint i;\n\tfor (i=0;i<sp->protocol_n;i++) {\n\t\tif (strcmp(name, sp->proto[i].name) == 0) {\n\t\t\treturn sp->proto[i].tag;\n\t\t}\n\t}\n\treturn -1;\n}\n\nstatic struct protocol *\nquery_proto(const struct sproto *sp, int tag) {\n\tint begin = 0, end = sp->protocol_n;\n\twhile(begin<end) {\n\t\tint mid = (begin+end)/2;\n\t\tint t = sp->proto[mid].tag;\n\t\tif (t==tag) {\n\t\t\treturn &sp->proto[mid];\n\t\t}\n\t\tif (tag > t) {\n\t\t\tbegin = mid+1;\n\t\t} else {\n\t\t\tend = mid;\n\t\t}\n\t}\n\treturn NULL;\n}\n\nstruct sproto_type *\nsproto_protoquery(const struct sproto *sp, int proto, int what) {\n\tstruct protocol * p;\n\tif (what <0 || what >1) {\n\t\treturn NULL;\n\t}\n\tp = query_proto(sp, proto);\n\tif (p) {\n\t\treturn p->p[what];\n\t}\n\treturn NULL;\n}\n\nint\nsproto_protoresponse(const struct sproto * sp, int proto) {\n\tstruct protocol * p = query_proto(sp, proto);\n\treturn (p!=NULL && (p->p[SPROTO_RESPONSE] || p->confirm));\n}\n\nconst char *\nsproto_protoname(const struct sproto *sp, int proto) {\n\tstruct protocol * p = query_proto(sp, proto);\n\tif (p) {\n\t\treturn p->name;\n\t}\n\treturn NULL;\n}\n\nstruct sproto_type *\nsproto_type(const struct sproto *sp, const char * type_name) {\n\tint i;\n\tfor (i=0;i<sp->type_n;i++) {\n\t\tif (strcmp(type_name, sp->type[i].name) == 0) {\n\t\t\treturn &sp->type[i];\n\t\t}\n\t}\n\treturn NULL;\n}\n\nconst char *\nsproto_name(struct sproto_type * st) {\n\treturn st->name;\n}\n\nstatic struct field *\nfindtag(const struct sproto_type *st, int tag) {\n\tint begin, end;\n\tif (st->base >=0 ) {\n\t\ttag -= st->base;\n\t\tif (tag < 0 || tag >= st->n)\n\t\t\treturn NULL;\n\t\treturn &st->f[tag];\n\t}\n\tbegin = 0;\n\tend = st->n;\n\twhile (begin < end) {\n\t\tint mid = (begin+end)/2;\n\t\tstruct field *f = &st->f[mid];\n\t\tint t = f->tag;\n\t\tif (t == tag) {\n\t\t\treturn f;\n\t\t}\n\t\tif (tag > t) {\n\t\t\tbegin = mid + 1;\n\t\t} else {\n\t\t\tend = mid;\n\t\t}\n\t}\n\treturn NULL;\n}\n\n// encode & decode\n// sproto_callback(void *ud, int tag, int type, struct sproto_type *, void *value, int length)\n//\t  return size, -1 means error\n\nstatic inline int\nfill_size(uint8_t * data, int sz) {\n\tdata[0] = sz & 0xff;\n\tdata[1] = (sz >> 8) & 0xff;\n\tdata[2] = (sz >> 16) & 0xff;\n\tdata[3] = (sz >> 24) & 0xff;\n\treturn sz + SIZEOF_LENGTH;\n}\n\nstatic int\nencode_integer(uint32_t v, uint8_t * data, int size) {\n\tif (size < SIZEOF_LENGTH + sizeof(v))\n\t\treturn -1;\n\tdata[4] = v & 0xff;\n\tdata[5] = (v >> 8) & 0xff;\n\tdata[6] = (v >> 16) & 0xff;\n\tdata[7] = (v >> 24) & 0xff;\n\treturn fill_size(data, sizeof(v));\n}\n\nstatic int\nencode_uint64(uint64_t v, uint8_t * data, int size) {\n\tif (size < SIZEOF_LENGTH + sizeof(v))\n\t\treturn -1;\n\tdata[4] = v & 0xff;\n\tdata[5] = (v >> 8) & 0xff;\n\tdata[6] = (v >> 16) & 0xff;\n\tdata[7] = (v >> 24) & 0xff;\n\tdata[8] = (v >> 32) & 0xff;\n\tdata[9] = (v >> 40) & 0xff;\n\tdata[10] = (v >> 48) & 0xff;\n\tdata[11] = (v >> 56) & 0xff;\n\treturn fill_size(data, sizeof(v));\n}\n\n/*\n//#define CB(tagname,type,index,subtype,value,length) cb(ud, tagname,type,index,subtype,value,length)\n\nstatic int\ndo_cb(sproto_callback cb, void *ud, const char *tagname, int type, int index, struct sproto_type *subtype, void *value, int length) {\n\tif (subtype) {\n\t\tif (type >= 0) {\n\t\t\tprintf(\"callback: tag=%s[%d], subtype[%s]:%d\\n\",tagname,index, subtype->name, type);\n\t\t} else {\n\t\t\tprintf(\"callback: tag=%s[%d], subtype[%s]\\n\",tagname,index, subtype->name);\n\t\t}\n\t} else if (index > 0) {\n\t\tprintf(\"callback: tag=%s[%d]\\n\",tagname,index);\n\t} else if (index == 0) {\n\t\tprintf(\"callback: tag=%s\\n\",tagname);\n\t} else {\n\t\tprintf(\"callback: tag=%s [mainkey]\\n\",tagname);\n\t}\n\treturn cb(ud, tagname,type,index,subtype,value,length);\n}\n#define CB(tagname,type,index,subtype,value,length) do_cb(cb,ud, tagname,type,index,subtype,value,length)\n*/\n\nstatic int\nencode_object(sproto_callback cb, struct sproto_arg *args, uint8_t *data, int size) {\n\tint sz;\n\tif (size < SIZEOF_LENGTH)\n\t\treturn -1;\n\targs->value = data+SIZEOF_LENGTH;\n\targs->length = size-SIZEOF_LENGTH;\n\tsz = cb(args);\n\tif (sz < 0) {\n\t\tif (sz == SPROTO_CB_NIL)\n\t\t\treturn 0;\n\t\treturn -1;\t// sz == SPROTO_CB_ERROR\n\t}\n\tassert(sz <= size-SIZEOF_LENGTH);\t// verify buffer overflow\n\treturn fill_size(data, sz);\n}\n\nstatic inline void\nuint32_to_uint64(int negative, uint8_t *buffer) {\n\tif (negative) {\n\t\tbuffer[4] = 0xff;\n\t\tbuffer[5] = 0xff;\n\t\tbuffer[6] = 0xff;\n\t\tbuffer[7] = 0xff;\n\t} else {\n\t\tbuffer[4] = 0;\n\t\tbuffer[5] = 0;\n\t\tbuffer[6] = 0;\n\t\tbuffer[7] = 0;\n\t}\n}\n\nstatic uint8_t *\nencode_integer_array(sproto_callback cb, struct sproto_arg *args, uint8_t *buffer, int size, int *noarray) {\n\tuint8_t * header = buffer;\n\tint intlen;\n\tint index;\n\tif (size < 1)\n\t\treturn NULL;\n\tbuffer++;\n\tsize--;\n\tintlen = sizeof(uint32_t);\n\tindex = 1;\n\t*noarray = 0;\n\n\tfor (;;) {\n\t\tint sz;\n\t\tunion {\n\t\t\tuint64_t u64;\n\t\t\tuint32_t u32;\n\t\t} u;\n\t\targs->value = &u;\n\t\targs->length = sizeof(u);\n\t\targs->index = index;\n\t\tsz = cb(args);\n\t\tif (sz <= 0) {\n\t\t\tif (sz == SPROTO_CB_NIL) // nil object, end of array\n\t\t\t\tbreak;\n\t\t\tif (sz == SPROTO_CB_NOARRAY) {\t// no array, don't encode it\n\t\t\t\t*noarray = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn NULL;\t// sz == SPROTO_CB_ERROR\n\t\t}\n\t\tif (size < sizeof(uint64_t))\n\t\t\treturn NULL;\n\t\tif (sz == sizeof(uint32_t)) {\n\t\t\tuint32_t v = u.u32;\n\t\t\tbuffer[0] = v & 0xff;\n\t\t\tbuffer[1] = (v >> 8) & 0xff;\n\t\t\tbuffer[2] = (v >> 16) & 0xff;\n\t\t\tbuffer[3] = (v >> 24) & 0xff;\n\n\t\t\tif (intlen == sizeof(uint64_t)) {\n\t\t\t\tuint32_to_uint64(v & 0x80000000, buffer);\n\t\t\t}\n\t\t} else {\n\t\t\tuint64_t v;\n\t\t\tif (sz != sizeof(uint64_t))\n\t\t\t\treturn NULL;\n\t\t\tif (intlen == sizeof(uint32_t)) {\n\t\t\t\tint i;\n\t\t\t\t// rearrange\n\t\t\t\tsize -= (index-1) * sizeof(uint32_t);\n\t\t\t\tif (size < sizeof(uint64_t))\n\t\t\t\t\treturn NULL;\n\t\t\t\tbuffer += (index-1) * sizeof(uint32_t);\n\t\t\t\tfor (i=index-2;i>=0;i--) {\n\t\t\t\t\tint negative;\n\t\t\t\t\tmemcpy(header+1+i*sizeof(uint64_t), header+1+i*sizeof(uint32_t), sizeof(uint32_t));\n\t\t\t\t\tnegative = header[1+i*sizeof(uint64_t)+3] & 0x80;\n\t\t\t\t\tuint32_to_uint64(negative, header+1+i*sizeof(uint64_t));\n\t\t\t\t}\n\t\t\t\tintlen = sizeof(uint64_t);\n\t\t\t}\n\n\t\t\tv = u.u64;\n\t\t\tbuffer[0] = v & 0xff;\n\t\t\tbuffer[1] = (v >> 8) & 0xff;\n\t\t\tbuffer[2] = (v >> 16) & 0xff;\n\t\t\tbuffer[3] = (v >> 24) & 0xff;\n\t\t\tbuffer[4] = (v >> 32) & 0xff;\n\t\t\tbuffer[5] = (v >> 40) & 0xff;\n\t\t\tbuffer[6] = (v >> 48) & 0xff;\n\t\t\tbuffer[7] = (v >> 56) & 0xff;\n\t\t}\n\n\t\tsize -= intlen;\n\t\tbuffer += intlen;\n\t\tindex++;\n\t}\n\n\tif (buffer == header + 1) {\n\t\treturn header;\n\t}\n\t*header = (uint8_t)intlen;\n\treturn buffer;\n}\n\nstatic int\nencode_array(sproto_callback cb, struct sproto_arg *args, uint8_t *data, int size) {\n\tuint8_t * buffer;\n\tint sz;\n\tif (size < SIZEOF_LENGTH)\n\t\treturn -1;\n\tsize -= SIZEOF_LENGTH;\n\tbuffer = data + SIZEOF_LENGTH;\n\tswitch (args->type) {\n\tcase SPROTO_TINTEGER: {\n\t\tint noarray;\n\t\tbuffer = encode_integer_array(cb,args,buffer,size, &noarray);\n\t\tif (buffer == NULL)\n\t\t\treturn -1;\n\t\n\t\tif (noarray) {\n\t\t\treturn 0;\n\t\t}\n\t\tbreak;\n\t}\n\tcase SPROTO_TBOOLEAN:\n\t\targs->index = 1;\n\t\tfor (;;) {\n\t\t\tint v = 0;\n\t\t\targs->value = &v;\n\t\t\targs->length = sizeof(v);\n\t\t\tsz = cb(args);\n\t\t\tif (sz < 0) {\n\t\t\t\tif (sz == SPROTO_CB_NIL)\t\t// nil object , end of array\n\t\t\t\t\tbreak;\n\t\t\t\tif (sz == SPROTO_CB_NOARRAY)\t// no array, don't encode it\n\t\t\t\t\treturn 0;\n\t\t\t\treturn -1;\t// sz == SPROTO_CB_ERROR\n\t\t\t}\n\t\t\tif (size < 1)\n\t\t\t\treturn -1;\n\t\t\tbuffer[0] = v ? 1: 0;\n\t\t\tsize -= 1;\n\t\t\tbuffer += 1;\n\t\t\t++args->index;\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\targs->index = 1;\n\t\tfor (;;) {\n\t\t\tif (size < SIZEOF_LENGTH)\n\t\t\t\treturn -1;\n\t\t\tsize -= SIZEOF_LENGTH;\n\t\t\targs->value = buffer+SIZEOF_LENGTH;\n\t\t\targs->length = size;\n\t\t\tsz = cb(args);\n\t\t\tif (sz < 0) {\n\t\t\t\tif (sz == SPROTO_CB_NIL) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (sz == SPROTO_CB_NOARRAY)\t// no array, don't encode it\n\t\t\t\t\treturn 0;\n\t\t\t\treturn -1;\t// sz == SPROTO_CB_ERROR\n\t\t\t}\n\t\t\tfill_size(buffer, sz);\n\t\t\tbuffer += SIZEOF_LENGTH+sz;\n\t\t\tsize -=sz;\n\t\t\t++args->index;\n\t\t}\n\t\tbreak;\n\t}\n\tsz = buffer - (data + SIZEOF_LENGTH);\n\treturn fill_size(data, sz);\n}\n\nint\nsproto_encode(const struct sproto_type *st, void * buffer, int size, sproto_callback cb, void *ud) {\n\tstruct sproto_arg args;\n\tuint8_t * header = buffer;\n\tuint8_t * data;\n\tint header_sz = SIZEOF_HEADER + st->maxn * SIZEOF_FIELD;\n\tint i;\n\tint index;\n\tint lasttag;\n\tint datasz;\n\tif (size < header_sz)\n\t\treturn -1;\n\targs.ud = ud;\n\tdata = header + header_sz;\n\tsize -= header_sz;\n\tindex = 0;\n\tlasttag = -1;\n\tfor (i=0;i<st->n;i++) {\n\t\tstruct field *f = &st->f[i];\n\t\tint type = f->type;\n\t\tint value = 0;\n\t\tint sz = -1;\n\t\targs.tagname = f->name;\n\t\targs.tagid = f->tag;\n\t\targs.subtype = f->st;\n\t\targs.mainindex = f->key;\n\t\targs.extra = f->extra;\n\t\tif (type & SPROTO_TARRAY) {\n\t\t\targs.type = type & ~SPROTO_TARRAY;\n\t\t\tsz = encode_array(cb, &args, data, size);\n\t\t} else {\n\t\t\targs.type = type;\n\t\t\targs.index = 0;\n\t\t\tswitch(type) {\n\t\t\tcase SPROTO_TINTEGER:\n\t\t\tcase SPROTO_TBOOLEAN: {\n\t\t\t\tunion {\n\t\t\t\t\tuint64_t u64;\n\t\t\t\t\tuint32_t u32;\n\t\t\t\t} u;\n\t\t\t\targs.value = &u;\n\t\t\t\targs.length = sizeof(u);\n\t\t\t\tsz = cb(&args);\n\t\t\t\tif (sz < 0) {\n\t\t\t\t\tif (sz == SPROTO_CB_NIL)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (sz == SPROTO_CB_NOARRAY)\t// no array, don't encode it\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\treturn -1;\t// sz == SPROTO_CB_ERROR\n\t\t\t\t}\n\t\t\t\tif (sz == sizeof(uint32_t)) {\n\t\t\t\t\tif (u.u32 < 0x7fff) {\n\t\t\t\t\t\tvalue = (u.u32+1) * 2;\n\t\t\t\t\t\tsz = 2; // sz can be any number > 0\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsz = encode_integer(u.u32, data, size);\n\t\t\t\t\t}\n\t\t\t\t} else if (sz == sizeof(uint64_t)) {\n\t\t\t\t\tsz= encode_uint64(u.u64, data, size);\n\t\t\t\t} else {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SPROTO_TSTRUCT:\n\t\t\tcase SPROTO_TSTRING:\n\t\t\t\tsz = encode_object(cb, &args, data, size);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (sz < 0)\n\t\t\treturn -1;\n\t\tif (sz > 0) {\n\t\t\tuint8_t * record;\n\t\t\tint tag;\n\t\t\tif (value == 0) {\n\t\t\t\tdata += sz;\n\t\t\t\tsize -= sz;\n\t\t\t}\n\t\t\trecord = header+SIZEOF_HEADER+SIZEOF_FIELD*index;\n\t\t\ttag = f->tag - lasttag - 1;\n\t\t\tif (tag > 0) {\n\t\t\t\t// skip tag\n\t\t\t\ttag = (tag - 1) * 2 + 1;\n\t\t\t\tif (tag > 0xffff)\n\t\t\t\t\treturn -1;\n\t\t\t\trecord[0] = tag & 0xff;\n\t\t\t\trecord[1] = (tag >> 8) & 0xff;\n\t\t\t\t++index;\n\t\t\t\trecord += SIZEOF_FIELD;\n\t\t\t}\n\t\t\t++index;\n\t\t\trecord[0] = value & 0xff;\n\t\t\trecord[1] = (value >> 8) & 0xff;\n\t\t\tlasttag = f->tag;\n\t\t}\n\t}\n\theader[0] = index & 0xff;\n\theader[1] = (index >> 8) & 0xff;\n\n\tdatasz = data - (header + header_sz);\n\tdata = header + header_sz;\n\tif (index != st->maxn) {\n\t\tmemmove(header + SIZEOF_HEADER + index * SIZEOF_FIELD, data, datasz);\n\t}\n\treturn SIZEOF_HEADER + index * SIZEOF_FIELD + datasz;\n}\n\nstatic int\ndecode_array_object(sproto_callback cb, struct sproto_arg *args, uint8_t * stream, int sz) {\n\tuint32_t hsz;\n\tint index = 1;\n\twhile (sz > 0) {\n\t\tif (sz < SIZEOF_LENGTH)\n\t\t\treturn -1;\n\t\thsz = todword(stream);\n\t\tstream += SIZEOF_LENGTH;\n\t\tsz -= SIZEOF_LENGTH;\n\t\tif (hsz > sz)\n\t\t\treturn -1;\n\t\targs->index = index;\n\t\targs->value = stream;\n\t\targs->length = hsz;\n\t\tif (cb(args))\n\t\t\treturn -1;\n\t\tsz -= hsz;\n\t\tstream += hsz;\n\t\t++index;\n\t}\n\treturn 0;\n}\n\nstatic inline uint64_t\nexpand64(uint32_t v) {\n\tuint64_t value = v;\n\tif (value & 0x80000000) {\n\t\tvalue |= (uint64_t)~0  << 32 ;\n\t}\n\treturn value;\n}\n\nstatic int\ndecode_array(sproto_callback cb, struct sproto_arg *args, uint8_t * stream) {\n\tuint32_t sz = todword(stream);\n\tint type = args->type;\n\tint i;\n\tif (sz == 0) {\n\t\t// It's empty array, call cb with index == -1 to create the empty array.\n\t\targs->index = -1;\n\t\targs->value = NULL;\n\t\targs->length = 0;\n\t\tcb(args);\n\t\treturn 0;\n\t}\t\n\tstream += SIZEOF_LENGTH;\n\tswitch (type) {\n\tcase SPROTO_TINTEGER: {\n\t\tint len = *stream;\n\t\t++stream;\n\t\t--sz;\n\t\tif (len == sizeof(uint32_t)) {\n\t\t\tif (sz % sizeof(uint32_t) != 0)\n\t\t\t\treturn -1;\n\t\t\tfor (i=0;i<sz/sizeof(uint32_t);i++) {\n\t\t\t\tuint64_t value = expand64(todword(stream + i*sizeof(uint32_t)));\n\t\t\t\targs->index = i+1;\n\t\t\t\targs->value = &value;\n\t\t\t\targs->length = sizeof(value);\n\t\t\t\tcb(args);\n\t\t\t}\n\t\t} else if (len == sizeof(uint64_t)) {\n\t\t\tif (sz % sizeof(uint64_t) != 0)\n\t\t\t\treturn -1;\n\t\t\tfor (i=0;i<sz/sizeof(uint64_t);i++) {\n\t\t\t\tuint64_t low = todword(stream + i*sizeof(uint64_t));\n\t\t\t\tuint64_t hi = todword(stream + i*sizeof(uint64_t) + sizeof(uint32_t));\n\t\t\t\tuint64_t value = low | hi << 32;\n\t\t\t\targs->index = i+1;\n\t\t\t\targs->value = &value;\n\t\t\t\targs->length = sizeof(value);\n\t\t\t\tcb(args);\n\t\t\t}\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t\tbreak;\n\t}\n\tcase SPROTO_TBOOLEAN:\n\t\tfor (i=0;i<sz;i++) {\n\t\t\tuint64_t value = stream[i];\n\t\t\targs->index = i+1;\n\t\t\targs->value = &value;\n\t\t\targs->length = sizeof(value);\n\t\t\tcb(args);\n\t\t}\n\t\tbreak;\n\tcase SPROTO_TSTRING:\n\tcase SPROTO_TSTRUCT:\n\t\treturn decode_array_object(cb, args, stream, sz);\n\tdefault:\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\nint\nsproto_decode(const struct sproto_type *st, const void * data, int size, sproto_callback cb, void *ud) {\n\tstruct sproto_arg args;\n\tint total = size;\n\tuint8_t * stream;\n\tuint8_t * datastream;\n\tint fn;\n\tint i;\n\tint tag;\n\tif (size < SIZEOF_HEADER)\n\t\treturn -1;\n\t// debug print\n\t// printf(\"sproto_decode[%p] (%s)\\n\", ud, st->name);\n\tstream = (void *)data;\n\tfn = toword(stream);\n\tstream += SIZEOF_HEADER;\n\tsize -= SIZEOF_HEADER ;\n\tif (size < fn * SIZEOF_FIELD)\n\t\treturn -1;\n\tdatastream = stream + fn * SIZEOF_FIELD;\n\tsize -= fn * SIZEOF_FIELD;\n\targs.ud = ud;\n\n\ttag = -1;\n\tfor (i=0;i<fn;i++) {\n\t\tuint8_t * currentdata;\n\t\tstruct field * f;\n\t\tint value = toword(stream + i * SIZEOF_FIELD);\n\t\t++ tag;\n\t\tif (value & 1) {\n\t\t\ttag += value/2;\n\t\t\tcontinue;\n\t\t}\n\t\tvalue = value/2 - 1;\n\t\tcurrentdata = datastream;\n\t\tif (value < 0) {\n\t\t\tuint32_t sz;\n\t\t\tif (size < SIZEOF_LENGTH)\n\t\t\t\treturn -1;\n\t\t\tsz = todword(datastream);\n\t\t\tif (size < sz + SIZEOF_LENGTH)\n\t\t\t\treturn -1;\n\t\t\tdatastream += sz+SIZEOF_LENGTH;\n\t\t\tsize -= sz+SIZEOF_LENGTH;\n\t\t}\n\t\tf = findtag(st, tag);\n\t\tif (f == NULL)\n\t\t\tcontinue;\n\t\targs.tagname = f->name;\n\t\targs.tagid = f->tag;\n\t\targs.type = f->type & ~SPROTO_TARRAY;\n\t\targs.subtype = f->st;\n\t\targs.index = 0;\n\t\targs.mainindex = f->key;\n\t\targs.extra = f->extra;\n\t\tif (value < 0) {\n\t\t\tif (f->type & SPROTO_TARRAY) {\n\t\t\t\tif (decode_array(cb, &args, currentdata)) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tswitch (f->type) {\n\t\t\t\tcase SPROTO_TINTEGER: {\n\t\t\t\t\tuint32_t sz = todword(currentdata);\n\t\t\t\t\tif (sz == sizeof(uint32_t)) {\n\t\t\t\t\t\tuint64_t v = expand64(todword(currentdata + SIZEOF_LENGTH));\n\t\t\t\t\t\targs.value = &v;\n\t\t\t\t\t\targs.length = sizeof(v);\n\t\t\t\t\t\tcb(&args);\n\t\t\t\t\t} else if (sz != sizeof(uint64_t)) {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tuint32_t low = todword(currentdata + SIZEOF_LENGTH);\n\t\t\t\t\t\tuint32_t hi = todword(currentdata + SIZEOF_LENGTH + sizeof(uint32_t));\n\t\t\t\t\t\tuint64_t v = (uint64_t)low | (uint64_t) hi << 32;\n\t\t\t\t\t\targs.value = &v;\n\t\t\t\t\t\targs.length = sizeof(v);\n\t\t\t\t\t\tcb(&args);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SPROTO_TSTRING:\n\t\t\t\tcase SPROTO_TSTRUCT: {\n\t\t\t\t\tuint32_t sz = todword(currentdata);\n\t\t\t\t\targs.value = currentdata+SIZEOF_LENGTH;\n\t\t\t\t\targs.length = sz;\n\t\t\t\t\tif (cb(&args))\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (f->type != SPROTO_TINTEGER && f->type != SPROTO_TBOOLEAN) {\n\t\t\treturn -1;\n\t\t} else {\n\t\t\tuint64_t v = value;\n\t\t\targs.value = &v;\n\t\t\targs.length = sizeof(v);\n\t\t\tcb(&args);\n\t\t}\n\t}\n\treturn total - size;\n}\n\n// 0 pack\n\nstatic int\npack_seg(const uint8_t *src, uint8_t * buffer, int sz, int n) {\n\tuint8_t header = 0;\n\tint notzero = 0;\n\tint i;\n\tuint8_t * obuffer = buffer;\n\t++buffer;\n\t--sz;\n\tif (sz < 0)\n\t\tobuffer = NULL;\n\n\tfor (i=0;i<8;i++) {\n\t\tif (src[i] != 0) {\n\t\t\tnotzero++;\n\t\t\theader |= 1<<i;\n\t\t\tif (sz > 0) {\n\t\t\t\t*buffer = src[i];\n\t\t\t\t++buffer;\n\t\t\t\t--sz;\n\t\t\t}\n\t\t}\n\t}\n\tif ((notzero == 7 || notzero == 6) && n > 0) {\n\t\tnotzero = 8;\n\t}\n\tif (notzero == 8) {\n\t\tif (n > 0) {\n\t\t\treturn 8;\n\t\t} else {\n\t\t\treturn 10;\n\t\t}\n\t}\n\tif (obuffer) {\n\t\t*obuffer = header;\n\t}\n\treturn notzero + 1;\n}\n\nstatic inline void\nwrite_ff(const uint8_t * src, uint8_t * des, int n) {\n\tint i;\n\tint align8_n = (n+7)&(~7);\n\n\tdes[0] = 0xff;\n\tdes[1] = align8_n/8 - 1;\n\tmemcpy(des+2, src, n);\n\tfor(i=0; i< align8_n-n; i++){\n\t\tdes[n+2+i] = 0;\n\t}\n}\n\nint\nsproto_pack(const void * srcv, int srcsz, void * bufferv, int bufsz) {\n\tuint8_t tmp[8];\n\tint i;\n\tconst uint8_t * ff_srcstart = NULL;\n\tuint8_t * ff_desstart = NULL;\n\tint ff_n = 0;\n\tint size = 0;\n\tconst uint8_t * src = srcv;\n\tuint8_t * buffer = bufferv;\n\tfor (i=0;i<srcsz;i+=8) {\n\t\tint n;\n\t\tint padding = i+8 - srcsz;\n\t\tif (padding > 0) {\n\t\t\tint j;\n\t\t\tmemcpy(tmp, src, 8-padding);\n\t\t\tfor (j=0;j<padding;j++) {\n\t\t\t\ttmp[7-j] = 0;\n\t\t\t}\n\t\t\tsrc = tmp;\n\t\t}\n\t\tn = pack_seg(src, buffer, bufsz, ff_n);\n\t\tbufsz -= n;\n\t\tif (n == 10) {\n\t\t\t// first FF\n\t\t\tff_srcstart = src;\n\t\t\tff_desstart = buffer;\n\t\t\tff_n = 1;\n\t\t} else if (n==8 && ff_n>0) {\n\t\t\t++ff_n;\n\t\t\tif (ff_n == 256) {\n\t\t\t\tif (bufsz >= 0) {\n\t\t\t\t\twrite_ff(ff_srcstart, ff_desstart, 256*8);\n\t\t\t\t}\n\t\t\t\tff_n = 0;\n\t\t\t}\n\t\t} else {\n\t\t\tif (ff_n > 0) {\n\t\t\t\tif (bufsz >= 0) {\n\t\t\t\t\twrite_ff(ff_srcstart, ff_desstart, ff_n*8);\n\t\t\t\t}\n\t\t\t\tff_n = 0;\n\t\t\t}\n\t\t}\n\t\tsrc += 8;\n\t\tbuffer += n;\n\t\tsize += n;\n\t}\n\tif(bufsz >= 0){\n\t\tif(ff_n == 1)\n\t\t\twrite_ff(ff_srcstart, ff_desstart, 8);\n\t\telse if (ff_n > 1)\n\t\t\twrite_ff(ff_srcstart, ff_desstart, srcsz - (intptr_t)(ff_srcstart - (const uint8_t*)srcv));\n\t}\n\treturn size;\n}\n\nint\nsproto_unpack(const void * srcv, int srcsz, void * bufferv, int bufsz) {\n\tconst uint8_t * src = srcv;\n\tuint8_t * buffer = bufferv;\n\tint size = 0;\n\twhile (srcsz > 0) {\n\t\tuint8_t header = src[0];\n\t\t--srcsz;\n\t\t++src;\n\t\tif (header == 0xff) {\n\t\t\tint n;\n\t\t\tif (srcsz < 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tn = (src[0] + 1) * 8;\n\t\t\tif (srcsz < n + 1)\n\t\t\t\treturn -1;\n\t\t\tsrcsz -= n + 1;\n\t\t\t++src;\n\t\t\tif (bufsz >= n) {\n\t\t\t\tmemcpy(buffer, src, n);\n\t\t\t}\n\t\t\tbufsz -= n;\n\t\t\tbuffer += n;\n\t\t\tsrc += n;\n\t\t\tsize += n;\n\t\t} else {\n\t\t\tint i;\n\t\t\tfor (i=0;i<8;i++) {\n\t\t\t\tint nz = (header >> i) & 1;\n\t\t\t\tif (nz) {\n\t\t\t\t\tif (srcsz < 0)\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\tif (bufsz > 0) {\n\t\t\t\t\t\t*buffer = *src;\n\t\t\t\t\t\t--bufsz;\n\t\t\t\t\t\t++buffer;\n\t\t\t\t\t}\n\t\t\t\t\t++src;\n\t\t\t\t\t--srcsz;\n\t\t\t\t} else {\n\t\t\t\t\tif (bufsz > 0) {\n\t\t\t\t\t\t*buffer = 0;\n\t\t\t\t\t\t--bufsz;\n\t\t\t\t\t\t++buffer;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t++size;\n\t\t\t}\n\t\t}\n\t}\n\treturn size;\n}\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.c.meta",
    "content": "fileFormatVersion: 2\nguid: f9be0a941ac952540a994fe1c4561001\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.h",
    "content": "#ifndef sproto_h\n#define sproto_h\n\n#include <stddef.h>\n\nstruct sproto;\nstruct sproto_type;\n\n#define SPROTO_REQUEST 0\n#define SPROTO_RESPONSE 1\n\n// type (sproto_arg.type)\n#define SPROTO_TINTEGER 0\n#define SPROTO_TBOOLEAN 1\n#define SPROTO_TSTRING 2\n#define SPROTO_TSTRUCT 3\n\n// sub type of string (sproto_arg.extra)\n#define SPROTO_TSTRING_STRING 0\n#define SPROTO_TSTRING_BINARY 1\n\n#define SPROTO_CB_ERROR -1\n#define SPROTO_CB_NIL -2\n#define SPROTO_CB_NOARRAY -3\n\nstruct sproto * sproto_create(const void * proto, size_t sz);\nvoid sproto_release(struct sproto *);\n\nint sproto_prototag(const struct sproto *, const char * name);\nconst char * sproto_protoname(const struct sproto *, int proto);\n// SPROTO_REQUEST(0) : request, SPROTO_RESPONSE(1): response\nstruct sproto_type * sproto_protoquery(const struct sproto *, int proto, int what);\nint sproto_protoresponse(const struct sproto *, int proto);\n\nstruct sproto_type * sproto_type(const struct sproto *, const char * type_name);\n\nint sproto_pack(const void * src, int srcsz, void * buffer, int bufsz);\nint sproto_unpack(const void * src, int srcsz, void * buffer, int bufsz);\n\nstruct sproto_arg {\n\tvoid *ud;\n\tconst char *tagname;\n\tint tagid;\n\tint type;\n\tstruct sproto_type *subtype;\n\tvoid *value;\n\tint length;\n\tint index;\t// array base 1\n\tint mainindex;\t// for map\n\tint extra; // SPROTO_TINTEGER: decimal ; SPROTO_TSTRING 0:utf8 string 1:binary\n};\n\ntypedef int (*sproto_callback)(const struct sproto_arg *args);\n\nint sproto_decode(const struct sproto_type *, const void * data, int size, sproto_callback cb, void *ud);\nint sproto_encode(const struct sproto_type *, void * buffer, int size, sproto_callback cb, void *ud);\n\n// for debug use\nvoid sproto_dump(struct sproto *);\nconst char * sproto_name(struct sproto_type *);\n\n#endif\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.h.meta",
    "content": "fileFormatVersion: 2\nguid: f6d6ff16b7056e34abe86ede4d3e7692\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.lua",
    "content": "local core = require \"sproto.core\"\nlocal assert = assert\n\nlocal sproto = {}\nlocal host = {}\n\nlocal weak_mt = { __mode = \"kv\" }\nlocal sproto_mt = { __index = sproto }\nlocal sproto_nogc = { __index = sproto }\nlocal host_mt = { __index = host }\n\nfunction sproto_mt:__gc()\n\tcore.deleteproto(self.__cobj)\nend\n\nfunction sproto.new(bin)\n\tlocal cobj = assert(core.newproto(bin))\n\tlocal self = {\n\t\t__cobj = cobj,\n\t\t__tcache = setmetatable( {} , weak_mt ),\n\t\t__pcache = setmetatable( {} , weak_mt ),\n\t}\n\treturn setmetatable(self, sproto_mt)\nend\n\nfunction sproto.sharenew(cobj)\n\tlocal self = {\n\t\t__cobj = cobj,\n\t\t__tcache = setmetatable( {} , weak_mt ),\n\t\t__pcache = setmetatable( {} , weak_mt ),\n\t}\n\treturn setmetatable(self, sproto_nogc)\nend\n\nfunction sproto.parse(ptext)\n\tlocal parser = require \"sprotoparser\"\n\tlocal pbin = parser.parse(ptext)\n\treturn sproto.new(pbin)\nend\n\nfunction sproto:host( packagename )\n\tpackagename = packagename or  \"package\"\n\tlocal obj = {\n\t\t__proto = self,\n\t\t__package = assert(core.querytype(self.__cobj, packagename), \"type package not found\"),\n\t\t__session = {},\n\t}\n\treturn setmetatable(obj, host_mt)\nend\n\nlocal function querytype(self, typename)\n\tlocal v = self.__tcache[typename]\n\tif not v then\n\t\tv = assert(core.querytype(self.__cobj, typename), \"type not found\")\n\t\tself.__tcache[typename] = v\n\tend\n\n\treturn v\nend\n\nfunction sproto:exist_type(typename)\n\tlocal v = self.__tcache[typename]\n\tif not v then\n\t\treturn core.querytype(self.__cobj, typename) ~= nil\n\telse\n\t\treturn true\n\tend\nend\n\nfunction sproto:encode(typename, tbl)\n\tlocal st = querytype(self, typename)\n\treturn core.encode(st, tbl)\nend\n\nfunction sproto:decode(typename, ...)\n\tlocal st = querytype(self, typename)\n\treturn core.decode(st, ...)\nend\n\nfunction sproto:pencode(typename, tbl)\n\tlocal st = querytype(self, typename)\n\treturn core.pack(core.encode(st, tbl))\nend\n\nfunction sproto:pdecode(typename, ...)\n\tlocal st = querytype(self, typename)\n\treturn core.decode(st, core.unpack(...))\nend\n\nlocal function queryproto(self, pname)\n\tlocal v = self.__pcache[pname]\n\tif not v then\n\t\tlocal tag, req, resp = core.protocol(self.__cobj, pname)\n\t\tassert(tag, pname .. \" not found\")\n\t\tif tonumber(pname) then\n\t\t\tpname, tag = tag, pname\n\t\tend\n\t\tv = {\n\t\t\trequest = req,\n\t\t\tresponse =resp,\n\t\t\tname = pname,\n\t\t\ttag = tag,\n\t\t}\n\t\tself.__pcache[pname] = v\n\t\tself.__pcache[tag]  = v\n\tend\n\n\treturn v\nend\n\nfunction sproto:exist_proto(pname)\n\tlocal v = self.__pcache[pname]\n\tif not v then\n\t\treturn core.protocol(self.__cobj, pname) ~= nil\n\telse\n\t\treturn true\n\tend\nend\n\nfunction sproto:request_encode(protoname, tbl)\n\tlocal p = queryproto(self, protoname)\n\tlocal request = p.request\n\tif request then\n\t\treturn core.encode(request,tbl) , p.tag\n\telse\n\t\treturn \"\" , p.tag\n\tend\nend\n\nfunction sproto:response_encode(protoname, tbl)\n\tlocal p = queryproto(self, protoname)\n\tlocal response = p.response\n\tif response then\n\t\treturn core.encode(response,tbl)\n\telse\n\t\treturn \"\"\n\tend\nend\n\nfunction sproto:request_decode(protoname, ...)\n\tlocal p = queryproto(self, protoname)\n\tlocal request = p.request\n\tif request then\n\t\treturn core.decode(request,...) , p.name\n\telse\n\t\treturn nil, p.name\n\tend\nend\n\nfunction sproto:response_decode(protoname, ...)\n\tlocal p = queryproto(self, protoname)\n\tlocal response = p.response\n\tif response then\n\t\treturn core.decode(response,...)\n\tend\nend\n\nsproto.pack = core.pack\nsproto.unpack = core.unpack\n\nfunction sproto:default(typename, type)\n\tif type == nil then\n\t\treturn core.default(querytype(self, typename))\n\telse\n\t\tlocal p = queryproto(self, typename)\n\t\tif type == \"REQUEST\" then\n\t\t\tif p.request then\n\t\t\t\treturn core.default(p.request)\n\t\t\tend\n\t\telseif type == \"RESPONSE\" then\n\t\t\tif p.response then\n\t\t\t\treturn core.default(p.response)\n\t\t\tend\n\t\telse\n\t\t\terror \"Invalid type\"\n\t\tend\n\tend\nend\n\nlocal header_tmp = {}\n\nlocal function gen_response(self, response, session)\n\treturn function(args, ud)\n\t\theader_tmp.type = nil\n\t\theader_tmp.session = session\n\t\theader_tmp.ud = ud\n\t\tlocal header = core.encode(self.__package, header_tmp)\n\t\tif response then\n\t\t\tlocal content = core.encode(response, args)\n\t\t\treturn core.pack(header .. content)\n\t\telse\n\t\t\treturn core.pack(header)\n\t\tend\n\tend\nend\n\nfunction host:dispatch(...)\n\tlocal bin = core.unpack(...)\n\theader_tmp.type = nil\n\theader_tmp.session = nil\n\theader_tmp.ud = nil\n\tlocal header, size = core.decode(self.__package, bin, header_tmp)\n\tlocal content = bin:sub(size + 1)\n\tif header.type then\n\t\t-- request\n\t\tlocal proto = queryproto(self.__proto, header.type)\n\t\tlocal result\n\t\tif proto.request then\n\t\t\tresult = core.decode(proto.request, content)\n\t\tend\n\t\tif header_tmp.session then\n\t\t\treturn \"REQUEST\", proto.name, result, gen_response(self, proto.response, header_tmp.session), header.ud\n\t\telse\n\t\t\treturn \"REQUEST\", proto.name, result, nil, header.ud\n\t\tend\n\telse\n\t\t-- response\n\t\tlocal session = assert(header_tmp.session, \"session not found\")\n\t\tlocal response = assert(self.__session[session], \"Unknown session\")\n\t\tself.__session[session] = nil\n\t\tif response == true then\n\t\t\treturn \"RESPONSE\", session, nil, header.ud\n\t\telse\n\t\t\tlocal result = core.decode(response, content)\n\t\t\treturn \"RESPONSE\", session, result, header.ud\n\t\tend\n\tend\nend\n\nfunction host:attach(sp)\n\treturn function(name, args, session, ud)\n\t\tlocal proto = queryproto(sp, name)\n\t\theader_tmp.type = proto.tag\n\t\theader_tmp.session = session\n\t\theader_tmp.ud = ud\n\t\tlocal header = core.encode(self.__package, header_tmp)\n\n\t\tif session then\n\t\t\tself.__session[session] = proto.response or true\n\t\tend\n\n\t\tif proto.request then\n\t\t\tlocal content = core.encode(proto.request, args)\n\t\t\treturn core.pack(header ..  content)\n\t\telse\n\t\t\treturn core.pack(header)\n\t\tend\n\tend\nend\n\nreturn sproto\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.lua.meta",
    "content": "fileFormatVersion: 2\nguid: c305eb9af5293a54d9e5159527184f35\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.new.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXFileReference section */\n\t\t44C04F89228C0E000073049F /* lsproto.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lsproto.c; sourceTree = \"<group>\"; };\n\t\t44C04F8A228C0E010073049F /* sproto.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sproto.c; sourceTree = \"<group>\"; };\n\t\t44C04F8B228C0E010073049F /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = \"<group>\"; };\n\t\t44C04F8C228C0E010073049F /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = \"<group>\"; };\n\t\t44C04F8D228C0E010073049F /* testrpc.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = testrpc.lua; sourceTree = \"<group>\"; };\n\t\t44C04F8E228C0E010073049F /* sprotoparser.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = sprotoparser.lua; sourceTree = \"<group>\"; };\n\t\t44C04F8F228C0E010073049F /* sproto.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = sproto.lua; sourceTree = \"<group>\"; };\n\t\t44C04F90228C0E010073049F /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = \"<group>\"; };\n\t\t44C04F91228C0E010073049F /* test.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = test.lua; sourceTree = \"<group>\"; };\n\t\t44C04F92228C0E010073049F /* msvcint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = msvcint.h; sourceTree = \"<group>\"; };\n\t\t44C04F93228C0E010073049F /* sproto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sproto.h; sourceTree = \"<group>\"; };\n\t\t44C04F94228C0E010073049F /* testall.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = testall.lua; sourceTree = \"<group>\"; };\n\t\t44C04F95228C0E010073049F /* print_r.lua */ = {isa = PBXFileReference; lastKnownFileType = text; path = print_r.lua; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXGroup section */\n\t\t44C04F83228C0E000073049F = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t44C04F89228C0E000073049F /* lsproto.c */,\n\t\t\t\t44C04F8A228C0E010073049F /* sproto.c */,\n\t\t\t\t44C04F8B228C0E010073049F /* LICENSE */,\n\t\t\t\t44C04F8C228C0E010073049F /* Makefile */,\n\t\t\t\t44C04F8D228C0E010073049F /* testrpc.lua */,\n\t\t\t\t44C04F8E228C0E010073049F /* sprotoparser.lua */,\n\t\t\t\t44C04F8F228C0E010073049F /* sproto.lua */,\n\t\t\t\t44C04F90228C0E010073049F /* README.md */,\n\t\t\t\t44C04F91228C0E010073049F /* test.lua */,\n\t\t\t\t44C04F92228C0E010073049F /* msvcint.h */,\n\t\t\t\t44C04F93228C0E010073049F /* sproto.h */,\n\t\t\t\t44C04F94228C0E010073049F /* testall.lua */,\n\t\t\t\t44C04F95228C0E010073049F /* print_r.lua */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXLegacyTarget section */\n\t\t44C04F88228C0E000073049F /* sproto.new */ = {\n\t\t\tisa = PBXLegacyTarget;\n\t\t\tbuildArgumentsString = \"$(ACTION)\";\n\t\t\tbuildConfigurationList = 44C04F96228C0E010073049F /* Build configuration list for PBXLegacyTarget \"sproto.new\" */;\n\t\t\tbuildPhases = (\n\t\t\t);\n\t\t\tbuildToolPath = /usr/bin/make;\n\t\t\tbuildWorkingDirectory = /Users/averson/Averson/Unity/UnitySourceCode/jarjin_tolua_rumtime/sproto.new;\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = sproto.new;\n\t\t\tpassBuildSettingsInEnvironment = 1;\n\t\t\tproductName = sproto.new;\n\t\t};\n/* End PBXLegacyTarget section */\n\n/* Begin PBXProject section */\n\t\t44C04F84228C0E000073049F /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t};\n\t\t\tbuildConfigurationList = 44C04F87228C0E000073049F /* Build configuration list for PBXProject \"sproto.new\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 44C04F83228C0E000073049F;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t44C04F88228C0E000073049F /* sproto.new */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin XCBuildConfiguration section */\n\t\t44C04F85228C0E000073049F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tARCHS = \"$(ARCHS_STANDARD_32_BIT)\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = macosx10.6;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t44C04F86228C0E000073049F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tARCHS = \"$(ARCHS_STANDARD_32_BIT)\";\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tSDKROOT = macosx10.6;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t44C04F97228C0E010073049F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUGGING_SYMBOLS = YES;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_ENABLE_FIX_AND_CONTINUE = YES;\n\t\t\t\tGCC_GENERATE_DEBUGGING_SYMBOLS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tOTHER_CFLAGS = \"\";\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tPRODUCT_NAME = sproto.new;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t44C04F98228C0E010073049F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tGCC_ENABLE_FIX_AND_CONTINUE = NO;\n\t\t\t\tOTHER_CFLAGS = \"\";\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tPRODUCT_NAME = sproto.new;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t44C04F87228C0E000073049F /* Build configuration list for PBXProject \"sproto.new\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t44C04F85228C0E000073049F /* Debug */,\n\t\t\t\t44C04F86228C0E000073049F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t44C04F96228C0E010073049F /* Build configuration list for PBXLegacyTarget \"sproto.new\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t44C04F97228C0E010073049F /* Debug */,\n\t\t\t\t44C04F98228C0E010073049F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 44C04F84228C0E000073049F /* Project object */;\n}\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.new.xcodeproj/project.pbxproj.meta",
    "content": "fileFormatVersion: 2\nguid: c51513cc997bc6c46baf4f36e2a99423\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sproto.new.xcodeproj.meta",
    "content": "fileFormatVersion: 2\nguid: b0a3f0970b9952e4897f249798035d7e\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sprotoparser.lua",
    "content": "local lpeg = require \"lpeg\"\nlocal table = require \"table\"\n\nlocal packbytes\nlocal packvalue\n\nif _VERSION == \"Lua 5.3\" then\n\tfunction packbytes(str)\n\t\treturn string.pack(\"<s4\",str)\n\tend\n\n\tfunction packvalue(id)\n\t\tid = (id + 1) * 2\n\t\treturn string.pack(\"<I2\",id)\n\tend\nelse\n\tfunction packbytes(str)\n\t\tlocal size = #str\n\t\tlocal a = size % 256\n\t\tsize = math.floor(size / 256)\n\t\tlocal b = size % 256\n\t\tsize = math.floor(size / 256)\n\t\tlocal c = size % 256\n\t\tsize = math.floor(size / 256)\n\t\tlocal d = size\n\t\treturn string.char(a)..string.char(b)..string.char(c)..string.char(d) .. str\n\tend\n\n\tfunction packvalue(id)\n\t\tid = (id + 1) * 2\n\t\tassert(id >=0 and id < 65536)\n\t\tlocal a = id % 256\n\t\tlocal b = math.floor(id / 256)\n\t\treturn string.char(a) .. string.char(b)\n\tend\nend\n\nlocal P = lpeg.P\nlocal S = lpeg.S\nlocal R = lpeg.R\nlocal C = lpeg.C\nlocal Ct = lpeg.Ct\nlocal Cg = lpeg.Cg\nlocal Cc = lpeg.Cc\nlocal V = lpeg.V\n\nlocal function count_lines(_,pos, parser_state)\n\tif parser_state.pos < pos then\n\t\tparser_state.line = parser_state.line + 1\n\t\tparser_state.pos = pos\n\tend\n\treturn pos\nend\n\nlocal exception = lpeg.Cmt( lpeg.Carg(1) , function ( _ , pos, parser_state)\n\terror(string.format(\"syntax error at [%s] line (%d)\", parser_state.file or \"\", parser_state.line))\n\treturn pos\nend)\n\nlocal eof = P(-1)\nlocal newline = lpeg.Cmt((P\"\\n\" + \"\\r\\n\") * lpeg.Carg(1) ,count_lines)\nlocal line_comment = \"#\" * (1 - newline) ^0 * (newline + eof)\nlocal blank = S\" \\t\" + newline + line_comment\nlocal blank0 = blank ^ 0\nlocal blanks = blank ^ 1\nlocal alpha = R\"az\" + R\"AZ\" + \"_\"\nlocal alnum = alpha + R\"09\"\nlocal word = alpha * alnum ^ 0\nlocal name = C(word)\nlocal typename = C(word * (\".\" * word) ^ 0)\nlocal tag = R\"09\" ^ 1 / tonumber\nlocal mainkey = \"(\" * blank0 * name * blank0 * \")\"\nlocal decimal = \"(\" * blank0 * C(tag) * blank0 * \")\"\n\nlocal function multipat(pat)\n\treturn Ct(blank0 * (pat * blanks) ^ 0 * pat^0 * blank0)\nend\n\nlocal function namedpat(name, pat)\n\treturn Ct(Cg(Cc(name), \"type\") * Cg(pat))\nend\n\nlocal typedef = P {\n\t\"ALL\",\n\tFIELD = namedpat(\"field\", (name * blanks * tag * blank0 * \":\" * blank0 * (C\"*\")^-1 * typename * (mainkey +  decimal)^0)),\n\tSTRUCT = P\"{\" * multipat(V\"FIELD\" + V\"TYPE\") * P\"}\",\n\tTYPE = namedpat(\"type\", P\".\" * name * blank0 * V\"STRUCT\" ),\n\tSUBPROTO = Ct((C\"request\" + C\"response\") * blanks * (typename + V\"STRUCT\")),\n\tPROTOCOL = namedpat(\"protocol\", name * blanks * tag * blank0 * P\"{\" * multipat(V\"SUBPROTO\") * P\"}\"),\n\tALL = multipat(V\"TYPE\" + V\"PROTOCOL\"),\n}\n\nlocal proto = blank0 * typedef * blank0\n\nlocal convert = {}\n\nfunction convert.protocol(all, obj)\n\tlocal result = { tag = obj[2] }\n\tfor _, p in ipairs(obj[3]) do\n\t\tassert(result[p[1]] == nil)\n\t\tlocal typename = p[2]\n\t\tif type(typename) == \"table\" then\n\t\t\tlocal struct = typename\n\t\t\ttypename = obj[1] .. \".\" .. p[1]\n\t\t\tall.type[typename] = convert.type(all, { typename, struct })\n\t\tend\n\t\tif typename == \"nil\" then\n\t\t\tif p[1] == \"response\" then\n\t\t\t\tresult.confirm = true\n\t\t\tend\n\t\telse\n\t\t\tresult[p[1]] = typename\n\t\tend\n\tend\n\treturn result\nend\n\nfunction convert.type(all, obj)\n\tlocal result = {}\n\tlocal typename = obj[1]\n\tlocal tags = {}\n\tlocal names = {}\n\tfor _, f in ipairs(obj[2]) do\n\t\tif f.type == \"field\" then\n\t\t\tlocal name = f[1]\n\t\t\tif names[name] then\n\t\t\t\terror(string.format(\"redefine %s in type %s\", name, typename))\n\t\t\tend\n\t\t\tnames[name] = true\n\t\t\tlocal tag = f[2]\n\t\t\tif tags[tag] then\n\t\t\t\terror(string.format(\"redefine tag %d in type %s\", tag, typename))\n\t\t\tend\n\t\t\ttags[tag] = true\n\t\t\tlocal field = { name = name, tag = tag }\n\t\t\ttable.insert(result, field)\n\t\t\tlocal fieldtype = f[3]\n\t\t\tif fieldtype == \"*\" then\n\t\t\t\tfield.array = true\n\t\t\t\tfieldtype = f[4]\n\t\t\tend\n\t\t\tlocal mainkey = f[5]\n\t\t\tif mainkey then\n\t\t\t\tif fieldtype == \"integer\" then\n\t\t\t\t\tfield.decimal = mainkey\n\t\t\t\telse\n\t\t\t\t\tassert(field.array)\n\t\t\t\t\tfield.key = mainkey\n\t\t\t\tend\n\t\t\tend\n\t\t\tfield.typename = fieldtype\n\t\telse\n\t\t\tassert(f.type == \"type\")\t-- nest type\n\t\t\tlocal nesttypename = typename .. \".\" .. f[1]\n\t\t\tf[1] = nesttypename\n\t\t\tassert(all.type[nesttypename] == nil, \"redefined \" .. nesttypename)\n\t\t\tall.type[nesttypename] = convert.type(all, f)\n\t\tend\n\tend\n\ttable.sort(result, function(a,b) return a.tag < b.tag end)\n\treturn result\nend\n\nlocal function adjust(r)\n\tlocal result = { type = {} , protocol = {} }\n\n\tfor _, obj in ipairs(r) do\n\t\tlocal set = result[obj.type]\n\t\tlocal name = obj[1]\n\t\tassert(set[name] == nil , \"redefined \" .. name)\n\t\tset[name] = convert[obj.type](result,obj)\n\tend\n\n\treturn result\nend\n\nlocal buildin_types = {\n\tinteger = 0,\n\tboolean = 1,\n\tstring = 2,\n\tbinary = 2,\t-- binary is a sub type of string\n}\n\nlocal function checktype(types, ptype, t)\n\tif buildin_types[t] then\n\t\treturn t\n\tend\n\tlocal fullname = ptype .. \".\" .. t\n\tif types[fullname] then\n\t\treturn fullname\n\telse\n\t\tptype = ptype:match \"(.+)%..+$\"\n\t\tif ptype then\n\t\t\treturn checktype(types, ptype, t)\n\t\telseif types[t] then\n\t\t\treturn t\n\t\tend\n\tend\nend\n\nlocal function check_protocol(r)\n\tlocal map = {}\n\tlocal type = r.type\n\tfor name, v in pairs(r.protocol) do\n\t\tlocal tag = v.tag\n\t\tlocal request = v.request\n\t\tlocal response = v.response\n\t\tlocal p = map[tag]\n\n\t\tif p then\n\t\t\terror(string.format(\"redefined protocol tag %d at %s\", tag, name))\n\t\tend\n\n\t\tif request and not type[request] then\n\t\t\terror(string.format(\"Undefined request type %s in protocol %s\", request, name))\n\t\tend\n\n\t\tif response and not type[response] then\n\t\t\terror(string.format(\"Undefined response type %s in protocol %s\", response, name))\n\t\tend\n\n\t\tmap[tag] = v\n\tend\n\treturn r\nend\n\nlocal function flattypename(r)\n\tfor typename, t in pairs(r.type) do\n\t\tfor _, f in pairs(t) do\n\t\t\tlocal ftype = f.typename\n\t\t\tlocal fullname = checktype(r.type, typename, ftype)\n\t\t\tif fullname == nil then\n\t\t\t\terror(string.format(\"Undefined type %s in type %s\", ftype, typename))\n\t\t\tend\n\t\t\tf.typename = fullname\n\t\tend\n\tend\n\n\treturn r\nend\n\nlocal function parser(text,filename)\n\tlocal state = { file = filename, pos = 0, line = 1 }\n\tlocal r = lpeg.match(proto * -1 + exception , text , 1, state )\n\treturn flattypename(check_protocol(adjust(r)))\nend\n\n--[[\n-- The protocol of sproto\n.type {\n\t.field {\n\t\tname 0 : string\n\t\tbuildin\t1 :\tinteger\n\t\ttype 2 : integer\n\t\ttag\t3 :\tinteger\n\t\tarray 4\t: boolean\n\t\tkey 5 : integer # If key exists, array must be true, and it's a map.\n\t}\n\tname 0 : string\n\tfields 1 : *field\n}\n\n.protocol {\n\tname 0 : string\n\ttag\t1 :\tinteger\n\trequest\t2 :\tinteger\t# index\n\tresponse 3 : integer # index\n\tconfirm 4 : boolean # true means response nil\n}\n\n.group {\n\ttype 0 : *type\n\tprotocol 1 : *protocol\n}\n]]\n\nlocal function packfield(f)\n\tlocal strtbl = {}\n\tif f.array then\n\t\tif f.key then\n\t\t\ttable.insert(strtbl, \"\\6\\0\")  -- 6 fields\n\t\telse\n\t\t\ttable.insert(strtbl, \"\\5\\0\")  -- 5 fields\n\t\tend\n\telse\n\t\ttable.insert(strtbl, \"\\4\\0\")\t-- 4 fields\n\tend\n\ttable.insert(strtbl, \"\\0\\0\")\t-- name\t(tag = 0, ref an object)\n\tif f.buildin then\n\t\ttable.insert(strtbl, packvalue(f.buildin))\t-- buildin (tag = 1)\n\t\tif f.extra then\n\t\t\ttable.insert(strtbl, packvalue(f.extra))\t-- f.buildin can be integer or string\n\t\telse\n\t\t\ttable.insert(strtbl, \"\\1\\0\")\t-- skip (tag = 2)\n\t\tend\n\t\ttable.insert(strtbl, packvalue(f.tag))\t\t-- tag (tag = 3)\n\telse\n\t\ttable.insert(strtbl, \"\\1\\0\")\t-- skip (tag = 1)\n\t\ttable.insert(strtbl, packvalue(f.type))\t\t-- type (tag = 2)\n\t\ttable.insert(strtbl, packvalue(f.tag))\t\t-- tag (tag = 3)\n\tend\n\tif f.array then\n\t\ttable.insert(strtbl, packvalue(1))\t-- array = true (tag = 4)\n\tend\n\tif f.key then\n\t\ttable.insert(strtbl, packvalue(f.key)) -- key tag (tag = 5)\n\tend\n\ttable.insert(strtbl, packbytes(f.name)) -- external object (name)\n\treturn packbytes(table.concat(strtbl))\nend\n\nlocal function packtype(name, t, alltypes)\n\tlocal fields = {}\n\tlocal tmp = {}\n\tfor _, f in ipairs(t) do\n\t\ttmp.array = f.array\n\t\ttmp.name = f.name\n\t\ttmp.tag = f.tag\n\t\ttmp.extra = f.decimal\n\n\t\ttmp.buildin = buildin_types[f.typename]\n\t\tif f.typename == \"binary\" then\n\t\t\ttmp.extra = 1\t-- binary is sub type of string\n\t\tend\n\t\tlocal subtype\n\t\tif not tmp.buildin then\n\t\t\tsubtype = assert(alltypes[f.typename])\n\t\t\ttmp.type = subtype.id\n\t\telse\n\t\t\ttmp.type = nil\n\t\tend\n\t\tif f.key then\n\t\t\ttmp.key = subtype.fields[f.key]\n\t\t\tif not tmp.key then\n\t\t\t\terror(\"Invalid map index :\" .. f.key)\n\t\t\tend\n\t\telse\n\t\t\ttmp.key = nil\n\t\tend\n\n\t\ttable.insert(fields, packfield(tmp))\n\tend\n\tlocal data\n\tif #fields == 0 then\n\t\tdata = {\n\t\t\t\"\\1\\0\",\t-- 1 fields\n\t\t\t\"\\0\\0\",\t-- name\t(id = 0, ref = 0)\n\t\t\tpackbytes(name),\n\t\t}\n\telse\n\t\tdata = {\n\t\t\t\"\\2\\0\",\t-- 2 fields\n\t\t\t\"\\0\\0\",\t-- name\t(tag = 0, ref = 0)\n\t\t\t\"\\0\\0\", -- field[]\t(tag = 1, ref = 1)\n\t\t\tpackbytes(name),\n\t\t\tpackbytes(table.concat(fields)),\n\t\t}\n\tend\n\n\treturn packbytes(table.concat(data))\nend\n\nlocal function packproto(name, p, alltypes)\n\tif p.request then\n\t\tlocal request = alltypes[p.request]\n\t\tif request == nil then\n\t\t\terror(string.format(\"Protocol %s request type %s not found\", name, p.request))\n\t\tend\n\t\trequest = request.id\n\tend\n\tlocal tmp = {\n\t\t\"\\4\\0\",\t-- 4 fields\n\t\t\"\\0\\0\",\t-- name (id=0, ref=0)\n\t\tpackvalue(p.tag),\t-- tag (tag=1)\n\t}\n\tif p.request == nil and p.response == nil and p.confirm == nil then\n\t\ttmp[1] = \"\\2\\0\"\t-- only two fields\n\telse\n\t\tif p.request then\n\t\t\ttable.insert(tmp, packvalue(alltypes[p.request].id)) -- request typename (tag=2)\n\t\telse\n\t\t\ttable.insert(tmp, \"\\1\\0\")\t-- skip this field (request)\n\t\tend\n\t\tif p.response then\n\t\t\ttable.insert(tmp, packvalue(alltypes[p.response].id)) -- request typename (tag=3)\n\t\telseif p.confirm then\n\t\t\ttmp[1] = \"\\5\\0\"\t-- add confirm field\n\t\t\ttable.insert(tmp, \"\\1\\0\")\t-- skip this field (response)\n\t\t\ttable.insert(tmp, packvalue(1))\t-- confirm = true\n\t\telse\n\t\t\ttmp[1] = \"\\3\\0\"\t-- only three fields\n\t\tend\n\tend\n\n\ttable.insert(tmp, packbytes(name))\n\n\treturn packbytes(table.concat(tmp))\nend\n\nlocal function packgroup(t,p)\n\tif next(t) == nil then\n\t\tassert(next(p) == nil)\n\t\treturn \"\\0\\0\"\n\tend\n\tlocal tt, tp\n\tlocal alltypes = {}\n\tfor name in pairs(t) do\n\t\ttable.insert(alltypes, name)\n\tend\n\ttable.sort(alltypes)\t-- make result stable\n\tfor idx, name in ipairs(alltypes) do\n\t\tlocal fields = {}\n\t\tfor _, type_fields in ipairs(t[name]) do\n\t\t\tif buildin_types[type_fields.typename] then\n\t\t\t\tfields[type_fields.name] = type_fields.tag\n\t\t\tend\n\t\tend\n\t\talltypes[name] = { id = idx - 1, fields = fields }\n\tend\n\ttt = {}\n\tfor _,name in ipairs(alltypes) do\n\t\ttable.insert(tt, packtype(name, t[name], alltypes))\n\tend\n\ttt = packbytes(table.concat(tt))\n\tif next(p) then\n\t\tlocal tmp = {}\n\t\tfor name, tbl in pairs(p) do\n\t\t\ttable.insert(tmp, tbl)\n\t\t\ttbl.name = name\n\t\tend\n\t\ttable.sort(tmp, function(a,b) return a.tag < b.tag end)\n\n\t\ttp = {}\n\t\tfor _, tbl in ipairs(tmp) do\n\t\t\ttable.insert(tp, packproto(tbl.name, tbl, alltypes))\n\t\tend\n\t\ttp = packbytes(table.concat(tp))\n\tend\n\tlocal result\n\tif tp == nil then\n\t\tresult = {\n\t\t\t\"\\1\\0\",\t-- 1 field\n\t\t\t\"\\0\\0\",\t-- type[] (id = 0, ref = 0)\n\t\t\ttt,\n\t\t}\n\telse\n\t\tresult = {\n\t\t\t\"\\2\\0\",\t-- 2fields\n\t\t\t\"\\0\\0\",\t-- type array\t(id = 0, ref = 0)\n\t\t\t\"\\0\\0\",\t-- protocol array\t(id = 1, ref =1)\n\n\t\t\ttt,\n\t\t\ttp,\n\t\t}\n\tend\n\n\treturn table.concat(result)\nend\n\nlocal function encodeall(r)\n\treturn packgroup(r.type, r.protocol)\nend\n\nlocal sparser = {}\n\nfunction sparser.dump(str)\n\tlocal tmp = \"\"\n\tfor i=1,#str do\n\t\ttmp = tmp .. string.format(\"%02X \", string.byte(str,i))\n\t\tif i % 8 == 0 then\n\t\t\tif i % 16 == 0 then\n\t\t\t\tprint(tmp)\n\t\t\t\ttmp = \"\"\n\t\t\telse\n\t\t\t\ttmp = tmp .. \"- \"\n\t\t\tend\n\t\tend\n\tend\n\tprint(tmp)\nend\n\nfunction sparser.parse(text, name)\n\tlocal r = parser(text, name or \"=text\")\n\tlocal data = encodeall(r)\n\treturn data\nend\n\nreturn sparser\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/sprotoparser.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 1029deb59a2e22741ae8bb6de18d55e3\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/test.lua",
    "content": "local sproto = require \"sproto\"\nlocal core = require \"sproto.core\"\nlocal print_r = require \"print_r\"\n\nlocal sp = sproto.parse [[\n.Person {\n\tname 0 : string\n\tid 1 : integer\n\temail 2 : string\n\n\t.PhoneNumber {\n\t\tnumber 0 : string\n\t\ttype 1 : integer\n\t}\n\n\tphone 3 : *PhoneNumber\n}\n\n.AddressBook {\n\tperson 0 : *Person(id)\n\tothers 1 : *Person\n}\n]]\n\n-- core.dumpproto only for debug use\ncore.dumpproto(sp.__cobj)\n\nlocal def = sp:default \"Person\"\nprint(\"default table for Person\")\nprint_r(def)\nprint(\"--------------\")\n\nlocal ab = {\n\tperson = {\n\t\t[10000] = {\n\t\t\tname = \"Alice\",\n\t\t\tid = 10000,\n\t\t\tphone = {\n\t\t\t\t{ number = \"123456789\" , type = 1 },\n\t\t\t\t{ number = \"87654321\" , type = 2 },\n\t\t\t}\n\t\t},\n\t\t[20000] = {\n\t\t\tname = \"Bob\",\n\t\t\tid = 20000,\n\t\t\tphone = {\n\t\t\t\t{ number = \"01234567890\" , type = 3 },\n\t\t\t}\n\t\t}\n\t},\n\tothers = {\n\t\t{\n\t\t\tname = \"Carol\",\n\t\t\tid = 30000,\n\t\t\tphone = {\n\t\t\t\t{ number = \"9876543210\" },\n\t\t\t}\n\t\t},\n\t}\n}\n\ncollectgarbage \"stop\"\n\nlocal code = sp:encode(\"AddressBook\", ab)\nlocal addr = sp:decode(\"AddressBook\", code)\nprint_r(addr)\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/test.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 8d9128acb663de141bc4315bb57648c3\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/testall.lua",
    "content": "local sproto = require \"sproto\"\nlocal print_r = require \"print_r\"\n\nlocal sp = sproto.parse [[\n.foobar {\n\t.nest {\n\t\ta 1 : string\n\t\tb 3 : boolean\n\t\tc 5 : integer\n\t\td 6 : integer(3)\n\t}\n\ta 0 : string\n\tb 1 : integer\n\tc 2 : boolean\n\td 3 : *nest(a)\n\n\te 4 : *string\n\tf 5 : *integer\n\tg 6 : *boolean\n\th 7 : *foobar\n\ti 8 : *integer(2)\n\tj 9 : binary\n}\n]]\n\nlocal obj = {\n\ta = \"hello\",\n\tb = 1000000,\n\tc = true,\n\td = {\n\t\t{\n\t\t\ta = \"one\",\n\t\t\t-- skip b\n\t\t\tc = -1,\n\t\t},\n\t\t{\n\t\t\ta = \"two\",\n\t\t\tb = true,\n\t\t},\n\t\t{\n\t\t\ta = \"\",\n\t\t\tb = false,\n\t\t\tc = 1,\n\t\t},\n\t\t{\n\t\t\ta = \"decimal\",\n\t\t\td = 1.235,\n\t\t}\n\t},\n\te = { \"ABC\", \"\", \"def\" },\n\tf = { -3, -2, -1, 0 , 1, 2},\n\tg = { true, false, true },\n\th = {\n\t\t{ b = 100 },\n\t\t{},\n\t\t{ b = -100, c= false },\n\t\t{ b = 0, e = { \"test\" } },\n\t},\n\ti = { 1,2.1,3.21,4.321 },\n\tj = \"\\0\\1\\2\\3\",\n}\n\nlocal code = sp:encode(\"foobar\", obj)\nobj = sp:decode(\"foobar\", code)\nprint_r(obj)\n\n-- core.dumpproto only for debug use\nlocal core = require \"sproto.core\"\ncore.dumpproto(sp.__cobj)\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/testall.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 228d5abe9cc3cdd40a7a63bda3a3a273\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/testrpc.lua",
    "content": "local sproto = require \"sproto\"\nlocal print_r = require \"print_r\"\n\nlocal server_proto = sproto.parse [[\n.package {\n\ttype 0 : integer\n\tsession 1 : integer\n}\n\nfoobar 1 {\n\trequest {\n\t\twhat 0 : string\n\t}\n\tresponse {\n\t\tok 0 : boolean\n\t}\n}\n\nfoo 2 {\n\tresponse {\n\t\tok 0 : boolean\n\t}\n}\n\nbar 3 {\n\tresponse nil\n}\n\nblackhole 4 {\n}\n]]\n\nlocal client_proto = sproto.parse [[\n.package {\n\ttype 0 : integer\n\tsession 1 : integer\n}\n]]\n\n\nassert(server_proto:exist_type \"package\")\nassert(server_proto:exist_proto \"foobar\")\n\nprint(\"=== default table\")\n\nprint_r(server_proto:default(\"package\"))\nprint_r(server_proto:default(\"foobar\", \"REQUEST\"))\nassert(server_proto:default(\"foo\", \"REQUEST\")==nil)\nassert(server_proto:request_encode(\"foo\")==\"\")\nserver_proto:response_encode(\"foo\", { ok = true })\nassert(server_proto:request_decode(\"blackhole\")==nil)\nassert(server_proto:response_decode(\"blackhole\")==nil)\n\nprint(\"=== test 1\")\n\n-- The type package must has two field : type and session\nlocal server = server_proto:host \"package\"\nlocal client = client_proto:host \"package\"\nlocal client_request = client:attach(server_proto)\n\nprint(\"client request foobar\")\nlocal req = client_request(\"foobar\", { what = \"foo\" }, 1)\nprint(\"request foobar size =\", #req)\nlocal type, name, request, response = server:dispatch(req)\nassert(type == \"REQUEST\" and name == \"foobar\")\nprint_r(request)\nprint(\"server response\")\nlocal resp = response { ok = true }\nprint(\"response package size =\", #resp)\nprint(\"client dispatch\")\nlocal type, session, response = client:dispatch(resp)\nassert(type == \"RESPONSE\" and session == 1)\nprint_r(response)\n\nlocal req = client_request(\"foo\", nil, 2)\nprint(\"request foo size =\", #req)\nlocal type, name, request, response = server:dispatch(req)\nassert(type == \"REQUEST\" and name == \"foo\" and request == nil)\nlocal resp = response { ok = false }\nprint(\"response package size =\", #resp)\nprint(\"client dispatch\")\nlocal type, session, response = client:dispatch(resp)\nassert(type == \"RESPONSE\" and session == 2)\nprint_r(response)\n\nlocal req = client_request(\"bar\", nil, 3)\nprint(\"request bar size =\", #req)\nlocal type, name, request, response = server:dispatch(req)\nassert(type == \"REQUEST\" and name == \"bar\" and request == nil)\nassert(select(2,client:dispatch(response())) == 3)\n\nlocal req = client_request \"blackhole\"\t-- no response\nprint(\"request blackhole size = \", #req)\n\nprint(\"=== test 2\")\nlocal v, tag = server_proto:request_encode(\"foobar\", { what = \"hello\"})\nassert(tag == 1)\t-- foobar : 1\nprint(\"tag =\", tag)\nprint_r(server_proto:request_decode(\"foobar\", v))\nlocal v = server_proto:response_encode(\"foobar\", { ok = true })\nprint_r(server_proto:response_decode(\"foobar\", v))\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new/testrpc.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 400fb0a0e87b312488b39e8370915feb\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sproto.new.meta",
    "content": "fileFormatVersion: 2\nguid: 51f3c40d92337c04f9b7b816f11e2166\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sprotoparser.lua",
    "content": "local lpeg = require \"lpeg\"\nlocal table = require \"table\"\n\nlocal packbytes\nlocal packvalue\n\nif _VERSION == \"Lua 5.3\" then\n\tfunction packbytes(str)\n\t\treturn string.pack(\"<s4\",str)\n\tend\n\n\tfunction packvalue(id)\n\t\tid = (id + 1) * 2\n\t\treturn string.pack(\"<I2\",id)\n\tend\nelse\n\tfunction packbytes(str)\n\t\tlocal size = #str\n\t\tlocal a = size % 256\n\t\tsize = math.floor(size / 256)\n\t\tlocal b = size % 256\n\t\tsize = math.floor(size / 256)\n\t\tlocal c = size % 256\n\t\tsize = math.floor(size / 256)\n\t\tlocal d = size\n\t\treturn string.char(a)..string.char(b)..string.char(c)..string.char(d) .. str\n\tend\n\n\tfunction packvalue(id)\n\t\tid = (id + 1) * 2\n\t\tassert(id >=0 and id < 65536)\n\t\tlocal a = id % 256\n\t\tlocal b = math.floor(id / 256)\n\t\treturn string.char(a) .. string.char(b)\n\tend\nend\n\nlocal P = lpeg.P\nlocal S = lpeg.S\nlocal R = lpeg.R\nlocal C = lpeg.C\nlocal Ct = lpeg.Ct\nlocal Cg = lpeg.Cg\nlocal Cc = lpeg.Cc\nlocal V = lpeg.V\n\nlocal function count_lines(_,pos, parser_state)\n\tif parser_state.pos < pos then\n\t\tparser_state.line = parser_state.line + 1\n\t\tparser_state.pos = pos\n\tend\n\treturn pos\nend\n\nlocal exception = lpeg.Cmt( lpeg.Carg(1) , function ( _ , pos, parser_state)\n\terror(string.format(\"syntax error at [%s] line (%d)\", parser_state.file or \"\", parser_state.line))\n\treturn pos\nend)\n\nlocal eof = P(-1)\nlocal newline = lpeg.Cmt((P\"\\n\" + \"\\r\\n\") * lpeg.Carg(1) ,count_lines)\nlocal line_comment = \"#\" * (1 - newline) ^0 * (newline + eof)\nlocal blank = S\" \\t\" + newline + line_comment\nlocal blank0 = blank ^ 0\nlocal blanks = blank ^ 1\nlocal alpha = R\"az\" + R\"AZ\" + \"_\"\nlocal alnum = alpha + R\"09\"\nlocal word = alpha * alnum ^ 0\nlocal name = C(word)\nlocal typename = C(word * (\".\" * word) ^ 0)\nlocal tag = R\"09\" ^ 1 / tonumber\nlocal mainkey = \"(\" * blank0 * name * blank0 * \")\"\nlocal decimal = \"(\" * blank0 * C(tag) * blank0 * \")\"\n\nlocal function multipat(pat)\n\treturn Ct(blank0 * (pat * blanks) ^ 0 * pat^0 * blank0)\nend\n\nlocal function namedpat(name, pat)\n\treturn Ct(Cg(Cc(name), \"type\") * Cg(pat))\nend\n\nlocal typedef = P {\n\t\"ALL\",\n\tFIELD = namedpat(\"field\", (name * blanks * tag * blank0 * \":\" * blank0 * (C\"*\")^-1 * typename * (mainkey +  decimal)^0)),\n\tSTRUCT = P\"{\" * multipat(V\"FIELD\" + V\"TYPE\") * P\"}\",\n\tTYPE = namedpat(\"type\", P\".\" * name * blank0 * V\"STRUCT\" ),\n\tSUBPROTO = Ct((C\"request\" + C\"response\") * blanks * (typename + V\"STRUCT\")),\n\tPROTOCOL = namedpat(\"protocol\", name * blanks * tag * blank0 * P\"{\" * multipat(V\"SUBPROTO\") * P\"}\"),\n\tALL = multipat(V\"TYPE\" + V\"PROTOCOL\"),\n}\n\nlocal proto = blank0 * typedef * blank0\n\nlocal convert = {}\n\nfunction convert.protocol(all, obj)\n\tlocal result = { tag = obj[2] }\n\tfor _, p in ipairs(obj[3]) do\n\t\tassert(result[p[1]] == nil)\n\t\tlocal typename = p[2]\n\t\tif type(typename) == \"table\" then\n\t\t\tlocal struct = typename\n\t\t\ttypename = obj[1] .. \".\" .. p[1]\n\t\t\tall.type[typename] = convert.type(all, { typename, struct })\n\t\tend\n\t\tif typename == \"nil\" then\n\t\t\tif p[1] == \"response\" then\n\t\t\t\tresult.confirm = true\n\t\t\tend\n\t\telse\n\t\t\tresult[p[1]] = typename\n\t\tend\n\tend\n\treturn result\nend\n\nfunction convert.type(all, obj)\n\tlocal result = {}\n\tlocal typename = obj[1]\n\tlocal tags = {}\n\tlocal names = {}\n\tfor _, f in ipairs(obj[2]) do\n\t\tif f.type == \"field\" then\n\t\t\tlocal name = f[1]\n\t\t\tif names[name] then\n\t\t\t\terror(string.format(\"redefine %s in type %s\", name, typename))\n\t\t\tend\n\t\t\tnames[name] = true\n\t\t\tlocal tag = f[2]\n\t\t\tif tags[tag] then\n\t\t\t\terror(string.format(\"redefine tag %d in type %s\", tag, typename))\n\t\t\tend\n\t\t\ttags[tag] = true\n\t\t\tlocal field = { name = name, tag = tag }\n\t\t\ttable.insert(result, field)\n\t\t\tlocal fieldtype = f[3]\n\t\t\tif fieldtype == \"*\" then\n\t\t\t\tfield.array = true\n\t\t\t\tfieldtype = f[4]\n\t\t\tend\n\t\t\tlocal mainkey = f[5]\n\t\t\tif mainkey then\n\t\t\t\tif fieldtype == \"integer\" then\n\t\t\t\t\tfield.decimal = mainkey\n\t\t\t\telse\n\t\t\t\t\tassert(field.array)\n\t\t\t\t\tfield.key = mainkey\n\t\t\t\tend\n\t\t\tend\n\t\t\tfield.typename = fieldtype\n\t\telse\n\t\t\tassert(f.type == \"type\")\t-- nest type\n\t\t\tlocal nesttypename = typename .. \".\" .. f[1]\n\t\t\tf[1] = nesttypename\n\t\t\tassert(all.type[nesttypename] == nil, \"redefined \" .. nesttypename)\n\t\t\tall.type[nesttypename] = convert.type(all, f)\n\t\tend\n\tend\n\ttable.sort(result, function(a,b) return a.tag < b.tag end)\n\treturn result\nend\n\nlocal function adjust(r)\n\tlocal result = { type = {} , protocol = {} }\n\n\tfor _, obj in ipairs(r) do\n\t\tlocal set = result[obj.type]\n\t\tlocal name = obj[1]\n\t\tassert(set[name] == nil , \"redefined \" .. name)\n\t\tset[name] = convert[obj.type](result,obj)\n\tend\n\n\treturn result\nend\n\nlocal buildin_types = {\n\tinteger = 0,\n\tboolean = 1,\n\tstring = 2,\n\tbinary = 2,\t-- binary is a sub type of string\n}\n\nlocal function checktype(types, ptype, t)\n\tif buildin_types[t] then\n\t\treturn t\n\tend\n\tlocal fullname = ptype .. \".\" .. t\n\tif types[fullname] then\n\t\treturn fullname\n\telse\n\t\tptype = ptype:match \"(.+)%..+$\"\n\t\tif ptype then\n\t\t\treturn checktype(types, ptype, t)\n\t\telseif types[t] then\n\t\t\treturn t\n\t\tend\n\tend\nend\n\nlocal function check_protocol(r)\n\tlocal map = {}\n\tlocal type = r.type\n\tfor name, v in pairs(r.protocol) do\n\t\tlocal tag = v.tag\n\t\tlocal request = v.request\n\t\tlocal response = v.response\n\t\tlocal p = map[tag]\n\n\t\tif p then\n\t\t\terror(string.format(\"redefined protocol tag %d at %s\", tag, name))\n\t\tend\n\n\t\tif request and not type[request] then\n\t\t\terror(string.format(\"Undefined request type %s in protocol %s\", request, name))\n\t\tend\n\n\t\tif response and not type[response] then\n\t\t\terror(string.format(\"Undefined response type %s in protocol %s\", response, name))\n\t\tend\n\n\t\tmap[tag] = v\n\tend\n\treturn r\nend\n\nlocal function flattypename(r)\n\tfor typename, t in pairs(r.type) do\n\t\tfor _, f in pairs(t) do\n\t\t\tlocal ftype = f.typename\n\t\t\tlocal fullname = checktype(r.type, typename, ftype)\n\t\t\tif fullname == nil then\n\t\t\t\terror(string.format(\"Undefined type %s in type %s\", ftype, typename))\n\t\t\tend\n\t\t\tf.typename = fullname\n\t\tend\n\tend\n\n\treturn r\nend\n\nlocal function parser(text,filename)\n\tlocal state = { file = filename, pos = 0, line = 1 }\n\tlocal r = lpeg.match(proto * -1 + exception , text , 1, state )\n\treturn flattypename(check_protocol(adjust(r)))\nend\n\n--[[\n-- The protocol of sproto\n.type {\n\t.field {\n\t\tname 0 : string\n\t\tbuildin\t1 :\tinteger\n\t\ttype 2 : integer\n\t\ttag\t3 :\tinteger\n\t\tarray 4\t: boolean\n\t\tkey 5 : integer # If key exists, array must be true, and it's a map.\n\t}\n\tname 0 : string\n\tfields 1 : *field\n}\n\n.protocol {\n\tname 0 : string\n\ttag\t1 :\tinteger\n\trequest\t2 :\tinteger\t# index\n\tresponse 3 : integer # index\n\tconfirm 4 : boolean # true means response nil\n}\n\n.group {\n\ttype 0 : *type\n\tprotocol 1 : *protocol\n}\n]]\n\nlocal function packfield(f)\n\tlocal strtbl = {}\n\tif f.array then\n\t\tif f.key then\n\t\t\ttable.insert(strtbl, \"\\6\\0\")  -- 6 fields\n\t\telse\n\t\t\ttable.insert(strtbl, \"\\5\\0\")  -- 5 fields\n\t\tend\n\telse\n\t\ttable.insert(strtbl, \"\\4\\0\")\t-- 4 fields\n\tend\n\ttable.insert(strtbl, \"\\0\\0\")\t-- name\t(tag = 0, ref an object)\n\tif f.buildin then\n\t\ttable.insert(strtbl, packvalue(f.buildin))\t-- buildin (tag = 1)\n\t\tif f.extra then\n\t\t\ttable.insert(strtbl, packvalue(f.extra))\t-- f.buildin can be integer or string\n\t\telse\n\t\t\ttable.insert(strtbl, \"\\1\\0\")\t-- skip (tag = 2)\n\t\tend\n\t\ttable.insert(strtbl, packvalue(f.tag))\t\t-- tag (tag = 3)\n\telse\n\t\ttable.insert(strtbl, \"\\1\\0\")\t-- skip (tag = 1)\n\t\ttable.insert(strtbl, packvalue(f.type))\t\t-- type (tag = 2)\n\t\ttable.insert(strtbl, packvalue(f.tag))\t\t-- tag (tag = 3)\n\tend\n\tif f.array then\n\t\ttable.insert(strtbl, packvalue(1))\t-- array = true (tag = 4)\n\tend\n\tif f.key then\n\t\ttable.insert(strtbl, packvalue(f.key)) -- key tag (tag = 5)\n\tend\n\ttable.insert(strtbl, packbytes(f.name)) -- external object (name)\n\treturn packbytes(table.concat(strtbl))\nend\n\nlocal function packtype(name, t, alltypes)\n\tlocal fields = {}\n\tlocal tmp = {}\n\tfor _, f in ipairs(t) do\n\t\ttmp.array = f.array\n\t\ttmp.name = f.name\n\t\ttmp.tag = f.tag\n\t\ttmp.extra = f.decimal\n\n\t\ttmp.buildin = buildin_types[f.typename]\n\t\tif f.typename == \"binary\" then\n\t\t\ttmp.extra = 1\t-- binary is sub type of string\n\t\tend\n\t\tlocal subtype\n\t\tif not tmp.buildin then\n\t\t\tsubtype = assert(alltypes[f.typename])\n\t\t\ttmp.type = subtype.id\n\t\telse\n\t\t\ttmp.type = nil\n\t\tend\n\t\tif f.key then\n\t\t\ttmp.key = subtype.fields[f.key]\n\t\t\tif not tmp.key then\n\t\t\t\terror(\"Invalid map index :\" .. f.key)\n\t\t\tend\n\t\telse\n\t\t\ttmp.key = nil\n\t\tend\n\n\t\ttable.insert(fields, packfield(tmp))\n\tend\n\tlocal data\n\tif #fields == 0 then\n\t\tdata = {\n\t\t\t\"\\1\\0\",\t-- 1 fields\n\t\t\t\"\\0\\0\",\t-- name\t(id = 0, ref = 0)\n\t\t\tpackbytes(name),\n\t\t}\n\telse\n\t\tdata = {\n\t\t\t\"\\2\\0\",\t-- 2 fields\n\t\t\t\"\\0\\0\",\t-- name\t(tag = 0, ref = 0)\n\t\t\t\"\\0\\0\", -- field[]\t(tag = 1, ref = 1)\n\t\t\tpackbytes(name),\n\t\t\tpackbytes(table.concat(fields)),\n\t\t}\n\tend\n\n\treturn packbytes(table.concat(data))\nend\n\nlocal function packproto(name, p, alltypes)\n\tif p.request then\n\t\tlocal request = alltypes[p.request]\n\t\tif request == nil then\n\t\t\terror(string.format(\"Protocol %s request type %s not found\", name, p.request))\n\t\tend\n\t\trequest = request.id\n\tend\n\tlocal tmp = {\n\t\t\"\\4\\0\",\t-- 4 fields\n\t\t\"\\0\\0\",\t-- name (id=0, ref=0)\n\t\tpackvalue(p.tag),\t-- tag (tag=1)\n\t}\n\tif p.request == nil and p.response == nil and p.confirm == nil then\n\t\ttmp[1] = \"\\2\\0\"\t-- only two fields\n\telse\n\t\tif p.request then\n\t\t\ttable.insert(tmp, packvalue(alltypes[p.request].id)) -- request typename (tag=2)\n\t\telse\n\t\t\ttable.insert(tmp, \"\\1\\0\")\t-- skip this field (request)\n\t\tend\n\t\tif p.response then\n\t\t\ttable.insert(tmp, packvalue(alltypes[p.response].id)) -- request typename (tag=3)\n\t\telseif p.confirm then\n\t\t\ttmp[1] = \"\\5\\0\"\t-- add confirm field\n\t\t\ttable.insert(tmp, \"\\1\\0\")\t-- skip this field (response)\n\t\t\ttable.insert(tmp, packvalue(1))\t-- confirm = true\n\t\telse\n\t\t\ttmp[1] = \"\\3\\0\"\t-- only three fields\n\t\tend\n\tend\n\n\ttable.insert(tmp, packbytes(name))\n\n\treturn packbytes(table.concat(tmp))\nend\n\nlocal function packgroup(t,p)\n\tif next(t) == nil then\n\t\tassert(next(p) == nil)\n\t\treturn \"\\0\\0\"\n\tend\n\tlocal tt, tp\n\tlocal alltypes = {}\n\tfor name in pairs(t) do\n\t\ttable.insert(alltypes, name)\n\tend\n\ttable.sort(alltypes)\t-- make result stable\n\tfor idx, name in ipairs(alltypes) do\n\t\tlocal fields = {}\n\t\tfor _, type_fields in ipairs(t[name]) do\n\t\t\tif buildin_types[type_fields.typename] then\n\t\t\t\tfields[type_fields.name] = type_fields.tag\n\t\t\tend\n\t\tend\n\t\talltypes[name] = { id = idx - 1, fields = fields }\n\tend\n\ttt = {}\n\tfor _,name in ipairs(alltypes) do\n\t\ttable.insert(tt, packtype(name, t[name], alltypes))\n\tend\n\ttt = packbytes(table.concat(tt))\n\tif next(p) then\n\t\tlocal tmp = {}\n\t\tfor name, tbl in pairs(p) do\n\t\t\ttable.insert(tmp, tbl)\n\t\t\ttbl.name = name\n\t\tend\n\t\ttable.sort(tmp, function(a,b) return a.tag < b.tag end)\n\n\t\ttp = {}\n\t\tfor _, tbl in ipairs(tmp) do\n\t\t\ttable.insert(tp, packproto(tbl.name, tbl, alltypes))\n\t\tend\n\t\ttp = packbytes(table.concat(tp))\n\tend\n\tlocal result\n\tif tp == nil then\n\t\tresult = {\n\t\t\t\"\\1\\0\",\t-- 1 field\n\t\t\t\"\\0\\0\",\t-- type[] (id = 0, ref = 0)\n\t\t\ttt,\n\t\t}\n\telse\n\t\tresult = {\n\t\t\t\"\\2\\0\",\t-- 2fields\n\t\t\t\"\\0\\0\",\t-- type array\t(id = 0, ref = 0)\n\t\t\t\"\\0\\0\",\t-- protocol array\t(id = 1, ref =1)\n\n\t\t\ttt,\n\t\t\ttp,\n\t\t}\n\tend\n\n\treturn table.concat(result)\nend\n\nlocal function encodeall(r)\n\treturn packgroup(r.type, r.protocol)\nend\n\nlocal sparser = {}\n\nfunction sparser.dump(str)\n\tlocal tmp = \"\"\n\tfor i=1,#str do\n\t\ttmp = tmp .. string.format(\"%02X \", string.byte(str,i))\n\t\tif i % 8 == 0 then\n\t\t\tif i % 16 == 0 then\n\t\t\t\tprint(tmp)\n\t\t\t\ttmp = \"\"\n\t\t\telse\n\t\t\t\ttmp = tmp .. \"- \"\n\t\t\tend\n\t\tend\n\tend\n\tprint(tmp)\nend\n\nfunction sparser.parse(text, name)\n\tlocal r = parser(text, name or \"=text\")\n\tlocal data = encodeall(r)\n\treturn data\nend\n\nreturn sparser\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/sprotoparser.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 3b6c96a99e1b8fd4aae2bcc27d800ebc\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/test.lua",
    "content": "local sproto = require \"sproto\"\nlocal core = require \"sproto.core\"\nlocal print_r = require \"print_r\"\n\nlocal sp = sproto.parse [[\n.Person {\n\tname 0 : string\n\tid 1 : integer\n\temail 2 : string\n\n\t.PhoneNumber {\n\t\tnumber 0 : string\n\t\ttype 1 : integer\n\t}\n\n\tphone 3 : *PhoneNumber\n}\n\n.AddressBook {\n\tperson 0 : *Person(id)\n\tothers 1 : *Person\n}\n]]\n\n-- core.dumpproto only for debug use\ncore.dumpproto(sp.__cobj)\n\nlocal def = sp:default \"Person\"\nprint(\"default table for Person\")\nprint_r(def)\nprint(\"--------------\")\n\nlocal ab = {\n\tperson = {\n\t\t[10000] = {\n\t\t\tname = \"Alice\",\n\t\t\tid = 10000,\n\t\t\tphone = {\n\t\t\t\t{ number = \"123456789\" , type = 1 },\n\t\t\t\t{ number = \"87654321\" , type = 2 },\n\t\t\t}\n\t\t},\n\t\t[20000] = {\n\t\t\tname = \"Bob\",\n\t\t\tid = 20000,\n\t\t\tphone = {\n\t\t\t\t{ number = \"01234567890\" , type = 3 },\n\t\t\t}\n\t\t}\n\t},\n\tothers = {\n\t\t{\n\t\t\tname = \"Carol\",\n\t\t\tid = 30000,\n\t\t\tphone = {\n\t\t\t\t{ number = \"9876543210\" },\n\t\t\t}\n\t\t},\n\t}\n}\n\ncollectgarbage \"stop\"\n\nlocal code = sp:encode(\"AddressBook\", ab)\nlocal addr = sp:decode(\"AddressBook\", code)\nprint_r(addr)\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/test.lua.meta",
    "content": "fileFormatVersion: 2\nguid: a955d75e03673da40b51a1c34364118f\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/testall.lua",
    "content": "local sproto = require \"sproto\"\nlocal print_r = require \"print_r\"\n\nlocal sp = sproto.parse [[\n.foobar {\n\t.nest {\n\t\ta 1 : string\n\t\tb 3 : boolean\n\t\tc 5 : integer\n\t\td 6 : integer(3)\n\t}\n\ta 0 : string\n\tb 1 : integer\n\tc 2 : boolean\n\td 3 : *nest(a)\n\n\te 4 : *string\n\tf 5 : *integer\n\tg 6 : *boolean\n\th 7 : *foobar\n\ti 8 : *integer(2)\n\tj 9 : binary\n}\n]]\n\nlocal obj = {\n\ta = \"hello\",\n\tb = 1000000,\n\tc = true,\n\td = {\n\t\t{\n\t\t\ta = \"one\",\n\t\t\t-- skip b\n\t\t\tc = -1,\n\t\t},\n\t\t{\n\t\t\ta = \"two\",\n\t\t\tb = true,\n\t\t},\n\t\t{\n\t\t\ta = \"\",\n\t\t\tb = false,\n\t\t\tc = 1,\n\t\t},\n\t\t{\n\t\t\ta = \"decimal\",\n\t\t\td = 1.235,\n\t\t}\n\t},\n\te = { \"ABC\", \"\", \"def\" },\n\tf = { -3, -2, -1, 0 , 1, 2},\n\tg = { true, false, true },\n\th = {\n\t\t{ b = 100 },\n\t\t{},\n\t\t{ b = -100, c= false },\n\t\t{ b = 0, e = { \"test\" } },\n\t},\n\ti = { 1,2.1,3.21,4.321 },\n\tj = \"\\0\\1\\2\\3\",\n}\n\nlocal code = sp:encode(\"foobar\", obj)\nobj = sp:decode(\"foobar\", code)\nprint_r(obj)\n\n-- core.dumpproto only for debug use\nlocal core = require \"sproto.core\"\ncore.dumpproto(sp.__cobj)\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/testall.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 6f0ca69e73aad4b488d5071e00b384a8\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/testrpc.lua",
    "content": "local sproto = require \"sproto\"\nlocal print_r = require \"print_r\"\n\nlocal server_proto = sproto.parse [[\n.package {\n\ttype 0 : integer\n\tsession 1 : integer\n}\n\nfoobar 1 {\n\trequest {\n\t\twhat 0 : string\n\t}\n\tresponse {\n\t\tok 0 : boolean\n\t}\n}\n\nfoo 2 {\n\tresponse {\n\t\tok 0 : boolean\n\t}\n}\n\nbar 3 {\n\tresponse nil\n}\n\nblackhole 4 {\n}\n]]\n\nlocal client_proto = sproto.parse [[\n.package {\n\ttype 0 : integer\n\tsession 1 : integer\n}\n]]\n\n\nassert(server_proto:exist_type \"package\")\nassert(server_proto:exist_proto \"foobar\")\n\nprint(\"=== default table\")\n\nprint_r(server_proto:default(\"package\"))\nprint_r(server_proto:default(\"foobar\", \"REQUEST\"))\nassert(server_proto:default(\"foo\", \"REQUEST\")==nil)\nassert(server_proto:request_encode(\"foo\")==\"\")\nserver_proto:response_encode(\"foo\", { ok = true })\nassert(server_proto:request_decode(\"blackhole\")==nil)\nassert(server_proto:response_decode(\"blackhole\")==nil)\n\nprint(\"=== test 1\")\n\n-- The type package must has two field : type and session\nlocal server = server_proto:host \"package\"\nlocal client = client_proto:host \"package\"\nlocal client_request = client:attach(server_proto)\n\nprint(\"client request foobar\")\nlocal req = client_request(\"foobar\", { what = \"foo\" }, 1)\nprint(\"request foobar size =\", #req)\nlocal type, name, request, response = server:dispatch(req)\nassert(type == \"REQUEST\" and name == \"foobar\")\nprint_r(request)\nprint(\"server response\")\nlocal resp = response { ok = true }\nprint(\"response package size =\", #resp)\nprint(\"client dispatch\")\nlocal type, session, response = client:dispatch(resp)\nassert(type == \"RESPONSE\" and session == 1)\nprint_r(response)\n\nlocal req = client_request(\"foo\", nil, 2)\nprint(\"request foo size =\", #req)\nlocal type, name, request, response = server:dispatch(req)\nassert(type == \"REQUEST\" and name == \"foo\" and request == nil)\nlocal resp = response { ok = false }\nprint(\"response package size =\", #resp)\nprint(\"client dispatch\")\nlocal type, session, response = client:dispatch(resp)\nassert(type == \"RESPONSE\" and session == 2)\nprint_r(response)\n\nlocal req = client_request(\"bar\", nil, 3)\nprint(\"request bar size =\", #req)\nlocal type, name, request, response = server:dispatch(req)\nassert(type == \"REQUEST\" and name == \"bar\" and request == nil)\nassert(select(2,client:dispatch(response())) == 3)\n\nlocal req = client_request \"blackhole\"\t-- no response\nprint(\"request blackhole size = \", #req)\n\nprint(\"=== test 2\")\nlocal v, tag = server_proto:request_encode(\"foobar\", { what = \"hello\"})\nassert(tag == 1)\t-- foobar : 1\nprint(\"tag =\", tag)\nprint_r(server_proto:request_decode(\"foobar\", v))\nlocal v = server_proto:response_encode(\"foobar\", { ok = true })\nprint_r(server_proto:response_decode(\"foobar\", v))\n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources/testrpc.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 666350acbed6d6d46ae2175b5bf12b56\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents/Resources.meta",
    "content": "fileFormatVersion: 2\nguid: 2bc3127b3b551e44da3235a21c051ee0\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle/Contents.meta",
    "content": "fileFormatVersion: 2\nguid: 22990b789b0594c8785404a854b20a60\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/tolua.bundle.meta",
    "content": "fileFormatVersion: 2\nguid: d67965ea35e33fa4f8179bc8f4f3ce74\nfolderAsset: yes\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      '': OSXIntel\n    second:\n      enabled: 1\n      settings: {}\n  - first:\n      '': OSXIntel64\n    second:\n      enabled: 1\n      settings: {}\n  - first:\n      Any: \n    second:\n      enabled: 0\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 1\n      settings:\n        DefaultValueInitialized: true\n  - first:\n      Standalone: OSXUniversal\n    second:\n      enabled: 1\n      settings: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/x86/tolua.dll.meta",
    "content": "fileFormatVersion: 2\nguid: f3b9938f609831e41b7ffc0f4108166b\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      '': Any\n    second:\n      enabled: 0\n      settings:\n        Exclude Android: 1\n        Exclude Editor: 1\n        Exclude Linux: 1\n        Exclude Linux64: 1\n        Exclude LinuxUniversal: 1\n        Exclude OSXUniversal: 1\n        Exclude Win: 1\n        Exclude Win64: 1\n        Exclude iOS: 1\n  - first:\n      '': OSXIntel\n    second:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n  - first:\n      '': OSXIntel64\n    second:\n      enabled: 0\n      settings:\n        CPU: None\n  - first:\n      Android: Android\n    second:\n      enabled: 0\n      settings:\n        CPU: ARMv7\n  - first:\n      Any: \n    second:\n      enabled: 0\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 0\n      settings:\n        CPU: x86\n        DefaultValueInitialized: true\n        OS: AnyOS\n  - first:\n      Facebook: Win\n    second:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n  - first:\n      Facebook: Win64\n    second:\n      enabled: 0\n      settings:\n        CPU: None\n  - first:\n      Standalone: Linux\n    second:\n      enabled: 0\n      settings:\n        CPU: x86\n  - first:\n      Standalone: Linux64\n    second:\n      enabled: 0\n      settings:\n        CPU: None\n  - first:\n      Standalone: LinuxUniversal\n    second:\n      enabled: 0\n      settings:\n        CPU: None\n  - first:\n      Standalone: OSXUniversal\n    second:\n      enabled: 0\n      settings:\n        CPU: x86\n  - first:\n      Standalone: Win\n    second:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n  - first:\n      Standalone: Win64\n    second:\n      enabled: 0\n      settings:\n        CPU: None\n  - first:\n      iPhone: iOS\n    second:\n      enabled: 0\n      settings:\n        AddToEmbeddedBinaries: false\n        CompileFlags: \n        FrameworkDependencies: \n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/x86.meta",
    "content": "fileFormatVersion: 2\nguid: 8b0b0c4ffe67d2f4292c5211de91e55f\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Plugins/x86_64/tolua.dll.meta",
    "content": "fileFormatVersion: 2\nguid: 82bce848ef6ade348a8220c2ada7da08\nPluginImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  isOverridable: 0\n  platformData:\n  - first:\n      '': Any\n    second:\n      enabled: 0\n      settings:\n        Exclude Android: 0\n        Exclude Editor: 0\n        Exclude Linux: 0\n        Exclude Linux64: 0\n        Exclude LinuxUniversal: 0\n        Exclude OSXUniversal: 0\n        Exclude Win: 0\n        Exclude Win64: 0\n        Exclude iOS: 0\n  - first:\n      '': OSXIntel\n    second:\n      enabled: 0\n      settings:\n        CPU: None\n  - first:\n      '': OSXIntel64\n    second:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n  - first:\n      Android: Android\n    second:\n      enabled: 1\n      settings:\n        CPU: ARMv7\n  - first:\n      Any: \n    second:\n      enabled: 0\n      settings: {}\n  - first:\n      Editor: Editor\n    second:\n      enabled: 1\n      settings:\n        CPU: x86_64\n        DefaultValueInitialized: true\n        OS: AnyOS\n  - first:\n      Facebook: Win\n    second:\n      enabled: 0\n      settings:\n        CPU: None\n  - first:\n      Facebook: Win64\n    second:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n  - first:\n      Standalone: Linux\n    second:\n      enabled: 1\n      settings:\n        CPU: None\n  - first:\n      Standalone: Linux64\n    second:\n      enabled: 1\n      settings:\n        CPU: x86_64\n  - first:\n      Standalone: LinuxUniversal\n    second:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n  - first:\n      Standalone: OSXUniversal\n    second:\n      enabled: 1\n      settings:\n        CPU: x86_64\n  - first:\n      Standalone: Win\n    second:\n      enabled: 1\n      settings:\n        CPU: None\n  - first:\n      Standalone: Win64\n    second:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n  - first:\n      iPhone: iOS\n    second:\n      enabled: 1\n      settings:\n        AddToEmbeddedBinaries: false\n        CompileFlags: \n        FrameworkDependencies: \n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Plugins/x86_64.meta",
    "content": "fileFormatVersion: 2\nguid: 7ea0a8e1f899b1148badb9e92b431566\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Plugins.meta",
    "content": "fileFormatVersion: 2\nguid: e34dc6e361156f0439e74fa578a45650\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/Source/Generate.meta",
    "content": "fileFormatVersion: 2\nguid: 31754e6228da68f4685ee6a121455def\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/Source/LuaConst.cs",
    "content": "﻿using UnityEngine;\n\npublic static class LuaConst\n{\n    public static string luaDir = Application.dataPath + \"/Lua\";                //lua逻辑代码目录\n    public static string toluaDir = Application.dataPath + \"/ToLua/Lua\";        //tolua lua文件目录\n\n#if UNITY_STANDALONE\n    public static string osDir = \"Win\";\n#elif UNITY_ANDROID\n    public static string osDir = \"Android\";            \n#elif UNITY_IPHONE\n    public static string osDir = \"iOS\";        \n#else\n    public static string osDir = \"\";        \n#endif\n\n    public static string luaResDir = string.Format(\"{0}/{1}/Lua\", Application.persistentDataPath, osDir);      //手机运行时lua文件下载目录    \n\n#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN    \n    public static string zbsDir = \"D:/ZeroBraneStudio/lualibs/mobdebug\";        //ZeroBraneStudio目录       \n#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX\n\tpublic static string zbsDir = \"/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/mobdebug\";\n#else\n    public static string zbsDir = luaResDir + \"/mobdebug/\";\n#endif    \n\n    public static bool openLuaSocket = true;            //是否打开Lua Socket库\n    public static bool openLuaDebugger = false;         //是否连接lua调试器\n}"
  },
  {
    "path": "Assets/Source/LuaConst.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 35b0c8bef181f2d4dacd3c860eb546a7\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/Source.meta",
    "content": "fileFormatVersion: 2\nguid: 51d939fde26e0e14891f186ff8635b87\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_EventObjectWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class LuaInterface_EventObjectWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(LuaInterface.EventObject), typeof(System.Object));\n\t\tL.RegFunction(\"__add\", op_Addition);\n\t\tL.RegFunction(\"__sub\", op_Subtraction);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Subtraction(IntPtr L)\n\t{\n        try\n        {\n            EventObject arg0 = (EventObject)ToLua.CheckObject(L, 1, typeof(EventObject));\n            arg0.func = ToLua.CheckDelegate(arg0.type, L, 2);\n            arg0.op = EventOp.Sub;\n            ToLua.Push(L, arg0);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Addition(IntPtr L)\n\t{\n        try\n        {\n            EventObject arg0 = (EventObject)ToLua.CheckObject(L, 1, typeof(EventObject));\n            arg0.func = ToLua.CheckDelegate(arg0.type, L, 2);\n            arg0.op = EventOp.Add;\n            ToLua.Push(L, arg0);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_EventObjectWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 9eec90316b4c2da499dee7c75f1f94ae\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaConstructorWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class LuaInterface_LuaConstructorWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(LuaInterface.LuaConstructor), typeof(System.Object));\n\t\tL.RegFunction(\"Call\", Call);\n\t\tL.RegFunction(\"Destroy\", Destroy);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Call(IntPtr L)\n\t{\n\t\ttry\n\t\t{\t\t\t\n\t\t\tLuaConstructor obj = (LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaConstructor));            \n\t\t\treturn obj.Call(L);\t\t\t\t\t\t\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Destroy(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tLuaConstructor obj = (LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaConstructor));\n\t\t\tobj.Destroy();\n            ToLua.Destroy(L);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaConstructorWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: be39bc8579dccd14bb20b24e64a68faf\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaFieldWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class LuaInterface_LuaFieldWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(LuaInterface.LuaField), typeof(System.Object));\n\t\tL.RegFunction(\"Get\", Get);\n\t\tL.RegFunction(\"Set\", Set);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Get(IntPtr L)\n\t{\n\t\ttry\n\t\t{\t\t\t\n\t\t\tLuaField obj = (LuaField)ToLua.CheckObject(L, 1, typeof(LuaField));            \n            return obj.Get(L);\t\t\t\t\t\t\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Set(IntPtr L)\n\t{\n\t\ttry\n\t\t{\t\t\t\n            LuaField obj = (LuaField)ToLua.CheckObject(L, 1, typeof(LuaField));            \n            return obj.Set(L);\n        }\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaFieldWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 58e0ce586689f58419f26062891e1fc1\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaMethodWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class LuaInterface_LuaMethodWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(LuaInterface.LuaMethod), typeof(System.Object));\n\t\tL.RegFunction(\"Destroy\", Destroy);\n\t\tL.RegFunction(\"Call\", Call);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Destroy(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tLuaMethod obj = (LuaMethod)ToLua.CheckObject(L, 1, typeof(LuaMethod));\n\t\t\tobj.Destroy();\n            ToLua.Destroy(L);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Call(IntPtr L)\n\t{\n\t\ttry\n\t\t{\t\t\t\n\t\t\tLuaMethod obj = (LuaMethod)ToLua.CheckObject(L, 1, typeof(LuaMethod));            \n\t\t\treturn obj.Call(L);\t\t\t\t\t\t\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaMethodWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: bd62b7af99a9c284cb3b8c9c8a177e8c\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaOutWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class LuaInterface_LuaOutWrap\n{\n    public static void Register(LuaState L)\n    {\n        L.BeginPreLoad();\n        L.RegFunction(\"tolua.out\", LuaOpen_ToLua_Out);\n        L.EndPreLoad();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int LuaOpen_ToLua_Out(IntPtr L)\n    {\n        try\n        {\n            LuaDLL.lua_newtable(L);\n\n            RawSetOutType<int>(L);\n            RawSetOutType<uint>(L);\n            RawSetOutType<float>(L);\n            RawSetOutType<double>(L);\n            RawSetOutType<long>(L);\n            RawSetOutType<ulong>(L);\n            RawSetOutType<byte>(L);\n            RawSetOutType<sbyte>(L);\n            RawSetOutType<char>(L);\n            RawSetOutType<short>(L);\n            RawSetOutType<ushort>(L);\n            RawSetOutType<bool>(L);\n            RawSetOutType<string>(L);\n\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    static void RawSetOutType<T>(IntPtr L)\n    {\n        string str = TypeTraits<T>.GetTypeName();\n        LuaDLL.lua_pushstring(L, str);\n        ToLua.PushOut<T>(L, new LuaOut<T>());\n        LuaDLL.lua_rawset(L, -3);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaOutWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6ba873a052f57bc45890275ec67bb4dc\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class LuaInterface_LuaPropertyWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(LuaInterface.LuaProperty), typeof(System.Object));\n\t\tL.RegFunction(\"Get\", Get);\n\t\tL.RegFunction(\"Set\", Set);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Get(IntPtr L)\n\t{\n\t\ttry\n\t\t{\t\t\t\n\t\t\tLuaProperty obj = (LuaProperty)ToLua.CheckObject(L, 1, typeof(LuaProperty));            \n            return obj.Get(L);\t\t\t\t\t\t\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Set(IntPtr L)\n\t{\n\t\ttry\n\t\t{\t\t\t\n            LuaProperty obj = (LuaProperty)ToLua.CheckObject(L, 1, typeof(LuaProperty));            \n            return obj.Set(L);\n        }\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5b401947a631ece4487e44f4b8ef9418\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_ArrayWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\nusing UnityEngine;\n\npublic class System_ArrayWrap \n{\n\tpublic static void Register(LuaState L)\n\t{\n      L.BeginClass(typeof(Array), typeof(System.Object));\n      L.RegFunction(\".geti\", get_Item);\n      L.RegFunction(\"get\", get_Item);\n      L.RegFunction(\".seti\", set_Item);\n      L.RegFunction(\"set\", set_Item);\n      L.RegFunction(\"ToTable\", ToTable);\n\t\tL.RegFunction(\"GetLength\", GetLength);\n\t\tL.RegFunction(\"GetLongLength\", GetLongLength);\n\t\tL.RegFunction(\"GetLowerBound\", GetLowerBound);\n\t\tL.RegFunction(\"GetValue\", GetValue);\n\t\tL.RegFunction(\"SetValue\", SetValue);\n\t\tL.RegFunction(\"GetEnumerator\", GetEnumerator);\n\t\tL.RegFunction(\"GetUpperBound\", GetUpperBound);\n\t\tL.RegFunction(\"CreateInstance\", CreateInstance);\n\t\tL.RegFunction(\"BinarySearch\", BinarySearch);\n\t\tL.RegFunction(\"Clear\", Clear);\n\t\tL.RegFunction(\"Clone\", Clone);\n\t\tL.RegFunction(\"Copy\", Copy);\n\t\tL.RegFunction(\"IndexOf\", IndexOf);\n\t\tL.RegFunction(\"Initialize\", Initialize);\n\t\tL.RegFunction(\"LastIndexOf\", LastIndexOf);\n\t\tL.RegFunction(\"Reverse\", Reverse);\n\t\tL.RegFunction(\"Sort\", Sort);\n\t\tL.RegFunction(\"CopyTo\", CopyTo);\n\t\tL.RegFunction(\"ConstrainedCopy\", ConstrainedCopy);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n              L.RegFunction(\"__len\", get_Length);\n              L.RegVar(\"Length\", get_Length, null);\n\t\tL.RegVar(\"LongLength\", get_LongLength, null);\n\t\tL.RegVar(\"Rank\", get_Rank, null);\n\t\tL.RegVar(\"IsSynchronized\", get_IsSynchronized, null);\n\t\tL.RegVar(\"SyncRoot\", get_SyncRoot, null);\n\t\tL.RegVar(\"IsFixedSize\", get_IsFixedSize, null);\n\t\tL.RegVar(\"IsReadOnly\", get_IsReadOnly, null);\n\t\tL.EndClass();\n\t}\n\n    static bool GetPrimitiveValue(IntPtr L, object obj, Type t, int index)\n    {\n        bool flag = true;\n\n        if (t == typeof(System.Single))\n        {\n            float[] array = obj as float[];\n            float ret = array[index];\n            LuaDLL.lua_pushnumber(L, ret);            \n        }\n        else if (t == typeof(System.Int32))\n        {\n            int[] array = obj as int[];\n            int ret = array[index];\n            LuaDLL.lua_pushinteger(L, ret);\n        }\n        else if (t == typeof(System.Double))\n        {\n            double[] array = obj as double[];\n            double ret = array[index];\n            LuaDLL.lua_pushnumber(L, ret);\n        }\n        else if (t == typeof(System.Boolean))\n        {\n            bool[] array = obj as bool[];\n            bool ret = array[index];\n            LuaDLL.lua_pushboolean(L, ret);\n        }\n        else if (t == typeof(System.Int64))\n        {\n            long[] array = obj as long[];\n            long ret = array[index];\n            LuaDLL.tolua_pushint64(L, ret);\n        }\n\t\telse if (t == typeof(System.UInt64))\n\t\t{\n\t\t\tulong[] array = obj as ulong[];\n\t\t\tulong ret = array[index];\n\t\t\tLuaDLL.tolua_pushuint64(L, ret);\n\t\t}\n\t\telse if (t == typeof(System.SByte))\n        {\n            sbyte[] array = obj as sbyte[];\n            sbyte ret = array[index];\n            LuaDLL.lua_pushnumber(L, ret);\n        }\n        else if (t == typeof(System.Byte))\n        {\n            byte[] array = obj as byte[];\n            byte ret = array[index];\n            LuaDLL.lua_pushnumber(L, ret);\n        }\n        else if (t == typeof(System.Int16))\n        {\n            short[] array = obj as short[];\n            short ret = array[index];\n            LuaDLL.lua_pushnumber(L, ret);\n        }\n        else if (t == typeof(System.UInt16))\n        {\n            ushort[] array = obj as ushort[];\n            ushort ret = array[index];\n            LuaDLL.lua_pushnumber(L, ret);\n        }\n        else if (t == typeof(System.Char))\n        {\n            char[] array = obj as char[];\n            char ret = array[index];\n            LuaDLL.lua_pushnumber(L, ret);\n        }\n        else if (t == typeof(System.UInt32))\n        {\n            uint[] array = obj as uint[];\n            uint ret = array[index];\n            LuaDLL.lua_pushnumber(L, ret);\n        }\n        else\n        {\n            flag = false;\n        }\n\n        return flag;\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Item(IntPtr L)\n    {\n        try\n        {\n            Array obj = ToLua.ToObject(L, 1) as Array;\n\n            if (obj == null)\n            {\n                throw new LuaException(\"trying to index an invalid object reference\");                \n            }\n\n            int index = (int)LuaDLL.lua_tointeger(L, 2);\n\n            if (index >= obj.Length)\n            {\n                throw new LuaException(\"array index out of bounds: \" + index + \" \" + obj.Length);                \n            }\n\n            Type t = obj.GetType().GetElementType();\n\n            if (t.IsValueType)\n            {\n                if (t.IsPrimitive)\n                {\n                    if (GetPrimitiveValue(L, obj, t, index))\n                    {\n                        return 1;\n                    }\n                }\n                else if (t == typeof(Vector3))\n                {\n                    Vector3[] array = obj as Vector3[];\n                    Vector3 ret = array[index];\n                    ToLua.Push(L, ret);                    \n                    return 1;\n                }\n                else if (t == typeof(Quaternion))\n                {\n                    Quaternion[] array = obj as Quaternion[];\n                    Quaternion ret = array[index];\n                    ToLua.Push(L, ret);\n                    return 1;                    \n                }\n                else if (t == typeof(Vector2))\n                {\n                    Vector2[] array = obj as Vector2[];\n                    Vector2 ret = array[index];\n                    ToLua.Push(L, ret);\n                    return 1;                    \n                }\n                else if (t == typeof(Vector4))\n                {\n                    Vector4[] array = obj as Vector4[];\n                    Vector4 ret = array[index];\n                    ToLua.Push(L, ret);\n                    return 1;                    \n                }\n                else if (t == typeof(Color))\n                {\n                    Color[] array = obj as Color[];\n                    Color ret = array[index];\n                    ToLua.Push(L, ret);\n                    return 1;                    \n                }\n            }            \n\n            object val = obj.GetValue(index);\n            ToLua.Push(L, val);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    static bool SetPrimitiveValue(IntPtr L, object obj, Type t, int index)\n    {\n        bool flag = true;\n\n        if (t == typeof(System.Single))\n        {\n            float[] array = obj as float[];\n            float val = (float)LuaDLL.luaL_checknumber(L, 3);\n            array[index] = val;            \n        }\n        else if (t == typeof(System.Int32))\n        {\n            int[] array = obj as int[];\n            int val = (int)LuaDLL.luaL_checkinteger(L, 3);\n            array[index] = val;\n        }\n        else if (t == typeof(System.Double))\n        {\n            double[] array = obj as double[];\n            double val = LuaDLL.luaL_checknumber(L, 3);\n            array[index] = val;\n        }\n        else if (t == typeof(System.Boolean))\n        {\n            bool[] array = obj as bool[];\n            bool val = LuaDLL.luaL_checkboolean(L, 3);\n            array[index] = val;\n        }\n        else if (t == typeof(System.Int64))\n        {\n            long[] array = obj as long[];\n            long val = LuaDLL.tolua_toint64(L, 3);\n            array[index] = val;\n        }\n\t\telse if (t == typeof(System.UInt64))\n\t\t{\n\t\t\tulong[] array = obj as ulong[];\n\t\t\tulong val = LuaDLL.tolua_touint64(L, 3);\n\t\t\tarray[index] = val;\n\t\t}\n\t\telse if (t == typeof(System.SByte))\n        {\n            sbyte[] array = obj as sbyte[];\n            sbyte val = (sbyte)LuaDLL.luaL_checknumber(L, 3);\n            array[index] = val;\n        }\n        else if (t == typeof(System.Byte))\n        {\n            byte[] array = obj as byte[];\n            byte val = (byte)LuaDLL.luaL_checknumber(L, 3);\n            array[index] = val;\n        }\n        else if (t == typeof(System.Int16))\n        {\n            short[] array = obj as short[];\n            short val = (short)LuaDLL.luaL_checknumber(L, 3);\n            array[index] = val;\n        }\n        else if (t == typeof(System.UInt16))\n        {\n            ushort[] array = obj as ushort[];\n            ushort val = (ushort)LuaDLL.luaL_checknumber(L, 3);\n            array[index] = val;\n        }\n        else if (t == typeof(System.Char))\n        {\n            char[] array = obj as char[];\n            char val = (char)LuaDLL.luaL_checknumber(L, 3);\n            array[index] = val;\n        }\n        else if (t == typeof(System.UInt32))\n        {\n            uint[] array = obj as uint[];\n            uint val = (uint)LuaDLL.luaL_checknumber(L, 3);\n            array[index] = val;\n        }\n        else\n        {\n            flag = false;\n        }\n\n        return flag;\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int set_Item(IntPtr L)\n    {\n        try\n        {\n            Array obj = ToLua.ToObject(L, 1) as Array;\n\n            if (obj == null)\n            {\n                throw new LuaException(\"trying to index an invalid object reference\");\n            }\n\n            int index = (int)LuaDLL.lua_tointeger(L, 2);            \n            Type t = obj.GetType().GetElementType();\n\n            if (t.IsValueType)\n            {\n                if (t.IsPrimitive)\n                {\n                    if (SetPrimitiveValue(L, obj, t, index))\n                    {\n                        return 0;\n                    }\n                }\n                else if (t == typeof(Vector3))\n                {\n                    Vector3[] array = obj as Vector3[];\n                    Vector3 val = ToLua.ToVector3(L, 3);\n                    array[index] = val;\n                    return 0;\n                }\n                else if (t == typeof(Quaternion))\n                {\n                    Quaternion[] array = obj as Quaternion[];\n                    Quaternion val = ToLua.ToQuaternion(L, 3);\n                    array[index] = val;\n                    return 0;\n                }\n                else if (t == typeof(Vector2))\n                {\n                    Vector2[] array = obj as Vector2[];\n                    Vector2 val = ToLua.ToVector2(L, 3);\n                    array[index] = val;\n                    return 0;\n                }\n                else if (t == typeof(Vector4))\n                {\n                    Vector4[] array = obj as Vector4[];\n                    Vector4 val = ToLua.ToVector4(L, 3);\n                    array[index] = val;\n                    return 0;\n                }\n                else if (t == typeof(Color))\n                {\n                    Color[] array = obj as Color[];\n                    Color val = ToLua.ToColor(L, 3);\n                    array[index] = val;\n                    return 0;\n                }\n            }\n\n            if (!TypeChecker.CheckType(L, t, 3))\n            {                                \n                return LuaDLL.luaL_typerror(L, 3, LuaMisc.GetTypeName(t));\n            }\n\n            object v = ToLua.CheckVarObject(L, 3, t);\n            v = TypeChecker.ChangeType(v, t);\n            obj.SetValue(v, index);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Length(IntPtr L)\n    {\n        try\n        {\n            Array obj = ToLua.ToObject(L, 1) as Array;\n\n            if (obj == null)\n            {\n                throw new LuaException(\"trying to index an invalid object reference\");                \n            }\n\n            LuaDLL.lua_pushinteger(L, obj.Length);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int ToTable(IntPtr L)\n    {\n        try\n        {\n            Array obj = ToLua.ToObject(L, 1) as Array;\n\n            if (obj == null)\n            {\n                throw new LuaException(\"trying to index an invalid object reference\");                \n            }\n\n            LuaDLL.lua_createtable(L, obj.Length, 0);\n            Type t = obj.GetType().GetElementType();\n\n            if (t.IsValueType)\n            {\n                if (t.IsPrimitive)\n                {\n                    if (t == typeof(System.Single))\n                    {\n                        float[] array = obj as float[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            float ret = array[i];\n                            LuaDLL.lua_pushnumber(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.Int32))\n                    {\n                        int[] array = obj as int[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            int ret = array[i];\n                            LuaDLL.lua_pushinteger(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.Double))\n                    {\n                        double[] array = obj as double[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            double ret = array[i];\n                            LuaDLL.lua_pushnumber(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.Boolean))\n                    {\n                        bool[] array = obj as bool[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            bool ret = array[i];\n                            LuaDLL.lua_pushboolean(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.Int64))\n                    {\n                        long[] array = obj as long[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            long ret = array[i];\n                            LuaDLL.tolua_pushint64(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n\t\t\t\t\telse if (t == typeof(System.UInt64))\n\t\t\t\t\t{\n\t\t\t\t\t\tulong[] array = obj as ulong[];\n\n\t\t\t\t\t\tfor (int i = 0; i < array.Length; i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tulong ret = array[i];\n\t\t\t\t\t\t\tLuaDLL.tolua_pushuint64(L, ret);\n\t\t\t\t\t\t\tLuaDLL.lua_rawseti(L, -2, i + 1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (t == typeof(System.Byte))\n                    {\n                        byte[] array = obj as byte[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            byte ret = array[i];\n                            LuaDLL.lua_pushnumber(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.SByte))\n                    {\n                        sbyte[] array = obj as sbyte[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            sbyte ret = array[i];\n                            LuaDLL.lua_pushnumber(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.Char))\n                    {\n                        char[] array = obj as char[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            char ret = array[i];\n                            LuaDLL.lua_pushnumber(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.UInt32))\n                    {\n                        uint[] array = obj as uint[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            uint ret = array[i];\n                            LuaDLL.lua_pushnumber(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.Int16))\n                    {\n                        short[] array = obj as short[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            short ret = array[i];\n                            LuaDLL.lua_pushnumber(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                    else if (t == typeof(System.UInt16))\n                    {\n                        ushort[] array = obj as ushort[];\n\n                        for (int i = 0; i < array.Length; i++)\n                        {\n                            ushort ret = array[i];\n                            LuaDLL.lua_pushnumber(L, ret);\n                            LuaDLL.lua_rawseti(L, -2, i + 1);\n                        }\n\n                        return 1;\n                    }\n                }\n                else if (t == typeof(Vector3))\n                {\n                    Vector3[] array = obj as Vector3[];\n\n                    for (int i = 0; i < array.Length; i++)\n                    {\n                        Vector3 ret = array[i];\n                        ToLua.Push(L, ret);\n                        LuaDLL.lua_rawseti(L, -2, i + 1);\n                    }\n\n                    return 1;\n                }\n                else if (t == typeof(Quaternion))\n                {\n                    Quaternion[] array = obj as Quaternion[];\n\n                    for (int i = 0; i < array.Length; i++)\n                    {\n                        Quaternion ret = array[i];\n                        ToLua.Push(L, ret);\n                        LuaDLL.lua_rawseti(L, -2, i + 1);\n                    }\n\n                    return 1;\n                }\n                else if (t == typeof(Vector2))\n                {\n                    Vector2[] array = obj as Vector2[];\n\n                    for (int i = 0; i < array.Length; i++)\n                    {\n                        Vector2 ret = array[i];\n                        ToLua.Push(L, ret);\n                        LuaDLL.lua_rawseti(L, -2, i + 1);\n                    }\n\n                    return 1;\n                }\n                else if (t == typeof(Vector4))\n                {\n                    Vector4[] array = obj as Vector4[];\n\n                    for (int i = 0; i < array.Length; i++)\n                    {\n                        Vector4 ret = array[i];\n                        ToLua.Push(L, ret);\n                        LuaDLL.lua_rawseti(L, -2, i + 1);\n                    }\n\n                    return 1;\n                }\n                else if (t == typeof(Color))\n                {\n                    Color[] array = obj as Color[];\n\n                    for (int i = 0; i < array.Length; i++)\n                    {\n                        Color ret = array[i];\n                        ToLua.Push(L, ret);\n                        LuaDLL.lua_rawseti(L, -2, i + 1);\n                    }\n\n                    return 1;\n                }\n            }\n\n\n            for (int i = 0; i < obj.Length; i++)\n            {\n                object val = obj.GetValue(i);\n                ToLua.Push(L, val);\n                LuaDLL.lua_rawseti(L, -2, i + 1);\n            }\n\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetLength(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint o = obj.GetLength(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetLongLength(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tlong o = obj.GetLongLength(arg0);\n            LuaDLL.lua_pushnumber(L, o);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetLowerBound(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint o = obj.GetLowerBound(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetValue(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);            \n\n            if (count == 2 && TypeChecker.CheckTypes<long>(L, 2))\n\t\t\t{\n                System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n                long arg0 = (long)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tobject o = obj.GetValue(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<long, long>(L, 2))\n\t\t\t{\n                System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n                long arg0 = (long)LuaDLL.lua_tonumber(L, 2);\n                long arg1 = (long)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tobject o = obj.GetValue(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<int, int>(L, 2))\n\t\t\t{\n                System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tobject o = obj.GetValue(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<long, long, long>(L, 2))\n\t\t\t{\n                System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n                long arg0 = (long)LuaDLL.lua_tonumber(L, 2);\n                long arg1 = (long)LuaDLL.lua_tonumber(L, 3);\n                long arg2 = (long)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tobject o = obj.GetValue(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<int, int, int>(L, 2))\n\t\t\t{\n                System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tobject o = obj.GetValue(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckParamsType<long>(L, 2, count - 1))\n\t\t\t{\n                System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n                long[] arg0 = ToLua.ToParamsNumber<long>(L, 2, count - 1);\n\t\t\t\tobject o = obj.GetValue(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckParamsType<int>(L, 2, count - 1))\n\t\t\t{\n                System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n                int[] arg0 = ToLua.ToParamsNumber<int>(L, 2, count - 1);\n\t\t\t\tobject o = obj.GetValue(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.GetValue\");\n\t\t\t}\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int SetValue(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);            \n\n            if (count == 3 && TypeChecker.CheckTypes<object, long>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Array obj = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType());\n                long arg1 = (long)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tobj.SetValue(arg0, arg1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<object, int, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Array obj = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType());\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tobj.SetValue(arg0, arg1, arg2);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<object, long, long>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Array obj = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType());\n                long arg1 = (long)LuaDLL.lua_tonumber(L, 3);\n                long arg2 = (long)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tobj.SetValue(arg0, arg1, arg2);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 5 && TypeChecker.CheckTypes<object, int, int, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Array obj = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType());\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint arg3 = (int)LuaDLL.lua_tonumber(L, 5);\n\t\t\t\tobj.SetValue(arg0, arg1, arg2, arg3);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 5 && TypeChecker.CheckTypes<object, long, long, long>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Array obj = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType());\n                long arg1 = (long)LuaDLL.lua_tonumber(L, 3);\n                long arg2 = (long)LuaDLL.lua_tonumber(L, 4);\n                long arg3 = (long)LuaDLL.lua_tonumber(L, 5);\n\t\t\t\tobj.SetValue(arg0, arg1, arg2, arg3);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<object>(L, 2) && TypeChecker.CheckParamsType<long>(L, 3, count - 2))\n\t\t\t{\n\t\t\t\tSystem.Array obj = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType());\n\t\t\t\tlong[] arg1 = ToLua.ToParamsNumber<long>(L, 3, count - 2);\n\t\t\t\tobj.SetValue(arg0, arg1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<object>(L, 2) && TypeChecker.CheckParamsType<int>(L, 3, count - 2))\n\t\t\t{\n\t\t\t\tSystem.Array obj = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg0 = ToLua.ToVarObject(L, 2, obj.GetType().GetElementType());\n\t\t\t\tint[] arg1 = ToLua.ToParamsNumber<int>(L, 3, count - 2);\n\t\t\t\tobj.SetValue(arg0, arg1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.SetValue\");\n\t\t\t}\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumerator(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n            System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n            System.Collections.IEnumerator o = obj.GetEnumerator();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetUpperBound(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint o = obj.GetUpperBound(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CreateInstance(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);            \n\n            if (count == 2 && TypeChecker.CheckTypes<System.Type, int>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tSystem.Array o = System.Array.CreateInstance(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<System.Type, int[], int[]>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tint[] arg1 = ToLua.CheckNumberArray<int>(L, 2);\n\t\t\t\tint[] arg2 = ToLua.CheckNumberArray<int>(L, 3);\n\t\t\t\tSystem.Array o = System.Array.CreateInstance(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<System.Type, int, int>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tSystem.Array o = System.Array.CreateInstance(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<System.Type, int, int, int>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg3 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tSystem.Array o = System.Array.CreateInstance(arg0, arg1, arg2, arg3);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<System.Type>(L, 1) && TypeChecker.CheckParamsType<long>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tlong[] arg1 = ToLua.ToParamsNumber<long>(L, 2, count - 1);\n\t\t\t\tSystem.Array o = System.Array.CreateInstance(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<System.Type>(L, 1) && TypeChecker.CheckParamsType<int>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tint[] arg1 = ToLua.ToParamsNumber<int>(L, 2, count - 1);\n\t\t\t\tSystem.Array o = System.Array.CreateInstance(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.CreateInstance\");\n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int BinarySearch(IntPtr L)\n\t{\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 2)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType());\n                int o = System.Array.BinarySearch(arg0, arg1);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else if (count == 3)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType());\n                System.Collections.IComparer arg2 = (System.Collections.IComparer)ToLua.CheckObject<System.Collections.IComparer>(L, 3);\n                int o = System.Array.BinarySearch(arg0, arg1, arg2);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else if (count == 4)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n                object arg3 = ToLua.ToVarObject(L, 4, arg0.GetType().GetElementType());\n                int o = System.Array.BinarySearch(arg0, arg1, arg2, arg3);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else if (count == 5)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n                object arg3 = ToLua.ToVarObject(L, 4, arg0.GetType().GetElementType());\n                System.Collections.IComparer arg4 = (System.Collections.IComparer)ToLua.CheckObject<System.Collections.IComparer>(L, 5);\n                int o = System.Array.BinarySearch(arg0, arg1, arg2, arg3, arg4);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.BinarySearch\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Clear(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Array arg0 = (System.Array)ToLua.CheckObject(L, 1, typeof(System.Array));\n\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\tSystem.Array.Clear(arg0, arg1, arg2);\n\t\t\treturn 0;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Clone(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n            System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n            object o = obj.Clone();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Copy(IntPtr L)\n\t{\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 3)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                System.Array arg1 = (System.Array)ToLua.CheckObject<System.Array>(L, 2);\n                long arg2 = LuaDLL.tolua_checkint64(L, 3);\n                System.Array.Copy(arg0, arg1, arg2);\n                return 0;\n            }\n            else if (count == 5 && TypeChecker.CheckTypes<long, System.Array, long, long>(L, 2))\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                long arg1 = LuaDLL.tolua_toint64(L, 2);\n                System.Array arg2 = (System.Array)ToLua.ToObject(L, 3);\n                long arg3 = LuaDLL.tolua_toint64(L, 4);\n                long arg4 = LuaDLL.tolua_toint64(L, 5);\n                System.Array.Copy(arg0, arg1, arg2, arg3, arg4);\n                return 0;\n            }\n            else if (count == 5 && TypeChecker.CheckTypes<int, System.Array, int, int>(L, 2))\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                int arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n                System.Array arg2 = (System.Array)ToLua.ToObject(L, 3);\n                int arg3 = (int)LuaDLL.lua_tonumber(L, 4);\n                int arg4 = (int)LuaDLL.lua_tonumber(L, 5);\n                System.Array.Copy(arg0, arg1, arg2, arg3, arg4);\n                return 0;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.Copy\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IndexOf(IntPtr L)\n\t{\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 2)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType());\n                int o = System.Array.IndexOf(arg0, arg1);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else if (count == 3)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType());\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n                int o = System.Array.IndexOf(arg0, arg1, arg2);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else if (count == 4)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType());\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n                int arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n                int o = System.Array.IndexOf(arg0, arg1, arg2, arg3);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.IndexOf\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Initialize(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n            System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n            obj.Initialize();\n\t\t\treturn 0;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int LastIndexOf(IntPtr L)\n\t{\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 2)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType());\n                int o = System.Array.LastIndexOf(arg0, arg1);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else if (count == 3)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType());\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n                int o = System.Array.LastIndexOf(arg0, arg1, arg2);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else if (count == 4)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                object arg1 = ToLua.ToVarObject(L, 2, arg0.GetType().GetElementType());\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n                int arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n                int o = System.Array.LastIndexOf(arg0, arg1, arg2, arg3);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.LastIndexOf\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Reverse(IntPtr L)\n\t{\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                System.Array.Reverse(arg0);\n                return 0;\n            }\n            else if (count == 3)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n                System.Array.Reverse(arg0, arg1, arg2);\n                return 0;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.Reverse\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Sort(IntPtr L)\n\t{\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                System.Array.Sort(arg0);\n                return 0;\n            }\n            else if (count == 2 && TypeChecker.CheckTypes<System.Collections.IComparer>(L, 2))\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                System.Collections.IComparer arg1 = (System.Collections.IComparer)ToLua.ToObject(L, 2);\n                System.Array.Sort(arg0, arg1);\n                return 0;\n            }\n            else if (count == 2 && TypeChecker.CheckTypes<System.Array>(L, 2))\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                System.Array arg1 = (System.Array)ToLua.ToObject(L, 2);\n                System.Array.Sort(arg0, arg1);\n                return 0;\n            }\n            else if (count == 3 && TypeChecker.CheckTypes<System.Array, System.Collections.IComparer>(L, 2))\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                System.Array arg1 = (System.Array)ToLua.ToObject(L, 2);\n                System.Collections.IComparer arg2 = (System.Collections.IComparer)ToLua.ToObject(L, 3);\n                System.Array.Sort(arg0, arg1, arg2);\n                return 0;\n            }\n            else if (count == 3 && TypeChecker.CheckTypes<int, int>(L, 2))\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                int arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n                int arg2 = (int)LuaDLL.lua_tonumber(L, 3);\n                System.Array.Sort(arg0, arg1, arg2);\n                return 0;\n            }\n            else if (count == 4 && TypeChecker.CheckTypes<int, int, System.Collections.IComparer>(L, 2))\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                int arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n                int arg2 = (int)LuaDLL.lua_tonumber(L, 3);\n                System.Collections.IComparer arg3 = (System.Collections.IComparer)ToLua.ToObject(L, 4);\n                System.Array.Sort(arg0, arg1, arg2, arg3);\n                return 0;\n            }\n            else if (count == 4 && TypeChecker.CheckTypes<System.Array, int, int>(L, 2))\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                System.Array arg1 = (System.Array)ToLua.ToObject(L, 2);\n                int arg2 = (int)LuaDLL.lua_tonumber(L, 3);\n                int arg3 = (int)LuaDLL.lua_tonumber(L, 4);\n                System.Array.Sort(arg0, arg1, arg2, arg3);\n                return 0;\n            }\n            else if (count == 5)\n            {\n                System.Array arg0 = (System.Array)ToLua.CheckObject<System.Array>(L, 1);\n                System.Array arg1 = (System.Array)ToLua.CheckObject<System.Array>(L, 2);\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n                int arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n                System.Collections.IComparer arg4 = (System.Collections.IComparer)ToLua.CheckObject<System.Collections.IComparer>(L, 5);\n                System.Array.Sort(arg0, arg1, arg2, arg3, arg4);\n                return 0;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Array.Sort\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CopyTo(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n            System.Array obj = (System.Array)ToLua.CheckObject<Array>(L, 1);\n            System.Array arg0 = (System.Array)ToLua.CheckObject<Array>(L, 2);\n            long arg1 = (long)LuaDLL.luaL_checknumber(L, 3);\n\t\t\tobj.CopyTo(arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ConstrainedCopy(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 5);\n\t\t\tSystem.Array arg0 = (System.Array)ToLua.CheckObject<Array>(L, 1);\n\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tSystem.Array arg2 = (System.Array)ToLua.CheckObject<Array>(L, 3);\n\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\tint arg4 = (int)LuaDLL.luaL_checknumber(L, 5);\n\t\t\tSystem.Array.ConstrainedCopy(arg0, arg1, arg2, arg3, arg4);\n\t\t\treturn 0;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_LongLength(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Array obj = (System.Array)o;\n\t\t\tlong ret = obj.LongLength;\n            LuaDLL.lua_pushnumber(L, ret);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index LongLength on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Rank(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Array obj = (System.Array)o;\n\t\t\tint ret = obj.Rank;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Rank on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsSynchronized(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Array obj = (System.Array)o;\n\t\t\tbool ret = obj.IsSynchronized;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsSynchronized on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_SyncRoot(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Array obj = (System.Array)o;\n\t\t\tobject ret = obj.SyncRoot;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index SyncRoot on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsFixedSize(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Array obj = (System.Array)o;\n\t\t\tbool ret = obj.IsFixedSize;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsFixedSize on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsReadOnly(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Array obj = (System.Array)o;\n\t\t\tbool ret = obj.IsReadOnly;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsReadOnly on a nil value\");\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_ArrayWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 270e5e13dbb276c47a14c00ec09f9254\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\nusing System.Collections.Generic;\nusing System.Runtime.Serialization;\nusing System.Collections;\n\npublic class System_Collections_Generic_DictionaryWrap\n{\n    public static void Register(LuaState L)\n    {\n        L.BeginClass(typeof(Dictionary<,>), typeof(System.Object), \"Dictionary\");\n        L.RegFunction(\"get_Item\", get_Item);\n        L.RegFunction(\"get\", get_Item);\n        L.RegFunction(\"set_Item\", set_Item);\n        L.RegFunction(\"set\", set_Item);\n        L.RegFunction(\".geti\", _geti);\n        L.RegFunction(\".seti\", _seti);\n        L.RegFunction(\"Add\", Add);\n        L.RegFunction(\"Clear\", Clear);\n        L.RegFunction(\"ContainsKey\", ContainsKey);\n        L.RegFunction(\"ContainsValue\", ContainsValue);\n        L.RegFunction(\"GetObjectData\", GetObjectData);\n        L.RegFunction(\"OnDeserialization\", OnDeserialization);\n        L.RegFunction(\"Remove\", Remove);\n        L.RegFunction(\"TryGetValue\", TryGetValue);\n        L.RegFunction(\"GetEnumerator\", GetEnumerator);\n        L.RegVar(\"this\", _this, null);\n        L.RegFunction(\"__tostring\", ToLua.op_ToString);\n        L.RegVar(\"Count\", get_Count, null);\n        L.RegVar(\"Comparer\", get_Comparer, null);\n        L.RegVar(\"Keys\", get_Keys, null);\n        L.RegVar(\"Values\", get_Values, null);\n        L.EndClass();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int _get_this(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type kt = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt);\n            object arg0 = ToLua.CheckVarObject(L, 2, kt);\n            object o = LuaMethodCache.CallSingleMethod(\"get_Item\", obj, arg0);\n            ToLua.Push(L, o);\n            return 1;\n\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int _set_this(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            Type kt, vt;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt);\n            object arg0 = ToLua.CheckVarObject(L, 2, kt);\n            object arg1 = ToLua.CheckVarObject(L, 3, vt);\n            LuaMethodCache.CallSingleMethod(\"set_Item\", obj, arg0, arg1);\n            return 0;\n\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int _this(IntPtr L)\n    {\n        try\n        {\n            LuaDLL.lua_pushvalue(L, 1);\n            LuaDLL.tolua_bindthis(L, _get_this, _set_this);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Item(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type kt = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt);\n            object arg0 = ToLua.CheckVarObject(L, 2, kt);\n            object o = LuaMethodCache.CallSingleMethod(\"get_Item\", obj, arg0);\n            ToLua.Push(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int set_Item(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            Type kt, vt;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt);\n            object arg0 = ToLua.CheckVarObject(L, 2, kt);\n            object arg1 = ToLua.CheckVarObject(L, 3, vt);\n            LuaMethodCache.CallSingleMethod(\"set_Item\", obj, arg0, arg1);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int _geti(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type kt = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt);\n\n            if (kt != typeof(int))\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                object arg0 = ToLua.CheckVarObject(L, 2, kt);\n                object o = LuaMethodCache.CallSingleMethod(\"get_Item\", obj, arg0);\n                ToLua.Push(L, o);\n            }\n\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int _seti(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            Type kt, vt;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt);\n\n            if (kt == typeof(int))\n            {\n                object arg0 = ToLua.CheckVarObject(L, 2, kt);\n                object arg1 = ToLua.CheckVarObject(L, 3, vt);\n                LuaMethodCache.CallSingleMethod(\"set_Item\", obj, arg0, arg1);\n            }\n\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Add(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            Type kt, vt;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt);\n            object arg0 = ToLua.CheckVarObject(L, 2, kt);\n            object arg1 = ToLua.CheckVarObject(L, 3, vt);\n            LuaMethodCache.CallSingleMethod(\"Add\", obj, arg0, arg1);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Clear(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 1);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>));\n            LuaMethodCache.CallSingleMethod(\"Clear\", obj);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int ContainsKey(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type kt;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt);\n            object arg0 = ToLua.CheckVarObject(L, 2, kt);\n            bool o = (bool)LuaMethodCache.CallSingleMethod(\"ContainsKey\", obj, arg0);\n            LuaDLL.lua_pushboolean(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int ContainsValue(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type kt, vt;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt, out vt);\n            object arg0 = ToLua.CheckVarObject(L, 2, vt);\n            bool o = (bool)LuaMethodCache.CallSingleMethod(\"ContainsValue\", obj, arg0);\n            LuaDLL.lua_pushboolean(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int GetObjectData(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>));\n            SerializationInfo arg0 = (SerializationInfo)ToLua.CheckObject(L, 2, typeof(SerializationInfo));\n            StreamingContext arg1 = (StreamingContext)ToLua.CheckObject(L, 3, typeof(StreamingContext));\n            LuaMethodCache.CallSingleMethod(\"GetObjectData\", obj, arg0, arg1);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int OnDeserialization(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>));\n            object arg0 = ToLua.ToVarObject(L, 2);\n            LuaMethodCache.CallSingleMethod(\"OnDeserialization\", obj, arg0);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Remove(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type kt;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt);\n            object arg0 = ToLua.CheckVarObject(L, 2, kt);\n            bool o = (bool)LuaMethodCache.CallSingleMethod(\"Remove\", obj, arg0);\n            LuaDLL.lua_pushboolean(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int TryGetValue(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            Type kt;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>), out kt);\n            object arg0 = ToLua.CheckVarObject(L, 2, kt);\n            object arg1 = null;\n            object[] args = new object[] { arg0, arg1 };\n            bool o = (bool)LuaMethodCache.CallSingleMethod(\"TryGetValue\", obj, args);\n            LuaDLL.lua_pushboolean(L, o);\n            ToLua.Push(L, args[1]);\n            return 2;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int GetEnumerator(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 1);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>));\n            IEnumerator o = (IEnumerator)LuaMethodCache.CallSingleMethod(\"GetEnumerator\", obj);\n            ToLua.Push(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Count(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            int ret = (int)LuaMethodCache.CallSingleMethod(\"get_Count\", o);\n            LuaDLL.lua_pushinteger(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Count on a nil value\");\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Comparer(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            object ret = LuaMethodCache.CallSingleMethod(\"get_Comparer\", o);\n            ToLua.PushObject(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Comparer on a nil value\");\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Keys(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            object ret = LuaMethodCache.CallSingleMethod(\"get_Keys\", o);\n            ToLua.PushObject(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Keys on a nil value\");\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Values(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            object ret = LuaMethodCache.CallSingleMethod(\"get_Values\", o);\n            ToLua.PushObject(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Values on a nil value\");\n        }\n    }\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_DictionaryWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 973a63c864c67f34b852be1021aa8445\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\nusing System.Collections.Generic;\nusing System.Collections;\n\npublic class System_Collections_Generic_Dictionary_KeyCollectionWrap\n{\n    public static void Register(LuaState L)\n    {\n        L.BeginClass(typeof(Dictionary<,>.KeyCollection), typeof(System.Object), \"KeyCollection\");\n        L.RegFunction(\"CopyTo\", CopyTo);\n        L.RegFunction(\"GetEnumerator\", GetEnumerator);\n        L.RegFunction(\"New\", _CreateSystem_Collections_Generic_Dictionary_KeyCollection);\n        L.RegFunction(\"__tostring\", ToLua.op_ToString);\n        L.RegVar(\"Count\", get_Count, null);\n        L.EndClass();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int _CreateSystem_Collections_Generic_Dictionary_KeyCollection(IntPtr L)\n    {\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                object arg0 = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>));\n                Type kc = arg0.GetType().GetNestedType(\"KeyCollection\");\n                object obj = Activator.CreateInstance(kc, arg0);\n                ToLua.PushObject(L, obj);\n                return 1;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: System.Collections.Generic.Dictionary.KeyCollection.New\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int CopyTo(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            Type kt = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>.KeyCollection), out kt);\n            object arg0 = ToLua.CheckObject(L, 2, kt.MakeArrayType());\n            int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n            LuaMethodCache.CallSingleMethod(\"CopyTo\", obj, arg0, arg1);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int GetEnumerator(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 1);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>.KeyCollection));\n            IEnumerator o = (IEnumerator)LuaMethodCache.CallSingleMethod(\"GetEnumerator\", obj);\n            ToLua.Push(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Count(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            int ret = (int)LuaMethodCache.CallSingleMethod(\"get_Count\", o);\n            LuaDLL.lua_pushinteger(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Count on a nil value\");\n        }\n    }\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_Dictionary_KeyCollectionWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b5a969e41ba260d4197ec05de2e0b107\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\nusing System.Collections.Generic;\nusing System.Collections;\n\npublic class System_Collections_Generic_Dictionary_ValueCollectionWrap\n{\n    public static void Register(LuaState L)\n    {\n        L.BeginClass(typeof(Dictionary<,>.ValueCollection), typeof(System.Object), \"ValueCollection\");\n        L.RegFunction(\"CopyTo\", CopyTo);\n        L.RegFunction(\"GetEnumerator\", GetEnumerator);\n        L.RegFunction(\"New\", _CreateSystem_Collections_Generic_Dictionary_ValueCollection);\n        L.RegFunction(\"__tostring\", ToLua.op_ToString);\n        L.RegVar(\"Count\", get_Count, null);\n        L.EndClass();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int _CreateSystem_Collections_Generic_Dictionary_ValueCollection(IntPtr L)\n    {\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                object arg0 = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>));\n                Type kv = arg0.GetType().GetNestedType(\"ValueCollection\");\n                object obj = Activator.CreateInstance(kv, arg0);\n                ToLua.PushObject(L, obj);\n                return 1;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: System.Collections.Generic.Dictionary.ValueCollection.New\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int CopyTo(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            Type kt, kv;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>.ValueCollection), out kt, out kv);\n            object arg0 = ToLua.CheckObject(L, 2, kv.MakeArrayType());\n            int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n            LuaMethodCache.CallSingleMethod(\"CopyTo\", obj, arg0, arg1);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int GetEnumerator(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 1);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(Dictionary<,>.ValueCollection));\n            IEnumerator o = (IEnumerator)LuaMethodCache.CallSingleMethod(\"GetEnumerator\", obj);\n            ToLua.Push(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Count(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            int ret = (int)LuaMethodCache.CallSingleMethod(\"get_Count\", o);\n            LuaDLL.lua_pushinteger(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Count on a nil value\");\n        }\n    }\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_Dictionary_ValueCollectionWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8b073f28ab535d6478ab1e2f76f44547\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\nusing System.Collections.Generic;\n\npublic class System_Collections_Generic_KeyValuePairWrap\n{\n    public static void Register(LuaState L)\n    {\n        L.BeginClass(typeof(KeyValuePair<,>), null, \"KeyValuePair\");\n        L.RegFunction(\"__tostring\", ToLua.op_ToString);\n        L.RegVar(\"Key\", get_Key, null);\n        L.RegVar(\"Value\", get_Value, null);\n        L.EndClass();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Key(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            object ret = LuaMethodCache.CallSingleMethod(\"get_Key\", o);\n            ToLua.Push(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Key on a nil value\");\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Value(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            object ret = LuaMethodCache.CallSingleMethod(\"get_Value\", o);\n            ToLua.Push(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Value on a nil value\");\n        }\n    }\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_KeyValuePairWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 2bfe26e81faf9a1498eaae521869ecea\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_ListWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing UnityEngine;\nusing System.Collections;\n\npublic class System_Collections_Generic_ListWrap\n{    \n    public static void Register(LuaState L)\n\t{        \n        L.BeginClass(typeof(List<>), typeof(System.Object), \"List\");\n\t\tL.RegFunction(\"Add\", Add);\n\t\tL.RegFunction(\"AddRange\", AddRange);\n\t\tL.RegFunction(\"AsReadOnly\", AsReadOnly);\n\t\tL.RegFunction(\"BinarySearch\", BinarySearch);\n\t\tL.RegFunction(\"Clear\", Clear);\n\t\tL.RegFunction(\"Contains\", Contains);\n\t\tL.RegFunction(\"CopyTo\", CopyTo);\n\t\tL.RegFunction(\"Exists\", Exists);\n\t\tL.RegFunction(\"Find\", Find);\n\t\tL.RegFunction(\"FindAll\", FindAll);\n\t\tL.RegFunction(\"FindIndex\", FindIndex);\n\t\tL.RegFunction(\"FindLast\", FindLast);\n\t\tL.RegFunction(\"FindLastIndex\", FindLastIndex);\n\t\tL.RegFunction(\"ForEach\", ForEach);\n\t\tL.RegFunction(\"GetEnumerator\", GetEnumerator);\n\t\tL.RegFunction(\"GetRange\", GetRange);\n\t\tL.RegFunction(\"IndexOf\", IndexOf);\n\t\tL.RegFunction(\"Insert\", Insert);\n        L.RegFunction(\"InsertRange\", InsertRange);\n        L.RegFunction(\"LastIndexOf\", LastIndexOf);\n\t\t    L.RegFunction(\"Remove\", Remove);\n\t\t    L.RegFunction(\"RemoveAll\", RemoveAll);\n\t\t    L.RegFunction(\"RemoveAt\", RemoveAt);\n\t\t    L.RegFunction(\"RemoveRange\", RemoveRange);\n\t\t    L.RegFunction(\"Reverse\", Reverse);\n\t\t    L.RegFunction(\"Sort\", Sort);\n\t\t    L.RegFunction(\"ToArray\", ToArray);\n\t\t    L.RegFunction(\"TrimExcess\", TrimExcess);\n\t\t    L.RegFunction(\"TrueForAll\", TrueForAll);\n\t\t    L.RegFunction(\"get_Item\", get_Item);\n        L.RegFunction(\"get\", get_Item);\n        L.RegFunction(\"set_Item\", set_Item);\n        L.RegFunction(\"set\", set_Item);\n         L.RegFunction(\".geti\", get_Item);\n         L.RegFunction(\".seti\", set_Item);\n         L.RegFunction(\"__tostring\", ToLua.op_ToString);\n        L.RegFunction(\"__len\", get_Count);\n        L.RegVar(\"Capacity\", get_Capacity, set_Capacity);\n        L.RegVar(\"Count\", get_Count, null);\n         L.EndClass();        \n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Add(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            object arg0 = ToLua.CheckVarObject(L, 2, argType);\n            LuaMethodCache.CallSingleMethod(\"Add\", obj, arg0);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int AddRange(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            object arg0 = ToLua.CheckObject(L, 2, typeof(IEnumerable<>).MakeGenericType(argType));\n            LuaMethodCache.CallSingleMethod(\"AddRange\", obj, arg0);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int AsReadOnly(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            object o = LuaMethodCache.CallSingleMethod(\"AsReadOnly\", obj);            \n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int BinarySearch(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n\n            if (count == 2)\n\t\t\t{                \n                object arg0 = ToLua.CheckVarObject(L, 2, argType);\n                int o = (int)LuaMethodCache.CallMethod(\"BinarySearch\", obj, arg0);                \n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{                \n                object arg0 = ToLua.CheckVarObject(L, 2, argType);\n                object arg1 = ToLua.CheckObject(L, 3, typeof(IComparer<>).MakeGenericType(argType));\n                int o = (int)LuaMethodCache.CallMethod(\"BinarySearch\", obj, arg0, arg1);                \n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n\t\t\t}\n\t\t\telse if (count == 5)\n\t\t\t{\n                int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n                int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n                object arg2 = ToLua.CheckVarObject(L, 4, argType);\n                object arg3 = ToLua.CheckObject(L, 5, typeof(IComparer<>).MakeGenericType(argType));\t\t\t\t\n                int o = (int)LuaMethodCache.CallMethod(\"BinarySearch\", obj, arg0, arg1, arg2, arg3);\n                LuaDLL.lua_pushinteger(L, o);\n                return 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, string.Format(\"invalid arguments to method: List<{0}>.BinarySearch\", LuaMisc.GetTypeName(argType)));\n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Clear(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\t\t\t\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>));\n            LuaMethodCache.CallSingleMethod(\"Clear\", obj);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Contains(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            object arg0 = ToLua.CheckVarObject(L, 2, argType);\n            object o = LuaMethodCache.CallSingleMethod(\"Contains\", obj, arg0);            \n\t\t\tLuaDLL.lua_pushboolean(L, (bool)o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CopyTo(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n\n            if (count == 2)\n\t\t\t{\t\t\t\t                \n                object arg0 = ToLua.CheckObject(L, 2, argType.MakeArrayType());\n                LuaMethodCache.CallMethod(\"CopyTo\", obj, arg0);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{                \n                object arg0 = ToLua.CheckObject(L, 2, argType.MakeArrayType());                \n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n                LuaMethodCache.CallMethod(\"CopyTo\", obj, arg0, arg1);\n                return 0;\n\t\t\t}\n\t\t\telse if (count == 5)\n\t\t\t{\t\t\t\t                \n                int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\t\t\t\t\n                object arg1 = ToLua.CheckObject(L, 3, argType.MakeArrayType());\n                int arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 5);\n                LuaMethodCache.CallMethod(\"CopyTo\", obj, arg0, arg1, arg2, arg3);\n                return 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t\n                return LuaDLL.luaL_throw(L, string.Format(\"invalid arguments to method: List<{0}>.CopyTo\", LuaMisc.GetTypeName(argType)));\n            }\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Exists(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;            \n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);       \n            bool o = (bool)LuaMethodCache.CallMethod(\"Exists\", obj, arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Find(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;            \n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);            \n            object o = LuaMethodCache.CallMethod(\"Find\", obj, arg0);\n            ToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int FindAll(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;            \n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);\n            object o = LuaMethodCache.CallMethod(\"FindAll\", obj, arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int FindIndex(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n\n            if (count == 2)\n\t\t\t{\n                Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);                \n                int o = (int)LuaMethodCache.CallMethod(\"FindIndex\", obj, arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\t\t\t\t\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n                Delegate arg1 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 3);                \n                int o = (int)LuaMethodCache.CallMethod(\"FindIndex\", obj, arg0, arg1);                \n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\t\t\t\t\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\t\t\t\t\n                Delegate arg2 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 4);                \n                int o = (int)LuaMethodCache.CallMethod(\"FindIndex\", obj, arg0, arg1, arg2);\n                LuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n                return LuaDLL.luaL_throw(L, string.Format(\"invalid arguments to method: List<{0}>.FindIndex\", LuaMisc.GetTypeName(argType)));                \n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int FindLast(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;            \n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);            \n            object o = LuaMethodCache.CallSingleMethod(\"FindLast\", obj, arg0);\n            ToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int FindLastIndex(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n            Type argType = null;            \n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n\n            if (count == 2)\n\t\t\t{\t\t\t\t\n\t\t\t\tDelegate arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate<>).MakeGenericType(argType));\t\t\t\t\n                int o = (int)LuaMethodCache.CallMethod(\"FindLastIndex\", obj, arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\t\t\t\t\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tDelegate arg1 = (Delegate)ToLua.CheckObject(L, 3, typeof(System.Predicate<>).MakeGenericType(argType));\t\t\t\t\n                int o = (int)LuaMethodCache.CallMethod(\"FindLastIndex\", obj, arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\t\t\t\t\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\t\t\t\t\n                Delegate arg2 = (Delegate)ToLua.CheckObject(L, 4, typeof(System.Predicate<>).MakeGenericType(argType));\n                int o = (int)LuaMethodCache.CallMethod(\"FindLastIndex\", obj, arg0, arg1, arg2);                \n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\t\t\t\t\n                return LuaDLL.luaL_throw(L, string.Format(\"invalid arguments to method: List<{0}>.FindLastIndex\", LuaMisc.GetTypeName(argType)));\n            }\n        }\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ForEach(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;            \n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);            \n\t\t\tDelegate arg0 = ToLua.CheckDelegate(typeof(System.Action<>).MakeGenericType(argType), L, 2);\t\n            LuaMethodCache.CallSingleMethod(\"ForEach\", obj, arg0);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumerator(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\t\t\t            \n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>));\n            IEnumerator o = LuaMethodCache.CallSingleMethod(\"GetEnumerator\", obj) as IEnumerator;            \n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetRange(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\t\t\t\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>));\n            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\t\t\t\n            object o = LuaMethodCache.CallSingleMethod(\"GetRange\", obj, arg0, arg1);\n\t\t\tToLua.PushObject(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IndexOf(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n\n            if (count == 2)\n\t\t\t{\t\t\t\t\t\t\t\t\n                object arg0 = ToLua.CheckVarObject(L, 2, argType);\n\t\t\t\tint o = (int)LuaMethodCache.CallMethod(\"IndexOf\", obj, arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\t\t\t\t\n                object arg0 = ToLua.CheckVarObject(L, 2, argType);                \n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\t\t\t\t\n                int o = (int)LuaMethodCache.CallMethod(\"IndexOf\", obj, arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n                object arg0 = ToLua.CheckVarObject(L, 2, argType);                \n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\t\t\t\t\n                int o = (int)LuaMethodCache.CallMethod(\"IndexOf\", obj, arg0, arg1, arg2);\n                LuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\t\t\t\t\n                return LuaDLL.luaL_throw(L, string.Format(\"invalid arguments to method: List<{0}>.IndexOf\", LuaMisc.GetTypeName(argType)));\n            }\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Insert(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);            \n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\t\t\t\n            object arg1 = ToLua.CheckVarObject(L, 3, argType);\n            LuaMethodCache.CallSingleMethod(\"Insert\", obj, arg0, arg1);\t\t\t\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int InsertRange(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tIEnumerable arg1 = (IEnumerable)ToLua.CheckObject(L, 3, typeof(IEnumerable<>).MakeGenericType(argType));\n            LuaMethodCache.CallSingleMethod(\"InsertRange\", obj, arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int LastIndexOf(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n\n            if (count == 2)\n\t\t\t{\n                object arg0 = ToLua.CheckVarObject(L, 2, argType);                \n\t\t\t\tint o = (int)LuaMethodCache.CallMethod(\"LastIndexOf\", obj, arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n                object arg0 = ToLua.CheckVarObject(L, 2, argType);\n                int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint o = (int)LuaMethodCache.CallMethod(\"LastIndexOf\", obj, arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n                object arg0 = ToLua.CheckVarObject(L, 2, argType);\n                int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint o = (int)LuaMethodCache.CallMethod(\"LastIndexOf\", obj, arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\t\t\t\t\n                return LuaDLL.luaL_throw(L, string.Format(\"invalid arguments to method: List<{0}>.LastIndexOf\", LuaMisc.GetTypeName(argType)));\n            }\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Remove(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            object arg0 = ToLua.CheckVarObject(L, 2, argType);\n            bool o = (bool)LuaMethodCache.CallSingleMethod(\"Remove\", obj, arg0);\t\t\t\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int RemoveAll(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);            \n\t\t\tDelegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);\n\t\t\tint o = (int)LuaMethodCache.CallSingleMethod(\"RemoveAll\", obj, arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int RemoveAt(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>));            \n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n            LuaMethodCache.CallSingleMethod(\"RemoveAt\", obj, arg0);\t\t\t\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int RemoveRange(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>));\n            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n            LuaMethodCache.CallSingleMethod(\"RemoveRange\", obj, arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Reverse(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n\n            if (count == 1)\n\t\t\t{\n                LuaMethodCache.CallMethod(\"Reverse\", obj);\t\t\t\t\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\t\t\t\t\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n                LuaMethodCache.CallMethod(\"Reverse\", obj, arg0, arg1);                \n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\t\t\t\t\n                return LuaDLL.luaL_throw(L, string.Format(\"invalid arguments to method: List<{0}>.LastIndexOf\", LuaMisc.GetTypeName(argType)));\n            }\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Sort(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n\n            if (count == 1)\n\t\t\t{\n                LuaMethodCache.CallMethod(\"Sort\", obj);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes(L, 2, typeof(System.Comparison<>).MakeGenericType(argType)))\n\t\t\t{\t\t\t\t\n\t\t\t\tDelegate arg0 = (Delegate)ToLua.ToObject(L, 2);\n                LuaMethodCache.CallMethod(\"Sort\", obj, arg0);                \n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes(L, 2, typeof(IComparer<>).MakeGenericType(argType)))\n\t\t\t{\n                object arg0 = ToLua.ToObject(L, 2);\n                LuaMethodCache.CallMethod(\"Sort\", obj, arg0);\n                return 0;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\t\t\t\t\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tobject arg2 = ToLua.CheckObject(L, 4, typeof(IComparer<>).MakeGenericType(argType));\n                LuaMethodCache.CallMethod(\"Sort\", obj, arg0, arg1, arg2);                \n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\t\t\t\t\n                return LuaDLL.luaL_throw(L, string.Format(\"invalid arguments to method: List<{0}>.LastIndexOf\", LuaMisc.GetTypeName(argType)));\n            }\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToArray(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>));\n            Array o = (Array)LuaMethodCache.CallSingleMethod(\"ToArray\", obj);\t\t\t\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TrimExcess(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>));\n            LuaMethodCache.CallSingleMethod(\"TrimExcess\", obj);\n            return 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TrueForAll(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n            Type argType = null;\t\t\t\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);\n            Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate<>).MakeGenericType(argType), L, 2);\n            bool o = (bool)LuaMethodCache.CallSingleMethod(\"TrueForAll\", obj, arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Item(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\t\t\t            \n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>));\n            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n            object o = LuaMethodCache.CallSingleMethod(\"get_Item\", obj, arg0);\n            ToLua.Push(L, o);\t\t\t\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_Item(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(List<>), out argType);            \n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n            object arg1 = ToLua.CheckObject(L, 3, argType);\n            LuaMethodCache.CallSingleMethod(\"set_Item\", obj, arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Capacity(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\t\t\t\n            int ret = (int)LuaMethodCache.CallSingleMethod(\"get_Capacity\", o);\t\t\t\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Capacity on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Count(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n            o = ToLua.ToObject(L, 1);\n            int ret = (int)LuaMethodCache.CallSingleMethod(\"get_Count\", o);\n            LuaDLL.lua_pushinteger(L, ret);\n            return 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Count on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_Capacity(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\t\t\t\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n            LuaMethodCache.CallSingleMethod(\"set_Capacity\", o, arg0);            \n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Capacity on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_Generic_ListWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 9806172156647e244b2fb905a4d02611\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_Collections_IEnumeratorWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Collections.IEnumerator), null);\n\t\tL.RegFunction(\"MoveNext\", MoveNext);\n\t\tL.RegFunction(\"Reset\", Reset);\n\t\tL.RegVar(\"Current\", get_Current, null);\n\t\tL.RegFunction(\"getCurrent\", get_Current);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int MoveNext(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Collections.IEnumerator obj = ToLua.CheckIter(L, 1);\n\t\t\tbool o = obj.MoveNext();\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Reset(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Collections.IEnumerator obj = ToLua.CheckIter(L, 1);\n\t\t\tobj.Reset();\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Current(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.IEnumerator obj = (System.Collections.IEnumerator)o;\n\t\t\tobject ret = obj.Current;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Current on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_IEnumeratorWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7eaa472c4f36f9d419d9bf704795f0d6\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\nusing System.Collections.ObjectModel;\nusing System.Collections;\n\npublic class System_Collections_ObjectModel_ReadOnlyCollectionWrap\n{\n    public static void Register(LuaState L)\n    {\n        L.BeginClass(typeof(ReadOnlyCollection<>), typeof(System.Object), \"ReadOnlyCollection\");\n        L.RegFunction(\"Contains\", Contains);\n        L.RegFunction(\"CopyTo\", CopyTo);\n        L.RegFunction(\"GetEnumerator\", GetEnumerator);\n        L.RegFunction(\"IndexOf\", IndexOf);\n        L.RegFunction(\".geti\", get_Item);\n        L.RegFunction(\"get_Item\", get_Item);\n        L.RegFunction(\"__tostring\", ToLua.op_ToString);\n        L.RegVar(\"Count\", get_Count, null);\n        L.EndClass();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Contains(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>), out argType);\n            object arg0 = ToLua.CheckVarObject(L, 2, argType);\n            bool o = (bool)LuaMethodCache.CallSingleMethod(\"Contains\", obj, arg0);\n            LuaDLL.lua_pushboolean(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int CopyTo(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 3);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>), out argType);\n            object arg0 = ToLua.CheckObject(L, 2, argType.MakeArrayType());\n            int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n            LuaMethodCache.CallSingleMethod(\"CopyTo\", obj, arg0, arg1);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int GetEnumerator(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 1);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>));\n            IEnumerator o = (IEnumerator)LuaMethodCache.CallSingleMethod(\"GetEnumerator\", obj);\n            ToLua.Push(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int IndexOf(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            Type argType = null;\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>), out argType);\n            object arg0 = ToLua.CheckVarObject(L, 2, argType);\n            int o = (int)LuaMethodCache.CallSingleMethod(\"IndexOf\", obj, arg0);\n            LuaDLL.lua_pushinteger(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Item(IntPtr L)\n    {\n        try\n        {\n            ToLua.CheckArgsCount(L, 2);\n            object obj = ToLua.CheckGenericObject(L, 1, typeof(ReadOnlyCollection<>));\n            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n            int o = (int)LuaMethodCache.CallSingleMethod(\"get_Item\", obj, arg0);\n            LuaDLL.lua_pushinteger(L, o);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int get_Count(IntPtr L)\n    {\n        object o = null;\n\n        try\n        {\n            o = ToLua.ToObject(L, 1);\n            int ret = (int)LuaMethodCache.CallSingleMethod(\"get_Count\", o);\n            LuaDLL.lua_pushinteger(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e, o, \"attempt to index Count on a nil value\");\n        }\n    }\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_Collections_ObjectModel_ReadOnlyCollectionWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: fa5b181e2942520408fb4d6bac615d4f\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_DelegateWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing System.Collections.Generic;\nusing LuaInterface;\n\npublic class System_DelegateWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Delegate), typeof(System.Object));\n\t\tL.RegFunction(\"CreateDelegate\", CreateDelegate);\n\t\tL.RegFunction(\"DynamicInvoke\", DynamicInvoke);\n\t\tL.RegFunction(\"Clone\", Clone);\n\t\tL.RegFunction(\"GetObjectData\", GetObjectData);\n\t\tL.RegFunction(\"GetInvocationList\", GetInvocationList);\n\t\tL.RegFunction(\"Combine\", Combine);\n\t\tL.RegFunction(\"Remove\", Remove);\n\t\tL.RegFunction(\"RemoveAll\", RemoveAll);\n\t\tL.RegFunction(\"Destroy\", Destroy);\n\t\tL.RegFunction(\"GetHashCode\", GetHashCode);\n\t\tL.RegFunction(\"Equals\", Equals);\n\t\tL.RegFunction(\"__add\", op_Addition);\n\t\tL.RegFunction(\"__sub\", op_Subtraction);\n\t\tL.RegFunction(\"__eq\", op_Equality);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"Method\", get_Method, null);\n\t\tL.RegFunction(\"getMethod\", get_Method);\n\t\tL.RegVar(\"Target\", get_Target, null);\n\t\tL.RegFunction(\"getTarget\", get_Target);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CreateDelegate(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Reflection.MethodInfo arg1 = (System.Reflection.MethodInfo)ToLua.CheckObject<System.Reflection.MethodInfo>(L, 2);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<System.Reflection.MethodInfo, bool>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Reflection.MethodInfo arg1 = (System.Reflection.MethodInfo)ToLua.ToObject(L, 2);\n\t\t\t\tbool arg2 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<System.Type, string>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Type arg1 = (System.Type)ToLua.ToObject(L, 2);\n\t\t\t\tstring arg2 = ToLua.ToString(L, 3);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<object, System.Reflection.MethodInfo>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tSystem.Reflection.MethodInfo arg2 = (System.Reflection.MethodInfo)ToLua.ToObject(L, 3);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<object, string>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tstring arg2 = ToLua.ToString(L, 3);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<System.Type, string, bool>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Type arg1 = (System.Type)ToLua.ToObject(L, 2);\n\t\t\t\tstring arg2 = ToLua.ToString(L, 3);\n\t\t\t\tbool arg3 = LuaDLL.lua_toboolean(L, 4);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<object, System.Reflection.MethodInfo, bool>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tSystem.Reflection.MethodInfo arg2 = (System.Reflection.MethodInfo)ToLua.ToObject(L, 3);\n\t\t\t\tbool arg3 = LuaDLL.lua_toboolean(L, 4);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<object, string, bool>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tstring arg2 = ToLua.ToString(L, 3);\n\t\t\t\tbool arg3 = LuaDLL.lua_toboolean(L, 4);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 5 && TypeChecker.CheckTypes<System.Type, string, bool, bool>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Type arg1 = (System.Type)ToLua.ToObject(L, 2);\n\t\t\t\tstring arg2 = ToLua.ToString(L, 3);\n\t\t\t\tbool arg3 = LuaDLL.lua_toboolean(L, 4);\n\t\t\t\tbool arg4 = LuaDLL.lua_toboolean(L, 5);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3, arg4);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 5 && TypeChecker.CheckTypes<object, string, bool, bool>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tstring arg2 = ToLua.ToString(L, 3);\n\t\t\t\tbool arg3 = LuaDLL.lua_toboolean(L, 4);\n\t\t\t\tbool arg4 = LuaDLL.lua_toboolean(L, 5);\n\t\t\t\tSystem.Delegate o = System.Delegate.CreateDelegate(arg0, arg1, arg2, arg3, arg4);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Delegate.CreateDelegate\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int DynamicInvoke(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tSystem.Delegate obj = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 1);\n\t\t\tobject[] arg0 = ToLua.ToParamsObject(L, 2, count - 1);\n\t\t\tobject o = obj.DynamicInvoke(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Clone(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Delegate obj = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 1);\n\t\t\tobject o = obj.Clone();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetObjectData(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Delegate obj = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 1);\n\t\t\tSystem.Runtime.Serialization.SerializationInfo arg0 = (System.Runtime.Serialization.SerializationInfo)ToLua.CheckObject(L, 2, typeof(System.Runtime.Serialization.SerializationInfo));\n\t\t\tSystem.Runtime.Serialization.StreamingContext arg1 = StackTraits<System.Runtime.Serialization.StreamingContext>.Check(L, 3);\n\t\t\tobj.GetObjectData(arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetInvocationList(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Delegate obj = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 1);\n\t\t\tSystem.Delegate[] o = obj.GetInvocationList();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Combine(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<System.Delegate, System.Delegate>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Delegate arg0 = (System.Delegate)ToLua.ToObject(L, 1);\n\t\t\t\tSystem.Delegate arg1 = (System.Delegate)ToLua.ToObject(L, 2);\n\t\t\t\tSystem.Delegate o = System.Delegate.Combine(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckParamsType<System.Delegate>(L, 1, count))\n\t\t\t{\n\t\t\t\tSystem.Delegate[] arg0 = ToLua.ToParamsObject<System.Delegate>(L, 1, count);\n\t\t\t\tSystem.Delegate o = System.Delegate.Combine(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Delegate.Combine\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Remove(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Delegate arg0 = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 1);\n\t\t\tSystem.Delegate arg1 = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 2);\n\t\t\tSystem.Delegate o = System.Delegate.Remove(arg0, arg1);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int RemoveAll(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Delegate arg0 = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 1);\n\t\t\tSystem.Delegate arg1 = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 2);\n\t\t\tSystem.Delegate o = System.Delegate.RemoveAll(arg0, arg1);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Destroy(IntPtr L)\n\t{\n        Delegate arg0 = (Delegate)ToLua.CheckObject<Delegate>(L, 1);\n        Delegate[] ds = arg0.GetInvocationList();\n\n        for (int i = 0; i < ds.Length; i++)\n        {\n            LuaDelegate ld = ds[i].Target as LuaDelegate;\n\n            if (ld != null)\n            {                \n                ld.Dispose();                \n            }\n        }\n\n        return 0;\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetHashCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Delegate obj = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 1);\n\t\t\tint o = obj.GetHashCode();\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Equals(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Delegate obj = (System.Delegate)ToLua.CheckObject<System.Delegate>(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = obj != null ? obj.Equals(arg0) : arg0 == null;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Subtraction(IntPtr L)\n\t{\n        try\n        {            \n            Delegate arg0 = (Delegate)ToLua.CheckObject<Delegate>(L, 1);\n            LuaTypes type = LuaDLL.lua_type(L, 2);\n\n            if (type == LuaTypes.LUA_TFUNCTION)\n            {\n                LuaState state = LuaState.Get(L);\n                LuaFunction func = ToLua.ToLuaFunction(L, 2);\n                Delegate[] ds = arg0.GetInvocationList();\n\n                for (int i = 0; i < ds.Length; i++)\n                {\n                    LuaDelegate ld = ds[i].Target as LuaDelegate;\n\n                    if (ld != null && ld.func == func && ld.self == null)\n                    {\n                        arg0 = Delegate.Remove(arg0, ds[i]);\n                        state.DelayDispose(ld.func);\n                        break;\n                    }\n                }\n\n                func.Dispose();\n                ToLua.Push(L, arg0);\n                return 1;\n            }\n            else\n            {\n                Delegate arg1 = (Delegate)ToLua.CheckObject<Delegate>(L, 2);\n                arg0 = DelegateFactory.RemoveDelegate(arg0, arg1);                \n                ToLua.Push(L, arg0);\n                return 1;\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Addition(IntPtr L)\n\t{\n        try\n        {                        \n            LuaTypes type = LuaDLL.lua_type(L, 1);\n\n            switch (type)\n            {\n                case LuaTypes.LUA_TFUNCTION:\n                    Delegate arg0 = ToLua.ToObject(L, 2) as Delegate;\n                    LuaFunction func = ToLua.ToLuaFunction(L, 1);\n                    Type t = arg0.GetType();\n                    Delegate arg1 = DelegateFactory.CreateDelegate(t, func);\n                    Delegate arg2 = Delegate.Combine(arg0, arg1);\n                    ToLua.Push(L, arg2);\n                    return 1;\n                case LuaTypes.LUA_TNIL:\n                    LuaDLL.lua_pushvalue(L, 2);\n                    return 1;\n                case LuaTypes.LUA_TUSERDATA:\n                    Delegate a0 = ToLua.ToObject(L, 1) as Delegate;\n                    Delegate a1 = ToLua.CheckDelegate(a0.GetType(), L, 2);\n                    Delegate ret = Delegate.Combine(a0, a1);\n                    ToLua.Push(L, ret);\n                    return 1;\n                default:\n                    LuaDLL.luaL_typerror(L, 1, \"Delegate\");\n                    return 0;\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Equality(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Delegate arg0 = (System.Delegate)ToLua.ToObject(L, 1);\n\t\t\tSystem.Delegate arg1 = (System.Delegate)ToLua.ToObject(L, 2);\n\t\t\tbool o = arg0 == arg1;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Method(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Delegate obj = (System.Delegate)o;\n\t\t\tSystem.Reflection.MethodInfo ret = obj.Method;\n\t\t\tToLua.PushObject(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Method on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Target(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Delegate obj = (System.Delegate)o;\n\t\t\tobject ret = obj.Target;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Target on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_DelegateWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 86ed9798a2c5dc74e9018394dfc827ea\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_EnumWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_EnumWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Enum), null);\n\t\tL.RegFunction(\"GetUnderlyingType\", GetUnderlyingType);\n\t\tL.RegFunction(\"GetValues\", GetValues);\n\t\tL.RegFunction(\"GetName\", GetName);\n\t\tL.RegFunction(\"GetNames\", GetNames);\n\t\tL.RegFunction(\"IsDefined\", IsDefined);\n\t\tL.RegFunction(\"Format\", Format);\n\t\tL.RegFunction(\"Equals\", Equals);\n\t\tL.RegFunction(\"GetHashCode\", GetHashCode);\n\t\tL.RegFunction(\"ToString\", ToString);\n\t\tL.RegFunction(\"CompareTo\", CompareTo);\n\t\tL.RegFunction(\"HasFlag\", HasFlag);\n\t\tL.RegFunction(\"GetTypeCode\", GetTypeCode);\n\t\tL.RegFunction(\"Parse\", Parse);\n\t\tL.RegFunction(\"ToObject\", ToObject);\n\t\tL.RegFunction(\"ToInt\", ToInt);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetUnderlyingType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type o = System.Enum.GetUnderlyingType(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetValues(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Array o = System.Enum.GetValues(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetName(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\tstring o = System.Enum.GetName(arg0, arg1);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetNames(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tstring[] o = System.Enum.GetNames(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsDefined(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = System.Enum.IsDefined(arg0, arg1);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Format(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\tstring arg2 = ToLua.CheckString(L, 3);\n\t\t\tstring o = System.Enum.Format(arg0, arg1, arg2);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Equals(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Enum obj = (System.Enum)ToLua.CheckObject<System.Enum>(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = obj != null ? obj.Equals(arg0) : arg0 == null;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetHashCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Enum obj = (System.Enum)ToLua.CheckObject<System.Enum>(L, 1);\n\t\t\tint o = obj.GetHashCode();\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToString(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.Enum obj = (System.Enum)ToLua.CheckObject<System.Enum>(L, 1);\n\t\t\t\tstring o = obj.ToString();\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tSystem.Enum obj = (System.Enum)ToLua.CheckObject<System.Enum>(L, 1);\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tstring o = obj.ToString(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Enum.ToString\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CompareTo(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Enum obj = (System.Enum)ToLua.CheckObject<System.Enum>(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tint o = obj.CompareTo(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int HasFlag(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Enum obj = (System.Enum)ToLua.CheckObject<System.Enum>(L, 1);\n\t\t\tSystem.Enum arg0 = (System.Enum)ToLua.CheckObject<System.Enum>(L, 2);\n\t\t\tbool o = obj.HasFlag(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetTypeCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Enum obj = (System.Enum)ToLua.CheckObject<System.Enum>(L, 1);\n\t\t\tSystem.TypeCode o = obj.GetTypeCode();\n\t\t\tLuaDLL.lua_pushinteger(L, (int)o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Parse(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<System.Type, string>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tobject o = System.Enum.Parse(arg0, arg1);\n\t\t\t\tToLua.Push(L, (Enum)o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<System.Type, string, bool>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tbool arg2 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tobject o = System.Enum.Parse(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, (Enum)o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Enum.Parse\");\n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToObject(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<System.Type, int>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tobject o = System.Enum.ToObject(arg0, arg1);\n\t\t\t\tToLua.Push(L, (Enum)o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<System.Type, object>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tobject o = System.Enum.ToObject(arg0, arg1);\n\t\t\t\tToLua.Push(L, (Enum)o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Enum.ToObject\");\n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToInt(IntPtr L)\n\t{\n\t\ttry\n        {\n            object arg0 = ToLua.CheckObject<System.Enum>(L, 1);\n            int ret = Convert.ToInt32(arg0);\n            LuaDLL.lua_pushinteger(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_EnumWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 9fd9d683a50920540914bdd15aa75290\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_NullObjectWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class System_NullObjectWrap\n{\n    public static void Register(LuaState L)\n    {\n        L.BeginClass(typeof(NullObject), null, \"null\");        \n        L.EndClass();\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_NullObjectWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: bdcd3994912f4e145b1f12f3d76376b6\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_ObjectWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_ObjectWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Object), null);\n\t\tL.RegFunction(\"Equals\", Equals);\n\t\tL.RegFunction(\"GetHashCode\", GetHashCode);\n\t\tL.RegFunction(\"GetType\", GetType);\n\t\tL.RegFunction(\"ToString\", ToString);\n\t\tL.RegFunction(\"ReferenceEquals\", ReferenceEquals);\n\t\tL.RegFunction(\"Destroy\", Destroy);\n\t\tL.RegFunction(\"New\", _CreateSystem_Object);\n\t\tL.RegFunction(\"__eq\", op_Equality);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateSystem_Object(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 0)\n\t\t\t{\n\t\t\t\tSystem.Object obj = new System.Object();\n\t\t\t\tToLua.Push(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: System.Object.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Equals(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tobject obj = ToLua.CheckObject(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = obj != null ? obj.Equals(arg0) : arg0 == null;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetHashCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tobject obj = ToLua.CheckObject(L, 1);\n\t\t\tint o = obj.GetHashCode();\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tobject obj = ToLua.CheckObject(L, 1);\n\t\t\tSystem.Type o = obj.GetType();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToString(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tobject obj = ToLua.CheckObject(L, 1);\n\t\t\tstring o = obj.ToString();\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ReferenceEquals(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 1);\n\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = System.Object.ReferenceEquals(arg0, arg1);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Equality(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 1);\n\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = arg0 == arg1;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Destroy(IntPtr L)\n\t{\n\t\treturn ToLua.Destroy(L);\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_ObjectWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: fcf1094389eec494d9d80c46f54f2a7e\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_StringWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_StringWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.String), typeof(System.Object));\n\t\tL.RegFunction(\"Join\", Join);\n\t\tL.RegFunction(\"Equals\", Equals);\n\t\tL.RegFunction(\"CopyTo\", CopyTo);\n\t\tL.RegFunction(\"ToCharArray\", ToCharArray);\n\t\tL.RegFunction(\"IsNullOrEmpty\", IsNullOrEmpty);\n\t\tL.RegFunction(\"IsNullOrWhiteSpace\", IsNullOrWhiteSpace);\n\t\tL.RegFunction(\"GetHashCode\", GetHashCode);\n\t\tL.RegFunction(\"Split\", Split);\n\t\tL.RegFunction(\"Substring\", Substring);\n\t\tL.RegFunction(\"Trim\", Trim);\n\t\tL.RegFunction(\"TrimStart\", TrimStart);\n\t\tL.RegFunction(\"TrimEnd\", TrimEnd);\n\t\tL.RegFunction(\"IsNormalized\", IsNormalized);\n\t\tL.RegFunction(\"Normalize\", Normalize);\n\t\tL.RegFunction(\"Compare\", Compare);\n\t\tL.RegFunction(\"CompareTo\", CompareTo);\n\t\tL.RegFunction(\"CompareOrdinal\", CompareOrdinal);\n\t\tL.RegFunction(\"Contains\", Contains);\n\t\tL.RegFunction(\"EndsWith\", EndsWith);\n\t\tL.RegFunction(\"IndexOf\", IndexOf);\n\t\tL.RegFunction(\"IndexOfAny\", IndexOfAny);\n\t\tL.RegFunction(\"LastIndexOf\", LastIndexOf);\n\t\tL.RegFunction(\"LastIndexOfAny\", LastIndexOfAny);\n\t\tL.RegFunction(\"PadLeft\", PadLeft);\n\t\tL.RegFunction(\"PadRight\", PadRight);\n\t\tL.RegFunction(\"StartsWith\", StartsWith);\n\t\tL.RegFunction(\"ToLower\", ToLower);\n\t\tL.RegFunction(\"ToLowerInvariant\", ToLowerInvariant);\n\t\tL.RegFunction(\"ToUpper\", ToUpper);\n\t\tL.RegFunction(\"ToUpperInvariant\", ToUpperInvariant);\n\t\tL.RegFunction(\"ToString\", ToString);\n\t\tL.RegFunction(\"Clone\", Clone);\n\t\tL.RegFunction(\"Insert\", Insert);\n\t\tL.RegFunction(\"Replace\", Replace);\n\t\tL.RegFunction(\"Remove\", Remove);\n\t\tL.RegFunction(\"Format\", Format);\n\t\tL.RegFunction(\"Copy\", Copy);\n\t\tL.RegFunction(\"Concat\", Concat);\n\t\tL.RegFunction(\"Intern\", Intern);\n\t\tL.RegFunction(\"IsInterned\", IsInterned);\n\t\tL.RegFunction(\"GetTypeCode\", GetTypeCode);\n\t\tL.RegFunction(\"GetEnumerator\", GetEnumerator);\n\t\tL.RegFunction(\"New\", _CreateSystem_String);\n\t\tL.RegFunction(\"__eq\", op_Equality);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"Empty\", get_Empty, null);\n\t\tL.RegVar(\"Length\", get_Length, null);\n\t\tL.RegFunction(\"getLength\", get_Length);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateSystem_String(IntPtr L)\n\t{\n        try\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, 1);\n\n            if (luatype == LuaTypes.LUA_TSTRING)\n            {\n                string arg0 = LuaDLL.lua_tostring(L, 1);\n                ToLua.PushSealed(L, arg0);\n                return 1;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to string's ctor method\");\n            }            \n        }\n        catch(Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Join(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<string, System.Collections.Generic.IEnumerable<string>>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tSystem.Collections.Generic.IEnumerable<string> arg1 = (System.Collections.Generic.IEnumerable<string>)ToLua.ToObject(L, 2);\n\t\t\t\tstring o = System.String.Join(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, string[], int, int>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tstring[] arg1 = ToLua.ToStringArray(L, 2);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg3 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tstring o = System.String.Join(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<string>(L, 1) && TypeChecker.CheckParamsType<string>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tstring[] arg1 = ToLua.ToParamsString(L, 2, count - 1);\n\t\t\t\tstring o = System.String.Join(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<string>(L, 1) && TypeChecker.CheckParamsType<object>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tobject[] arg1 = ToLua.ToParamsObject(L, 2, count - 1);\n\t\t\t\tstring o = System.String.Join(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Join\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Equals(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tbool o = obj != null ? obj.Equals(arg0) : arg0 == null;\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<object>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\t\tbool o = obj != null ? obj.Equals(arg0) : arg0 == null;\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.StringComparison arg1 = (System.StringComparison)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tbool o = obj.Equals(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Equals\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Equality(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\tbool o = arg0 == arg1;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CopyTo(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 5);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tchar[] arg1 = ToLua.CheckCharBuffer(L, 3);\n\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 5);\n\t\t\tobj.CopyTo(arg0, arg1, arg2, arg3);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToCharArray(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar[] o = obj.ToCharArray();\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tchar[] o = obj.ToCharArray(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.ToCharArray\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsNullOrEmpty(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\tbool o = System.String.IsNullOrEmpty(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsNullOrWhiteSpace(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\tbool o = System.String.IsNullOrWhiteSpace(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetHashCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tint o = obj.GetHashCode();\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Split(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 3 && TypeChecker.CheckTypes<string, char[], int>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.ToObject(L, 1);\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tstring[] o = obj.Split(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, char[], uint>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.ToObject(L, 1);\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tSystem.StringSplitOptions arg1 = (System.StringSplitOptions)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tstring[] o = obj.Split(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, string[], uint>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.ToObject(L, 1);\n\t\t\t\tstring[] arg0 = ToLua.ToStringArray(L, 2);\n\t\t\t\tSystem.StringSplitOptions arg1 = (System.StringSplitOptions)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tstring[] o = obj.Split(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, char[], int, uint>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.ToObject(L, 1);\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tSystem.StringSplitOptions arg2 = (System.StringSplitOptions)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tstring[] o = obj.Split(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, string[], int, uint>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.ToObject(L, 1);\n\t\t\t\tstring[] arg0 = ToLua.ToStringArray(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tSystem.StringSplitOptions arg2 = (System.StringSplitOptions)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tstring[] o = obj.Split(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<string>(L, 1) && TypeChecker.CheckParamsType<char>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.ToObject(L, 1);\n\t\t\t\tchar[] arg0 = ToLua.ToParamsChar(L, 2, count - 1);\n\t\t\t\tstring[] o = obj.Split(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Split\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Substring(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring o = obj.Substring(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tstring o = obj.Substring(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Substring\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Trim(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1 && TypeChecker.CheckTypes<string>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.ToObject(L, 1);\n\t\t\t\tstring o = obj.Trim();\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<string>(L, 1) && TypeChecker.CheckParamsType<char>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.ToObject(L, 1);\n\t\t\t\tchar[] arg0 = ToLua.ToParamsChar(L, 2, count - 1);\n\t\t\t\tstring o = obj.Trim(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Trim\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TrimStart(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tchar[] arg0 = ToLua.CheckParamsChar(L, 2, count - 1);\n\t\t\tstring o = obj.TrimStart(arg0);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TrimEnd(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tchar[] arg0 = ToLua.CheckParamsChar(L, 2, count - 1);\n\t\t\tstring o = obj.TrimEnd(arg0);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsNormalized(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tbool o = obj.IsNormalized();\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tSystem.Text.NormalizationForm arg0 = (System.Text.NormalizationForm)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tbool o = obj.IsNormalized(arg0);\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.IsNormalized\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Normalize(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring o = obj.Normalize();\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tSystem.Text.NormalizationForm arg0 = (System.Text.NormalizationForm)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring o = obj.Normalize(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Normalize\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Compare(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tint o = System.String.Compare(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<bool>(L, 3))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tbool arg2 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<uint>(L, 3))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.StringComparison arg2 = (System.StringComparison)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<bool, System.Globalization.CultureInfo>(L, 3))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tbool arg2 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tSystem.Globalization.CultureInfo arg3 = (System.Globalization.CultureInfo)ToLua.ToObject(L, 4);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<System.Globalization.CultureInfo, uint>(L, 3))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.Globalization.CultureInfo arg2 = (System.Globalization.CultureInfo)ToLua.ToObject(L, 3);\n\t\t\t\tSystem.Globalization.CompareOptions arg3 = (System.Globalization.CompareOptions)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 5)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring arg2 = ToLua.CheckString(L, 3);\n\t\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint arg4 = (int)LuaDLL.luaL_checknumber(L, 5);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2, arg3, arg4);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 6 && TypeChecker.CheckTypes<bool>(L, 6))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring arg2 = ToLua.CheckString(L, 3);\n\t\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint arg4 = (int)LuaDLL.luaL_checknumber(L, 5);\n\t\t\t\tbool arg5 = LuaDLL.lua_toboolean(L, 6);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2, arg3, arg4, arg5);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 6 && TypeChecker.CheckTypes<uint>(L, 6))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring arg2 = ToLua.CheckString(L, 3);\n\t\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint arg4 = (int)LuaDLL.luaL_checknumber(L, 5);\n\t\t\t\tSystem.StringComparison arg5 = (System.StringComparison)LuaDLL.lua_tonumber(L, 6);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2, arg3, arg4, arg5);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 7 && TypeChecker.CheckTypes<bool, System.Globalization.CultureInfo>(L, 6))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring arg2 = ToLua.CheckString(L, 3);\n\t\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint arg4 = (int)LuaDLL.luaL_checknumber(L, 5);\n\t\t\t\tbool arg5 = LuaDLL.lua_toboolean(L, 6);\n\t\t\t\tSystem.Globalization.CultureInfo arg6 = (System.Globalization.CultureInfo)ToLua.ToObject(L, 7);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2, arg3, arg4, arg5, arg6);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 7 && TypeChecker.CheckTypes<System.Globalization.CultureInfo, uint>(L, 6))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring arg2 = ToLua.CheckString(L, 3);\n\t\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint arg4 = (int)LuaDLL.luaL_checknumber(L, 5);\n\t\t\t\tSystem.Globalization.CultureInfo arg5 = (System.Globalization.CultureInfo)ToLua.ToObject(L, 6);\n\t\t\t\tSystem.Globalization.CompareOptions arg6 = (System.Globalization.CompareOptions)LuaDLL.lua_tonumber(L, 7);\n\t\t\t\tint o = System.String.Compare(arg0, arg1, arg2, arg3, arg4, arg5, arg6);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Compare\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CompareTo(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint o = obj.CompareTo(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<object>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\t\tint o = obj.CompareTo(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.CompareTo\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CompareOrdinal(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tint o = System.String.CompareOrdinal(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 5)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring arg2 = ToLua.CheckString(L, 3);\n\t\t\t\tint arg3 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint arg4 = (int)LuaDLL.luaL_checknumber(L, 5);\n\t\t\t\tint o = System.String.CompareOrdinal(arg0, arg1, arg2, arg3, arg4);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.CompareOrdinal\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Contains(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\tbool o = obj.Contains(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int EndsWith(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tbool o = obj.EndsWith(arg0);\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.StringComparison arg1 = (System.StringComparison)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tbool o = obj.EndsWith(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tbool arg1 = LuaDLL.luaL_checkboolean(L, 3);\n\t\t\t\tSystem.Globalization.CultureInfo arg2 = (System.Globalization.CultureInfo)ToLua.CheckObject<System.Globalization.CultureInfo>(L, 4);\n\t\t\t\tbool o = obj.EndsWith(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.EndsWith\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IndexOf(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<char>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar arg0 = (char)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint o = obj.IndexOf(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint o = obj.IndexOf(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<char, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar arg0 = (char)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = obj.IndexOf(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = obj.IndexOf(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, uint>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tSystem.StringComparison arg1 = (System.StringComparison)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = obj.IndexOf(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<char, int, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar arg0 = (char)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint o = obj.IndexOf(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, int, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint o = obj.IndexOf(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, int, uint>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tSystem.StringComparison arg2 = (System.StringComparison)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint o = obj.IndexOf(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 5)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tSystem.StringComparison arg3 = (System.StringComparison)LuaDLL.luaL_checknumber(L, 5);\n\t\t\t\tint o = obj.IndexOf(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.IndexOf\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IndexOfAny(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tint o = obj.IndexOfAny(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint o = obj.IndexOfAny(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint o = obj.IndexOfAny(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.IndexOfAny\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int LastIndexOf(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<char>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar arg0 = (char)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint o = obj.LastIndexOf(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint o = obj.LastIndexOf(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<char, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar arg0 = (char)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = obj.LastIndexOf(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = obj.LastIndexOf(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, uint>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tSystem.StringComparison arg1 = (System.StringComparison)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = obj.LastIndexOf(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<char, int, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar arg0 = (char)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint o = obj.LastIndexOf(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, int, int>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint o = obj.LastIndexOf(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, int, uint>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tSystem.StringComparison arg2 = (System.StringComparison)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint o = obj.LastIndexOf(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 5)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tSystem.StringComparison arg3 = (System.StringComparison)LuaDLL.luaL_checknumber(L, 5);\n\t\t\t\tint o = obj.LastIndexOf(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.LastIndexOf\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int LastIndexOfAny(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tint o = obj.LastIndexOfAny(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint o = obj.LastIndexOfAny(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar[] arg0 = ToLua.CheckCharBuffer(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tint o = obj.LastIndexOfAny(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.LastIndexOfAny\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int PadLeft(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring o = obj.PadLeft(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tchar arg1 = (char)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tstring o = obj.PadLeft(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.PadLeft\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int PadRight(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring o = obj.PadRight(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tchar arg1 = (char)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tstring o = obj.PadRight(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.PadRight\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int StartsWith(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tbool o = obj.StartsWith(arg0);\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.StringComparison arg1 = (System.StringComparison)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tbool o = obj.StartsWith(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tbool arg1 = LuaDLL.luaL_checkboolean(L, 3);\n\t\t\t\tSystem.Globalization.CultureInfo arg2 = (System.Globalization.CultureInfo)ToLua.CheckObject<System.Globalization.CultureInfo>(L, 4);\n\t\t\t\tbool o = obj.StartsWith(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.StartsWith\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToLower(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring o = obj.ToLower();\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tSystem.Globalization.CultureInfo arg0 = (System.Globalization.CultureInfo)ToLua.CheckObject<System.Globalization.CultureInfo>(L, 2);\n\t\t\t\tstring o = obj.ToLower(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.ToLower\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToLowerInvariant(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tstring o = obj.ToLowerInvariant();\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToUpper(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring o = obj.ToUpper();\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tSystem.Globalization.CultureInfo arg0 = (System.Globalization.CultureInfo)ToLua.CheckObject<System.Globalization.CultureInfo>(L, 2);\n\t\t\t\tstring o = obj.ToUpper(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.ToUpper\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToUpperInvariant(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tstring o = obj.ToUpperInvariant();\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToString(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring o = obj.ToString();\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tSystem.IFormatProvider arg0 = (System.IFormatProvider)ToLua.CheckObject<System.IFormatProvider>(L, 2);\n\t\t\t\tstring o = obj.ToString(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.ToString\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Clone(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tobject o = obj.Clone();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Insert(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tstring arg1 = ToLua.CheckString(L, 3);\n\t\t\tstring o = obj.Insert(arg0, arg1);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Replace(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 3 && TypeChecker.CheckTypes<char, char>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tchar arg0 = (char)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tchar arg1 = (char)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tstring o = obj.Replace(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, string>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 3);\n\t\t\t\tstring o = obj.Replace(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Replace\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Remove(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tstring o = obj.Remove(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tstring o = obj.Remove(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Remove\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Format(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<string, object>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tstring o = System.String.Format(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<System.IFormatProvider, string, object>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.IFormatProvider arg0 = (System.IFormatProvider)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg2 = ToLua.ToVarObject(L, 3);\n\t\t\t\tstring o = System.String.Format(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, object, object>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tobject arg2 = ToLua.ToVarObject(L, 3);\n\t\t\t\tstring o = System.String.Format(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<System.IFormatProvider, string, object, object>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.IFormatProvider arg0 = (System.IFormatProvider)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg2 = ToLua.ToVarObject(L, 3);\n\t\t\t\tobject arg3 = ToLua.ToVarObject(L, 4);\n\t\t\t\tstring o = System.String.Format(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, object, object, object>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tobject arg2 = ToLua.ToVarObject(L, 3);\n\t\t\t\tobject arg3 = ToLua.ToVarObject(L, 4);\n\t\t\t\tstring o = System.String.Format(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 5 && TypeChecker.CheckTypes<System.IFormatProvider, string, object, object, object>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.IFormatProvider arg0 = (System.IFormatProvider)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg2 = ToLua.ToVarObject(L, 3);\n\t\t\t\tobject arg3 = ToLua.ToVarObject(L, 4);\n\t\t\t\tobject arg4 = ToLua.ToVarObject(L, 5);\n\t\t\t\tstring o = System.String.Format(arg0, arg1, arg2, arg3, arg4);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<System.IFormatProvider, string>(L, 1) && TypeChecker.CheckParamsType<object>(L, 3, count - 2))\n\t\t\t{\n\t\t\t\tSystem.IFormatProvider arg0 = (System.IFormatProvider)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tobject[] arg2 = ToLua.ToParamsObject(L, 3, count - 2);\n\t\t\t\tstring o = System.String.Format(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<string>(L, 1) && TypeChecker.CheckParamsType<object>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tobject[] arg1 = ToLua.ToParamsObject(L, 2, count - 1);\n\t\t\t\tstring o = System.String.Format(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Format\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Copy(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\tstring o = System.String.Copy(arg0);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Concat(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1 && TypeChecker.CheckTypes<System.Collections.Generic.IEnumerable<string>>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Collections.Generic.IEnumerable<string> arg0 = (System.Collections.Generic.IEnumerable<string>)ToLua.ToObject(L, 1);\n\t\t\t\tstring o = System.String.Concat(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1 && TypeChecker.CheckTypes<object>(L, 1))\n\t\t\t{\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 1);\n\t\t\t\tstring o = System.String.Concat(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<string, string>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tstring o = System.String.Concat(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<object, object>(L, 1))\n\t\t\t{\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tstring o = System.String.Concat(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, string, string>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tstring arg2 = ToLua.ToString(L, 3);\n\t\t\t\tstring o = System.String.Concat(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<object, object, object>(L, 1))\n\t\t\t{\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tobject arg2 = ToLua.ToVarObject(L, 3);\n\t\t\t\tstring o = System.String.Concat(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, string, string, string>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tstring arg2 = ToLua.ToString(L, 3);\n\t\t\t\tstring arg3 = ToLua.ToString(L, 4);\n\t\t\t\tstring o = System.String.Concat(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<object, object, object, object>(L, 1))\n\t\t\t{\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tobject arg2 = ToLua.ToVarObject(L, 3);\n\t\t\t\tobject arg3 = ToLua.ToVarObject(L, 4);\n\t\t\t\tstring o = System.String.Concat(arg0, arg1, arg2, arg3);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckParamsType<string>(L, 1, count))\n\t\t\t{\n\t\t\t\tstring[] arg0 = ToLua.ToParamsString(L, 1, count);\n\t\t\t\tstring o = System.String.Concat(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckParamsType<object>(L, 1, count))\n\t\t\t{\n\t\t\t\tobject[] arg0 = ToLua.ToParamsObject(L, 1, count);\n\t\t\t\tstring o = System.String.Concat(arg0);\n\t\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.String.Concat\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Intern(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\tstring o = System.String.Intern(arg0);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsInterned(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\tstring o = System.String.IsInterned(arg0);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetTypeCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tSystem.TypeCode o = obj.GetTypeCode();\n\t\t\tLuaDLL.lua_pushinteger(L, (int)o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumerator(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.String obj = (System.String)ToLua.CheckObject(L, 1, typeof(System.String));\n\t\t\tSystem.Collections.IEnumerator o = obj.GetEnumerator();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Empty(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tLuaDLL.lua_pushstring(L, System.String.Empty);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Length(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.String obj = (System.String)o;\n\t\t\tint ret = obj.Length;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Length on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_StringWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6380cf60ae81034418e4fe4dabc06bc2\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_TypeWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_TypeWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Type), typeof(System.Object));\n\t\tL.RegFunction(\"GetType\", GetType);\n\t\tL.RegFunction(\"MakePointerType\", MakePointerType);\n\t\tL.RegFunction(\"MakeByRefType\", MakeByRefType);\n\t\tL.RegFunction(\"MakeArrayType\", MakeArrayType);\n\t\tL.RegFunction(\"GetTypeFromProgID\", GetTypeFromProgID);\n\t\tL.RegFunction(\"GetTypeFromCLSID\", GetTypeFromCLSID);\n\t\tL.RegFunction(\"GetTypeCode\", GetTypeCode);\n\t\tL.RegFunction(\"InvokeMember\", InvokeMember);\n\t\tL.RegFunction(\"GetTypeHandle\", GetTypeHandle);\n\t\tL.RegFunction(\"GetArrayRank\", GetArrayRank);\n\t\tL.RegFunction(\"GetInterface\", GetInterface);\n\t\tL.RegFunction(\"GetInterfaces\", GetInterfaces);\n\t\tL.RegFunction(\"FindInterfaces\", FindInterfaces);\n\t\tL.RegFunction(\"GetNestedTypes\", GetNestedTypes);\n\t\tL.RegFunction(\"GetNestedType\", GetNestedType);\n\t\tL.RegFunction(\"GetDefaultMembers\", GetDefaultMembers);\n\t\tL.RegFunction(\"FindMembers\", FindMembers);\n\t\tL.RegFunction(\"GetGenericParameterConstraints\", GetGenericParameterConstraints);\n\t\tL.RegFunction(\"MakeGenericType\", MakeGenericType);\n\t\tL.RegFunction(\"GetElementType\", GetElementType);\n\t\tL.RegFunction(\"GetGenericArguments\", GetGenericArguments);\n\t\tL.RegFunction(\"GetGenericTypeDefinition\", GetGenericTypeDefinition);\n\t\tL.RegFunction(\"GetEnumNames\", GetEnumNames);\n\t\tL.RegFunction(\"GetEnumValues\", GetEnumValues);\n\t\tL.RegFunction(\"GetEnumUnderlyingType\", GetEnumUnderlyingType);\n\t\tL.RegFunction(\"IsEnumDefined\", IsEnumDefined);\n\t\tL.RegFunction(\"GetEnumName\", GetEnumName);\n\t\tL.RegFunction(\"IsSubclassOf\", IsSubclassOf);\n\t\tL.RegFunction(\"IsInstanceOfType\", IsInstanceOfType);\n\t\tL.RegFunction(\"IsAssignableFrom\", IsAssignableFrom);\n\t\tL.RegFunction(\"IsEquivalentTo\", IsEquivalentTo);\n\t\tL.RegFunction(\"ToString\", ToString);\n\t\tL.RegFunction(\"GetTypeArray\", GetTypeArray);\n\t\tL.RegFunction(\"Equals\", Equals);\n\t\tL.RegFunction(\"GetHashCode\", GetHashCode);\n\t\tL.RegFunction(\"GetInterfaceMap\", GetInterfaceMap);\n\t\tL.RegFunction(\"ReflectionOnlyGetType\", ReflectionOnlyGetType);\n\t\tL.RegFunction(\"GetTypeFromHandle\", GetTypeFromHandle);\n\t\tL.RegFunction(\"__eq\", op_Equality);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"FilterAttribute\", get_FilterAttribute, null);\n\t\tL.RegVar(\"FilterName\", get_FilterName, null);\n\t\tL.RegVar(\"FilterNameIgnoreCase\", get_FilterNameIgnoreCase, null);\n\t\tL.RegVar(\"Missing\", get_Missing, null);\n\t\tL.RegVar(\"Delimiter\", get_Delimiter, null);\n\t\tL.RegVar(\"EmptyTypes\", get_EmptyTypes, null);\n\t\tL.RegVar(\"MemberType\", get_MemberType, null);\n\t\tL.RegFunction(\"getMemberType\", get_MemberType);\n\t\tL.RegVar(\"DeclaringType\", get_DeclaringType, null);\n\t\tL.RegFunction(\"getDeclaringType\", get_DeclaringType);\n\t\tL.RegVar(\"DeclaringMethod\", get_DeclaringMethod, null);\n\t\tL.RegFunction(\"getDeclaringMethod\", get_DeclaringMethod);\n\t\tL.RegVar(\"ReflectedType\", get_ReflectedType, null);\n\t\tL.RegFunction(\"getReflectedType\", get_ReflectedType);\n\t\tL.RegVar(\"StructLayoutAttribute\", get_StructLayoutAttribute, null);\n\t\tL.RegFunction(\"getStructLayoutAttribute\", get_StructLayoutAttribute);\n\t\tL.RegVar(\"GUID\", get_GUID, null);\n\t\tL.RegFunction(\"getGUID\", get_GUID);\n\t\tL.RegVar(\"DefaultBinder\", get_DefaultBinder, null);\n\t\tL.RegFunction(\"getDefaultBinder\", get_DefaultBinder);\n\t\tL.RegVar(\"Module\", get_Module, null);\n\t\tL.RegFunction(\"getModule\", get_Module);\n\t\tL.RegVar(\"Assembly\", get_Assembly, null);\n\t\tL.RegFunction(\"getAssembly\", get_Assembly);\n\t\tL.RegVar(\"TypeHandle\", get_TypeHandle, null);\n\t\tL.RegFunction(\"getTypeHandle\", get_TypeHandle);\n\t\tL.RegVar(\"FullName\", get_FullName, null);\n\t\tL.RegFunction(\"getFullName\", get_FullName);\n\t\tL.RegVar(\"Namespace\", get_Namespace, null);\n\t\tL.RegFunction(\"getNamespace\", get_Namespace);\n\t\tL.RegVar(\"AssemblyQualifiedName\", get_AssemblyQualifiedName, null);\n\t\tL.RegFunction(\"getAssemblyQualifiedName\", get_AssemblyQualifiedName);\n\t\tL.RegVar(\"BaseType\", get_BaseType, null);\n\t\tL.RegFunction(\"getBaseType\", get_BaseType);\n\t\tL.RegVar(\"TypeInitializer\", get_TypeInitializer, null);\n\t\tL.RegFunction(\"getTypeInitializer\", get_TypeInitializer);\n\t\tL.RegVar(\"IsNested\", get_IsNested, null);\n\t\tL.RegFunction(\"getIsNested\", get_IsNested);\n\t\tL.RegVar(\"Attributes\", get_Attributes, null);\n\t\tL.RegFunction(\"getAttributes\", get_Attributes);\n\t\tL.RegVar(\"GenericParameterAttributes\", get_GenericParameterAttributes, null);\n\t\tL.RegFunction(\"getGenericParameterAttributes\", get_GenericParameterAttributes);\n\t\tL.RegVar(\"IsVisible\", get_IsVisible, null);\n\t\tL.RegFunction(\"getIsVisible\", get_IsVisible);\n\t\tL.RegVar(\"IsNotPublic\", get_IsNotPublic, null);\n\t\tL.RegFunction(\"getIsNotPublic\", get_IsNotPublic);\n\t\tL.RegVar(\"IsPublic\", get_IsPublic, null);\n\t\tL.RegFunction(\"getIsPublic\", get_IsPublic);\n\t\tL.RegVar(\"IsNestedPublic\", get_IsNestedPublic, null);\n\t\tL.RegFunction(\"getIsNestedPublic\", get_IsNestedPublic);\n\t\tL.RegVar(\"IsNestedPrivate\", get_IsNestedPrivate, null);\n\t\tL.RegFunction(\"getIsNestedPrivate\", get_IsNestedPrivate);\n\t\tL.RegVar(\"IsNestedFamily\", get_IsNestedFamily, null);\n\t\tL.RegFunction(\"getIsNestedFamily\", get_IsNestedFamily);\n\t\tL.RegVar(\"IsNestedAssembly\", get_IsNestedAssembly, null);\n\t\tL.RegFunction(\"getIsNestedAssembly\", get_IsNestedAssembly);\n\t\tL.RegVar(\"IsNestedFamANDAssem\", get_IsNestedFamANDAssem, null);\n\t\tL.RegFunction(\"getIsNestedFamANDAssem\", get_IsNestedFamANDAssem);\n\t\tL.RegVar(\"IsNestedFamORAssem\", get_IsNestedFamORAssem, null);\n\t\tL.RegFunction(\"getIsNestedFamORAssem\", get_IsNestedFamORAssem);\n\t\tL.RegVar(\"IsAutoLayout\", get_IsAutoLayout, null);\n\t\tL.RegFunction(\"getIsAutoLayout\", get_IsAutoLayout);\n\t\tL.RegVar(\"IsLayoutSequential\", get_IsLayoutSequential, null);\n\t\tL.RegFunction(\"getIsLayoutSequential\", get_IsLayoutSequential);\n\t\tL.RegVar(\"IsExplicitLayout\", get_IsExplicitLayout, null);\n\t\tL.RegFunction(\"getIsExplicitLayout\", get_IsExplicitLayout);\n\t\tL.RegVar(\"IsClass\", get_IsClass, null);\n\t\tL.RegFunction(\"getIsClass\", get_IsClass);\n\t\tL.RegVar(\"IsInterface\", get_IsInterface, null);\n\t\tL.RegFunction(\"getIsInterface\", get_IsInterface);\n\t\tL.RegVar(\"IsValueType\", get_IsValueType, null);\n\t\tL.RegFunction(\"getIsValueType\", get_IsValueType);\n\t\tL.RegVar(\"IsAbstract\", get_IsAbstract, null);\n\t\tL.RegFunction(\"getIsAbstract\", get_IsAbstract);\n\t\tL.RegVar(\"IsSealed\", get_IsSealed, null);\n\t\tL.RegFunction(\"getIsSealed\", get_IsSealed);\n\t\tL.RegVar(\"IsEnum\", get_IsEnum, null);\n\t\tL.RegFunction(\"getIsEnum\", get_IsEnum);\n\t\tL.RegVar(\"IsSpecialName\", get_IsSpecialName, null);\n\t\tL.RegFunction(\"getIsSpecialName\", get_IsSpecialName);\n\t\tL.RegVar(\"IsImport\", get_IsImport, null);\n\t\tL.RegFunction(\"getIsImport\", get_IsImport);\n\t\tL.RegVar(\"IsSerializable\", get_IsSerializable, null);\n\t\tL.RegFunction(\"getIsSerializable\", get_IsSerializable);\n\t\tL.RegVar(\"IsAnsiClass\", get_IsAnsiClass, null);\n\t\tL.RegFunction(\"getIsAnsiClass\", get_IsAnsiClass);\n\t\tL.RegVar(\"IsUnicodeClass\", get_IsUnicodeClass, null);\n\t\tL.RegFunction(\"getIsUnicodeClass\", get_IsUnicodeClass);\n\t\tL.RegVar(\"IsAutoClass\", get_IsAutoClass, null);\n\t\tL.RegFunction(\"getIsAutoClass\", get_IsAutoClass);\n\t\tL.RegVar(\"IsArray\", get_IsArray, null);\n\t\tL.RegFunction(\"getIsArray\", get_IsArray);\n\t\tL.RegVar(\"IsGenericType\", get_IsGenericType, null);\n\t\tL.RegFunction(\"getIsGenericType\", get_IsGenericType);\n\t\tL.RegVar(\"IsGenericTypeDefinition\", get_IsGenericTypeDefinition, null);\n\t\tL.RegFunction(\"getIsGenericTypeDefinition\", get_IsGenericTypeDefinition);\n\t\tL.RegVar(\"IsConstructedGenericType\", get_IsConstructedGenericType, null);\n\t\tL.RegFunction(\"getIsConstructedGenericType\", get_IsConstructedGenericType);\n\t\tL.RegVar(\"IsGenericParameter\", get_IsGenericParameter, null);\n\t\tL.RegFunction(\"getIsGenericParameter\", get_IsGenericParameter);\n\t\tL.RegVar(\"GenericParameterPosition\", get_GenericParameterPosition, null);\n\t\tL.RegFunction(\"getGenericParameterPosition\", get_GenericParameterPosition);\n\t\tL.RegVar(\"ContainsGenericParameters\", get_ContainsGenericParameters, null);\n\t\tL.RegFunction(\"getContainsGenericParameters\", get_ContainsGenericParameters);\n\t\tL.RegVar(\"IsByRef\", get_IsByRef, null);\n\t\tL.RegFunction(\"getIsByRef\", get_IsByRef);\n\t\tL.RegVar(\"IsPointer\", get_IsPointer, null);\n\t\tL.RegFunction(\"getIsPointer\", get_IsPointer);\n\t\tL.RegVar(\"IsPrimitive\", get_IsPrimitive, null);\n\t\tL.RegFunction(\"getIsPrimitive\", get_IsPrimitive);\n\t\tL.RegVar(\"IsCOMObject\", get_IsCOMObject, null);\n\t\tL.RegFunction(\"getIsCOMObject\", get_IsCOMObject);\n\t\tL.RegVar(\"HasElementType\", get_HasElementType, null);\n\t\tL.RegFunction(\"getHasElementType\", get_HasElementType);\n\t\tL.RegVar(\"IsContextful\", get_IsContextful, null);\n\t\tL.RegFunction(\"getIsContextful\", get_IsContextful);\n\t\tL.RegVar(\"IsMarshalByRef\", get_IsMarshalByRef, null);\n\t\tL.RegFunction(\"getIsMarshalByRef\", get_IsMarshalByRef);\n\t\tL.RegVar(\"GenericTypeArguments\", get_GenericTypeArguments, null);\n\t\tL.RegFunction(\"getGenericTypeArguments\", get_GenericTypeArguments);\n\t\tL.RegVar(\"IsSecurityCritical\", get_IsSecurityCritical, null);\n\t\tL.RegFunction(\"getIsSecurityCritical\", get_IsSecurityCritical);\n\t\tL.RegVar(\"IsSecuritySafeCritical\", get_IsSecuritySafeCritical, null);\n\t\tL.RegFunction(\"getIsSecuritySafeCritical\", get_IsSecuritySafeCritical);\n\t\tL.RegVar(\"IsSecurityTransparent\", get_IsSecurityTransparent, null);\n\t\tL.RegFunction(\"getIsSecurityTransparent\", get_IsSecurityTransparent);\n\t\tL.RegVar(\"UnderlyingSystemType\", get_UnderlyingSystemType, null);\n\t\tL.RegFunction(\"getUnderlyingSystemType\", get_UnderlyingSystemType);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1 && TypeChecker.CheckTypes<System.Type>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type obj = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tSystem.Type o = obj.GetType();\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1 && TypeChecker.CheckTypes<string>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tSystem.Type o = System.Type.GetType(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tbool arg1 = LuaDLL.luaL_checkboolean(L, 2);\n\t\t\t\tSystem.Type o = System.Type.GetType(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<bool, bool>(L, 2))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tbool arg1 = LuaDLL.lua_toboolean(L, 2);\n\t\t\t\tbool arg2 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tSystem.Type o = System.Type.GetType(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<System.Func<System.Reflection.AssemblyName,System.Reflection.Assembly>, System.Func<System.Reflection.Assembly,string,bool,System.Type>>(L, 2))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tSystem.Func<System.Reflection.AssemblyName,System.Reflection.Assembly> arg1 = (System.Func<System.Reflection.AssemblyName,System.Reflection.Assembly>)ToLua.ToObject(L, 2);\n\t\t\t\tSystem.Func<System.Reflection.Assembly,string,bool,System.Type> arg2 = (System.Func<System.Reflection.Assembly,string,bool,System.Type>)ToLua.ToObject(L, 3);\n\t\t\t\tSystem.Type o = System.Type.GetType(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tSystem.Func<System.Reflection.AssemblyName,System.Reflection.Assembly> arg1 = (System.Func<System.Reflection.AssemblyName,System.Reflection.Assembly>)ToLua.CheckDelegate<System.Func<System.Reflection.AssemblyName,System.Reflection.Assembly>>(L, 2);\n\t\t\t\tSystem.Func<System.Reflection.Assembly,string,bool,System.Type> arg2 = (System.Func<System.Reflection.Assembly,string,bool,System.Type>)ToLua.CheckDelegate<System.Func<System.Reflection.Assembly,string,bool,System.Type>>(L, 3);\n\t\t\t\tbool arg3 = LuaDLL.luaL_checkboolean(L, 4);\n\t\t\t\tSystem.Type o = System.Type.GetType(arg0, arg1, arg2, arg3);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 5)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tSystem.Func<System.Reflection.AssemblyName,System.Reflection.Assembly> arg1 = (System.Func<System.Reflection.AssemblyName,System.Reflection.Assembly>)ToLua.CheckDelegate<System.Func<System.Reflection.AssemblyName,System.Reflection.Assembly>>(L, 2);\n\t\t\t\tSystem.Func<System.Reflection.Assembly,string,bool,System.Type> arg2 = (System.Func<System.Reflection.Assembly,string,bool,System.Type>)ToLua.CheckDelegate<System.Func<System.Reflection.Assembly,string,bool,System.Type>>(L, 3);\n\t\t\t\tbool arg3 = LuaDLL.luaL_checkboolean(L, 4);\n\t\t\t\tbool arg4 = LuaDLL.luaL_checkboolean(L, 5);\n\t\t\t\tSystem.Type o = System.Type.GetType(arg0, arg1, arg2, arg3, arg4);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.GetType\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int MakePointerType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type o = obj.MakePointerType();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int MakeByRefType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type o = obj.MakeByRefType();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int MakeArrayType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Type o = obj.MakeArrayType();\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tSystem.Type o = obj.MakeArrayType(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.MakeArrayType\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetTypeFromProgID(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tSystem.Type o = System.Type.GetTypeFromProgID(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<bool>(L, 2))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tbool arg1 = LuaDLL.lua_toboolean(L, 2);\n\t\t\t\tSystem.Type o = System.Type.GetTypeFromProgID(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tSystem.Type o = System.Type.GetTypeFromProgID(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tbool arg2 = LuaDLL.luaL_checkboolean(L, 3);\n\t\t\t\tSystem.Type o = System.Type.GetTypeFromProgID(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.GetTypeFromProgID\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetTypeFromCLSID(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.Guid arg0 = StackTraits<System.Guid>.Check(L, 1);\n\t\t\t\tSystem.Type o = System.Type.GetTypeFromCLSID(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<bool>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Guid arg0 = StackTraits<System.Guid>.Check(L, 1);\n\t\t\t\tbool arg1 = LuaDLL.lua_toboolean(L, 2);\n\t\t\t\tSystem.Type o = System.Type.GetTypeFromCLSID(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Guid arg0 = StackTraits<System.Guid>.Check(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tSystem.Type o = System.Type.GetTypeFromCLSID(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.Guid arg0 = StackTraits<System.Guid>.Check(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tbool arg2 = LuaDLL.luaL_checkboolean(L, 3);\n\t\t\t\tSystem.Type o = System.Type.GetTypeFromCLSID(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.GetTypeFromCLSID\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetTypeCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.TypeCode o = System.Type.GetTypeCode(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, (int)o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int InvokeMember(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 6)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tSystem.Reflection.Binder arg2 = (System.Reflection.Binder)ToLua.CheckObject<System.Reflection.Binder>(L, 4);\n\t\t\t\tobject arg3 = ToLua.ToVarObject(L, 5);\n\t\t\t\tobject[] arg4 = ToLua.CheckObjectArray(L, 6);\n\t\t\t\tobject o = obj.InvokeMember(arg0, arg1, arg2, arg3, arg4);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 7)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tSystem.Reflection.Binder arg2 = (System.Reflection.Binder)ToLua.CheckObject<System.Reflection.Binder>(L, 4);\n\t\t\t\tobject arg3 = ToLua.ToVarObject(L, 5);\n\t\t\t\tobject[] arg4 = ToLua.CheckObjectArray(L, 6);\n\t\t\t\tSystem.Globalization.CultureInfo arg5 = (System.Globalization.CultureInfo)ToLua.CheckObject<System.Globalization.CultureInfo>(L, 7);\n\t\t\t\tobject o = obj.InvokeMember(arg0, arg1, arg2, arg3, arg4, arg5);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 9)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tSystem.Reflection.Binder arg2 = (System.Reflection.Binder)ToLua.CheckObject<System.Reflection.Binder>(L, 4);\n\t\t\t\tobject arg3 = ToLua.ToVarObject(L, 5);\n\t\t\t\tobject[] arg4 = ToLua.CheckObjectArray(L, 6);\n\t\t\t\tSystem.Reflection.ParameterModifier[] arg5 = ToLua.CheckStructArray<System.Reflection.ParameterModifier>(L, 7);\n\t\t\t\tSystem.Globalization.CultureInfo arg6 = (System.Globalization.CultureInfo)ToLua.CheckObject<System.Globalization.CultureInfo>(L, 8);\n\t\t\t\tstring[] arg7 = ToLua.CheckStringArray(L, 9);\n\t\t\t\tobject o = obj.InvokeMember(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.InvokeMember\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetTypeHandle(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 1);\n\t\t\tSystem.RuntimeTypeHandle o = System.Type.GetTypeHandle(arg0);\n\t\t\tToLua.PushValue(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetArrayRank(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tint o = obj.GetArrayRank();\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetInterface(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.Type o = obj.GetInterface(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tbool arg1 = LuaDLL.luaL_checkboolean(L, 3);\n\t\t\t\tSystem.Type o = obj.GetInterface(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.GetInterface\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetInterfaces(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type[] o = obj.GetInterfaces();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int FindInterfaces(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Reflection.TypeFilter arg0 = (System.Reflection.TypeFilter)ToLua.CheckDelegate<System.Reflection.TypeFilter>(L, 2);\n\t\t\tobject arg1 = ToLua.ToVarObject(L, 3);\n\t\t\tSystem.Type[] o = obj.FindInterfaces(arg0, arg1);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetNestedTypes(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Type[] o = obj.GetNestedTypes();\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Reflection.BindingFlags arg0 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tSystem.Type[] o = obj.GetNestedTypes(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.GetNestedTypes\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetNestedType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.Type o = obj.GetNestedType(arg0);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\t\tSystem.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tSystem.Type o = obj.GetNestedType(arg0, arg1);\n\t\t\t\tToLua.Push(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.GetNestedType\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetDefaultMembers(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Reflection.MemberInfo[] o = obj.GetDefaultMembers();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int FindMembers(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 5);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Reflection.MemberTypes arg0 = (System.Reflection.MemberTypes)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tSystem.Reflection.BindingFlags arg1 = (System.Reflection.BindingFlags)LuaDLL.luaL_checknumber(L, 3);\n\t\t\tSystem.Reflection.MemberFilter arg2 = (System.Reflection.MemberFilter)ToLua.CheckDelegate<System.Reflection.MemberFilter>(L, 4);\n\t\t\tobject arg3 = ToLua.ToVarObject(L, 5);\n\t\t\tSystem.Reflection.MemberInfo[] o = obj.FindMembers(arg0, arg1, arg2, arg3);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetGenericParameterConstraints(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type[] o = obj.GetGenericParameterConstraints();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int MakeGenericType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type[] arg0 = ToLua.CheckParamsObject<System.Type>(L, 2, count - 1);\n\t\t\tSystem.Type o = obj.MakeGenericType(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetElementType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type o = obj.GetElementType();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetGenericArguments(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type[] o = obj.GetGenericArguments();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetGenericTypeDefinition(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type o = obj.GetGenericTypeDefinition();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumNames(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tstring[] o = obj.GetEnumNames();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumValues(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Array o = obj.GetEnumValues();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumUnderlyingType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type o = obj.GetEnumUnderlyingType();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsEnumDefined(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = obj.IsEnumDefined(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumName(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tstring o = obj.GetEnumName(arg0);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsSubclassOf(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 2);\n\t\t\tbool o = obj.IsSubclassOf(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsInstanceOfType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = obj.IsInstanceOfType(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsAssignableFrom(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 2);\n\t\t\tbool o = obj.IsAssignableFrom(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IsEquivalentTo(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 2);\n\t\t\tbool o = obj.IsEquivalentTo(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToString(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tstring o = obj.ToString();\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetTypeArray(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tobject[] arg0 = ToLua.CheckObjectArray(L, 1);\n\t\t\tSystem.Type[] o = System.Type.GetTypeArray(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Equals(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<System.Type>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 2);\n\t\t\t\tbool o = obj != null ? obj.Equals(arg0) : arg0 == null;\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<object>(L, 2))\n\t\t\t{\n\t\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\t\tbool o = obj != null ? obj.Equals(arg0) : arg0 == null;\n\t\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: System.Type.Equals\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Equality(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\tSystem.Type arg1 = (System.Type)ToLua.ToObject(L, 2);\n\t\t\tbool o = arg0 == arg1;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetHashCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tint o = obj.GetHashCode();\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetInterfaceMap(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Type obj = ToLua.CheckMonoType(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 2);\n\t\t\tSystem.Reflection.InterfaceMapping o = obj.GetInterfaceMap(arg0);\n\t\t\tToLua.PushValue(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ReflectionOnlyGetType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tstring arg0 = ToLua.CheckString(L, 1);\n\t\t\tbool arg1 = LuaDLL.luaL_checkboolean(L, 2);\n\t\t\tbool arg2 = LuaDLL.luaL_checkboolean(L, 3);\n\t\t\tSystem.Type o = System.Type.ReflectionOnlyGetType(arg0, arg1, arg2);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetTypeFromHandle(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.RuntimeTypeHandle arg0 = StackTraits<System.RuntimeTypeHandle>.Check(L, 1);\n\t\t\tSystem.Type o = System.Type.GetTypeFromHandle(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_FilterAttribute(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.Push(L, System.Type.FilterAttribute);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_FilterName(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.Push(L, System.Type.FilterName);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_FilterNameIgnoreCase(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.Push(L, System.Type.FilterNameIgnoreCase);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Missing(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.Push(L, System.Type.Missing);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Delimiter(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tLuaDLL.lua_pushnumber(L, System.Type.Delimiter);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_EmptyTypes(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.Push(L, System.Type.EmptyTypes);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_MemberType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Reflection.MemberTypes ret = obj.MemberType;\n\t\t\tLuaDLL.lua_pushinteger(L, (int)ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index MemberType on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_DeclaringType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Type ret = obj.DeclaringType;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index DeclaringType on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_DeclaringMethod(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Reflection.MethodBase ret = obj.DeclaringMethod;\n\t\t\tToLua.PushObject(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index DeclaringMethod on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_ReflectedType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Type ret = obj.ReflectedType;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index ReflectedType on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_StructLayoutAttribute(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Runtime.InteropServices.StructLayoutAttribute ret = obj.StructLayoutAttribute;\n\t\t\tToLua.PushSealed(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index StructLayoutAttribute on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_GUID(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Guid ret = obj.GUID;\n\t\t\tToLua.PushValue(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index GUID on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_DefaultBinder(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.PushObject(L, System.Type.DefaultBinder);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Module(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Reflection.Module ret = obj.Module;\n\t\t\tToLua.PushObject(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Module on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Assembly(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Reflection.Assembly ret = obj.Assembly;\n\t\t\tToLua.PushObject(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Assembly on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_TypeHandle(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.RuntimeTypeHandle ret = obj.TypeHandle;\n\t\t\tToLua.PushValue(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index TypeHandle on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_FullName(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tstring ret = obj.FullName;\n\t\t\tLuaDLL.lua_pushstring(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index FullName on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Namespace(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tstring ret = obj.Namespace;\n\t\t\tLuaDLL.lua_pushstring(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Namespace on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_AssemblyQualifiedName(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tstring ret = obj.AssemblyQualifiedName;\n\t\t\tLuaDLL.lua_pushstring(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index AssemblyQualifiedName on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_BaseType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Type ret = obj.BaseType;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index BaseType on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_TypeInitializer(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Reflection.ConstructorInfo ret = obj.TypeInitializer;\n\t\t\tToLua.PushObject(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index TypeInitializer on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsNested(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsNested;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsNested on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Attributes(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Reflection.TypeAttributes ret = obj.Attributes;\n\t\t\tLuaDLL.lua_pushinteger(L, (int)ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Attributes on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_GenericParameterAttributes(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Reflection.GenericParameterAttributes ret = obj.GenericParameterAttributes;\n\t\t\tLuaDLL.lua_pushinteger(L, (int)ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index GenericParameterAttributes on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsVisible(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsVisible;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsVisible on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsNotPublic(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsNotPublic;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsNotPublic on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsPublic(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsPublic;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsPublic on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsNestedPublic(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsNestedPublic;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsNestedPublic on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsNestedPrivate(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsNestedPrivate;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsNestedPrivate on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsNestedFamily(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsNestedFamily;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsNestedFamily on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsNestedAssembly(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsNestedAssembly;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsNestedAssembly on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsNestedFamANDAssem(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsNestedFamANDAssem;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsNestedFamANDAssem on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsNestedFamORAssem(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsNestedFamORAssem;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsNestedFamORAssem on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsAutoLayout(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsAutoLayout;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsAutoLayout on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsLayoutSequential(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsLayoutSequential;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsLayoutSequential on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsExplicitLayout(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsExplicitLayout;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsExplicitLayout on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsClass(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsClass;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsClass on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsInterface(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsInterface;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsInterface on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsValueType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsValueType;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsValueType on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsAbstract(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsAbstract;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsAbstract on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsSealed(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsSealed;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsSealed on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsEnum(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsEnum;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsEnum on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsSpecialName(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsSpecialName;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsSpecialName on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsImport(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsImport;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsImport on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsSerializable(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsSerializable;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsSerializable on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsAnsiClass(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsAnsiClass;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsAnsiClass on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsUnicodeClass(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsUnicodeClass;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsUnicodeClass on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsAutoClass(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsAutoClass;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsAutoClass on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsArray(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsArray;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsArray on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsGenericType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsGenericType;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsGenericType on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsGenericTypeDefinition(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsGenericTypeDefinition;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsGenericTypeDefinition on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsConstructedGenericType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsConstructedGenericType;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsConstructedGenericType on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsGenericParameter(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsGenericParameter;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsGenericParameter on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_GenericParameterPosition(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tint ret = obj.GenericParameterPosition;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index GenericParameterPosition on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_ContainsGenericParameters(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.ContainsGenericParameters;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index ContainsGenericParameters on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsByRef(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsByRef;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsByRef on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsPointer(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsPointer;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsPointer on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsPrimitive(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsPrimitive;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsPrimitive on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsCOMObject(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsCOMObject;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsCOMObject on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_HasElementType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.HasElementType;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index HasElementType on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsContextful(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsContextful;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsContextful on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsMarshalByRef(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsMarshalByRef;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsMarshalByRef on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_GenericTypeArguments(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Type[] ret = obj.GenericTypeArguments;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index GenericTypeArguments on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsSecurityCritical(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsSecurityCritical;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsSecurityCritical on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsSecuritySafeCritical(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsSecuritySafeCritical;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsSecuritySafeCritical on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_IsSecurityTransparent(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tbool ret = obj.IsSecurityTransparent;\n\t\t\tLuaDLL.lua_pushboolean(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index IsSecurityTransparent on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_UnderlyingSystemType(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Type obj = (System.Type)o;\n\t\t\tSystem.Type ret = obj.UnderlyingSystemType;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index UnderlyingSystemType on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/System_TypeWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: a713f1fe057cf7248b09e045a105933b\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/UnityEngine_CoroutineWrap.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class UnityEngine_CoroutineWrap\n{\n    public static void Register(LuaState L)\n    {\n        L.BeginClass(typeof(UnityEngine.Coroutine), null);\n        L.RegFunction(\"__tostring\", ToLua.op_ToString);\n        L.EndClass();\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/BaseType/UnityEngine_CoroutineWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0142bbe402aab764582bb960d6966d34\ntimeCreated: 1471422858\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/BaseType/UnityEngine_ObjectWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class UnityEngine_ObjectWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(UnityEngine.Object), typeof(System.Object));\n\t\tL.RegFunction(\"GetInstanceID\", GetInstanceID);\n\t\tL.RegFunction(\"GetHashCode\", GetHashCode);\n\t\tL.RegFunction(\"Equals\", Equals);\n\t\tL.RegFunction(\"FindObjectsOfType\", FindObjectsOfType);\n\t\tL.RegFunction(\"DontDestroyOnLoad\", DontDestroyOnLoad);\n\t\tL.RegFunction(\"FindObjectOfType\", FindObjectOfType);\n\t\tL.RegFunction(\"ToString\", ToString);\n\t\tL.RegFunction(\"Instantiate\", Instantiate);\n\t\tL.RegFunction(\"DestroyImmediate\", DestroyImmediate);\n\t\tL.RegFunction(\"Destroy\", Destroy);\n\t\tL.RegFunction(\"New\", _CreateUnityEngine_Object);\n\t\tL.RegFunction(\"__eq\", op_Equality);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"name\", get_name, set_name);\n\t\tL.RegFunction(\"getname\", get_name);\n\t\tL.RegFunction(\"setname\", set_name);\n\t\tL.RegVar(\"hideFlags\", get_hideFlags, set_hideFlags);\n\t\tL.RegFunction(\"gethideFlags\", get_hideFlags);\n\t\tL.RegFunction(\"sethideFlags\", set_hideFlags);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateUnityEngine_Object(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 0)\n\t\t\t{\n\t\t\t\tUnityEngine.Object obj = new UnityEngine.Object();\n\t\t\t\tToLua.Push(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: UnityEngine.Object.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetInstanceID(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tUnityEngine.Object obj = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n\t\t\tint o = obj.GetInstanceID();\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetHashCode(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tUnityEngine.Object obj = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n\t\t\tint o = obj.GetHashCode();\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Equals(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tUnityEngine.Object obj = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tbool o = obj != null ? obj.Equals(arg0) : arg0 == null;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int FindObjectsOfType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tUnityEngine.Object[] o = UnityEngine.Object.FindObjectsOfType(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int DontDestroyOnLoad(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tUnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n\t\t\tUnityEngine.Object.DontDestroyOnLoad(arg0);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int FindObjectOfType(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 1);\n\t\t\tUnityEngine.Object o = UnityEngine.Object.FindObjectOfType(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToString(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tUnityEngine.Object obj = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n\t\t\tstring o = obj.ToString();\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Equality(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tUnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1);\n\t\t\tUnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2);\n\t\t\tbool o = arg0 == arg1;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Instantiate(IntPtr L)\n\t{\n\t\tIntPtr L0 = LuaException.L;\n\n        try\n        {\n            ++LuaException.InstantiateCount;            \n            LuaException.L = L;\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n#if UNITY_5_4_OR_NEWER\n            else if (count == 2)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.CheckObject<UnityEngine.Transform>(L, 2);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n#endif\n            else if (count == 3 && TypeChecker.CheckTypes<UnityEngine.Vector3, UnityEngine.Quaternion>(L, 2))\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2);\n                UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n#if UNITY_5_4_OR_NEWER\n            else if (count == 3 && TypeChecker.CheckTypes<UnityEngine.Transform, bool>(L, 2))\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.ToObject(L, 2);\n                bool arg2 = LuaDLL.lua_toboolean(L, 3);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n            else if (count == 4)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Vector3 arg1 = ToLua.CheckVector3(L, 2);\n                UnityEngine.Quaternion arg2 = ToLua.CheckQuaternion(L, 3);\n                UnityEngine.Transform arg3 = (UnityEngine.Transform)ToLua.CheckObject<UnityEngine.Transform>(L, 4);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2, arg3);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n#endif\n            else\n            {\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: UnityEngine.Object.Instantiate\");\n            }\n        }\n        catch (Exception e)\n        {\n            LuaException.L = L0;\n            --LuaException.InstantiateCount;\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int DestroyImmediate(IntPtr L)\n\t{\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                ToLua.Destroy(L);\n                UnityEngine.Object.DestroyImmediate(arg0);\n                return 0;\n            }\n            else if (count == 2)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                bool arg1 = LuaDLL.luaL_checkboolean(L, 2);\n                ToLua.Destroy(L);\n                UnityEngine.Object.DestroyImmediate(arg0, arg1);\n                return 0;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: Object.DestroyImmediate\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Destroy(IntPtr L)\n\t{\n        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                ToLua.Destroy(L);\n                UnityEngine.Object.Destroy(arg0);\n                return 0;\n            }\n            else if (count == 2)\n            {                \n                float arg1 = (float)LuaDLL.luaL_checknumber(L, 2);\n                int udata = LuaDLL.tolua_rawnetobj(L, 1);\n                ObjectTranslator translator = LuaState.GetTranslator(L);\n                translator.DelayDestroy(udata, arg1);\n                return 0;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: Object.Destroy\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_name(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tUnityEngine.Object obj = (UnityEngine.Object)o;\n\t\t\tstring ret = obj.name;\n\t\t\tLuaDLL.lua_pushstring(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index name on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_hideFlags(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tUnityEngine.Object obj = (UnityEngine.Object)o;\n\t\t\tUnityEngine.HideFlags ret = obj.hideFlags;\n\t\t\tLuaDLL.lua_pushinteger(L, (int)ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index hideFlags on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_name(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tUnityEngine.Object obj = (UnityEngine.Object)o;\n\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\tobj.name = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index name on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_hideFlags(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tUnityEngine.Object obj = (UnityEngine.Object)o;\n\t\t\tUnityEngine.HideFlags arg0 = (UnityEngine.HideFlags)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tobj.hideFlags = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index hideFlags on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/BaseType/UnityEngine_ObjectWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 66f068299d0233f409ae0011b24ae1ba\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/BaseType.meta",
    "content": "fileFormatVersion: 2\nguid: 337508ffab1cff64bbf7476789c95d59\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaAttributes.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\n\nnamespace LuaInterface\n{\n    [AttributeUsage(AttributeTargets.Method)]\n    public sealed class MonoPInvokeCallbackAttribute : Attribute\n    {\n        public MonoPInvokeCallbackAttribute(Type type)\n        {\n        }\n    }\n\n    public class NoToLuaAttribute : System.Attribute\n    {\n        public NoToLuaAttribute()\n        {\n\n        }\n    }\n\n    public class UseDefinedAttribute : System.Attribute\n    {\n        public UseDefinedAttribute()\n        {\n\n        }\n    }\n\n    public class OverrideDefinedAttribute: System.Attribute\n    {\n        public OverrideDefinedAttribute()\n        {\n\n        }\n    }\n    \n    public sealed class LuaByteBufferAttribute : Attribute\n    {                \n        public LuaByteBufferAttribute()\n        {\n        }       \n    }\n\n    [AttributeUsage(AttributeTargets.Method)]\n    public sealed class LuaRenameAttribute : Attribute\n    {\n        public string Name;\n        public LuaRenameAttribute()\n        {\n        }\n    }\n}"
  },
  {
    "path": "Assets/ToLua/Core/LuaAttributes.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 036fab5eb22f19e4bba933e194fb4756\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaBaseRef.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nusing System;\nusing System.Runtime.CompilerServices;\nusing UnityEngine;\n\nnamespace LuaInterface\n{\n    public abstract class LuaBaseRef : IDisposable\n    {\n        public string name = null;\n        protected int reference = -1;\n        protected LuaState luaState;\n        protected ObjectTranslator translator = null;\n\n        protected volatile bool beDisposed;\n        protected int count = 0;\n\n        public LuaBaseRef()\n        {\n            IsAlive = true;\n            count = 1;\n        }\n\n        ~LuaBaseRef()\n        {\n            IsAlive = false;\n            Dispose(false);\n        }\n\n        public virtual void Dispose()\n        {\n            --count;\n\n            if (count > 0)\n            {\n                return;\n            }\n\n            IsAlive = false;\n            Dispose(true);            \n        }\n\n        public void AddRef()\n        {\n            ++count;            \n        }\n\n        public virtual void Dispose(bool disposeManagedResources)\n        {\n            if (!beDisposed)\n            {\n                beDisposed = true;   \n\n                if (reference > 0 && luaState != null)\n                {\n                    luaState.CollectRef(reference, name, !disposeManagedResources);\n                }\n                \n                reference = -1;\n                luaState = null;\n                count = 0;\n            }            \n        }\n\n        //慎用\n        public void Dispose(int generation)\n        {                         \n            if (count > generation)\n            {\n                return;\n            }\n\n            Dispose(true);\n        }\n\n        public LuaState GetLuaState()\n        {\n            return luaState;\n        }\n\n        public void Push()\n        {\n            luaState.Push(this);\n        }\n\n        public override int GetHashCode()\n        {\n            return RuntimeHelpers.GetHashCode(this);            \n        }\n\n        public virtual int GetReference()\n        {\n            return reference;\n        }\n\n        public override bool Equals(object o)\n        {\n            if (o == null) return reference <= 0;\n            LuaBaseRef lr = o as LuaBaseRef;      \n            \n            if (lr == null || lr.reference != reference)\n            {\n                return false;\n            }\n\n            return reference > 0;\n        }\n\n        static bool CompareRef(LuaBaseRef a, LuaBaseRef b)\n        {\n            if (System.Object.ReferenceEquals(a, b))\n            {\n                return true;\n            }\n\n            object l = a;\n            object r = b;\n\n            if (l == null && r != null)\n            {\n                return b.reference <= 0;\n            }\n\n            if (l != null && r == null)\n            {\n                return a.reference <= 0;\n            }\n\n            if (a.reference != b.reference)\n            {\n                return false;\n            }\n\n            return a.reference > 0;\n        }\n\n        public static bool operator == (LuaBaseRef a, LuaBaseRef b)\n        {\n            return CompareRef(a, b);\n        }\n\n        public static bool operator != (LuaBaseRef a, LuaBaseRef b)\n        {\n            return !CompareRef(a, b);\n        }\n\n        public volatile bool IsAlive = true;\n    }\n}"
  },
  {
    "path": "Assets/ToLua/Core/LuaBaseRef.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 39292548101f65b41be91c5d20f20812\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaBeatEvent.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing LuaInterface;\n\nnamespace LuaInterface\n{    \n    public class LuaBeatEvent : IDisposable\n    {\n        protected LuaState luaState;\n        protected bool beDisposed;\n\n        LuaTable self = null;\n        LuaFunction _add = null;\n        LuaFunction _remove = null;\n        //LuaFunction _call = null;\n\n        public LuaBeatEvent(LuaTable table)            \n        {\n            self = table;\n            luaState = table.GetLuaState();\n            self.AddRef();\n            \n            _add = self.GetLuaFunction(\"Add\");\n            _remove = self.GetLuaFunction(\"Remove\");\n            //_call = self.GetLuaFunction(\"__call\");            \n        }\n\n        public void Dispose()\n        {\n            self.Dispose();            \n            _add.Dispose();\n            _remove.Dispose();\n            //_call.Dispose();\n            Clear();\n        }\n\n        void Clear()\n        {\n            //_call = null;\n            _add = null;\n            _remove = null;\n            self = null;            \n            luaState = null;\n        }\n\n        public void Dispose(bool disposeManagedResources)\n        {\n            if (!beDisposed)\n            {\n                beDisposed = true;\n\n                //if (_call != null)\n                //{\n                //    _call.Dispose(disposeManagedResources);\n                //    _call = null;\n                //}\n\n                if (_add != null)\n                {\n                    _add.Dispose(disposeManagedResources);\n                    _add = null;\n                }\n\n                if (_remove != null)\n                {\n                    _remove.Dispose(disposeManagedResources);\n                    _remove = null;\n                }\n\n                if (self != null)\n                {\n                    self.Dispose(disposeManagedResources);\n                }\n\n                Clear();\n            }\n        }\n\n        public void Add(LuaFunction func, LuaTable obj)\n        {\n            if (func == null)\n            {\n                return;\n            }\n\n            _add.BeginPCall();\n            _add.Push(self);\n            _add.Push(func);\n            _add.Push(obj);\n            _add.PCall();\n            _add.EndPCall();\n        }\n\n        public void Remove(LuaFunction func, LuaTable obj)\n        {\n            if (func == null)\n            {\n                return;\n            }\n\n            _remove.BeginPCall();\n            _remove.Push(self);\n            _remove.Push(func);\n            _remove.Push(obj);\n            _remove.PCall();\n            _remove.EndPCall();\n        }\n\n        //public override int GetReference()\n        //{\n        //    return self.GetReference();\n        //}\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaBeatEvent.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c7332596f22ac5446852c531d7148318\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaDLL.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nusing System;\nusing System.Runtime.InteropServices;\nusing System.Reflection;\nusing System.Collections;\nusing System.Text;\nusing System.Security;\n\nnamespace LuaInterface\n{\n    public enum LuaTypes\n    {\n        LUA_TNONE = -1,\n        LUA_TNIL = 0,\n        LUA_TBOOLEAN = 1,\n        LUA_TLIGHTUSERDATA = 2,\n        LUA_TNUMBER = 3,\n        LUA_TSTRING = 4,\n        LUA_TTABLE = 5,\n        LUA_TFUNCTION = 6,\n        LUA_TUSERDATA = 7,\n        LUA_TTHREAD = 8,\n\n    }\n\n    public enum LuaGCOptions\n    {\n        LUA_GCSTOP = 0,\n        LUA_GCRESTART = 1,\n        LUA_GCCOLLECT = 2,\n        LUA_GCCOUNT = 3,\n        LUA_GCCOUNTB = 4,\n        LUA_GCSTEP = 5,\n        LUA_GCSETPAUSE = 6,\n        LUA_GCSETSTEPMUL = 7,\n    }\n\n    public enum LuaThreadStatus\n    {\n        LUA_YIELD = 1,\n        LUA_ERRRUN = 2,\n        LUA_ERRSYNTAX = 3,\n        LUA_ERRMEM = 4,\n        LUA_ERRERR = 5,\n    }\n\n    public enum LuaHookFlag\n    {\n        LUA_HOOKCALL = 0,\n        LUA_HOOKRET\t = 1,\n        LUA_HOOKLINE = 2,\n        LUA_HOOKCOUNT = 3,\n        LUA_HOOKTAILRET = 4,\n    }\n\n    public enum LuaMask\n    {\n        LUA_MASKCALL = 1, //1 << LUA_HOOKCALL\n        LUA_MASKRET\t= 2, //(1 << LUA_HOOKRET)\n        LUA_MASKLINE = 4,//\t(1 << LUA_HOOKLINE)\n        LUA_MASKCOUNT = 8, //\t(1 << LUA_HOOKCOUNT)\n    }\n\n\n    public class LuaIndexes\n    {\n        public static int LUA_REGISTRYINDEX = -10000;\n        public static int LUA_ENVIRONINDEX  = -10001;\n        public static int LUA_GLOBALSINDEX  = -10002;\n    }\n\n    public class LuaRIDX\n    {\n        public int LUA_RIDX_MAINTHREAD = 1;\n        public int LUA_RIDX_GLOBALS = 2;\n        public int LUA_RIDX_PRELOAD = 25;\n        public int LUA_RIDX_LOADED = 26;\n    }\n\n    public static class ToLuaFlags\n    {\n        public const int INDEX_ERROR = 1;       //Index 失败提示error信息，false返回nil\n        public const int USE_INT64 = 2;         //是否luavm内部支持原生int64(目前用的vm都不支持, 默认false)\n    }\n\n    [StructLayout(LayoutKind.Sequential)]\n    public struct Lua_Debug\n    {        \n        public int eventcode;        \n        public IntPtr _name;\t            /* (n) */                \n        public IntPtr _namewhat;\t        /* (n) `global', `local', `field', `method' */        \n        public IntPtr _what;\t            /* (S) `Lua', `C', `main', `tail' */        \n        public IntPtr _source;\t            /* (S) */        \n        public int currentline;\t            /* (l) */        \n        public int nups;\t\t            /* (u) number of upvalues */        \n        public int linedefined;     \t    /* (S) */        \n        public int lastlinedefined; \t    /* (S) */        \n        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]\n        public byte[] _short_src;                \n        public int i_ci;                    /* active function */\n\n        string tostring(IntPtr p)\n        {\n            if (p != IntPtr.Zero)\n            {\n                int len = LuaDLL.tolua_strlen(p);\n                return LuaDLL.lua_ptrtostring(p, len);\n            }\n\n            return string.Empty;\n        }\n\n        public string namewhat\n        {\n            get\n            {\n                return tostring(_namewhat);\n            }\n        }\n\n        public string name\n        {\n            get\n            {\n                return tostring(_name);\n            }\n        }\n\n        public string what\n        {\n            get\n            {\n                return tostring(_what);\n            }\n        }\n\n        public string source\n        {\n            get\n            {\n                return tostring(_source);\n            }\n        }        \n\n        int GetShortSrcLen(byte[] str)\n        {\n            int i = 0;\n\n            for (; i < 128; i++)\n            {\n                if (str[i] == '\\0')\n                {\n                    return i;\n                }\n            }\n\n            return i;\n        }\n\n        public string short_src\n        {\n            get\n            {\n                if (_short_src == null)\n                {\n                    return string.Empty;\n                }\n\n                int count = GetShortSrcLen(_short_src);\n                return Encoding.UTF8.GetString(_short_src, 0, count);\n            }\n        }        \n    }\n\n#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_WSA_10_0\n    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n    public delegate int LuaCSFunction(IntPtr luaState);        \n    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]\n    public delegate void LuaHookFunc(IntPtr L, ref Lua_Debug ar);\n#else\n    public delegate int LuaCSFunction(IntPtr luaState);    \n    public delegate void LuaHookFunc(IntPtr L, ref Lua_Debug ar);    \n#endif\n\n    public class LuaDLL\n    {\n        public static string version = \"1.0.7.386\";\n        public static int LUA_MULTRET = -1;\n        public static string[] LuaTypeName = { \"none\", \"nil\", \"boolean\", \"lightuserdata\", \"number\", \"string\", \"table\", \"function\", \"userdata\", \"thread\" };        \n\n#if !UNITY_EDITOR && UNITY_IPHONE\n        const string LUADLL = \"__Internal\";\n#else\n        const string LUADLL = \"tolua\";\n#endif\n      /*\n      ** third party library\n      */\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_sproto_core(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_protobuf_c(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_pb(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_ffi(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_bit(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_struct(IntPtr L);     \n   \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_lpeg(IntPtr L);             \n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_socket_core(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_mime_core(IntPtr L);\n                   \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_cjson(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaopen_cjson_safe(IntPtr L);\n\n        /*\n         ** pseudo-indices\n         */\n        public static int lua_upvalueindex(int i)\n        {\n            return LuaIndexes.LUA_GLOBALSINDEX - i;\n        }\n\n        /*\n         * state manipulation\n         */\n        //[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        //public static extern IntPtr lua_newstate(LuaAlloc f, IntPtr ud);                      //luajit64位不能用这个函数\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_close(IntPtr luaState);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]                        //[-0, +1, m]  \n        public static extern IntPtr lua_newthread(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr lua_atpanic(IntPtr luaState, IntPtr panic);\n\n        /*\n         * basic stack manipulation\n         */\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_gettop(IntPtr luaState);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_settop(IntPtr luaState, int top);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_pushvalue(IntPtr luaState, int idx);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_remove(IntPtr luaState, int idx);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_insert(IntPtr luaState, int idx);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_replace(IntPtr luaState, int index);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_checkstack(IntPtr luaState, int extra);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_xmove(IntPtr from, IntPtr to, int n);\n\n        /*\n         * access functions (stack -> C)\n         */\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_isnumber(IntPtr luaState, int idx);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_isstring(IntPtr luaState, int index);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_iscfunction(IntPtr luaState, int index);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_isuserdata(IntPtr luaState, int stackPos);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern LuaTypes lua_type(IntPtr luaState, int index);\n\n        public static string lua_typename(IntPtr luaState, LuaTypes type)\n        {\n            int t = (int)type;\n            return LuaTypeName[t + 1];\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_equal(IntPtr luaState, int idx1, int idx2);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_rawequal(IntPtr luaState, int idx1, int idx2);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_lessthan(IntPtr luaState, int idx1, int idx2);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern double lua_tonumber(IntPtr luaState, int idx);\n\n        public static int lua_tointeger(IntPtr luaState, int idx)\n        {\n            return tolua_tointeger(luaState, idx);\n        }\n\n        public static bool lua_toboolean(IntPtr luaState, int idx)\n        {\n            return tolua_toboolean(luaState, idx);            \n        }\n\n        public static IntPtr lua_tolstring(IntPtr luaState, int index, out int strLen)               //[-0, +0, m]\n        {            \n            return tolua_tolstring(luaState, index, out strLen);\n        }\n\n        public static int lua_objlen(IntPtr luaState, int idx)\n        {\n            return tolua_objlen(luaState, idx);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr lua_tocfunction(IntPtr luaState, int idx);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr lua_touserdata(IntPtr luaState, int idx);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr lua_tothread(IntPtr L, int idx);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr lua_topointer(IntPtr L, int idx);\n\n        /* \n         * push functions (C -> stack)\n         */\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_pushnil(IntPtr luaState);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_pushnumber(IntPtr luaState, double number);\n        \n        public static void lua_pushinteger(IntPtr L, int n)\n        {\n            lua_pushnumber(L, n);\n        }                \n\n        public static void lua_pushlstring(IntPtr luaState, byte[] str, int size)                   //[-0, +1, m]\n        {\n            if (size >= 0x7fffff00)\n            {\n                throw new LuaException(\"string length overflow\");\n            }\n\n            tolua_pushlstring(luaState, str, size);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_pushstring(IntPtr luaState, string str);                      //[-0, +1, m]\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_pushcclosure(IntPtr luaState, IntPtr fn, int n);              //[-n, +1, m]\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_pushboolean(IntPtr luaState, int value);\n\n        public static void lua_pushboolean(IntPtr luaState, bool value)\n        {\n            lua_pushboolean(luaState, value ? 1 : 0);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_pushlightuserdata(IntPtr luaState, IntPtr udata);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_pushthread(IntPtr L);\n\n        /*\n         * get functions (Lua -> stack)\n         */\n        public static void lua_gettable(IntPtr L, int idx)\n        {\n            if (LuaDLL.tolua_gettable(L, idx) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        public static void lua_getfield(IntPtr L, int idx, string key)\n        {\n            if (LuaDLL.tolua_getfield(L, idx, key) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_rawget(IntPtr luaState, int idx);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_rawgeti(IntPtr luaState, int idx, int n);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_createtable(IntPtr luaState, int narr, int nrec);             //[-0, +1, m]        \n\n        public static IntPtr lua_newuserdata(IntPtr luaState, int size)                             //[-0, +1, m]\n        {\n            return tolua_newuserdata(luaState, size);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_getmetatable(IntPtr luaState, int objIndex);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_getfenv(IntPtr luaState, int idx);\n\n        /*\n         * set functions (stack -> Lua)\n         */\n        public static void lua_settable(IntPtr L, int idx)\n        {\n            if (tolua_settable(L, idx) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        public static void lua_setfield(IntPtr L, int idx, string key)\n        {\n            if (tolua_setfield(L, idx, key) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_rawset(IntPtr luaState, int idx);                             //[-2, +0, m]       \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_rawseti(IntPtr luaState, int tableIndex, int index);          //[-1, +0, m]\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_setmetatable(IntPtr luaState, int objIndex);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_setfenv(IntPtr luaState, int stackPos);\n\n        /*\n         * `load' and `call' functions (load and run Lua code)\n         */\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_call(IntPtr luaState, int nArgs, int nResults);               //[-(nargs+1), +nresults, e]       \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_pcall(IntPtr luaState, int nArgs, int nResults, int errfunc);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_cpcall(IntPtr L, IntPtr func, IntPtr ud);\n\n        //[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        //public static extern int lua_load(IntPtr luaState, LuaChunkReader chunkReader, ref ReaderInfo data, string chunkName);\n        //[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        //public static extern int lua_dump(IntPtr L, LuaWriter writer, IntPtr data);\n\n        /* \n         * coroutine functions\n         */\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_yield(IntPtr L, int nresults);                                 //[-?, +?, e]       \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_resume(IntPtr L, int narg);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_status(IntPtr L);\n\n        /*\n         * garbage-collection function and options\n         */\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_gc(IntPtr luaState, LuaGCOptions what, int data);              //[-0, +0, e]\n\n        /*\n         * miscellaneous functions\n         */                \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_next(IntPtr luaState, int index);                              //[-1, +(2|0), e]        \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void lua_concat(IntPtr luaState, int n);                               //[-n, +1, e]\n\n        /* \n        ** ===============================================================\n        ** some useful functions\n        ** ===============================================================\n        */\n        public static void lua_pop(IntPtr luaState, int amount)\n        {\n            LuaDLL.lua_settop(luaState, -(amount) - 1);\n        }\n\n        public static void lua_newtable(IntPtr luaState)\n        {\n            LuaDLL.lua_createtable(luaState, 0, 0);\n        }\n\n        public static void lua_register(IntPtr luaState, string name, LuaCSFunction func)\n        {\n            lua_pushcfunction(luaState, func);\n            lua_setglobal(luaState, name);\n        }\n\n        public static void lua_pushcfunction(IntPtr luaState, LuaCSFunction func)\n        {\n            IntPtr fn = Marshal.GetFunctionPointerForDelegate(func);\n            lua_pushcclosure(luaState, fn, 0);\n        }\n\n        public static bool lua_isfunction(IntPtr luaState, int n)\n        {\n            return lua_type(luaState, n) == LuaTypes.LUA_TFUNCTION;\n        }\n\n        public static bool lua_istable(IntPtr luaState, int n)\n        {\n            return lua_type(luaState, n) == LuaTypes.LUA_TTABLE;\n        }\n\n        public static bool lua_islightuserdata(IntPtr luaState, int n)\n        {\n            return lua_type(luaState, n) == LuaTypes.LUA_TLIGHTUSERDATA;\n        }\n\n        public static bool lua_isnil(IntPtr luaState, int n)\n        {\n            return (lua_type(luaState, n) == LuaTypes.LUA_TNIL);\n        }\n\n        public static bool lua_isboolean(IntPtr luaState, int n)\n        {\n            LuaTypes type = lua_type(luaState, n);\n            return type == LuaTypes.LUA_TBOOLEAN || type == LuaTypes.LUA_TNIL;\n        }\n\n        public static bool lua_isthread(IntPtr luaState, int n)\n        {\n            return lua_type(luaState, n) == LuaTypes.LUA_TTHREAD;\n        }\n\n        public static bool lua_isnone(IntPtr luaState, int n)\n        {\n            return lua_type(luaState, n) == LuaTypes.LUA_TNONE;\n        }\n\n        public static bool lua_isnoneornil(IntPtr luaState, int n)\n        {\n            return lua_type(luaState, n) <= LuaTypes.LUA_TNIL;\n        }\n\n        public static void lua_setglobal(IntPtr luaState, string name)\n        {\n            lua_setfield(luaState, LuaIndexes.LUA_GLOBALSINDEX, name);\n        }\n\n        public static void lua_getglobal(IntPtr luaState, string name)\n        {\n            lua_getfield(luaState, LuaIndexes.LUA_GLOBALSINDEX, name);\n        }\n\n        public static string lua_ptrtostring(IntPtr str, int len)\n        {\n            string ss = Marshal.PtrToStringAnsi(str, len);\n\n            if (ss == null)\n            {\n                byte[] buffer = new byte[len];\n                Marshal.Copy(str, buffer, 0, len);\n                return Encoding.UTF8.GetString(buffer);\n            }\n\n            return ss;\n        }\n\n        public static string lua_tostring(IntPtr luaState, int index)\n        {\n            int len = 0;\n            IntPtr str = tolua_tolstring(luaState, index, out len);\n\n            if (str != IntPtr.Zero)\n            {\n                return lua_ptrtostring(str, len);\n            }\n\n            return null;\n        }\n\n        public static IntPtr lua_open()\n        {\n            return luaL_newstate();\n        }\n\n        public static void lua_getregistry(IntPtr L)\n        {\n            lua_pushvalue(L, LuaIndexes.LUA_REGISTRYINDEX);\n        }\n\n        public static int lua_getgccount(IntPtr L)\n        {\n            return lua_gc(L, LuaGCOptions.LUA_GCCOUNT, 0);\n        }\n\n        /*\n         ** ======================================================================\n         ** Debug API\n         ** =======================================================================\n         */\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_getstack(IntPtr L, int level, ref Lua_Debug ar);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_getinfo(IntPtr L, string what, ref Lua_Debug ar);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern string lua_getlocal(IntPtr L, ref Lua_Debug ar, int n);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern string lua_setlocal(IntPtr L, ref Lua_Debug ar, int n);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern string lua_getupvalue(IntPtr L, int funcindex, int n);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern string lua_setupvalue(IntPtr L, int funcindex, int n);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_sethook(IntPtr L, LuaHookFunc func, int mask, int count);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern LuaHookFunc lua_gethook(IntPtr L);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_gethookmask(IntPtr L);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int lua_gethookcount(IntPtr L);\n\n        //lualib.h\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void luaL_openlibs(IntPtr luaState);\n\n        //lauxlib.h\n        public static int abs_index(IntPtr L, int i)\n        {\n            return (i > 0 || i <= LuaIndexes.LUA_REGISTRYINDEX) ? i : lua_gettop(L) + i + 1;\n        }\n\n        public static int luaL_getn(IntPtr luaState, int i)\n        {\n            return (int)tolua_getn(luaState, i);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaL_getmetafield(IntPtr luaState, int stackPos, string field);           //[-0, +(0|1), m]\n\n        public static int luaL_callmeta(IntPtr L, int stackPos, string field)                              //[-0, +(0|1), m]\n        {\n            stackPos = abs_index(L, stackPos);\n\n            if (luaL_getmetafield(L, stackPos, field) == 0)  /* no metafield? */\n            {\n                return 0;\n            }\n\n            lua_pushvalue(L, stackPos);\n\n            if (lua_pcall(L, 1, 1, 0) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                lua_pop(L, 1);\n                throw new LuaException(error);\n            }\n\n            return 1;\n        }\n\n        public static int luaL_argerror(IntPtr L, int narg, string extramsg)\n        {\n            if (tolua_argerror(L, narg, extramsg) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                lua_pop(L, 1);\n                throw new LuaException(error);\n            }\n\n            return 0;\n        }\n\n        public static int luaL_typerror(IntPtr L, int stackPos, string tname, string t2 = null)\n        {\n            if (t2 == null)\n            {\n                t2 = luaL_typename(L, stackPos);\n            }\n\n            string msg = string.Format(\"{0} expected, got {1}\", tname, t2);\n            return luaL_argerror(L, stackPos, msg);\n        }\n\n        public static string luaL_checklstring(IntPtr L, int numArg, out int len)\n        {\n            IntPtr str = tolua_tolstring(L, numArg, out len);\n\n            if (str == IntPtr.Zero)\n            {\n                luaL_typerror(L, numArg, \"string\");\n                return null;\n            }\n\n            return lua_ptrtostring(str, len);\n        }\n\n        public static string luaL_optlstring(IntPtr L, int narg, string def, out int len)\n        {\n            if (lua_isnoneornil(L, narg))\n            {\n                len = def != null ? def.Length : 0;\n                return def;\n            }\n\n            return luaL_checklstring(L, narg, out len);\n        }\n\n        public static double luaL_checknumber(IntPtr L, int stackPos)\n        {\n            double d = lua_tonumber(L, stackPos);\n\n            if (d == 0 && LuaDLL.lua_isnumber(L, stackPos) == 0)\n            {\n                luaL_typerror(L, stackPos, \"number\");\n                return 0;\n            }\n\n            return d;\n        }\n\n        public static double luaL_optnumber(IntPtr L, int idx, double def)\n        {\n            if (lua_isnoneornil(L, idx))\n            {\n                return def;\n            }\n\n            return luaL_checknumber(L, idx);\n        }\n\n        public static int luaL_checkinteger(IntPtr L, int stackPos)\n        {\n            int d = tolua_tointeger(L, stackPos);\n\n            if (d == 0 && lua_isnumber(L, stackPos) == 0)\n            {\n                luaL_typerror(L, stackPos, \"number\");\n                return 0;\n            }\n\n            return d;\n        }\n\n        public static int luaL_optinteger(IntPtr L, int idx, int def)\n        {\n            if (lua_isnoneornil(L, idx))\n            {\n                return def;\n            }\n\n            return luaL_checkinteger(L, idx);\n        }\n\n        public static bool luaL_checkboolean(IntPtr luaState, int index)\n        {\n            if (lua_isboolean(luaState, index))\n            {\n                return lua_toboolean(luaState, index);\n            }\n\n            luaL_typerror(luaState, index, \"boolean\");\n            return false;\n        }\n\n        public static void luaL_checkstack(IntPtr L, int space, string mes)\n        {\n            if (lua_checkstack(L, space) == 0)\n            {\n                throw new LuaException(string.Format(\"stack overflow {0}\", mes));\n            }\n        }\n\n        public static void luaL_checktype(IntPtr L, int narg, LuaTypes t)\n        {\n            if (lua_type(L, narg) != t)\n            {\n                luaL_typerror(L, narg, lua_typename(L, t));\n            }\n        }\n\n        public static void luaL_checkany(IntPtr L, int narg)\n        {\n            if (lua_type(L, narg) == LuaTypes.LUA_TNONE)\n            {\n                luaL_argerror(L, narg, \"value expected\");\n            }\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaL_newmetatable(IntPtr luaState, string meta);                               //[-0, +1, m]\n\n        public static IntPtr luaL_checkudata(IntPtr L, int ud, string tname)\n        {\n            IntPtr p = lua_touserdata(L, ud);\n\n            if (p != IntPtr.Zero)\n            {\n                if (lua_getmetatable(L, ud) != 0)\n                {\n                    lua_getfield(L, LuaIndexes.LUA_REGISTRYINDEX, tname);  /* get correct metatable */\n\n                    if (lua_rawequal(L, -1, -2) != 0)\n                    {  /* does it have the correct mt? */\n                        lua_pop(L, 2);  /* remove both metatables */\n                        return p;\n                    }\n                }\n            }\n\n            luaL_typerror(L, ud, tname);    /* else error */\n            return IntPtr.Zero;             /* to avoid warnings */\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void luaL_where(IntPtr luaState, int level);                                           //[-0, +1, e]\n\n        //[DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        //public static extern int luaL_error(IntPtr luaState, string message);\n\n        public static int luaL_throw(IntPtr L, string message)\n        {\n            tolua_pushtraceback(L);\n            lua_pushstring(L, message);\n            lua_pushnumber(L, 1);\n\n            if (lua_pcall(L, 2, -1, 0) == 0)\n            {\n                message = lua_tostring(L, -1);\n            }\n            else\n            {\n                lua_pop(L, 1);\n            }\n\n            throw new LuaException(message, null, 2);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaL_ref(IntPtr luaState, int t);                                                  //[-1, +0, m]\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void luaL_unref(IntPtr luaState, int registryIndex, int reference);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaL_loadfile(IntPtr luaState, string filename);                                   //[-0, +1, e]\n\n        public static int luaL_loadbuffer(IntPtr luaState, byte[] buff, int size, string name)\n        {\n            return tolua_loadbuffer(luaState, buff, size, name);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int luaL_loadstring(IntPtr luaState, string chunk);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr luaL_newstate();\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr luaL_gsub(IntPtr luaState, string str, string pattern, string replacement);     //[-0, +1, e]  \n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr luaL_findtable(IntPtr luaState, int idx, string fname, int szhint = 1);\n\n        /*\n         ** ===============================================================\n         ** some useful functions\n         ** ===============================================================\n        */\n        public static string luaL_typename(IntPtr luaState, int stackPos)\n        {\n            LuaTypes type = LuaDLL.lua_type(luaState, stackPos);\n            return lua_typename(luaState, type);\n        }\n\n        public static bool luaL_dofile(IntPtr luaState, string fileName)                                              //[-0, +1, e]\n        {\n            int result = luaL_loadfile(luaState, fileName);\n\n            if (result != 0)\n            {\n                return false;\n            }\n\n            return LuaDLL.lua_pcall(luaState, 0, LUA_MULTRET, 0) == 0;\n        }\n\n        public static bool luaL_dostring(IntPtr luaState, string chunk)\n        {\n            int result = LuaDLL.luaL_loadstring(luaState, chunk);\n\n            if (result != 0)\n            {\n                return false;\n            }\n\n            return LuaDLL.lua_pcall(luaState, 0, LUA_MULTRET, 0) == 0;\n        }\n\n        public static void luaL_getmetatable(IntPtr luaState, string meta)\n        {\n            LuaDLL.lua_getfield(luaState, LuaIndexes.LUA_REGISTRYINDEX, meta);\n        }\n\n\n        /* compatibility with ref system */\n        public static int lua_ref(IntPtr luaState)\n        {\n            return LuaDLL.luaL_ref(luaState, LuaIndexes.LUA_REGISTRYINDEX);\n        }\n\n        public static void lua_getref(IntPtr luaState, int reference)\n        {\n            lua_rawgeti(luaState, LuaIndexes.LUA_REGISTRYINDEX, reference);\n        }\n\n        public static void lua_unref(IntPtr luaState, int reference)\n        {\n            luaL_unref(luaState, LuaIndexes.LUA_REGISTRYINDEX, reference);\n        }\n\n        /*\n        ** ======================================================\n        ** tolua libs\n        ** =======================================================\n        */\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_openlibs(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_openint64(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_openlualibs(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr tolua_tag();\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_newudata(IntPtr luaState, int val);                         //[-0, +0, m]\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_rawnetobj(IntPtr luaState, int obj);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_pushudata(IntPtr L, int index);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_pushnewudata(IntPtr L, int metaRef, int index);             //[-0, +0, m]\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_beginpcall(IntPtr L, int reference);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushtraceback(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_getvec2(IntPtr luaState, int stackPos, out float x, out float y);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_getvec3(IntPtr luaState, int stackPos, out float x, out float y, out float z);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_getvec4(IntPtr luaState, int stackPos, out float x, out float y, out float z, out float w);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_getclr(IntPtr luaState, int stackPos, out float r, out float g, out float b, out float a);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_getquat(IntPtr luaState, int stackPos, out float x, out float y, out float z, out float w);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_getlayermask(IntPtr luaState, int stackPos);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushvec2(IntPtr luaState, float x, float y);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushvec3(IntPtr luaState, float x, float y, float z);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushvec4(IntPtr luaState, float x, float y, float z, float w);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushquat(IntPtr luaState, float x, float y, float z, float w);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushclr(IntPtr luaState, float r, float g, float b, float a);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushlayermask(IntPtr luaState, int mask);\n\n        public static bool tolua_isint64(IntPtr luaState, int stackPos)\n        {\n            return lua_isnumber(luaState, stackPos) != 0;\n        }\n\n        public static long tolua_toint64(IntPtr luaState, int stackPos)\n        {\n            return (long)lua_tonumber(luaState, stackPos);\n        }\n\n        public static long tolua_checkint64(IntPtr L, int stackPos)\n        {\n            return (long)luaL_checknumber(L, stackPos);\n        }\n\n        public static void tolua_pushint64(IntPtr luaState, long n)\n        {\n            lua_pushnumber(luaState, n);\n        }\n\n        public static bool tolua_isuint64(IntPtr luaState, int stackPos)\n        {\n            return lua_isnumber(luaState, stackPos) != 0;\n        }\n\n        public static ulong tolua_touint64(IntPtr luaState, int stackPos)\n        {\n            return (ulong)lua_tonumber(luaState, stackPos);\n        }\n\n        public static ulong tolua_checkuint64(IntPtr L, int stackPos)\n        {\n            return (ulong)luaL_checknumber(L, stackPos);\n        }\n\n        public static void tolua_pushuint64(IntPtr luaState, ulong n)\n        {\n            lua_pushnumber(luaState, n);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_setindex(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_setnewindex(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int toluaL_ref(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void toluaL_unref(IntPtr L, int reference);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr tolua_getmainstate(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_getvaluetype(IntPtr L, int stackPos);                \n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_createtable(IntPtr L, string fullPath, int szhint = 0);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_pushluatable(IntPtr L, string fullPath);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_beginmodule(IntPtr L, string name);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_endmodule(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_beginpremodule(IntPtr L, string fullPath, int szhint = 0);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_endpremodule(IntPtr L, int reference);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_addpreload(IntPtr L, string path);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_beginclass(IntPtr L, string name, int baseMetaRef, int reference = -1);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_endclass(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_function(IntPtr L, string name, IntPtr fn);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr tolua_tocbuffer(string name, int sz);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_freebuffer(IntPtr buffer);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_variable(IntPtr L, string name, IntPtr get, IntPtr set);\n\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_constant(IntPtr L, string name, double val);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_beginenum(IntPtr L, string name);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_endenum(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_beginstaticclass(IntPtr L, string name);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_endstaticclass(IntPtr L);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_require(IntPtr L, string fileName);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_getmetatableref(IntPtr L, int pos);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_setflag(int bit, [MarshalAs(UnmanagedType.I1)]bool flag);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_isvptrtable(IntPtr L, int index);\n\n        public static int toluaL_exception(IntPtr L, Exception e)\n        {            \n            LuaException.luaStack = new LuaException(e.Message, e, 2);            \n            return tolua_error(L, e.Message);\n        }\n\n        public static int toluaL_exception(IntPtr L, Exception e, object o, string msg)\n        {\n            if (o != null && !o.Equals(null))\n            {\n                msg = e.Message;\n            }\n            \n            LuaException.luaStack = new LuaException(msg, e, 2);\n            return tolua_error(L, msg);\n        }\n\n        //适配函数\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_loadbuffer(IntPtr luaState, byte[] buff, int size, string name);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        [return: MarshalAs(UnmanagedType.I1)]\n        public static extern bool tolua_toboolean(IntPtr luaState, int index);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_tointeger(IntPtr luaState, int idx);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr tolua_tolstring(IntPtr luaState, int index, out int strLen);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushlstring(IntPtr luaState, byte[] str, int size);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_objlen(IntPtr luaState, int stackPos);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr tolua_newuserdata(IntPtr luaState, int size);                     //[-0, +1, m]\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_argerror(IntPtr luaState, int narg, string extramsg);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_error(IntPtr L, string msg);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_getfield(IntPtr L, int idx, string key);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_setfield(IntPtr L, int idx, string key);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_gettable(IntPtr luaState, int idx);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_settable(IntPtr luaState, int idx);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_getn(IntPtr luaState, int stackPos);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_strlen(IntPtr str);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushcfunction(IntPtr L, IntPtr fn);\n\n        public static void tolua_pushcfunction(IntPtr luaState, LuaCSFunction func)\n        {\n            IntPtr fn = Marshal.GetFunctionPointerForDelegate(func);\n            tolua_pushcfunction(luaState, fn);\n        }\n\n        public static string tolua_findtable(IntPtr L, int idx, string name, int size = 1)\n        {\n            int oldTop = lua_gettop(L);\n            IntPtr p = LuaDLL.luaL_findtable(L, idx, name, size);\n\n            if (p != IntPtr.Zero)\n            {\n                LuaDLL.lua_settop(L, oldTop);\n                int len = LuaDLL.tolua_strlen(p);\n                return LuaDLL.lua_ptrtostring(p, len);\n            }\n\n            return null;\n        }\n\n        public static IntPtr tolua_atpanic(IntPtr L, LuaCSFunction func)\n        {\n            IntPtr fn = Marshal.GetFunctionPointerForDelegate(func);\n            return lua_atpanic(L, fn);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern IntPtr tolua_buffinit(IntPtr luaState);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_addlstring(IntPtr b, string str, int l);      \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_addstring(IntPtr b, string s);                \n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_addchar(IntPtr b, byte s);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_pushresult(IntPtr b);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_update(IntPtr L, float deltaTime, float unscaledDelta);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_lateupdate(IntPtr L);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_fixedupdate(IntPtr L, float fixedTime);\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern void tolua_regthis(IntPtr L, IntPtr get, IntPtr set);\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_where(IntPtr L, int level);\n\n        public static void tolua_bindthis(IntPtr L, LuaCSFunction get, LuaCSFunction set)\n        {\n            IntPtr pGet = IntPtr.Zero;\n            IntPtr pSet = IntPtr.Zero;\n\n            if (get != null)\n            {\n                pGet = Marshal.GetFunctionPointerForDelegate(get);\n            }\n\n            if (set != null)\n            {\n                pSet = Marshal.GetFunctionPointerForDelegate(set);\n            }\n\n            tolua_regthis(L, pGet, pSet);\n        }\n\n        [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]\n        public static extern int tolua_getclassref(IntPtr L, int pos);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaDLL.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d60cef534e986e849a829838fbeb74b5\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaEvent.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing LuaInterface;\n\nnamespace LuaInterface\n{    \n    public class LuaEvent : IDisposable\n    {\n        protected LuaState luaState;\n        protected bool beDisposed;\n\n        LuaTable self = null;\n        LuaFunction _add = null;\n        LuaFunction _remove = null;\n        //LuaFunction _call = null;\n\n        public LuaEvent(LuaTable table)            \n        {\n            self = table;\n            luaState = table.GetLuaState();\n            self.AddRef();\n            \n            _add = self.GetLuaFunction(\"Add\");\n            _remove = self.GetLuaFunction(\"Remove\");\n            //_call = self.GetLuaFunction(\"__call\");            \n        }\n\n        public void Dispose()\n        {\n            self.Dispose();            \n            _add.Dispose();\n            _remove.Dispose();\n            //_call.Dispose();\n            Clear();\n        }\n\n        void Clear()\n        {\n            //_call = null;\n            _add = null;\n            _remove = null;\n            self = null;            \n            luaState = null;\n        }\n\n        public void Dispose(bool disposeManagedResources)\n        {\n            if (!beDisposed)\n            {\n                beDisposed = true;\n\n                //if (_call != null)\n                //{\n                //    _call.Dispose(disposeManagedResources);\n                //    _call = null;\n                //}\n\n                if (_add != null)\n                {\n                    _add.Dispose(disposeManagedResources);\n                    _add = null;\n                }\n\n                if (_remove != null)\n                {\n                    _remove.Dispose(disposeManagedResources);\n                    _remove = null;\n                }\n\n                if (self != null)\n                {\n                    self.Dispose(disposeManagedResources);\n                }\n\n                Clear();\n            }\n        }\n\n        public void Add(LuaFunction func, LuaTable obj)\n        {\n            if (func == null)\n            {\n                return;\n            }\n\n            _add.BeginPCall();\n            _add.Push(self);\n            _add.Push(func);\n            _add.Push(obj);\n            _add.PCall();\n            _add.EndPCall();\n        }\n\n        public void Remove(LuaFunction func, LuaTable obj)\n        {\n            if (func == null)\n            {\n                return;\n            }\n\n            _remove.BeginPCall();\n            _remove.Push(self);\n            _remove.Push(func);\n            _remove.Push(obj);\n            _remove.PCall();\n            _remove.EndPCall();\n        }\n\n        //public override int GetReference()\n        //{\n        //    return self.GetReference();\n        //}\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaEvent.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ce5b2d0ac4f71564c84ecc85556409a4\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaException.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nusing System;\nusing System.Diagnostics;\nusing System.Reflection;\nusing System.Text;\nusing UnityEngine;\n\nnamespace LuaInterface\n{\n    public class LuaException : Exception\n    {\n        public static Exception luaStack = null;\n        public static string projectFolder = null;\n        public static int InstantiateCount = 0;\n        public static int SendMsgCount = 0;\n        public static IntPtr L = IntPtr.Zero;\n\n        public override string StackTrace\n        {\n            get\n            {\n                return _stack;\n            }\n        }\n\n        protected string _stack = string.Empty;        \n\n        public LuaException(string msg, Exception e = null, int skip = 1)\n            : base(msg)\n        {                                  \n            if (e != null)\n            {\n                if (e is LuaException)\n                {\n                    _stack = e.StackTrace;\n                }\n                else\n                {                                        \n                    StackTrace trace = new StackTrace(e, true);\n                    StringBuilder sb = new StringBuilder();\n                    ExtractFormattedStackTrace(trace, sb);                    \n                    StackTrace self = new StackTrace(skip, true);\n                    ExtractFormattedStackTrace(self, sb, trace);\n                    _stack = sb.ToString();                    \n                }\n            }\n            else\n            {\n                StackTrace self = new StackTrace(skip, true);\n                StringBuilder sb = new StringBuilder();\n                ExtractFormattedStackTrace(self, sb);\n                _stack = sb.ToString();\n            }                        \n        }\n\n        public static Exception GetLastError()\n        {\n            Exception last = luaStack;\n            luaStack = null;\n            return last;\n        }\n\n        public static void ExtractFormattedStackTrace(StackTrace trace, StringBuilder sb, StackTrace skip = null)\n        {\n            int begin = 0;\n\n            if (skip != null && skip.FrameCount > 0)\n            {\n                MethodBase m0 = skip.GetFrame(skip.FrameCount - 1).GetMethod();\n\n                for (int i = 0; i < trace.FrameCount; i++)\n                {\n                    StackFrame frame = trace.GetFrame(i);\n                    MethodBase method = frame.GetMethod();\n\n                    if (method == m0)\n                    {\n                        begin = i + 1;\n                        break;\n                    }                    \n                }\n\n                sb.AppendLineEx();\n            }\n\n            for (int i = begin; i < trace.FrameCount; i++)\n            {\n                StackFrame frame = trace.GetFrame(i);\n                MethodBase method = frame.GetMethod();\n\n                if (method == null || method.DeclaringType == null)\n                {\n                    continue;\n                }                               \n\n                Type declaringType = method.DeclaringType;\n                string str = declaringType.Namespace;\n\n                if ( (InstantiateCount == 0 && declaringType == typeof(UnityEngine.Object) &&  method.Name == \"Instantiate\") //(method.Name == \"Internal_CloneSingle\"\n                    || (SendMsgCount == 0 && declaringType == typeof(GameObject) && method.Name == \"SendMessage\"))\n                {\n                    break;\n                }\n\n                if ((str != null) && (str.Length != 0))\n                {\n                    sb.Append(str);\n                    sb.Append(\".\");\n                }\n\n                sb.Append(declaringType.Name);\n                sb.Append(\":\");\n                sb.Append(method.Name);\n                sb.Append(\"(\");\n                int index = 0;\n                ParameterInfo[] parameters = method.GetParameters();\n                bool flag = true;\n\n                while (index < parameters.Length)\n                {\n                    if (!flag)\n                    {\n                        sb.Append(\", \");\n                    }\n                    else\n                    {\n                        flag = false;\n                    }\n\n                    sb.Append(parameters[index].ParameterType.Name);\n                    index++;\n                }\n\n                sb.Append(\")\");\n                string fileName = frame.GetFileName();                \n\n                if (fileName != null)\n                {\n                    fileName = fileName.Replace('\\\\', '/');\n                    sb.Append(\" (at \");\n\n                    if (fileName.StartsWith(projectFolder))\n                    {\n                        fileName = fileName.Substring(projectFolder.Length, fileName.Length - projectFolder.Length);\n                    }\n\n                    sb.Append(fileName);\n                    sb.Append(\":\");\n                    sb.Append(frame.GetFileLineNumber().ToString());\n                    sb.Append(\")\");\n                }\n\n                if (i != trace.FrameCount - 1)\n                {\n                    sb.Append(\"\\n\");\n                }\n            }\n        }\n\n        public static void Init(IntPtr L0)\n        {\n            L = L0;\n            Type type = typeof(StackTraceUtility);\n            FieldInfo field = type.GetField(\"projectFolder\", BindingFlags.Static | BindingFlags.GetField | BindingFlags.NonPublic);\n            LuaException.projectFolder = (string)field.GetValue(null);\n            projectFolder = projectFolder.Replace('\\\\', '/');\n#if DEVELOPER\n            Debugger.Log(\"projectFolder is {0}\", projectFolder);\n#endif\n        }\n    }\n}"
  },
  {
    "path": "Assets/ToLua/Core/LuaException.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1b37c8a2d4e86364c85c26a407d79af7\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaFileUtils.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nusing UnityEngine;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Collections;\nusing System.Text;\n\nnamespace LuaInterface\n{\n    public class LuaFileUtils\n    {\n        public static LuaFileUtils Instance\n        {\n            get\n            {\n                if (instance == null)\n                {\n                    instance = new LuaFileUtils();\n                }\n\n                return instance;\n            }\n\n            protected set\n            {\n                instance = value;\n            }\n        }\n\n        //beZip = false 在search path 中查找读取lua文件。否则从外部设置过来bundel文件中读取lua文件\n        public bool beZip = false;\n        protected List<string> searchPaths = new List<string>();\n        protected Dictionary<string, AssetBundle> zipMap = new Dictionary<string, AssetBundle>();\n\n        protected static LuaFileUtils instance = null;\n\n        public LuaFileUtils()\n        {\n            instance = this;\n        }\n\n        public virtual void Dispose()\n        {\n            if (instance != null)\n            {\n                instance = null;\n                searchPaths.Clear();\n\n                foreach (KeyValuePair<string, AssetBundle> iter in zipMap)\n                {\n                    iter.Value.Unload(true);\n                }\n\n                zipMap.Clear();\n            }\n        }\n\n        //格式: 路径/?.lua\n        public bool AddSearchPath(string path, bool front = false)\n        {\n            int index = searchPaths.IndexOf(path);\n\n            if (index >= 0)\n            {\n                return false;\n            }\n\n            if (front)\n            {\n                searchPaths.Insert(0, path);\n            }\n            else\n            {\n                searchPaths.Add(path);\n            }\n\n            return true;\n        }\n\n        public bool RemoveSearchPath(string path)\n        {\n            int index = searchPaths.IndexOf(path);\n\n            if (index >= 0)\n            {\n                searchPaths.RemoveAt(index);\n                return true;\n            }\n\n            return false;\n        }\n\n        public void AddSearchBundle(string name, AssetBundle bundle)\n        {\n            zipMap[name] = bundle;\n        }\n\n        public string FindFile(string fileName)\n        {\n            if (fileName == string.Empty)\n            {\n                return string.Empty;\n            }\n\n            if (Path.IsPathRooted(fileName))\n            {\n                if (!fileName.EndsWith(\".lua\"))\n                {\n                    fileName += \".lua\";\n                }\n\n                return fileName;\n            }\n\n            if (fileName.EndsWith(\".lua\"))\n            {\n                fileName = fileName.Substring(0, fileName.Length - 4);\n            }\n\n            string fullPath = null;\n\n            for (int i = 0; i < searchPaths.Count; i++)\n            {\n                fullPath = searchPaths[i].Replace(\"?\", fileName);\n\n                if (File.Exists(fullPath))\n                {\n                    return fullPath;\n                }\n            }\n\n            return null;\n        }\n\n        public virtual byte[] ReadFile(string fileName)\n        {\n            if (!beZip)\n            {\n                string path = FindFile(fileName);\n                byte[] str = null;\n\n                if (!string.IsNullOrEmpty(path) && File.Exists(path))\n                {\n#if !UNITY_WEBPLAYER\n                    str = File.ReadAllBytes(path);\n#else\n                    throw new LuaException(\"can't run in web platform, please switch to other platform\");\n#endif\n                }\n\n                return str;\n            }\n            else\n            {\n                return ReadZipFile(fileName);\n            }\n        }\n\n        public virtual string FindFileError(string fileName)\n        {\n            if (Path.IsPathRooted(fileName))\n            {\n                return fileName;\n            }\n\n            if (fileName.EndsWith(\".lua\"))\n            {\n                fileName = fileName.Substring(0, fileName.Length - 4);\n            }\n\n            using (CString.Block())\n            {\n                CString sb = CString.Alloc(512);\n\n                for (int i = 0; i < searchPaths.Count; i++)\n                {\n                    sb.Append(\"\\n\\tno file '\").Append(searchPaths[i]).Append('\\'');\n                }\n\n                sb = sb.Replace(\"?\", fileName);\n\n                if (beZip)\n                {\n                    int pos = fileName.LastIndexOf('/');\n\n                    if (pos > 0)\n                    {\n                        int tmp = pos + 1;\n                        sb.Append(\"\\n\\tno file '\").Append(fileName, tmp, fileName.Length - tmp).Append(\".lua' in \").Append(\"lua_\");\n                        tmp = sb.Length;\n                        sb.Append(fileName, 0, pos).Replace('/', '_', tmp, pos).Append(\".unity3d\");\n                    }\n                    else\n                    {\n                        sb.Append(\"\\n\\tno file '\").Append(fileName).Append(\".lua' in \").Append(\"lua.unity3d\");\n                    }\n                }\n\n                return sb.ToString();\n            }\n        }\n\n        byte[] ReadZipFile(string fileName)\n        {\n            AssetBundle zipFile = null;\n            byte[] buffer = null;\n            string zipName = null;\n\n            using (CString.Block())\n            {\n                CString sb = CString.Alloc(256);\n                sb.Append(\"lua\");\n                int pos = fileName.LastIndexOf('/');\n\n                if (pos > 0)\n                {\n                    sb.Append(\"_\");\n                    sb.Append(fileName, 0, pos).ToLower().Replace('/', '_');\n                    fileName = fileName.Substring(pos + 1);\n                }\n\n                if (!fileName.EndsWith(\".lua\"))\n                {\n                    fileName += \".lua\";\n                }\n\n#if UNITY_5 || UNITY_5_3_OR_NEWER\n                fileName += \".bytes\";\n#endif\n                zipName = sb.ToString();\n                zipMap.TryGetValue(zipName, out zipFile);\n            }\n\n            if (zipFile != null)\n            {\n#if UNITY_4_6 || UNITY_4_7\n                TextAsset luaCode = zipFile.Load(fileName, typeof(TextAsset)) as TextAsset;\n#else\n                TextAsset luaCode = zipFile.LoadAsset<TextAsset>(fileName);\n#endif\n                if (luaCode != null)\n                {\n                    buffer = luaCode.bytes;\n                    Resources.UnloadAsset(luaCode);\n                }\n            }\n\n            return buffer;\n        }\n\n        public static string GetOSDir()\n        {\n            return LuaConst.osDir;\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaFileUtils.cs.meta",
    "content": "fileFormatVersion: 2\nguid: bc1dfae6a246cdf418b607701b2dfc7c\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaFunction.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Collections.Generic;\nusing UnityEngine;\n\nnamespace LuaInterface\n{\n    public class LuaFunction : LuaBaseRef\n    {\n        protected struct FuncData\n        {\n            public int oldTop;\n            public int stackPos;\n\n            public FuncData(int top, int stack)\n            {\n                oldTop = top;\n                stackPos = stack;\n            }\n        }\n\n        protected int oldTop = -1;\n        private int argCount = 0;\n        private int stackPos = -1;\n        private Stack<FuncData> stack = new Stack<FuncData>();\n\n        public LuaFunction(int reference, LuaState state)\n        {\n            this.reference = reference;\n            this.luaState = state;\n        }\n\n        public override void Dispose()\n        {\n#if UNITY_EDITOR\n            if (oldTop != -1 && count <= 1)\n            {\n                Debugger.LogError(\"You must call EndPCall before calling Dispose\");\n            }\n#endif\n            base.Dispose();\n        }\n\n        public T ToDelegate<T>() where T : class\n        {\n            return DelegateTraits<T>.Create(this) as T;\n        }\n\n        public virtual int BeginPCall()\n        {\n            if (luaState == null)\n            {\n                throw new LuaException(\"LuaFunction has been disposed\");\n            }\n\n            stack.Push(new FuncData(oldTop, stackPos));\n            oldTop = luaState.BeginPCall(reference);\n            stackPos = -1;\n            argCount = 0;\n            return oldTop;\n        }\n\n        public void PCall()\n        {\n#if UNITY_EDITOR\n            if (oldTop == -1)\n            {\n                Debugger.LogError(\"You must call BeginPCall before calling PCall\");\n            }\n#endif\n\n            stackPos = oldTop + 1;\n\n            try\n            {\n                luaState.PCall(argCount, oldTop);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void EndPCall()\n        {\n            if (oldTop != -1)\n            {\n                luaState.EndPCall(oldTop);\n                argCount = 0;\n                FuncData data = stack.Pop();\n                oldTop = data.oldTop;\n                stackPos = data.stackPos;\n            }\n        }\n\n        public void Call()\n        {\n            BeginPCall();\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1>(T1 arg1)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1, T2>(T1 arg1, T2 arg2)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1, T2, T3>(T1 arg1, T2 arg2, T3 arg3)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1, T2, T3, T4>(T1 arg1, T2 arg2, T3 arg3, T4 arg4)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1, T2, T3, T4, T5>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1, T2, T3, T4, T5, T6>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PushGeneric(arg6);\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1, T2, T3, T4, T5, T6, T7>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PushGeneric(arg6);\n            PushGeneric(arg7);\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1, T2, T3, T4, T5, T6, T7, T8>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PushGeneric(arg6);\n            PushGeneric(arg7);\n            PushGeneric(arg8);\n            PCall();\n            EndPCall();\n        }\n\n        public void Call<T1, T2, T3, T4, T5, T6, T7, T8, T9>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PushGeneric(arg6);\n            PushGeneric(arg7);\n            PushGeneric(arg8);\n            PushGeneric(arg9);\n            PCall();\n            EndPCall();\n        }\n\n        public R1 Invoke<R1>()\n        {\n            BeginPCall();\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, R1>(T1 arg1)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, T2, R1>(T1 arg1, T2 arg2)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, T2, T3, R1>(T1 arg1, T2 arg2, T3 arg3)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, R1>(T1 arg1, T2 arg2, T3 arg3, T4 arg4)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, R1>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, T6, R1>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PushGeneric(arg6);\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, T6, T7, R1>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PushGeneric(arg6);\n            PushGeneric(arg7);\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, T6, T7, T8, R1>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PushGeneric(arg6);\n            PushGeneric(arg7);\n            PushGeneric(arg8);\n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, T6, T7, T8, T9, R1>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)\n        {\n            BeginPCall();\n            PushGeneric(arg1);\n            PushGeneric(arg2);\n            PushGeneric(arg3);\n            PushGeneric(arg4);\n            PushGeneric(arg5);\n            PushGeneric(arg6);\n            PushGeneric(arg7);\n            PushGeneric(arg8);\n            PushGeneric(arg9);            \n            PCall();\n            R1 ret1 = CheckValue<R1>();\n            EndPCall();\n            return ret1;\n        }\n\n        //慎用, 有gc alloc\n        [System.Obsolete(\"LuaFunction.LazyCall() is obsolete.Use LuaFunction.Invoke()\")]\n        public object[] LazyCall(params object[] args)\n        {\n            BeginPCall();\n            int count = args == null ? 0 : args.Length;\n\n            if (!luaState.LuaCheckStack(count + 6))\n            {\n                EndPCall();\n                throw new LuaException(\"stack overflow\");\n            }\n            \n            PushArgs(args);\n            PCall();\n            object[] objs = luaState.CheckObjects(oldTop);\n            EndPCall();\n            return objs;\n        }\n\n        public void CheckStack(int args)\n        {\n            luaState.LuaCheckStack(args + 6);\n        }\n\n        public bool IsBegin()\n        {\n            return oldTop != -1;\n        }\n\n        public void Push(double num)\n        {\n            luaState.Push(num);\n            ++argCount;\n        }\n\n        public void Push(int n)\n        {\n            luaState.Push(n);\n            ++argCount;\n        }\n\n        public void PushLayerMask(LayerMask n)\n        {\n            luaState.PushLayerMask(n);\n            ++argCount;\n        }\n\n        public void Push(uint un)\n        {\n            luaState.Push(un);\n            ++argCount;\n        }\n\n        public void Push(long num)\n        {\n            luaState.Push(num);\n            ++argCount;\n        }\n\n        public void Push(ulong un)\n        {\n            luaState.Push(un);\n            ++argCount;\n        }\n\n        public void Push(bool b)\n        {\n            luaState.Push(b);\n            ++argCount;\n        }\n\n        public void Push(string str)\n        {\n            luaState.Push(str);\n            ++argCount;\n        }\n\n        public void Push(IntPtr ptr)\n        {\n            luaState.Push(ptr);\n            ++argCount;\n        }\n\n        public void Push(LuaBaseRef lbr)\n        {\n            luaState.Push(lbr);\n            ++argCount;\n        }\n\n        public void Push(object o)\n        {\n            luaState.PushVariant(o);\n            ++argCount;\n        }\n\n        public void Push(UnityEngine.Object o)\n        {\n            luaState.Push(o);\n            ++argCount;\n        }\n\n        public void Push(Type t)\n        {\n            luaState.Push(t);\n            ++argCount;\n        }\n\n        public void Push(Enum e)\n        {\n            luaState.Push(e);\n            ++argCount;\n        }\n\n        public void Push(Array array)\n        {\n            luaState.Push(array);\n            ++argCount;\n        }\n\n        public void Push(Vector3 v3)\n        {\n            luaState.Push(v3);\n            ++argCount;\n        }\n\n        public void Push(Vector2 v2)\n        {\n            luaState.Push(v2);\n            ++argCount;\n        }\n\n        public void Push(Vector4 v4)\n        {\n            luaState.Push(v4);\n            ++argCount;\n        }\n\n        public void Push(Quaternion quat)\n        {\n            luaState.Push(quat);\n            ++argCount;\n        }\n\n        public void Push(Color clr)\n        {\n            luaState.Push(clr);\n            ++argCount;\n        }\n\n        public void Push(Ray ray)\n        {\n            try\n            {\n                luaState.Push(ray);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void Push(Bounds bounds)\n        {\n            try\n            {\n                luaState.Push(bounds);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void Push(RaycastHit hit)\n        {\n            try\n            {\n                luaState.Push(hit);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void Push(Touch t)\n        {\n            try\n            {\n                luaState.Push(t);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void Push(LuaByteBuffer buffer)\n        {\n            try\n            {\n                luaState.Push(buffer);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void PushValue<T>(T value) where T : struct\n        {\n            try\n            {\n                luaState.PushValue(value);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void PushObject(object o)\n        {\n            try\n            {\n                luaState.PushObject(o);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void PushSealed<T>(T o)\n        {\n            try\n            {\n                luaState.PushSealed(o);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void PushGeneric<T>(T t)\n        {\n            try\n            {\n                luaState.PushGeneric(t);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public void PushArgs(object[] args)\n        {\n            if (args == null)\n            {\n                return;\n            }\n\n            argCount += args.Length;\n            luaState.PushArgs(args);\n        }\n\n        public void PushByteBuffer(byte[] buffer, int len = -1)\n        {\n            try\n            {\n                if (len == -1)\n                {\n                    len = buffer.Length;\n                }\n\n                luaState.PushByteBuffer(buffer, len);\n                ++argCount;\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public double CheckNumber()\n        {\n            try\n            {\n                return luaState.LuaCheckNumber(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public bool CheckBoolean()\n        {\n            try\n            {\n                return luaState.LuaCheckBoolean(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public string CheckString()\n        {\n            try\n            {\n                return luaState.CheckString(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public Vector3 CheckVector3()\n        {\n            try\n            {\n                return luaState.CheckVector3(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public Quaternion CheckQuaternion()\n        {\n            try\n            {\n                return luaState.CheckQuaternion(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public Vector2 CheckVector2()\n        {\n            try\n            {\n                return luaState.CheckVector2(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public Vector4 CheckVector4()\n        {\n            try\n            {\n                return luaState.CheckVector4(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public Color CheckColor()\n        {\n            try\n            {\n                return luaState.CheckColor(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n        public Color32 CheckColor32()\n        {\n            try\n            {\n                return luaState.CheckColor32(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public Ray CheckRay()\n        {\n            try\n            {\n                return luaState.CheckRay(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public Bounds CheckBounds()\n        {\n            try\n            {\n                return luaState.CheckBounds(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public LayerMask CheckLayerMask()\n        {\n            try\n            {\n                return luaState.CheckLayerMask(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public long CheckLong()\n        {\n            try\n            {\n                return luaState.CheckLong(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public ulong CheckULong()\n        {\n            try\n            {\n                return luaState.CheckULong(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public Delegate CheckDelegate()\n        {\n            try\n            {\n                return luaState.CheckDelegate(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public object CheckVariant()\n        {\n            return luaState.ToVariant(stackPos++);\n        }\n\n        public char[] CheckCharBuffer()\n        {\n            try\n            {\n                return luaState.CheckCharBuffer(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public byte[] CheckByteBuffer()\n        {\n            try\n            {\n                return luaState.CheckByteBuffer(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public object CheckObject(Type t)\n        {\n            try\n            {\n                return luaState.CheckObject(stackPos++, t);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public LuaFunction CheckLuaFunction()\n        {\n            try\n            {\n                return luaState.CheckLuaFunction(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public LuaTable CheckLuaTable()\n        {\n            try\n            {\n                return luaState.CheckLuaTable(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public LuaThread CheckLuaThread()\n        {\n            try\n            {\n                return luaState.CheckLuaThread(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n\n        public T CheckValue<T>()\n        {\n            try\n            {\n                return luaState.CheckValue<T>(stackPos++);\n            }\n            catch (Exception e)\n            {\n                EndPCall();\n                throw e;\n            }\n        }\n    }    \n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaFunction.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8f2e7f7664506cc45b1e1d375c066432\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaMatchType.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing System;\nusing System.Collections;\n\nnamespace LuaInterface\n{\n    public class LuaMatchType\n    {\n        public bool CheckNumber(IntPtr L, int pos)\n        {            \n            return LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TNUMBER;\n        }\n\n        public bool CheckBool(IntPtr L, int pos)\n        {\n            return LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TBOOLEAN;\n        }\n\n        public bool CheckLong(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNUMBER:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Int64;                    \n                default:\n                    return false;\n            }                        \n        }\n\n        public bool CheckULong(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNUMBER:\n                    return LuaDLL.lua_tonumber(L, pos) >= 0;\n                case LuaTypes.LUA_TUSERDATA:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.UInt64;                    \n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullNumber(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n            return luaType == LuaTypes.LUA_TNUMBER || luaType == LuaTypes.LUA_TNIL;\n        }\n\n        public bool CheckNullBool(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n            return luaType == LuaTypes.LUA_TBOOLEAN || luaType == LuaTypes.LUA_TNIL;\n        }\n\n        public bool CheckNullLong(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TNUMBER:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Int64;                    \n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullULong(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TNUMBER:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.UInt64;                    \n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckString(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TSTRING:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return CheckClassType(typeof(string), L, pos);\n                default:\n                    return false;\n            }            \n        }\n\n        public bool CheckByteArray(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TSTRING:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return CheckClassType(typeof(byte[]), L, pos);\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckCharArray(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TSTRING:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return CheckClassType(typeof(char[]), L, pos);\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckArray(Type t, IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:                                \n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return CheckClassType(t, L, pos);\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckBoolArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(bool[]), L, pos);\n        }\n\n        public bool CheckSByteArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(sbyte[]), L, pos);\n        }\n\n        public bool CheckInt16Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(short[]), L, pos);\n        }\n\n        public bool CheckUInt16Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(ushort[]), L, pos);\n        }\n\n        public bool CheckDecimalArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(decimal[]), L, pos);\n        }\n\n        public bool CheckSingleArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(float[]), L, pos);\n        }\n\n        public bool CheckDoubleArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(double[]), L, pos);\n        }\n\n        public bool CheckInt32Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(int[]), L, pos);\n        }\n\n        public bool CheckUInt32Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(uint[]), L, pos);\n        }\n\n        public bool CheckInt64Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(long[]), L, pos);\n        }\n\n        public bool CheckUInt64Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(ulong[]), L, pos);\n        }\n\n        public bool CheckStringArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(string[]), L, pos);\n        }\n\n        public bool CheckTypeArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(Type[]), L, pos);\n        }\n\n        public bool CheckObjectArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(object[]), L, pos);\n        }        \n\n        bool CheckValueType(IntPtr L, int pos, int valueType, Type nt)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                int vt = LuaDLL.tolua_getvaluetype(L, pos);                \n                return vt == valueType;\n            }\n\n            return false;\n        }\n\n        public bool CheckVec3(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector3;\n            }\n\n            return false;            \n        }\n\n        public bool CheckQuat(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Quaternion;\n            }\n\n            return false;            \n        }\n\n        public bool CheckVec2(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector2;\n            }\n\n            return false;            \n        }\n\n        public bool CheckColor(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Color;\n            }\n\n            return false;            \n        }\n        public bool CheckColor32(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Color32;\n            }\n\n            return false;\n        }\n\n        public bool CheckVec4(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector4;\n            }\n\n            return false;            \n        }\n\n        public bool CheckRay(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Ray;\n            }\n\n            return false;            \n        }\n\n        public bool CheckBounds(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Bounds;\n            }\n\n            return false;            \n        }\n\n        public bool CheckTouch(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Touch;\n            }\n\n            return false;            \n        }\n\n        public bool CheckLayerMask(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.LayerMask;\n            }\n\n            return false;            \n        }\n\n        public bool CheckRaycastHit(IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TTABLE)\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.RaycastHit;\n            }\n\n            return false;            \n        }\n\n        public bool CheckNullVec3(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector3;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullQuat(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Quaternion;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullVec2(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector2;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullColor(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Color;\n                default:\n                    return false;\n            }\n        }\n        public bool CheckNullColor32(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Color32;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullVec4(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Vector4;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullRay(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Ray;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullBounds(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Bounds;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullTouch(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Touch;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullLayerMask(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.LayerMask;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckNullRaycastHit(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.RaycastHit;\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckVec3Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(Vector3[]), L, pos);\n        }\n\n        public bool CheckQuatArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(Quaternion[]), L, pos);\n        }\n\n        public bool CheckVec2Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(Vector2[]), L, pos);\n        }\n\n        public bool CheckVec4Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(Vector4[]), L, pos);\n        }\n\n        public bool CheckColorArray(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(Color[]), L, pos);\n        }\n\n        public bool CheckColor32Array(IntPtr L, int pos)\n        {\n            return CheckArray(typeof(Color32[]), L, pos);\n        }\n\n        public bool CheckPtr(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n            return luaType == LuaTypes.LUA_TLIGHTUSERDATA || luaType == LuaTypes.LUA_TNIL;\n        }\n\n        public bool CheckLuaFunc(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n            return luaType == LuaTypes.LUA_TFUNCTION || luaType == LuaTypes.LUA_TNIL;\n        }\n\n        public bool CheckLuaTable(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n            return luaType == LuaTypes.LUA_TTABLE || luaType == LuaTypes.LUA_TNIL;\n        }\n\n        public bool CheckLuaThread(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n            return luaType == LuaTypes.LUA_TTHREAD || luaType == LuaTypes.LUA_TNIL;\n        }\n\n        public bool CheckLuaBaseRef(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch(luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TFUNCTION:\n                    return true;\n                case LuaTypes.LUA_TTABLE:\n                    return true;\n                case LuaTypes.LUA_TTHREAD:\n                    return true;\n                default:\n                    return false;\n            }            \n        }\n\n        public bool CheckByteBuffer(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n            return luaType == LuaTypes.LUA_TSTRING || luaType == LuaTypes.LUA_TNIL;\n        }\n\n        public bool CheckEventObject(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return CheckClassType(typeof(EventObject), L, pos);\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckEnumerator(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:                    \n                    int udata = LuaDLL.tolua_rawnetobj(L, pos);\n\n                    if (udata != -1)\n                    {\n                        ObjectTranslator translator = ObjectTranslator.Get(L);\n                        object obj = translator.GetObject(udata);\n                        return obj == null ? true : obj is IEnumerator;\n                    }\n                    return false;\n                case LuaTypes.LUA_TTABLE:\n                    return true;\n\n                default:\n                    return false;\n            }\n        }\n\n        //不存在派生类的类型\n        bool CheckFinalType(Type type, IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return CheckClassType(type, L, pos);\n                default:\n                    return false;\n            }\n        }\n\n        public bool CheckGameObject(IntPtr L, int pos)\n        {\n            return CheckFinalType(typeof(GameObject), L, pos);\n        }\n\n        public bool CheckTransform(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:                    \n                    int udata = LuaDLL.tolua_rawnetobj(L, pos);\n\n                    if (udata != -1)\n                    {\n                        ObjectTranslator translator = ObjectTranslator.Get(L);\n                        object obj = translator.GetObject(udata);\n                        return obj == null ? true : obj is Transform;\n                    }\n\n                    return false;                    \n                default:\n                    return false;\n            }\n        }\n\n        static Type monoType = typeof(Type).GetType();\n\n        public bool CheckMonoType(IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:\n                    return CheckClassType(monoType, L, pos);\n                default:\n                    return false;\n            }            \n        }        \n\n        public bool CheckVariant(IntPtr L, int pos)\n        {\n            return true;\n        }\n\n        bool CheckClassType(Type t, IntPtr L, int pos)\n        {            \n            int udata = LuaDLL.tolua_rawnetobj(L, pos);\n\n            if (udata != -1)\n            {                \n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                object obj = translator.GetObject(udata);\n                return obj == null ? true : obj.GetType() == t;\n            }\n\n            return false;\n        }\n    }\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaMatchType.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 23fa92cf1685f2d4da97d54967a224ad\ntimeCreated: 1494397554\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaMethodCache.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Reflection;\nusing System.Collections.Generic;\n\nnamespace LuaInterface\n{\n    public static class LuaMethodCache\n    {\n        public static Dictionary<Type, Dictionary<string, List<MethodInfo>>> dict = new Dictionary<Type, Dictionary<string, List<MethodInfo>>>();\n\n        static MethodInfo GetMethod(Type t, string name, Type[] ts)\n        {\n            Dictionary<string, List<MethodInfo>> map = null;\n            List<MethodInfo> list = null;\n\n            if (!dict.TryGetValue(t, out map))\n            {\n                map = new Dictionary<string, List<MethodInfo>>();\n                dict.Add(t, map);\n            }\n\n            if (!map.TryGetValue(name, out list))\n            {\n                list = new List<MethodInfo>();\n                MethodInfo[] mds = t.GetMethods();\n\n                for (int i = 0; i < mds.Length; i++)\n                {\n                    if (mds[i].Name == name)\n                    {\n                        list.Add(mds[i]);\n                    }\n                }\n\n                map.Add(name, list);\n            }\n\n            if (list.Count == 1)\n            {\n                return list[0];\n            }\n\n            for (int i = 0; i < list.Count; i++)\n            {\n                ParameterInfo[] pis = list[i].GetParameters();\n                bool flag = true;\n\n                if (pis.Length == 0 && (ts == null || ts.Length == 0))\n                {\n                    return list[i];\n                }\n                else if (pis.Length == ts.Length)\n                {\n                    for (int j = 0; j < ts.Length; j++)\n                    {\n                        if (pis[j].ParameterType != ts[j])\n                        {\n                            flag = false;\n                            break;\n                        }\n                    }\n\n                    if (flag)\n                    {\n                        return list[i];\n                    }\n                }\n            }\n\n            return null;\n        }\n\n        public static object CallSingleMethod(string name, object obj, params object[] args)\n        {\n            MethodInfo md = GetMethod(obj.GetType(), name, null);\n            return md.Invoke(obj, args);\n        }\n\n        public static object CallMethod(string name, object obj, params object[] args)\n        {\n            Type[] ts = new Type[args.Length];\n\n            for (int i = 0; i < args.Length; i++)\n            {\n                ts[i] = args[i].GetType();\n            }\n\n            MethodInfo md = GetMethod(obj.GetType(), name, ts);\n            return md.Invoke(obj, args);\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaMethodCache.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6d0c295670bdae343be5791ad4a0e9ae\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaMisc.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Runtime.InteropServices;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing System.Text;\nusing System.Runtime.CompilerServices;\n\nnamespace LuaInterface\n{\n    public class GCRef\n    {\n        public int reference;\n        public string name = null;\n\n        public GCRef(int reference, string name)\n        {\n            this.reference = reference;\n            this.name = name;\n        }\n    }\n\n    //让byte[] 压入成为lua string 而不是数组 userdata\n    //也可以使用LuaByteBufferAttribute来标记byte[]\n    public struct LuaByteBuffer\n    {        \n        public LuaByteBuffer(IntPtr source, int len)\n            : this()            \n        {\n            buffer = new byte[len];\n            Length = len;\n            Marshal.Copy(source, buffer, 0, len);\n        }\n        \n        public LuaByteBuffer(byte[] buf)\n            : this()\n        {\n            buffer = buf;\n            Length = buf.Length;            \n        }\n\n        public LuaByteBuffer(byte[] buf, int len)\n            : this()\n        {            \n            buffer = buf;\n            Length = len;\n        }\n\n        public LuaByteBuffer(System.IO.MemoryStream stream)   \n            : this()         \n        {\n            buffer = stream.GetBuffer();\n            Length = (int)stream.Length;            \n        }\n\n        public static implicit operator LuaByteBuffer(System.IO.MemoryStream stream)\n        {\n            return new LuaByteBuffer(stream);\n        }\n\n        public byte[] buffer;    \n\n        public int Length\n        {\n            get;\n            private set;\n        }    \n    }   \n\n    public class LuaOut<T> { }\n    //public class LuaOutMetatable {}\n    public class NullObject { }\n\n    //泛型函数参数null代替\n    public struct nil { }\n\n    public class LuaDelegate\n    {\n        public LuaFunction func = null;\n        public LuaTable self = null;\n        public MethodInfo method = null; \n\n        public LuaDelegate(LuaFunction func)\n        {\n            this.func = func;\n        }\n\n        public LuaDelegate(LuaFunction func, LuaTable self)\n        {\n            this.func = func;\n            this.self = self;\n        }\n\n        //如果count不是1，说明还有其他人引用，只能等待gc来处理\n        public virtual void Dispose()\n        {\n            method = null;\n\n            if (func != null)\n            {\n                func.Dispose(1);\n                func = null;\n            }\n\n            if (self != null)\n            {\n                self.Dispose(1);\n                self = null;\n            }\n        }\n\n        public override bool Equals(object o)\n        {                                    \n            if (o == null) return func == null && self == null;\n            LuaDelegate ld = o as LuaDelegate;\n\n            if (ld == null || ld.func != func || ld.self != self)\n            {\n                return false;\n            }\n\n            return ld.func != null;\n        }\n\n        static bool CompareLuaDelegate(LuaDelegate a, LuaDelegate b)\n        {\n            if (System.Object.ReferenceEquals(a, b))\n            {\n                return true;\n            }\n\n            object l = a;\n            object r = b;\n\n            if (l == null && r != null)\n            {\n                return b.func == null && b.self == null;\n            }\n\n            if (l != null && r == null)\n            {\n                return a.func == null && a.self == null;\n            }\n\n            if (a.func != b.func || a.self != b.self)\n            {\n                return false;\n            }\n\n            return a.func != null;\n        }\n\n        public static bool operator == (LuaDelegate a, LuaDelegate b)\n        {\n            return CompareLuaDelegate(a, b);\n        }\n\n        public static bool operator != (LuaDelegate a, LuaDelegate b)\n        {\n            return !CompareLuaDelegate(a, b);\n        }\n        public override int GetHashCode()\n        {\n            return RuntimeHelpers.GetHashCode(this);            \n        }\n    }\n\n    [NoToLuaAttribute]\n    public static class LuaMisc\n    {\n        public static string GetArrayRank(Type t)\n        {\n            int count = t.GetArrayRank();\n\n            if (count == 1)\n            {                \n                return \"[]\";\n            }\n\n            using (CString.Block())\n            {\n                CString sb = CString.Alloc(64);\n                sb.Append('[');\n\n                for (int i = 1; i < count; i++)\n                {\n                    sb.Append(',');\n                }\n\n                sb.Append(']');\n                return sb.ToString();\n            }\n        }\n\n        public static string GetTypeName(Type t)\n        {\n            if (t.IsArray)\n            {\n                string str = GetTypeName(t.GetElementType());\n                str += GetArrayRank(t);\n                return str;                \n            }\n            else if (t.IsByRef)\n            {\n                t = t.GetElementType();\n                return GetTypeName(t);\n            }\n            else if (t.IsGenericType)\n            {\n                return GetGenericName(t);\n            }\n            else if (t == typeof(void))\n            {\n                return \"void\";\n            }\n            else\n            {\n                string name = GetPrimitiveStr(t);\n                return name.Replace('+', '.');\n            }\n        }\n\n        public static string[] GetGenericName(Type[] types, int offset, int count)\n        {\n            string[] results = new string[count];\n\n            for (int i = 0; i < count; i++)\n            {\n                int pos = i + offset;\n\n                if (types[pos].IsGenericType)\n                {\n                    results[i] = GetGenericName(types[pos]);\n                }\n                else\n                {\n                    results[i] = GetTypeName(types[pos]);\n                }\n\n            }\n\n            return results;\n        }\n\n        static string CombineTypeStr(string space, string name)\n        {\n            if (string.IsNullOrEmpty(space))\n            {\n                return name;\n            }\n            else\n            {\n                return space + \".\" + name;\n            }\n        }\n\n        static string GetGenericName(Type t)\n        {\n            Type[] gArgs = t.GetGenericArguments();\n            string typeName = t.FullName ?? t.Name;\n            int count = gArgs.Length;\n            int pos = typeName.IndexOf(\"[\");\n\n            if (pos > 0)\n            {\n                typeName = typeName.Substring(0, pos);\n            }\n\n            string str = null;\n            string name = null;\n            int offset = 0;\n            pos = typeName.IndexOf(\"+\");\n\n            while (pos > 0)\n            {\n                str = typeName.Substring(0, pos);\n                typeName = typeName.Substring(pos + 1);\n                pos = str.IndexOf('`');\n\n                if (pos > 0)\n                {\n                    count = (int)(str[pos + 1] - '0');\n                    str = str.Substring(0, pos);\n                    str += \"<\" + string.Join(\",\", GetGenericName(gArgs, offset, count)) + \">\";\n                    offset += count;\n                }\n\n                name = CombineTypeStr(name, str);\n                pos = typeName.IndexOf(\"+\");\n            }\n\n            str = typeName;\n\n            if (offset < gArgs.Length)\n            {\n                pos = str.IndexOf('`');\n                count = (int)(str[pos + 1] - '0');\n                str = str.Substring(0, pos);\n                str += \"<\" + string.Join(\",\", GetGenericName(gArgs, offset, count)) + \">\";\n            }\n\n            return CombineTypeStr(name, str);\n        }\n\n        public static Delegate GetEventHandler(object obj, Type t, string eventName)\n        {\n            FieldInfo eventField = t.GetField(eventName, BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);\n            return (Delegate)eventField.GetValue(obj);\n        }\n\n        public static string GetPrimitiveStr(Type t)\n        {\n            if (t == typeof(System.Single))\n            {\n                return \"float\";\n            }\n            else if (t == typeof(System.String))\n            {\n                return \"string\";\n            }\n            else if (t == typeof(System.Int32))\n            {\n                return \"int\";\n            }\n            else if (t == typeof(System.Double))\n            {\n                return \"double\";\n            }\n            else if (t == typeof(System.Boolean))\n            {\n                return \"bool\";\n            }\n            else if (t == typeof(System.UInt32))\n            {\n                return \"uint\";\n            }\n            else if (t == typeof(System.SByte))\n            {\n                return \"sbyte\";\n            }\n            else if (t == typeof(System.Byte))\n            {\n                return \"byte\";\n            }\n            else if (t == typeof(System.Int16))\n            {\n                return \"short\";\n            }\n            else if (t == typeof(System.UInt16))\n            {\n                return \"ushort\";\n            }\n            else if (t == typeof(System.Char))\n            {\n                return \"char\";\n            }\n            else if (t == typeof(System.Int64))\n            {\n                return \"long\";\n            }\n            else if (t == typeof(System.UInt64))\n            {\n                return \"ulong\";\n            }\n            else if (t == typeof(System.Decimal))\n            {\n                return \"decimal\";\n            }\n            else if (t == typeof(System.Object))\n            {\n                return \"object\";\n            }\n            else\n            {\n                return t.ToString();\n            }\n        }        \n\n        public static double ToDouble(object obj)\n        {\n            Type t = obj.GetType();\n\n            if (t == typeof(double) || t == typeof(float))\n            {\n                double d = Convert.ToDouble(obj);\n                return d;\n            }\n            else if (t == typeof(int))\n            {\n                int n = Convert.ToInt32(obj);\n                return (double)n;\n            }\n            else if (t == typeof(uint))\n            {\n                uint n = Convert.ToUInt32(obj);\n                return (double)n;\n            }\n            else if (t == typeof(long))\n            {\n                long n = Convert.ToInt64(obj);\n                return (double)n;\n            }\n            else if (t == typeof(ulong))\n            {\n                ulong n = Convert.ToUInt64(obj);\n                return (double)n;\n            }\n            else if (t == typeof(byte))\n            {\n                byte b = Convert.ToByte(obj);\n                return (double)b;\n            }\n            else if (t == typeof(sbyte))\n            {\n                sbyte b = Convert.ToSByte(obj);\n                return (double)b;\n            }\n            else if (t == typeof(char))\n            {\n                char c = Convert.ToChar(obj);\n                return (double)c;\n            }            \n            else if (t == typeof(short))\n            {\n                Int16 n = Convert.ToInt16(obj);\n                return (double)n;\n            }\n            else if (t == typeof(ushort))\n            {\n                UInt16 n = Convert.ToUInt16(obj);\n                return (double)n;\n            }\n\n            return 0;\n        }\n\n        //可产生导出文件的基类\n        public static Type GetExportBaseType(Type t)\n        {\n            Type baseType = t.BaseType;\n\n            if (baseType == typeof(ValueType))\n            {\n                return null;\n            }\n\n            if (t.IsAbstract && t.IsSealed)\n            {\n                return baseType == typeof(object) ? null : baseType;\n            }\n\n            return baseType;\n        }\n    }       \n\n    /*[NoToLuaAttribute]\n    public struct LuaInteger64\n    {\n        public long i64;\n\n        public LuaInteger64(long i64)\n        {\n            this.i64 = i64;\n        }\n\n        public static implicit operator LuaInteger64(long i64)\n        {\n            return new LuaInteger64(i64);\n        }\n\n        public static implicit operator long(LuaInteger64 self)\n        {\n            return self.i64;\n        }\n\n        public ulong ToUInt64()\n        {\n            return (ulong)i64;\n        }\n\n        public override string ToString()\n        {\n            return Convert.ToString(i64);\n        }\n    }*/\n\n    public class TouchBits\n    {\n        public const int DeltaPosition = 1;\n        public const int Position = 2;\n        public const int RawPosition = 4;\n        public const int ALL = 7;\n    }\n\n    public class RaycastBits\n    {\n        public const int Collider = 1;\n        public const int Normal = 2;\n        public const int Point = 4;\n        public const int Rigidbody = 8;\n        public const int Transform = 16;\n        public const int ALL = 31;\n    }\n\n    public enum EventOp\n    {\n        None = 0,\n        Add = 1,\n        Sub = 2,\n    }\n\n    public class EventObject\n    {\n        [NoToLuaAttribute]\n        public EventOp op = EventOp.None;\n        [NoToLuaAttribute]\n        public Delegate func = null;\n        [NoToLuaAttribute]\n        public Type type;\n\n        [NoToLuaAttribute]\n        public EventObject(Type t)\n        {\n            type = t;\n        }\n\n        public static EventObject operator +(EventObject a, Delegate b)\n        {\n            a.op = EventOp.Add;\n            a.func = b;\n            return a;\n        }\n\n        public static EventObject operator -(EventObject a, Delegate b)\n        {\n            a.op = EventOp.Sub;\n            a.func = b;\n            return a;\n        }\n    }\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaMisc.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 49b0c76b911a9d34bac07d4b3aa7f6de\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaStackOp.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing System;\nusing System.Runtime.InteropServices;\nusing System.Collections;\n\nnamespace LuaInterface\n{\n    public class LuaStackOp\n    {\n        public sbyte ToSByte(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToSByte(ret);\n        }\n\n        public byte ToByte(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToByte(ret);\n        }\n\n        public short ToInt16(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToInt16(ret);\n        }\n\n        public ushort ToUInt16(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToUInt16(ret);\n        }\n\n        public char ToChar(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToChar(ret);\n        }\n\n        public int ToInt32(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToInt32(ret);\n        }\n\n        public uint ToUInt32(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToUInt32(ret);\n        }\n\n        public decimal ToDecimal(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToDecimal(ret);\n        }\n\n        public float ToFloat(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToSingle(ret);\n        }\n\n        public LuaByteBuffer ToLuaByteBuffer(IntPtr L, int stackPos)\n        {\n            return new LuaByteBuffer(ToLua.ToByteBuffer(L, stackPos));\n        }   \n\n        public IEnumerator ToIter(IntPtr L, int stackPos)\n        {\n            return (IEnumerator)ToLua.ToObject(L, stackPos);\n        }\n\n        public Type ToType(IntPtr L, int stackPos)\n        {\n            return (Type)ToLua.ToObject(L, stackPos);\n        }\n\n        public EventObject ToEventObject(IntPtr L, int stackPos)\n        {\n            return (EventObject)ToLua.ToObject(L, stackPos);\n        }\n\n        public Transform ToTransform(IntPtr L, int stackPos)\n        {\n            return (Transform)ToLua.ToObject(L, stackPos);\n        }\n\n        public GameObject ToGameObject(IntPtr L, int stackPos)\n        {\n            return (GameObject)ToLua.ToObject(L, stackPos);\n        }\n\n        public object ToObject(IntPtr L, int stackPos)\n        {\n            return ToLua.ToObject(L, stackPos);\n        }\n\n        public sbyte CheckSByte(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToSByte(ret);\n        }\n\n        public byte CheckByte(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToByte(ret);\n        }\n\n        public short CheckInt16(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToInt16(ret);\n        }\n\n        public ushort CheckUInt16(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToUInt16(ret);\n        }\n\n        public char CheckChar(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToChar(ret);\n        }\n\n        public int CheckInt32(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToInt32(ret);\n        }\n\n        public uint CheckUInt32(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToUInt32(ret);\n        }\n\n        public decimal CheckDecimal(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToDecimal(ret);\n        }     \n\n        public float CheckFloat(IntPtr L, int stackPos)\n        {\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToSingle(ret);\n        }\n\n        public IntPtr CheckIntPtr(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch(luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return IntPtr.Zero;\n                case LuaTypes.LUA_TLIGHTUSERDATA:\n                    return LuaDLL.lua_touserdata(L, stackPos);\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"IntPtr\");\n                    return IntPtr.Zero;\n            }            \n        }\n\n        public UIntPtr CheckUIntPtr(IntPtr L, int stackPos)\n        {\n            throw new LuaException(\"NYI\");\n        }\n\n        public LuaByteBuffer CheckLuaByteBuffer(IntPtr L, int stackPos)\n        {\n            return new LuaByteBuffer(ToLua.CheckByteBuffer(L, stackPos));\n        }\n\n        public EventObject CheckEventObject(IntPtr L, int stackPos)\n        {\n            return (EventObject)ToLua.CheckObject(L, stackPos, typeof(EventObject));\n        }\n\n        public Transform CheckTransform(IntPtr L, int stackPos)\n        {\n            return (Transform)ToLua.CheckObject(L, stackPos, typeof(Transform));\n        }\n\n        public GameObject CheckGameObject(IntPtr L, int stackPos)\n        {\n            return (GameObject)ToLua.CheckObject(L, stackPos, typeof(GameObject));\n        }\n\n        public void Push(IntPtr L, sbyte n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void Push(IntPtr L, byte n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void Push(IntPtr L, short n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void Push(IntPtr L, ushort n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void Push(IntPtr L, char n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void Push(IntPtr L, int n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void Push(IntPtr L, uint n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void Push(IntPtr L, decimal n)\n        {\n            LuaDLL.lua_pushnumber(L, (double)n);\n        }\n\n        public void Push(IntPtr L, float n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void Push(IntPtr L, UIntPtr p)\n        {\n            throw new LuaException(\"NYI\");\n        }\n\n        public void Push(IntPtr L, Delegate ev)\n        {\n            ToLua.Push(L, ev);\n        }\n\n        public void Push(IntPtr L, object obj)\n        {\n            ToLua.Push(L, obj);\n        }\n\n        public void Push(IntPtr L, GameObject o)\n        {\n            if (o == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                int reference = TypeTraits<GameObject>.GetLuaReference(L);\n\n                if (reference <= 0)\n                {\n                    reference = ToLua.LoadPreType(L, typeof(GameObject));\n                }\n\n                ToLua.PushUserData(L, o, reference);\n            }\n        }\n\n        public void Push(IntPtr L, Transform o)\n        {\n            if (o == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                Type type = o.GetType();\n                int reference = -1;\n\n                if (type == typeof(Transform))\n                {\n                    reference = TypeTraits<Transform>.GetLuaReference(L);\n                }\n                else\n                {\n                    reference = LuaStatic.GetMetaReference(L, type);\n                }\n\n                if (reference <= 0)\n                {\n                    reference = ToLua.LoadPreType(L, type);\n                }\n\n                ToLua.PushUserData(L, o, reference);\n            }\n        }\n\n        #region Nullable\n        public Nullable<sbyte> ToNullSByte(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToSByte(ret);\n        }\n\n        public Nullable<byte> ToNullByte(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToByte(ret);\n        }\n\n        public Nullable<short> ToNullInt16(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToInt16(ret);\n        }\n\n        public Nullable<ushort> ToNullUInt16(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToUInt16(ret);\n        }\n\n        public Nullable<char> ToNullChar(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToChar(ret);\n        }\n\n        public Nullable<int> ToNullInt32(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToInt32(ret);\n        }\n\n        public Nullable<uint> ToNullUInt32(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToUInt32(ret);\n        }\n\n        public Nullable<decimal> ToNullDecimal(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToDecimal(ret);\n        }\n\n        public Nullable<float> ToNullFloat(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.lua_tonumber(L, stackPos);\n            return Convert.ToSingle(ret);\n        }\n\n        public Nullable<double> ToNullNumber(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.lua_tonumber(L, stackPos);\n        }\n\n        public Nullable<bool> ToNullBool(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.lua_toboolean(L, stackPos);\n        }\n\n        public Nullable<long> ToNullInt64(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.tolua_toint64(L, stackPos);\n        }\n\n        public Nullable<ulong> ToNullUInt64(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.tolua_touint64(L, stackPos);\n        }\n\n        public sbyte[] ToSByteArray(IntPtr L, int stackPos)\n        {\n            return ToLua.ToNumberArray<sbyte>(L, stackPos);\n        }\n\n        public short[] ToInt16Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToNumberArray<short>(L, stackPos);\n        }\n\n        public ushort[] ToUInt16Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToNumberArray<ushort>(L, stackPos);\n        }\n\n        public decimal[] ToDecimalArray(IntPtr L, int stackPos)\n        {\n            return ToLua.ToNumberArray<decimal>(L, stackPos);\n        }\n\n        public float[] ToFloatArray(IntPtr L, int stackPos)\n        {\n            return ToLua.ToNumberArray<float>(L, stackPos);\n        }\n\n        public double[] ToDoubleArray(IntPtr L, int stackPos)\n        {\n            return ToLua.ToNumberArray<double>(L, stackPos);\n        }\n\n        public int[] ToInt32Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToNumberArray<int>(L, stackPos);\n        }\n\n        public uint[] ToUInt32Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToNumberArray<uint>(L, stackPos);\n        }\n\n        public long[] ToInt64Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToStructArray<long>(L, stackPos);\n        }\n\n        public ulong[] ToUInt64Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToStructArray<ulong>(L, stackPos);\n        }\n\n        public Nullable<Vector3> ToNullVec3(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            float x = 0, y = 0, z = 0;\n            LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z);\n            return new Vector3(x, y, z);\n        }\n\n        public Nullable<Quaternion> ToNullQuat(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            float x, y, z, w;\n            LuaDLL.tolua_getquat(L, stackPos, out x, out y, out z, out w);\n            return new Quaternion(x, y, z, w);\n        }\n\n        public Nullable<Vector2> ToNullVec2(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            float x, y;\n            LuaDLL.tolua_getvec2(L, stackPos, out x, out y);\n            return new Vector2(x, y);\n        }        \n\n        public Nullable<Color> ToNullColor(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            float r, g, b, a;\n            LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a);\n            return new Color(r, g, b, a);\n        }      \n\n        public Nullable<Color32> ToNullColor32(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            float r, g, b, a;\n            LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a);\n            return new Color32((byte)r, (byte)g, (byte)b, (byte)a);\n        }\n\n        public Nullable<Vector4> ToNullVec4(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            float x, y, z, w;\n            LuaDLL.tolua_getvec4(L, stackPos, out x, out y, out z, out w);\n            return new Vector4(x, y, z, w);\n        }   \n\n        public Nullable<Ray> ToNullRay(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.ToRay(L, stackPos);\n        }  \n\n        public Nullable<Bounds> ToNullBounds(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.ToBounds(L, stackPos);\n        }      \n\n        public Nullable<LayerMask> ToNullLayerMask(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.tolua_getlayermask(L, stackPos);\n        }\n\n        public Vector3[] ToVec3Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToStructArray<Vector3>(L, stackPos);\n        }\n\n        public Quaternion[] ToQuatArray(IntPtr L, int stackPos)\n        {\n            return ToLua.ToStructArray<Quaternion>(L, stackPos);\n        }\n\n        public Vector2[] ToVec2Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToStructArray<Vector2>(L, stackPos);\n        }\n\n        public Color[] ToColorArray(IntPtr L, int stackPos)\n        {\n            return ToLua.ToStructArray<Color>(L, stackPos);\n        }\n        public Color32[] ToColor32Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToStructArray<Color32>(L, stackPos);\n        }\n\n        public Vector4[] ToVec4Array(IntPtr L, int stackPos)\n        {\n            return ToLua.ToStructArray<Vector4>(L, stackPos);\n        }\n\n        public Type[] ToTypeArray(IntPtr L, int stackPos)\n        {\n            return ToLua.ToObjectArray<Type>(L, stackPos);\n        }\n\n        public Nullable<sbyte> CheckNullSByte(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToSByte(ret);\n        }\n\n        public Nullable<byte> CheckNullByte(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToByte(ret);\n        }\n\n        public Nullable<short> CheckNullInt16(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToInt16(ret);\n        }\n\n        public Nullable<ushort> CheckNullUInt16(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToUInt16(ret);\n        }\n\n        public Nullable<char> CheckNullChar(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToChar(ret);\n        }\n\n        public Nullable<int> CheckNullInt32(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToInt32(ret);\n        }\n\n        public Nullable<uint> CheckNullUInt32(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToUInt32(ret);\n        }\n\n        public Nullable<decimal> CheckNullDecimal(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToDecimal(ret);\n        }\n\n        public Nullable<float> CheckNullFloat(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            double ret = LuaDLL.luaL_checknumber(L, stackPos);\n            return Convert.ToSingle(ret);\n        }\n\n        public Nullable<double> CheckNullNumber(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.luaL_checknumber(L, stackPos);\n        }\n\n        public Nullable<bool> CheckNullBool(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.luaL_checkboolean(L, stackPos);\n        }\n\n        public Nullable<long> CheckNullInt64(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.tolua_checkint64(L, stackPos);\n        }\n\n        public Nullable<ulong> CheckNullUInt64(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return LuaDLL.tolua_checkuint64(L, stackPos);\n        }\n\n        public sbyte[] CheckSByteArray(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckNumberArray<sbyte>(L, stackPos);\n        }\n\n        public short[] CheckInt16Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckNumberArray<short>(L, stackPos);\n        }\n\n        public ushort[] CheckUInt16Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckNumberArray<ushort>(L, stackPos);\n        }\n\n        public decimal[] CheckDecimalArray(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckNumberArray<decimal>(L, stackPos);\n        }\n\n        public float[] CheckFloatArray(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckNumberArray<float>(L, stackPos);\n        }\n\n        public double[] CheckDoubleArray(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckNumberArray<double>(L, stackPos);\n        }\n\n        public int[] CheckInt32Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckNumberArray<int>(L, stackPos);\n        }\n\n        public uint[] CheckUInt32Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckNumberArray<uint>(L, stackPos);\n        }\n\n        public long[] CheckInt64Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckStructArray<long>(L, stackPos);\n        }\n\n        public ulong[] CheckUInt64Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckStructArray<ulong>(L, stackPos);\n        }\n\n        public Nullable<Vector3> CheckNullVec3(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckVector3(L, stackPos);\n        }\n\n        public Nullable<Quaternion> CheckNullQuat(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckQuaternion(L, stackPos);\n        }     \n\n        public Nullable<Vector2> CheckNullVec2(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckVector2(L, stackPos);\n        }   \n\n        public Nullable<Color> CheckNullColor(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckColor(L, stackPos);\n        }    \n\n\n        public Nullable<Color32> CheckNullColor32(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckColor32(L, stackPos);\n        }\n\n        public Nullable<Vector4> CheckNullVec4(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckVector4(L, stackPos);\n        }      \n\n        public Nullable<Ray> CheckNullRay(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckRay(L, stackPos);\n        }       \n\n        public Nullable<Bounds> CheckNullBounds(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckBounds(L, stackPos);\n        }    \n\n        public Nullable<LayerMask> CheckNullLayerMask(IntPtr L, int stackPos)\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return ToLua.CheckLayerMask(L, stackPos);\n        }\n\n        public Vector3[] CheckVec3Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckStructArray<Vector3>(L, stackPos);\n        }\n\n        public Quaternion[] CheckQuatArray(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckStructArray<Quaternion>(L, stackPos);\n        }\n\n        public Vector2[] CheckVec2Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckStructArray<Vector2>(L, stackPos);\n        }\n\n        public Color[] CheckColorArray(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckStructArray<Color>(L, stackPos);\n        }\n        public Color32[] CheckColor32Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckStructArray<Color32>(L, stackPos);\n        }\n\n        public Vector4[] CheckVec4Array(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckStructArray<Vector4>(L, stackPos);\n        }        \n\n        public Type[] CheckTypeArray(IntPtr L, int stackPos)\n        {\n            return ToLua.CheckObjectArray<Type>(L, stackPos);\n        }\n\n        public void Push(IntPtr L, Nullable<sbyte> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<byte> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<short> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<ushort> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<char> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<int> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<uint> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<decimal> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, Convert.ToDouble(n.Value));\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<float> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<double> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushnumber(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<bool> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.lua_pushboolean(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<long> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.tolua_pushint64(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<ulong> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.tolua_pushuint64(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Vector3> v3)\n        {\n            if (v3 == null)\n            {\n                LuaDLL.lua_pushnil(L);\n                return;\n            }\n            else\n            {\n                Vector3 v = v3.Value;\n                LuaDLL.tolua_pushvec3(L, v.x, v.y, v.z);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Quaternion> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                Quaternion q = n.Value;\n                LuaDLL.tolua_pushquat(L, q.x, q.y, q.z, q.w);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Vector2> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                Vector2 v2 = n.Value;\n                LuaDLL.tolua_pushvec2(L, v2.x, v2.y);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Color> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                Color clr = n.Value;\n                LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Color32> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                Color32 clr = n.Value;\n                LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Vector4> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                Vector4 v4 = n.Value;\n                LuaDLL.tolua_pushvec4(L, v4.x, v4.y, v4.z, v4.w);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Ray> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                ToLua.Push(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Bounds> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                ToLua.Push(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<LayerMask> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                LuaDLL.tolua_pushlayermask(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<Touch> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                ToLua.Push(L, n.Value);\n            }\n        }\n\n        public void Push(IntPtr L, Nullable<RaycastHit> n)\n        {\n            if (n == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                ToLua.Push(L, n.Value);\n            }\n        }\n        #endregion\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaStackOp.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 57935fe3acd7c654599f70b62465e1d0\ntimeCreated: 1495076837\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaState.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n#define MISS_WARNING\n\nusing System;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing UnityEngine;\n\nnamespace LuaInterface\n{\n    public class LuaState : LuaStatePtr, IDisposable\n    {\n        public ObjectTranslator translator = new ObjectTranslator();\n        public LuaReflection reflection = new LuaReflection();\n\n        public int ArrayMetatable { get; private set; }\n        public int DelegateMetatable { get; private set; }\n        public int TypeMetatable { get; private set; }\n        public int EnumMetatable { get; private set; }\n        public int IterMetatable { get; private set; }        \n        public int EventMetatable { get; private set; }\n\n        //function ref                \n        public int PackBounds { get; private set; }\n        public int UnpackBounds { get; private set; }\n        public int PackRay { get; private set; }\n        public int UnpackRay { get; private set; }\n        public int PackRaycastHit { get; private set; }        \n        public int PackTouch { get; private set; }\n\n        public bool LogGC \n        {\n            get\n            {\n                return beLogGC;\n            }\n\n            set\n            {\n                beLogGC = value;\n                translator.LogGC = value;\n            }\n        }\n\n        public Action OnDestroy = delegate { };\n        \n        Dictionary<string, WeakReference> funcMap = new Dictionary<string, WeakReference>();\n        Dictionary<int, WeakReference> funcRefMap = new Dictionary<int, WeakReference>();\n        Dictionary<long, WeakReference> delegateMap = new Dictionary<long, WeakReference>();\n\n        List<GCRef> gcList = new List<GCRef>();\n        List<LuaBaseRef> subList = new List<LuaBaseRef>();\n\n        Dictionary<Type, int> metaMap = new Dictionary<Type, int>();        \n        Dictionary<Enum, object> enumMap = new Dictionary<Enum, object>();\n        Dictionary<Type, LuaCSFunction> preLoadMap = new Dictionary<Type, LuaCSFunction>();\n\n        Dictionary<int, Type> typeMap = new Dictionary<int, Type>();\n        HashSet<Type> genericSet = new HashSet<Type>();\n        HashSet<string> moduleSet = null;\n\n        private static LuaState mainState = null;\n        private static LuaState injectionState = null;\n        private static Dictionary<IntPtr, LuaState> stateMap = new Dictionary<IntPtr, LuaState>();\n\n        private int beginCount = 0;\n        private bool beLogGC = false;\n        private bool bInjectionInited = false;\n#if UNITY_EDITOR\n        private bool beStart = false;\n#endif\n\n#if MISS_WARNING\n        HashSet<Type> missSet = new HashSet<Type>();\n#endif\n\n        public LuaState()            \n        {\n            if (mainState == null)\n            {\n                mainState = this;\n                // MULTI_STATE Not Support\n                injectionState = mainState;\n            }\n\n            float time = Time.realtimeSinceStartup;\n            InitTypeTraits();\n            InitStackTraits();\n            L = LuaNewState();            \n            LuaException.Init(L);\n            stateMap.Add(L, this);                        \n            OpenToLuaLibs();            \n            ToLua.OpenLibs(L);\n            OpenBaseLibs();\n            LuaSetTop(0);\n            InitLuaPath();\n            Debugger.Log(\"Init lua state cost: {0}\", Time.realtimeSinceStartup - time);\n        }        \n\n        void OpenBaseLibs()\n        {            \n            BeginModule(null);\n\n            BeginModule(\"System\");\n            System_ObjectWrap.Register(this);\n            System_NullObjectWrap.Register(this);            \n            System_StringWrap.Register(this);\n            System_DelegateWrap.Register(this);\n            System_EnumWrap.Register(this);\n            System_ArrayWrap.Register(this);\n            System_TypeWrap.Register(this);                                               \n            BeginModule(\"Collections\");\n            System_Collections_IEnumeratorWrap.Register(this);\n\n            BeginModule(\"ObjectModel\");\n            System_Collections_ObjectModel_ReadOnlyCollectionWrap.Register(this);\n            EndModule();//ObjectModel\n\n            BeginModule(\"Generic\");\n            System_Collections_Generic_ListWrap.Register(this);\n            System_Collections_Generic_DictionaryWrap.Register(this);\n            System_Collections_Generic_KeyValuePairWrap.Register(this);\n\n            BeginModule(\"Dictionary\");\n            System_Collections_Generic_Dictionary_KeyCollectionWrap.Register(this);\n            System_Collections_Generic_Dictionary_ValueCollectionWrap.Register(this);\n            EndModule();//Dictionary\n            EndModule();//Generic\n            EndModule();//Collections     \n            EndModule();//end System\n\n            BeginModule(\"LuaInterface\");\n            LuaInterface_LuaOutWrap.Register(this);\n            LuaInterface_EventObjectWrap.Register(this);\n            EndModule();//end LuaInterface\n\n            BeginModule(\"UnityEngine\");\n            UnityEngine_ObjectWrap.Register(this);            \n            UnityEngine_CoroutineWrap.Register(this);\n            EndModule(); //end UnityEngine\n\n            EndModule(); //end global\n                        \n            LuaUnityLibs.OpenLibs(L);            \n            LuaReflection.OpenLibs(L);\n            ArrayMetatable = metaMap[typeof(System.Array)];\n            TypeMetatable = metaMap[typeof(System.Type)];\n            DelegateMetatable = metaMap[typeof(System.Delegate)];\n            EnumMetatable = metaMap[typeof(System.Enum)];\n            IterMetatable = metaMap[typeof(IEnumerator)];\n            EventMetatable = metaMap[typeof(EventObject)];\n        }\n\n        void InitLuaPath()\n        {\n            InitPackagePath();\n\n            if (!LuaFileUtils.Instance.beZip)\n            {\n#if UNITY_EDITOR\n                if (!Directory.Exists(LuaConst.luaDir))\n                {\n                    string msg = string.Format(\"luaDir path not exists: {0}, configer it in LuaConst.cs\", LuaConst.luaDir);\n                    throw new LuaException(msg);\n                }\n\n                if (!Directory.Exists(LuaConst.toluaDir))\n                {\n                    string msg = string.Format(\"toluaDir path not exists: {0}, configer it in LuaConst.cs\", LuaConst.toluaDir);\n                    throw new LuaException(msg);\n                }\n\n                AddSearchPath(LuaConst.toluaDir);\n                AddSearchPath(LuaConst.luaDir);\n#endif\n                if (LuaFileUtils.Instance.GetType() == typeof(LuaFileUtils))\n                {\n                    AddSearchPath(LuaConst.luaResDir);\n                }\n            }\n        }\n\n        void OpenBaseLuaLibs()\n        {\n            DoFile(\"tolua.lua\");            //tolua table名字已经存在了,不能用require\n            LuaUnityLibs.OpenLuaLibs(L);\n        }\n\n        public void Start()\n        {\n#if UNITY_EDITOR\n            beStart = true;\n#endif\n            Debugger.Log(\"LuaState start\");\n            OpenBaseLuaLibs();\n#if ENABLE_LUA_INJECTION\n            Push(LuaDLL.tolua_tag());\n            LuaSetGlobal(\"tolua_tag\");\n#if UNITY_EDITOR\n            if (UnityEditor.EditorPrefs.GetInt(Application.dataPath + \"InjectStatus\") == 1)\n            { \n#endif\n                DoFile(\"System/Injection/LuaInjectionStation.lua\");\n                bInjectionInited = true;\n#if UNITY_EDITOR\n            }\n#endif\n#endif\n            PackBounds = GetFuncRef(\"Bounds.New\");\n            UnpackBounds = GetFuncRef(\"Bounds.Get\");\n            PackRay = GetFuncRef(\"Ray.New\");\n            UnpackRay = GetFuncRef(\"Ray.Get\");\n            PackRaycastHit = GetFuncRef(\"RaycastHit.New\");\n            PackTouch = GetFuncRef(\"Touch.New\");\n        }\n\n        public int OpenLibs(LuaCSFunction open)\n        {\n            int ret = open(L);            \n            return ret;\n        }\n\n        public void BeginPreLoad()\n        {\n            LuaGetGlobal(\"package\");\n            LuaGetField(-1, \"preload\");\n            moduleSet = new HashSet<string>();\n        }\n\n        public void EndPreLoad()\n        {\n            LuaPop(2);\n            moduleSet = null;\n        }\n\n        public void AddPreLoad(string name, LuaCSFunction func, Type type)\n        {            \n            if (!preLoadMap.ContainsKey(type))\n            {\n                LuaDLL.tolua_pushcfunction(L, func);\n                LuaSetField(-2, name);\n                preLoadMap[type] = func;\n                string module = type.Namespace;\n\n                if (!string.IsNullOrEmpty(module) && !moduleSet.Contains(module))\n                {\n                    LuaDLL.tolua_addpreload(L, module);\n                    moduleSet.Add(module);\n                }\n            }            \n        }\n\n        //慎用，需要自己保证不会重复Add相同的name,并且上面函数没有使用过这个name\n        public void AddPreLoad(string name, LuaCSFunction func)\n        {\n            LuaDLL.tolua_pushcfunction(L, func);\n            LuaSetField(-2, name);\n        }\n\n        public int BeginPreModule(string name)\n        {\n            int top = LuaGetTop();\n\n            if (string.IsNullOrEmpty(name))\n            {\n                LuaDLL.lua_pushvalue(L, LuaIndexes.LUA_GLOBALSINDEX);\n                ++beginCount;\n                return top;\n            }\n            else if (LuaDLL.tolua_beginpremodule(L, name))\n            {\n                ++beginCount;\n                return top;\n            }\n            \n            throw new LuaException(string.Format(\"create table {0} fail\", name));            \n        }\n\n        public void EndPreModule(int reference)\n        {\n            --beginCount;            \n            LuaDLL.tolua_endpremodule(L, reference);\n        }\n\n        public void EndPreModule(IntPtr L, int reference)\n        {\n            --beginCount;\n            LuaDLL.tolua_endpremodule(L, reference);\n        }\n\n        public void BindPreModule(Type t, LuaCSFunction func)\n        {\n            preLoadMap[t] = func;\n        }\n\n        public LuaCSFunction GetPreModule(Type t)\n        {\n            LuaCSFunction func = null;\n            preLoadMap.TryGetValue(t, out func);\n            return func;\n        }\n\n        public bool BeginModule(string name)\n        {\n#if UNITY_EDITOR\n            if (name != null)\n            {                \n                LuaTypes type = LuaType(-1);\n\n                if (type != LuaTypes.LUA_TTABLE)\n                {                    \n                    throw new LuaException(\"open global module first\");\n                }\n            }\n#endif\n            if (LuaDLL.tolua_beginmodule(L, name))\n            {\n                ++beginCount;\n                return true;\n            }\n\n            LuaSetTop(0);\n            throw new LuaException(string.Format(\"create table {0} fail\", name));            \n        }\n\n        public void EndModule()\n        {\n            --beginCount;            \n            LuaDLL.tolua_endmodule(L);\n        }\n\n        void BindTypeRef(int reference, Type t)\n        {\n            metaMap.Add(t, reference);\n            typeMap.Add(reference, t);\n\n            if (t.IsGenericTypeDefinition)\n            {\n                genericSet.Add(t);\n            }\n        }\n\n        public Type GetClassType(int reference)\n        {\n            Type t = null;\n            typeMap.TryGetValue(reference, out t);\n            return t;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        public static int Collect(IntPtr L)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, 1);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = GetTranslator(L);\n                translator.RemoveObject(udata);\n            }\n\n            return 0;\n        }\n\n        public static bool GetInjectInitState(int index)\n        {\n            if (injectionState != null && injectionState.bInjectionInited)\n            {\n                return true;\n            }\n\n            return false;\n        }\n\n        string GetToLuaTypeName(Type t)\n        {\n            if (t.IsGenericType)\n            {\n                string str = t.Name;\n                int pos = str.IndexOf('`');\n\n                if (pos > 0)\n                {\n                    str = str.Substring(0, pos);\n                }\n\n                return str;\n            }\n\n            return t.Name;\n        }\n\n        public int BeginClass(Type t, Type baseType, string name = null)\n        {\n            if (beginCount == 0)\n            {\n                throw new LuaException(\"must call BeginModule first\");\n            }\n\n            int baseMetaRef = 0;\n            int reference = 0;            \n\n            if (name == null)\n            {\n                name = GetToLuaTypeName(t);\n            }\n\n            if (baseType != null && !metaMap.TryGetValue(baseType, out baseMetaRef))\n            {\n                LuaCreateTable();\n                baseMetaRef = LuaRef(LuaIndexes.LUA_REGISTRYINDEX);                \n                BindTypeRef(baseMetaRef, baseType);\n            }\n\n            if (metaMap.TryGetValue(t, out reference))\n            {\n                LuaDLL.tolua_beginclass(L, name, baseMetaRef, reference);\n                RegFunction(\"__gc\", Collect);\n                RegConstant(\"__name__\", t.FullName);\n            }\n            else\n            {\n                reference = LuaDLL.tolua_beginclass(L, name, baseMetaRef);\n                RegFunction(\"__gc\", Collect);\n                RegConstant(\"__name__\", t.FullName);\n                BindTypeRef(reference, t);\n            }\n\n            return reference;\n        }\n\n        public void EndClass()\n        {\n            LuaDLL.tolua_endclass(L);\n        }\n\n        public int BeginEnum(Type t)\n        {\n            if (beginCount == 0)\n            {\n                throw new LuaException(\"must call BeginModule first\");\n            }\n\n            int reference = LuaDLL.tolua_beginenum(L, t.Name);\n            RegFunction(\"__gc\", Collect);            \n            BindTypeRef(reference, t);\n            return reference;\n        }\n\n        public void EndEnum()\n        {\n            LuaDLL.tolua_endenum(L);\n        }\n\n        public void BeginStaticLibs(string name)\n        {\n            if (beginCount == 0)\n            {\n                throw new LuaException(\"must call BeginModule first\");\n            }\n\n            LuaDLL.tolua_beginstaticclass(L, name);\n        }\n\n        public void EndStaticLibs()\n        {\n            LuaDLL.tolua_endstaticclass(L);\n        }\n\n        public void RegFunction(string name, LuaCSFunction func)\n        {\n            IntPtr fn = Marshal.GetFunctionPointerForDelegate(func);\n            LuaDLL.tolua_function(L, name, fn);            \n        }\n\n        public void RegVar(string name, LuaCSFunction get, LuaCSFunction set)\n        {            \n            IntPtr fget = IntPtr.Zero;\n            IntPtr fset = IntPtr.Zero;\n\n            if (get != null)\n            {\n                fget = Marshal.GetFunctionPointerForDelegate(get);\n            }\n\n            if (set != null)\n            {\n                fset = Marshal.GetFunctionPointerForDelegate(set);\n            }\n\n            LuaDLL.tolua_variable(L, name, fget, fset);\n        }\n\n        public void RegConstant(string name, double d)\n        {\n            LuaDLL.tolua_constant(L, name, d);\n        }\n\n        public void RegConstant(string name, ValueType value) {\n            LuaDLL.tolua_constant(L, name, (int)value);\n        }\n\n        public void RegConstant(string name, bool flag)\n        {\n            LuaDLL.lua_pushstring(L, name);\n            LuaDLL.lua_pushboolean(L, flag);\n            LuaDLL.lua_rawset(L, -3);\n        }\n\n        public void RegConstant(string name, string s) {\n            LuaDLL.lua_pushstring(L, name);\n            LuaDLL.lua_pushstring(L, s);\n            LuaDLL.lua_rawset(L, -3);\n        }\n\n        int GetFuncRef(string name)\n        {\n            if (PushLuaFunction(name, false))\n            {\n                return LuaRef(LuaIndexes.LUA_REGISTRYINDEX);\n            }\n\n            throw new LuaException(\"get lua function reference failed: \" + name);                         \n        }\n\n        public static LuaState Get(IntPtr ptr)\n        {\n#if !MULTI_STATE\n            return mainState;\n#else\n\n            if (mainState != null && mainState.L == ptr)\n            {\n                return mainState;\n            }            \n\n            LuaState state = null;\n\n            if (stateMap.TryGetValue(ptr, out state))\n            {\n                return state;\n            }\n            else\n            {\n                return Get(LuaDLL.tolua_getmainstate(ptr));\n            }\n#endif\n        }\n\n        public static ObjectTranslator GetTranslator(IntPtr ptr)\n        {\n#if !MULTI_STATE\n            return mainState.translator;\n#else\n            if (mainState != null && mainState.L == ptr)\n            {\n                return mainState.translator;\n            }\n\n            return Get(ptr).translator;\n#endif\n        }\n\n        public static LuaReflection GetReflection(IntPtr ptr)\n        {\n#if !MULTI_STATE\n            return mainState.reflection;\n#else\n            if (mainState != null && mainState.L == ptr)\n            {\n                return mainState.reflection;\n            }\n\n            return Get(ptr).reflection;\n#endif\n        }\n\n        public void DoString(string chunk, string chunkName = \"LuaState.cs\")\n        {\n#if UNITY_EDITOR\n            if (!beStart)\n            {\n                throw new LuaException(\"you must call Start() first to initialize LuaState\");\n            }\n#endif\n            byte[] buffer = Encoding.UTF8.GetBytes(chunk);\n            LuaLoadBuffer(buffer, chunkName);\n        }\n\n        public T DoString<T>(string chunk, string chunkName = \"LuaState.cs\")\n        {\n            byte[] buffer = Encoding.UTF8.GetBytes(chunk);\n            return LuaLoadBuffer<T>(buffer, chunkName);\n        }\n\n        byte[] LoadFileBuffer(string fileName)\n        {\n#if UNITY_EDITOR\n            if (!beStart)\n            {\n                throw new LuaException(\"you must call Start() first to initialize LuaState\");\n            }\n#endif\n            byte[] buffer = LuaFileUtils.Instance.ReadFile(fileName);\n\n            if (buffer == null)\n            {\n                string error = string.Format(\"cannot open {0}: No such file or directory\", fileName);\n                error += LuaFileUtils.Instance.FindFileError(fileName);\n                throw new LuaException(error);\n            }\n\n            return buffer;\n        }\n\n        string LuaChunkName(string name)\n        {\n            if (LuaConst.openLuaDebugger)\n            {\n                name = LuaFileUtils.Instance.FindFile(name);\n            }\n\n            return \"@\" + name;\n        }\n\n        public void DoFile(string fileName)\n        {\n            byte[] buffer = LoadFileBuffer(fileName);\n            fileName = LuaChunkName(fileName);\n            LuaLoadBuffer(buffer, fileName);\n        }\n\n        public T DoFile<T>(string fileName)\n        {\n            byte[] buffer = LoadFileBuffer(fileName);\n            fileName = LuaChunkName(fileName);\n            return LuaLoadBuffer<T>(buffer, fileName);\n        }\n\n        //注意fileName与lua文件中require一致。\n        public void Require(string fileName)\n        {\n            int top = LuaGetTop();\n            int ret = LuaRequire(fileName);\n\n            if (ret != 0)\n            {                \n                string err = LuaToString(-1);\n                LuaSetTop(top);\n                throw new LuaException(err, LuaException.GetLastError());\n            }\n\n            LuaSetTop(top);            \n        }\n\n        public T Require<T>(string fileName)\n        {\n            int top = LuaGetTop();\n            int ret = LuaRequire(fileName);\n\n            if (ret != 0)\n            {\n                string err = LuaToString(-1);\n                LuaSetTop(top);\n                throw new LuaException(err, LuaException.GetLastError());\n            }\n\n            T o = CheckValue<T>(-1);\n            LuaSetTop(top);\n            return o;\n        }\n\n        public void InitPackagePath()\n        {\n            LuaGetGlobal(\"package\");\n            LuaGetField(-1, \"path\");\n            string current = LuaToString(-1);\n            string[] paths = current.Split(';');\n\n            for (int i = 0; i < paths.Length; i++)\n            {\n                if (!string.IsNullOrEmpty(paths[i]))\n                {\n                    string path = paths[i].Replace('\\\\', '/');\n                    LuaFileUtils.Instance.AddSearchPath(path);\n                }\n            }\n\n            LuaPushString(\"\");            \n            LuaSetField(-3, \"path\");\n            LuaPop(2);\n        }\n\n        string ToPackagePath(string path)\n        {\n            using (CString.Block())\n            {\n                CString sb = CString.Alloc(256);\n                sb.Append(path);\n                sb.Replace('\\\\', '/');\n\n                if (sb.Length > 0 && sb[sb.Length - 1] != '/')\n                {\n                    sb.Append('/');\n                }\n\n                sb.Append(\"?.lua\");\n                return sb.ToString();\n            }\n        }\n\n        public void AddSearchPath(string fullPath)\n        {\n            if (!Path.IsPathRooted(fullPath))\n            {\n                throw new LuaException(fullPath + \" is not a full path\");\n            }\n\n            fullPath = ToPackagePath(fullPath);\n            LuaFileUtils.Instance.AddSearchPath(fullPath);        \n        }\n\n        public void RemoveSeachPath(string fullPath)\n        {\n            if (!Path.IsPathRooted(fullPath))\n            {\n                throw new LuaException(fullPath + \" is not a full path\");\n            }\n\n            fullPath = ToPackagePath(fullPath);\n            LuaFileUtils.Instance.RemoveSearchPath(fullPath);\n        }        \n\n        public int BeginPCall(int reference)\n        {\n            return LuaDLL.tolua_beginpcall(L, reference);\n        }\n\n        public void PCall(int args, int oldTop)\n        {            \n            if (LuaDLL.lua_pcall(L, args, LuaDLL.LUA_MULTRET, oldTop) != 0)\n            {\n                string error = LuaToString(-1);\n                throw new LuaException(error, LuaException.GetLastError());\n            }            \n        }\n\n        public void EndPCall(int oldTop)\n        {\n            LuaDLL.lua_settop(L, oldTop - 1);            \n        }\n\n        public void PushArgs(object[] args)\n        {\n            for (int i = 0; i < args.Length; i++)\n            {\n                PushVariant(args[i]);\n            }\n        }\n\n        void CheckNull(LuaBaseRef lbr, string fmt, object arg0)\n        {\n            if (lbr == null)\n            {\n                string error = string.Format(fmt, arg0);\n                throw new LuaException(error, null, 2);\n            }            \n        }\n\n        //压入一个存在的或不存在的table, 但不增加引用计数\n        bool PushLuaTable(string fullPath, bool checkMap = true)\n        {\n            if (checkMap)\n            {\n                WeakReference weak = null;\n\n                if (funcMap.TryGetValue(fullPath, out weak))\n                {\n                    if (weak.IsAlive)\n                    {\n                        LuaTable table = weak.Target as LuaTable;\n                        CheckNull(table, \"{0} not a lua table\", fullPath);\n                        Push(table);\n                        return true;\n                    }\n                    else\n                    {\n                        funcMap.Remove(fullPath);\n                    }\n                }\n            }\n\n            if (!LuaDLL.tolua_pushluatable(L, fullPath))\n            {                \n                return false;\n            }\n\n            return true;\n        }\n\n        bool PushLuaFunction(string fullPath, bool checkMap = true)\n        {\n            if (checkMap)\n            {\n                WeakReference weak = null;\n\n                if (funcMap.TryGetValue(fullPath, out weak))\n                {\n                    if (weak.IsAlive)\n                    {\n                        LuaFunction func = weak.Target as LuaFunction;\n                        CheckNull(func, \"{0} not a lua function\", fullPath);\n\n                        if (func.IsAlive)\n                        {\n                            func.AddRef();\n                            return true;\n                        }\n                    }\n\n                    funcMap.Remove(fullPath);\n                }\n            }\n\n            int oldTop = LuaDLL.lua_gettop(L);\n            int pos = fullPath.LastIndexOf('.');\n\n            if (pos > 0)\n            {\n                string tableName = fullPath.Substring(0, pos);\n\n                if (PushLuaTable(tableName, checkMap))\n                {\n                    string funcName = fullPath.Substring(pos + 1);\n                    LuaDLL.lua_pushstring(L, funcName);\n                    LuaDLL.lua_rawget(L, -2);\n\n                    LuaTypes type = LuaDLL.lua_type(L, -1);\n\n                    if (type == LuaTypes.LUA_TFUNCTION)\n                    {\n                        LuaDLL.lua_insert(L, oldTop + 1);\n                        LuaDLL.lua_settop(L, oldTop + 1);\n                        return true;\n                    }\n                }\n\n                LuaDLL.lua_settop(L, oldTop);\n                return false;\n            }\n            else\n            {\n                LuaDLL.lua_getglobal(L, fullPath);\n                LuaTypes type = LuaDLL.lua_type(L, -1);\n\n                if (type != LuaTypes.LUA_TFUNCTION)\n                {\n                    LuaDLL.lua_settop(L, oldTop);\n                    return false;\n                }\n            }\n\n            return true;\n        }\n\n        void RemoveFromGCList(int reference)\n        {            \n            lock (gcList)\n            {                \n                for (int i = 0; i < gcList.Count; i++)\n                {\n                    if (gcList[i].reference == reference)\n                    {\n                        gcList.RemoveAt(i);\n                        break;\n                    }\n                }\n            }\n        }\n\n        public LuaFunction GetFunction(string name, bool beLogMiss = true)\n        {\n            WeakReference weak = null;\n\n            if (funcMap.TryGetValue(name, out weak))\n            {\n                if (weak.IsAlive)\n                {\n                    LuaFunction func = weak.Target as LuaFunction;\n                    CheckNull(func, \"{0} not a lua function\", name);\n\n                    if (func.IsAlive)\n                    {\n                        func.AddRef();\n                        RemoveFromGCList(func.GetReference());\n                        return func;\n                    }\n                }\n\n                funcMap.Remove(name);\n            }\n\n            if (PushLuaFunction(name, false))\n            {\n                int reference = ToLuaRef();\n\n                if (funcRefMap.TryGetValue(reference, out weak))\n                {\n                    if (weak.IsAlive)\n                    {\n                        LuaFunction func = weak.Target as LuaFunction;\n                        CheckNull(func, \"{0} not a lua function\", name);\n\n                        if (func.IsAlive)\n                        {\n                            funcMap.Add(name, weak);\n                            func.AddRef();\n                            RemoveFromGCList(reference);\n                            return func;\n                        }\n                    }\n\n                    funcRefMap.Remove(reference);\n                    delegateMap.Remove(reference);\n                }\n                \n                LuaFunction fun = new LuaFunction(reference, this);\n                fun.name = name;\n                funcMap.Add(name, new WeakReference(fun));\n                funcRefMap.Add(reference, new WeakReference(fun));\n                RemoveFromGCList(reference);\n                if (LogGC) Debugger.Log(\"Alloc LuaFunction name {0}, id {1}\", name, reference);                \n                return fun;\n            }\n\n            if (beLogMiss)\n            {\n                Debugger.Log(\"Lua function {0} not exists\", name);                \n            }\n\n            return null;\n        }\n\n        LuaBaseRef TryGetLuaRef(int reference)\n        {            \n            WeakReference weak = null;\n\n            if (funcRefMap.TryGetValue(reference, out weak))\n            {\n                if (weak.IsAlive)\n                {\n                    LuaBaseRef luaRef = (LuaBaseRef)weak.Target;\n\n                    if (luaRef.IsAlive)\n                    {\n                        luaRef.AddRef();\n                        return luaRef;\n                    }\n                }                \n\n                funcRefMap.Remove(reference);                \n            }\n\n            return null;\n        }\n\n        public LuaFunction GetFunction(int reference)\n        {\n            LuaFunction func = TryGetLuaRef(reference) as LuaFunction;\n\n            if (func == null)\n            {                \n                func = new LuaFunction(reference, this);\n                funcRefMap.Add(reference, new WeakReference(func));\n                if (LogGC) Debugger.Log(\"Alloc LuaFunction name , id {0}\", reference);      \n            }\n\n            RemoveFromGCList(reference);\n            return func;\n        }\n\n        public LuaTable GetTable(string fullPath, bool beLogMiss = true)\n        {\n            WeakReference weak = null;\n\n            if (funcMap.TryGetValue(fullPath, out weak))\n            {\n                if (weak.IsAlive)\n                {\n                    LuaTable table = weak.Target as LuaTable;\n                    CheckNull(table, \"{0} not a lua table\", fullPath);\n\n                    if (table.IsAlive)\n                    {\n                        table.AddRef();\n                        RemoveFromGCList(table.GetReference());\n                        return table;\n                    }\n                }\n\n                funcMap.Remove(fullPath);\n            }\n\n            if (PushLuaTable(fullPath, false))\n            {\n                int reference = ToLuaRef();\n                LuaTable table = null;\n\n                if (funcRefMap.TryGetValue(reference, out weak))\n                {\n                    if (weak.IsAlive)\n                    {\n                        table = weak.Target as LuaTable;\n                        CheckNull(table, \"{0} not a lua table\", fullPath);\n\n                        if (table.IsAlive)\n                        {\n                            funcMap.Add(fullPath, weak);\n                            table.AddRef();\n                            RemoveFromGCList(reference);\n                            return table;\n                        }\n                    }\n\n                    funcRefMap.Remove(reference);\n                }\n\n                table = new LuaTable(reference, this);\n                table.name = fullPath;\n                funcMap.Add(fullPath, new WeakReference(table));\n                funcRefMap.Add(reference, new WeakReference(table));\n                if (LogGC) Debugger.Log(\"Alloc LuaTable name {0}, id {1}\", fullPath, reference);     \n                RemoveFromGCList(reference);\n                return table;\n            }\n\n            if (beLogMiss)\n            {\n                Debugger.LogWarning(\"Lua table {0} not exists\", fullPath);\n            }\n\n            return null;\n        }\n\n        public LuaTable GetTable(int reference)\n        {\n            LuaTable table = TryGetLuaRef(reference) as LuaTable;\n\n            if (table == null)\n            {                \n                table = new LuaTable(reference, this);\n                funcRefMap.Add(reference, new WeakReference(table));\n            }\n\n            RemoveFromGCList(reference);\n            return table;\n        }\n\n        public LuaThread GetLuaThread(int reference)\n        {\n            LuaThread thread = TryGetLuaRef(reference) as LuaThread;\n\n            if (thread == null)\n            {                \n                thread = new LuaThread(reference, this);\n                funcRefMap.Add(reference, new WeakReference(thread));\n            }\n\n            RemoveFromGCList(reference);\n            return thread;\n        }\n\n        public LuaDelegate GetLuaDelegate(LuaFunction func)\n        {\n            WeakReference weak = null;\n            int reference = func.GetReference();            \n            delegateMap.TryGetValue(reference, out weak);\n\n            if (weak != null)\n            {\n                if (weak.IsAlive)\n                {\n                    return weak.Target as LuaDelegate;\n                }\n\n                delegateMap.Remove(reference);\n            }\n\n            return null;\n        }\n\n        public LuaDelegate GetLuaDelegate(LuaFunction func, LuaTable self)\n        {\n            WeakReference weak = null;\n            long high = func.GetReference();\n            long low = self == null ? 0 : self.GetReference();\n            low = low >= 0 ? low : 0;\n            long key = high << 32 | low;            \n            delegateMap.TryGetValue(key, out weak);\n\n            if (weak != null)\n            {\n                if (weak.IsAlive)\n                {\n                    return weak.Target as LuaDelegate;\n                }\n\n                delegateMap.Remove(key);\n            }\n\n            return null;\n        }\n\n        public void AddLuaDelegate(LuaDelegate target, LuaFunction func)\n        {            \n            int key = func.GetReference();\n\n            if (key > 0)\n            {\n                delegateMap[key] = new WeakReference(target);\n            }\n        }\n\n        public void AddLuaDelegate(LuaDelegate target, LuaFunction func, LuaTable self)\n        {\n            long high = func.GetReference();\n            long low = self == null ? 0 : self.GetReference();\n            low = low >= 0 ? low : 0;\n            long key = high << 32 | low;\n\n            if (key > 0)\n            {\n                delegateMap[key] = new WeakReference(target);\n            }\n        }\n\n        public bool CheckTop()\n        {\n            int n = LuaGetTop();\n\n            if (n != 0)\n            {\n                Debugger.LogWarning(\"Lua stack top is {0}\", n);\n                return false;\n            }\n\n            return true;\n        }\n\n        public void Push(bool b)\n        {\n            LuaDLL.lua_pushboolean(L, b);\n        }\n\n        public void Push(double d)\n        {\n            LuaDLL.lua_pushnumber(L, d);\n        }\n\n        public void Push(uint un)\n        {\n            LuaDLL.lua_pushnumber(L, un);\n        }\n\n        public void Push(int n)\n        {\n            LuaDLL.lua_pushinteger(L, n);\n        }\n\n        public void Push(short s)\n        {\n            LuaDLL.lua_pushnumber(L, s);\n        }\n\n        public void Push(ushort us)\n        {\n            LuaDLL.lua_pushnumber(L, us);\n        }\n\n        public void Push(long l)\n        {\n            LuaDLL.tolua_pushint64(L, l);\n        }\n\n        public void Push(ulong ul)\n        {\n            LuaDLL.tolua_pushuint64(L, ul);\n        }\n\n        public void Push(string str)\n        {\n            LuaDLL.lua_pushstring(L, str);\n        }\n\n        public void Push(IntPtr p)\n        {\n            LuaDLL.lua_pushlightuserdata(L, p);\n        }\n\n        public void Push(Vector3 v3)\n        {            \n            LuaDLL.tolua_pushvec3(L, v3.x, v3.y, v3.z);\n        }\n\n        public void Push(Vector2 v2)\n        {\n            LuaDLL.tolua_pushvec2(L, v2.x, v2.y);\n        }\n\n        public void Push(Vector4 v4)\n        {\n            LuaDLL.tolua_pushvec4(L, v4.x, v4.y, v4.z, v4.w);\n        }\n\n        public void Push(Color clr)\n        {\n            LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a);\n        }\n\n        public void Push(Color32 clr)\n        {\n            LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a);\n        }\n\n        public void Push(Quaternion q)\n        {\n            LuaDLL.tolua_pushquat(L, q.x, q.y, q.z, q.w);\n        }          \n\n        public void Push(Ray ray)\n        {\n            ToLua.Push(L, ray);\n        }\n\n        public void Push(Bounds bound)\n        {\n            ToLua.Push(L, bound);\n        }\n\n        public void Push(RaycastHit hit)\n        {\n            ToLua.Push(L, hit);\n        }\n\n        public void Push(Touch touch)\n        {\n            ToLua.Push(L, touch);\n        }\n\n        public void PushLayerMask(LayerMask mask)\n        {\n            LuaDLL.tolua_pushlayermask(L, mask.value);\n        }\n\n        public void Push(LuaByteBuffer bb)\n        {\n            LuaDLL.lua_pushlstring(L, bb.buffer, bb.Length);\n        }\n\n        public void PushByteBuffer(byte[] buffer)\n        {\n            LuaDLL.lua_pushlstring(L, buffer, buffer.Length);\n        }\n\n        public void PushByteBuffer(byte[] buffer, int len)\n        {\n            LuaDLL.lua_pushlstring(L, buffer, len);\n        }\n\n        public void Push(LuaBaseRef lbr)\n        {\n            if (lbr == null)\n            {                \n                LuaPushNil();\n            }\n            else\n            {\n                LuaGetRef(lbr.GetReference());\n            }\n        }\n\n        void PushUserData(object o, int reference)\n        {\n            int index;\n\n            if (translator.Getudata(o, out index))\n            {\n                if (LuaDLL.tolua_pushudata(L, index))\n                {\n                    return;\n                }\n\n                translator.Destroyudata(index);\n            }\n\n            index = translator.AddObject(o);\n            LuaDLL.tolua_pushnewudata(L, reference, index);\n        }\n\n        public void Push(Array array)\n        {\n            if (array == null)\n            {                \n                LuaPushNil();\n            }\n            else\n            {\n                PushUserData(array, ArrayMetatable);\n            }\n        }\n\n        public void Push(Type t)\n        {\n            if (t == null)\n            {\n                LuaPushNil();\n            }\n            else\n            {\n                PushUserData(t, TypeMetatable);\n            }\n        }\n\n        public void Push(Delegate ev)\n        {\n            if (ev == null)\n            {                \n                LuaPushNil();\n            }\n            else\n            {\n                PushUserData(ev, DelegateMetatable);\n            }\n        }\n\n        public object GetEnumObj(Enum e)\n        {\n            object o = null;\n\n            if (!enumMap.TryGetValue(e, out o))\n            {\n                o = e;\n                enumMap.Add(e, o);\n            }\n\n            return o;\n        }\n\n        public void Push(Enum e)\n        {\n            ToLua.Push(L, e);\n        }\n\n        public void Push(IEnumerator iter)\n        {\n            ToLua.Push(L, iter);\n        }\n\n        public void Push(UnityEngine.Object obj)\n        {\n            ToLua.Push(L, obj);\n        }\n\n        public void Push(UnityEngine.TrackedReference tracker)\n        {\n            ToLua.Push(L, tracker);\n        }\n\n        public void PushVariant(object obj)\n        {\n            ToLua.Push(L, obj);\n        }\n\n        public void PushObject(object obj)\n        {\n            ToLua.PushObject(L, obj);\n        }\n\n        public void PushSealed<T>(T o)\n        {\n            ToLua.PushSealed<T>(L, o);\n        }\n\n        public void PushValue<T>(T v) where T : struct\n        {\n            StackTraits<T>.Push(L, v);\n        }\n\n        public void PushGeneric<T>(T o)\n        {\n            StackTraits<T>.Push(L, o);\n        }\n\n        Vector3 ToVector3(int stackPos)\n        {            \n            float x, y, z;\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z);\n            return new Vector3(x, y, z);\n        }\n\n        public Vector3 CheckVector3(int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Vector3)\n            {\n                LuaTypeError(stackPos, \"Vector3\",  LuaValueTypeName.Get(type));\n                return Vector3.zero;\n            }\n            \n            float x, y, z;\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z);\n            return new Vector3(x, y, z);\n        }\n\n        public Quaternion CheckQuaternion(int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Quaternion)\n            {\n                LuaTypeError(stackPos, \"Quaternion\", LuaValueTypeName.Get(type));\n                return Quaternion.identity;\n            }\n\n            float x, y, z, w;\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.tolua_getquat(L, stackPos, out x, out y, out z, out w);\n            return new Quaternion(x, y, z, w);\n        }\n\n        public Vector2 CheckVector2(int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Vector2)\n            {\n                LuaTypeError(stackPos, \"Vector2\", LuaValueTypeName.Get(type));                \n                return Vector2.zero;\n            }\n\n            float x, y;\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.tolua_getvec2(L, stackPos, out x, out y);\n            return new Vector2(x, y);\n        }\n\n        public Vector4 CheckVector4(int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Vector4)\n            {\n                LuaTypeError(stackPos, \"Vector4\", LuaValueTypeName.Get(type));\n                return Vector4.zero;\n            }\n\n            float x, y, z, w;\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.tolua_getvec4(L, stackPos, out x, out y, out z, out w);\n            return new Vector4(x, y, z, w);\n        }\n\n        public Color CheckColor(int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Color)\n            {\n                LuaTypeError(stackPos, \"Color\", LuaValueTypeName.Get(type));    \n                return Color.black;\n            }\n\n            float r, g, b, a;\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a);\n            return new Color(r, g, b, a);\n        }\n\n        public Color32 CheckColor32(int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Color32)\n            {\n                LuaTypeError(stackPos, \"Color32\", LuaValueTypeName.Get(type));\n                return new Color32();\n            }\n\n            float r, g, b, a;\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a);\n            return new Color32((byte)r, (byte)g, (byte)b, (byte)a);\n        }\n\n        public Ray CheckRay(int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Ray)\n            {\n                LuaTypeError(stackPos, \"Ray\", LuaValueTypeName.Get(type));\n                return new Ray();\n            }\n\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            int oldTop = BeginPCall(UnpackRay);\n            LuaPushValue(stackPos);\n\n            try\n            {\n                PCall(1, oldTop);\n                Vector3 origin = ToVector3(oldTop + 1);\n                Vector3 dir = ToVector3(oldTop + 2);\n                EndPCall(oldTop);                \n                return new Ray(origin, dir);\n            }\n            catch(Exception e)\n            {\n                EndPCall(oldTop);\n                throw e;\n            }\n        }\n\n        public Bounds CheckBounds(int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Bounds)\n            {\n                LuaTypeError(stackPos, \"Bounds\", LuaValueTypeName.Get(type));    \n                return new Bounds();\n            }\n\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            int oldTop = BeginPCall(UnpackBounds);\n            LuaPushValue(stackPos);\n\n            try\n            {\n                PCall(1, oldTop);\n                Vector3 center = ToVector3(oldTop + 1);\n                Vector3 size = ToVector3(oldTop + 2);\n                EndPCall(oldTop);\n                return new Bounds(center, size);\n            }\n            catch(Exception e)\n            {\n                EndPCall(oldTop);\n                throw e;\n            }\n        }\n\n        public LayerMask CheckLayerMask(int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.LayerMask)\n            {\n                LuaTypeError(stackPos, \"LayerMask\", LuaValueTypeName.Get(type));\n                return 0;\n            }\n\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            return LuaDLL.tolua_getlayermask(L, stackPos);\n        }\n\n        public long CheckLong(int stackPos)\n        {\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            return LuaDLL.tolua_checkint64(L, stackPos);\n        }\n\n        public ulong CheckULong(int stackPos)\n        {\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            return LuaDLL.tolua_checkuint64(L, stackPos);\n        }\n\n        public string CheckString(int stackPos)\n        {\n            return ToLua.CheckString(L, stackPos);\n        }\n\n        public Delegate CheckDelegate(int stackPos)\n        {            \n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n\n            if (udata != -1)\n            {\n                object obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {                                                  \n                    if (obj is Delegate)\n                    {\n                        return (Delegate)obj;\n                    }\n\n                    LuaTypeError(stackPos, \"Delegate\", obj.GetType().FullName);\n                }\n\n                return null;\n            }\n            else if (LuaDLL.lua_isnil(L,stackPos))\n            {\n                return null;\n            }\n\n            LuaTypeError(stackPos, \"Delegate\");\n            return null;\n        }\n\n        public char[] CheckCharBuffer(int stackPos)\n        {\n            return ToLua.CheckCharBuffer(L, stackPos);\n        }\n\n        public byte[] CheckByteBuffer(int stackPos)\n        {\n            return ToLua.CheckByteBuffer(L, stackPos);\n        }\n\n        public T[] CheckNumberArray<T>(int stackPos) where T : struct\n        {\n            return ToLua.CheckNumberArray<T>(L, stackPos);\n        }\n\n        public object CheckObject(int stackPos, Type type)\n        {\n            return ToLua.CheckObject(L, stackPos, type);\n        }\n\n        public object CheckVarObject(int stackPos, Type type)\n        {\n            return ToLua.CheckVarObject(L, stackPos, type);\n        }\n\n        public object[] CheckObjects(int oldTop)\n        {\n            int newTop = LuaGetTop();\n\n            if (oldTop == newTop)\n            {\n                return null;\n            }\n            else\n            {\n                List<object> returnValues = new List<object>();\n\n                for (int i = oldTop + 1; i <= newTop; i++)\n                {\n                    returnValues.Add(ToVariant(i));\n                }\n\n                return returnValues.ToArray();\n            }\n        }\n\n        public LuaFunction CheckLuaFunction(int stackPos)\n        {            \n            return ToLua.CheckLuaFunction(L, stackPos);\n        }\n\n        public LuaTable CheckLuaTable(int stackPos)\n        {            \n            return ToLua.CheckLuaTable(L, stackPos);\n        }\n\n        public LuaThread CheckLuaThread(int stackPos)\n        {            \n            return ToLua.CheckLuaThread(L, stackPos);\n        }\n\n        //从堆栈读取一个值类型\n        public T CheckValue<T>(int stackPos)\n        {            \n            return StackTraits<T>.Check(L, stackPos);\n        }\n\n        public object ToVariant(int stackPos)\n        {\n            return ToLua.ToVarObject(L, stackPos);\n        }\n\n        public void CollectRef(int reference, string name, bool isGCThread = false)\n        {\n            if (!isGCThread)\n            {                \n                Collect(reference, name, false);\n            }\n            else\n            {\n                lock (gcList)\n                {\n                    gcList.Add(new GCRef(reference, name));\n                }\n            }\n        }\n\n        //在委托调用中减掉一个LuaFunction, 此lua函数在委托中还会执行一次, 所以必须延迟删除，委托值类型表现之一\n        public void DelayDispose(LuaBaseRef br)\n        {\n            if (br != null)\n            {\n                subList.Add(br);\n            }\n        }\n\n        public int Collect()\n        {\n            int count = gcList.Count;\n\n            if (count > 0)\n            {\n                lock (gcList)\n                {\n                    for (int i = 0; i < gcList.Count; i++)\n                    {\n                        int reference = gcList[i].reference;\n                        string name = gcList[i].name;\n                        Collect(reference, name, true);\n                    }\n\n                    gcList.Clear();\n                    return count;\n                }\n            }\n\n            for (int i = 0; i < subList.Count; i++)\n            {\n                subList[i].Dispose();\n            }\n\n            subList.Clear();\n            translator.Collect();\n            return 0;\n        }\n\n        public void StepCollect()\n        {\n            translator.StepCollect();\n        }\n\n        public void RefreshDelegateMap()\n        {\n            List<long> list = new List<long>();\n            var iter = delegateMap.GetEnumerator();\n\n            while (iter.MoveNext())\n            {\n                if (!iter.Current.Value.IsAlive)\n                {\n                    list.Add(iter.Current.Key);\n                }\n            }\n\n            for (int i = 0; i < list.Count; i++)\n            {\n                delegateMap.Remove(list[i]);\n            }\n        }\n\n        public object this[string fullPath]\n        {\n            get\n            {\n                int oldTop = LuaGetTop();\n                int pos = fullPath.LastIndexOf('.');\n                object obj = null;\n\n                if (pos > 0)\n                {\n                    string tableName = fullPath.Substring(0, pos);\n\n                    if (PushLuaTable(tableName))\n                    {\n                        string name = fullPath.Substring(pos + 1);\n                        LuaPushString(name);\n                        LuaRawGet(-2);\n                        obj = ToVariant(-1);\n                    }    \n                    else\n                    {\n                        LuaSetTop(oldTop);\n                        return null;\n                    }\n                }\n                else\n                {\n                    LuaGetGlobal(fullPath);\n                    obj = ToVariant(-1);\n                }\n\n                LuaSetTop(oldTop);\n                return obj;\n            }\n\n            set\n            {\n                int oldTop = LuaGetTop();\n                int pos = fullPath.LastIndexOf('.');\n\n                if (pos > 0)\n                {\n                    string tableName = fullPath.Substring(0, pos);\n                    IntPtr p = LuaFindTable(LuaIndexes.LUA_GLOBALSINDEX, tableName);\n\n                    if (p == IntPtr.Zero)\n                    {\n                        string name = fullPath.Substring(pos + 1);\n                        LuaPushString(name);\n                        PushVariant(value);\n                        LuaSetTable(-3);\n                    }\n                    else\n                    {\n                        LuaSetTop(oldTop);\n                        int len = LuaDLL.tolua_strlen(p);\n                        string str = LuaDLL.lua_ptrtostring(p, len);\n                        throw new LuaException(string.Format(\"{0} not a Lua table\", str));\n                    }\n                }\n                else\n                {\n                    PushVariant(value);\n                    LuaSetGlobal(fullPath);                    \n                }\n\n                LuaSetTop(oldTop);\n            }\n        }\n\n        public void NewTable(string fullPath)\n        {\n            string[] path = fullPath.Split(new char[] { '.' });\n            int oldTop = LuaDLL.lua_gettop(L);\n\n            if (path.Length == 1)\n            {\n                LuaDLL.lua_newtable(L);\n                LuaDLL.lua_setglobal(L, fullPath);\n            }\n            else\n            {\n                LuaDLL.lua_getglobal(L, path[0]);\n\n                for (int i = 1; i < path.Length - 1; i++)\n                {\n                    LuaDLL.lua_pushstring(L, path[i]);\n                    LuaDLL.lua_gettable(L, -2);\n                }\n\n                LuaDLL.lua_pushstring(L, path[path.Length - 1]);\n                LuaDLL.lua_newtable(L);\n                LuaDLL.lua_settable(L, -3);\n            }\n\n            LuaDLL.lua_settop(L, oldTop);\n        }\n\n\n        public LuaTable NewTable(int narr = 0, int nrec = 0)\n        {\n            int oldTop = LuaDLL.lua_gettop(L);\n\n            LuaDLL.lua_createtable(L, 0, 0);\n            LuaTable table = ToLua.ToLuaTable(L, oldTop + 1);\n\n            LuaDLL.lua_settop(L, oldTop);\n            return table;\n        }\n\n        //慎用\n        public void ReLoad(string moduleFileName)\n        {\n            LuaGetGlobal(\"package\");\n            LuaGetField(-1, \"loaded\");\n            LuaPushString(moduleFileName);\n            LuaGetTable(-2);                          \n\n            if (!LuaIsNil(-1))\n            {\n                LuaPushString(moduleFileName);                        \n                LuaPushNil();\n                LuaSetTable(-4);                      \n            }\n\n            LuaPop(3);\n            string require = string.Format(\"require '{0}'\", moduleFileName);\n            DoString(require, \"ReLoad\");\n        }\n\n        public int GetMetaReference(Type t)\n        {\n            int reference = -1;\n            metaMap.TryGetValue(t, out reference);\n            return reference;\n        }\n\n        public int GetMissMetaReference(Type t)\n        {       \n            int reference = -1;\n            Type type = GetBaseType(t);\n\n            while (type != null)\n            {\n                if (metaMap.TryGetValue(type, out reference))\n                {\n#if MISS_WARNING\n                    if (!missSet.Contains(t))\n                    {\n                        missSet.Add(t);\n                        Debugger.LogWarning(\"Type {0} not wrap to lua, push as {1}, the warning is only raised once\", LuaMisc.GetTypeName(t), LuaMisc.GetTypeName(type));\n                    }\n#endif                    \n                    return reference;              \n                }\n\n                type = GetBaseType(type);\n            }            \n\n            if (reference <= 0)\n            {\n                type = typeof(object);\n                reference = LuaStatic.GetMetaReference(L, type);                \n            }\n\n#if MISS_WARNING\n            if (!missSet.Contains(t))\n            {\n                missSet.Add(t);\n                Debugger.LogWarning(\"Type {0} not wrap to lua, push as {1}, the warning is only raised once\", LuaMisc.GetTypeName(t), LuaMisc.GetTypeName(type));\n            }            \n#endif\n\n            return reference;\n        }\n\n        Type GetBaseType(Type t)\n        {\n            if (t.IsGenericType)\n            {\n                return GetSpecialGenericType(t);\n            }\n\n            return LuaMisc.GetExportBaseType(t);\n        }\n\n        Type GetSpecialGenericType(Type t)\n        {\n            Type generic = t.GetGenericTypeDefinition();\n\n            if (genericSet.Contains(generic))\n            {\n                return t == generic ? t.BaseType : generic;\n            }\n\n            return t.BaseType;\n        }\n\n        void CloseBaseRef()\n        {\n            LuaUnRef(PackBounds);\n            LuaUnRef(UnpackBounds);\n            LuaUnRef(PackRay);\n            LuaUnRef(UnpackRay);\n            LuaUnRef(PackRaycastHit);\n            LuaUnRef(PackTouch);   \n        }\n        \n        public void Dispose()\n        {\n            if (IntPtr.Zero != L)\n            {\n                Collect();\n\n                foreach (KeyValuePair<Type, int> kv in metaMap)\n                {\n                    LuaUnRef(kv.Value);\n                }\n\n                List<LuaBaseRef> list = new List<LuaBaseRef>();\n\n                foreach (KeyValuePair<int, WeakReference> kv in funcRefMap)\n                {\n                    if (kv.Value.IsAlive)\n                    {\n                        list.Add((LuaBaseRef)kv.Value.Target);\n                    }\n                }\n\n                for (int i = 0; i < list.Count; i++)\n                {\n                    list[i].Dispose(true);\n                }\n\n                CloseBaseRef();\n                delegateMap.Clear();\n                funcRefMap.Clear();\n                funcMap.Clear();\n                metaMap.Clear();                \n                typeMap.Clear();\n                enumMap.Clear();\n                preLoadMap.Clear();\n                genericSet.Clear();                                \n                LuaDLL.lua_close(L);                \n                translator.Dispose();\n                stateMap.Remove(L);\n                translator = null;\n                L = IntPtr.Zero;\n#if MISS_WARNING\n                missSet.Clear();\n#endif\n                OnDestroy();\n                Debugger.Log(\"LuaState destroy\");\n            }\n\n            if (mainState == this)\n            {\n                mainState = null;\n            }\n            if (injectionState == this)\n            {\n                injectionState = null;\n                LuaInjectionStation.Clear();\n            }\n\n#if UNITY_EDITOR\n            beStart = false;\n#endif\n\n            LuaFileUtils.Instance.Dispose();\n            System.GC.SuppressFinalize(this);            \n        }\n\n        //public virtual void Dispose(bool dispose)\n        //{\n        //}\n\n        public override int GetHashCode()\n        {\n            return RuntimeHelpers.GetHashCode(this);          \n        }\n\n        public override bool Equals(object o)\n        {\n            if (o == null) return L == IntPtr.Zero;\n            LuaState state = o as LuaState;\n\n            if (state == null || state.L != L)\n            {\n                return false;\n            }\n\n            return L != IntPtr.Zero;\n        }\n\n        public static bool operator == (LuaState a, LuaState b)\n        {\n            if (System.Object.ReferenceEquals(a, b))\n            {\n                return true;\n            }\n\n            object l = a;\n            object r = b;\n\n            if (l == null && r != null)\n            {\n                return b.L == IntPtr.Zero;\n            }\n\n            if (l != null && r == null)\n            {\n                return a.L == IntPtr.Zero;\n            }\n\n            if (a.L != b.L)\n            {\n                return false;\n            }\n\n            return a.L != IntPtr.Zero;\n        }\n\n        public static bool operator != (LuaState a, LuaState b)\n        {\n            return !(a == b);\n        }\n\n        public void PrintTable(string name)\n        {\n            LuaTable table = GetTable(name);\n            LuaDictTable dict = table.ToDictTable();\n            table.Dispose();\n            var iter2 = dict.GetEnumerator();\n\n            while (iter2.MoveNext())\n            {\n                Debugger.Log(\"map item, k,v is {0}:{1}\", iter2.Current.Key, iter2.Current.Value);\n            }\n\n            iter2.Dispose();\n            dict.Dispose();\n        }\n\n        protected void Collect(int reference, string name, bool beThread)\n        {\n            if (beThread)\n            {\n                WeakReference weak = null;\n\n                if (name != null)\n                {\n                    funcMap.TryGetValue(name, out weak);\n\n                    if (weak != null && !weak.IsAlive)\n                    {\n                        funcMap.Remove(name);\n                        weak = null;\n                    }\n                }\n                \n                funcRefMap.TryGetValue(reference, out weak);\n\n                if (weak != null && !weak.IsAlive)\n                {\n                    ToLuaUnRef(reference);\n                    funcRefMap.Remove(reference);\n                    delegateMap.Remove(reference);\n\n                    if (LogGC)\n                    {\n                        string str = name == null ? \"null\" : name;\n                        Debugger.Log(\"collect lua reference name {0}, id {1} in thread\", str, reference);\n                    }\n                }\n            }\n            else\n            {\n                if (name != null)\n                {\n                    WeakReference weak = null;\n                    funcMap.TryGetValue(name, out weak);\n                    \n                    if (weak != null && weak.IsAlive)\n                    {\n                        LuaBaseRef lbr = (LuaBaseRef)weak.Target;\n\n                        if (reference == lbr.GetReference())\n                        {\n                            funcMap.Remove(name);\n                        }\n                    }\n                }\n\n                ToLuaUnRef(reference);\n                funcRefMap.Remove(reference);\n                delegateMap.Remove(reference);\n\n                if (LogGC)\n                {\n                    string str = name == null ? \"null\" : name;\n                    Debugger.Log(\"collect lua reference name {0}, id {1} in main\", str, reference);\n                }\n            }\n        }\n\n        protected void LuaLoadBuffer(byte[] buffer, string chunkName)\n        {\n            LuaDLL.tolua_pushtraceback(L);\n            int oldTop = LuaGetTop();\n\n            if (LuaLoadBuffer(buffer, buffer.Length, chunkName) == 0)\n            {\n                if (LuaPCall(0, LuaDLL.LUA_MULTRET, oldTop) == 0)\n                {                    \n                    LuaSetTop(oldTop - 1);\n                    return;\n                }\n            }\n\n            string err = LuaToString(-1);\n            LuaSetTop(oldTop - 1);                        \n            throw new LuaException(err, LuaException.GetLastError());\n        }\n\n        protected T LuaLoadBuffer<T>(byte[] buffer, string chunkName)\n        {\n            LuaDLL.tolua_pushtraceback(L);\n            int oldTop = LuaGetTop();\n\n            if (LuaLoadBuffer(buffer, buffer.Length, chunkName) == 0)\n            {\n                if (LuaPCall(0, LuaDLL.LUA_MULTRET, oldTop) == 0)\n                {\n                    T result = CheckValue<T>(oldTop + 1);\n                    LuaSetTop(oldTop - 1);\n                    return result;\n                }\n            }\n\n            string err = LuaToString(-1);\n            LuaSetTop(oldTop - 1);\n            throw new LuaException(err, LuaException.GetLastError());\n        }\n\n        public bool BeginCall(string name, int top, bool beLogMiss)\n        {            \n            LuaDLL.tolua_pushtraceback(L);\n\n            if (PushLuaFunction(name, false))\n            {\n                return true;\n            }\n            else\n            {\n                LuaDLL.lua_settop(L, top);\n                if (beLogMiss)\n                {\n                    Debugger.Log(\"Lua function {0} not exists\", name);\n                }\n                \n                return false;\n            }\n        }\n\n        public void Call(int nArgs, int errfunc, int top)\n        {\n            if (LuaDLL.lua_pcall(L, nArgs, LuaDLL.LUA_MULTRET, errfunc) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);                \n                throw new LuaException(error, LuaException.GetLastError());\n            }\n        }\n\n        public void Call(string name, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {                \n                if (BeginCall(name, top, beLogMiss))\n                {\n                    Call(0, top + 1, top);\n                    LuaDLL.lua_settop(L, top);\n                }\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public void Call<T>(string name, T arg1, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    Call(1, top + 1, top);                    \n                    LuaDLL.lua_settop(L, top);\n                }\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2>(string name, T1 arg1, T2 arg2, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    Call(2, top + 1, top);\n                    LuaDLL.lua_settop(L, top);\n                }\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2, T3>(string name, T1 arg1, T2 arg2, T3 arg3, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    PushGeneric(arg3);\n                    Call(3, top + 1, top);\n                    LuaDLL.lua_settop(L, top);\n                }\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2, T3, T4>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    PushGeneric(arg3);\n                    PushGeneric(arg4);\n                    Call(4, top + 1, top);\n                    LuaDLL.lua_settop(L, top);\n                }\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2, T3, T4, T5>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    PushGeneric(arg3);\n                    PushGeneric(arg4);\n                    PushGeneric(arg5);\n                    Call(5, top + 1, top);\n                    LuaDLL.lua_settop(L, top);\n                }\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2, T3, T4, T5, T6>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    PushGeneric(arg3);\n                    PushGeneric(arg4);\n                    PushGeneric(arg5);\n                    PushGeneric(arg6);\n                    Call(6, top + 1, top);\n                    LuaDLL.lua_settop(L, top);\n                }\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<R1>(string name, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    Call(0, top + 1, top);\n                    R1 ret1 = CheckValue<R1>(top + 2);\n                    LuaDLL.lua_settop(L, top);\n                    return ret1;\n                }\n\n                return default(R1);\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, R1>(string name, T1 arg1, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    Call(1, top + 1, top);\n                    R1 ret1 = CheckValue<R1>(top + 2);\n                    LuaDLL.lua_settop(L, top);\n                    return ret1;\n                }\n\n                return default(R1);\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, R1>(string name, T1 arg1, T2 arg2, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    Call(2, top + 1, top);\n                    R1 ret1 = CheckValue<R1>(top + 2);\n                    LuaDLL.lua_settop(L, top);\n                    return ret1;\n                }\n\n                return default(R1);\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, T3, R1>(string name, T1 arg1, T2 arg2, T3 arg3, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    PushGeneric(arg3);\n                    Call(3, top + 1, top);\n                    R1 ret1 = CheckValue<R1>(top + 2);\n                    LuaDLL.lua_settop(L, top);\n                    return ret1;\n                }\n\n                return default(R1);\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, R1>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    PushGeneric(arg3);\n                    PushGeneric(arg4);\n                    Call(4, top + 1, top);\n                    R1 ret1 = CheckValue<R1>(top + 2);\n                    LuaDLL.lua_settop(L, top);\n                    return ret1;\n                }\n\n                return default(R1);\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, R1>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    PushGeneric(arg3);\n                    PushGeneric(arg4);\n                    PushGeneric(arg5);\n                    Call(5, top + 1, top);\n                    R1 ret1 = CheckValue<R1>(top + 2);\n                    LuaDLL.lua_settop(L, top);\n                    return ret1;\n                }\n\n                return default(R1);\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, T6, R1>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, bool beLogMiss)\n        {\n            int top = LuaDLL.lua_gettop(L);\n\n            try\n            {\n                if (BeginCall(name, top, beLogMiss))\n                {\n                    PushGeneric(arg1);\n                    PushGeneric(arg2);\n                    PushGeneric(arg3);\n                    PushGeneric(arg4);\n                    PushGeneric(arg5);\n                    PushGeneric(arg6);\n                    Call(6, top + 1, top);\n                    R1 ret1 = CheckValue<R1>(top + 2);\n                    LuaDLL.lua_settop(L, top);\n                    return ret1;\n                }\n\n                return default(R1);\n            }\n            catch (Exception e)\n            {\n                LuaDLL.lua_settop(L, top);\n                throw e;\n            }\n        }\n\n        void InitTypeTraits()\n        {\n            LuaMatchType _ck = new LuaMatchType();\n            TypeTraits<sbyte>.Init(_ck.CheckNumber);\n            TypeTraits<byte>.Init(_ck.CheckNumber);\n            TypeTraits<short>.Init(_ck.CheckNumber);\n            TypeTraits<ushort>.Init(_ck.CheckNumber);\n            TypeTraits<char>.Init(_ck.CheckNumber);\n            TypeTraits<int>.Init(_ck.CheckNumber);\n            TypeTraits<uint>.Init(_ck.CheckNumber);\n            TypeTraits<decimal>.Init(_ck.CheckNumber);\n            TypeTraits<float>.Init(_ck.CheckNumber);\n            TypeTraits<double>.Init(_ck.CheckNumber);\n            TypeTraits<bool>.Init(_ck.CheckBool);\n            TypeTraits<long>.Init(_ck.CheckLong);\n            TypeTraits<ulong>.Init(_ck.CheckULong);\n            TypeTraits<string>.Init(_ck.CheckString);\n\n            TypeTraits<Nullable<sbyte>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<byte>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<short>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<ushort>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<char>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<int>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<uint>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<decimal>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<float>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<double>>.Init(_ck.CheckNullNumber);\n            TypeTraits<Nullable<bool>>.Init(_ck.CheckNullBool);\n            TypeTraits<Nullable<long>>.Init(_ck.CheckNullLong);\n            TypeTraits<Nullable<ulong>>.Init(_ck.CheckNullULong);\n\n            TypeTraits<byte[]>.Init(_ck.CheckByteArray);            \n            TypeTraits<char[]>.Init(_ck.CheckCharArray);            \n            TypeTraits<bool[]>.Init(_ck.CheckBoolArray);            \n            TypeTraits<sbyte[]>.Init(_ck.CheckSByteArray);\n            TypeTraits<short[]>.Init(_ck.CheckInt16Array);\n            TypeTraits<ushort[]>.Init(_ck.CheckUInt16Array);\n            TypeTraits<decimal[]>.Init(_ck.CheckDecimalArray);\n            TypeTraits<float[]>.Init(_ck.CheckSingleArray);\n            TypeTraits<double[]>.Init(_ck.CheckDoubleArray);\n            TypeTraits<int[]>.Init(_ck.CheckInt32Array);\n            TypeTraits<uint[]>.Init(_ck.CheckUInt32Array);\n            TypeTraits<long[]>.Init(_ck.CheckInt64Array);\n            TypeTraits<ulong[]>.Init(_ck.CheckUInt64Array);\n            TypeTraits<string[]>.Init(_ck.CheckStringArray);\n\n            TypeTraits<Vector3>.Init(_ck.CheckVec3);\n            TypeTraits<Quaternion>.Init(_ck.CheckQuat);\n            TypeTraits<Vector2>.Init(_ck.CheckVec2);\n            TypeTraits<Color>.Init(_ck.CheckColor);\n            TypeTraits<Color32>.Init(_ck.CheckColor32);\n            TypeTraits<Vector4>.Init(_ck.CheckVec4);\n            TypeTraits<Ray>.Init(_ck.CheckRay);\n            TypeTraits<Bounds>.Init(_ck.CheckBounds);\n            TypeTraits<Touch>.Init(_ck.CheckTouch);\n            TypeTraits<LayerMask>.Init(_ck.CheckLayerMask);\n            TypeTraits<RaycastHit>.Init(_ck.CheckRaycastHit);\n\n            TypeTraits<Nullable<Vector3>>.Init(_ck.CheckNullVec3);\n            TypeTraits<Nullable<Quaternion>>.Init(_ck.CheckNullQuat);\n            TypeTraits<Nullable<Vector2>>.Init(_ck.CheckNullVec2);\n            TypeTraits<Nullable<Color>>.Init(_ck.CheckNullColor);\n            TypeTraits<Nullable<Color32>>.Init(_ck.CheckNullColor32);\n            TypeTraits<Nullable<Vector4>>.Init(_ck.CheckNullVec4);\n            TypeTraits<Nullable<Ray>>.Init(_ck.CheckNullRay);\n            TypeTraits<Nullable<Bounds>>.Init(_ck.CheckNullBounds);\n            TypeTraits<Nullable<Touch>>.Init(_ck.CheckNullTouch);\n            TypeTraits<Nullable<LayerMask>>.Init(_ck.CheckNullLayerMask);\n            TypeTraits<Nullable<RaycastHit>>.Init(_ck.CheckNullRaycastHit);\n\n            TypeTraits<Vector3[]>.Init(_ck.CheckVec3Array);\n            TypeTraits<Quaternion[]>.Init(_ck.CheckQuatArray);\n            TypeTraits<Vector2[]>.Init(_ck.CheckVec2Array);\n            TypeTraits<Color[]>.Init(_ck.CheckColorArray);\n            TypeTraits<Color32[]>.Init(_ck.CheckColor32Array);\n            TypeTraits<Vector4[]>.Init(_ck.CheckVec4Array);\n\n            TypeTraits<IntPtr>.Init(_ck.CheckPtr);\n            TypeTraits<UIntPtr>.Init(_ck.CheckPtr);\n            TypeTraits<LuaFunction>.Init(_ck.CheckLuaFunc);\n            TypeTraits<LuaTable>.Init(_ck.CheckLuaTable);\n            TypeTraits<LuaThread>.Init(_ck.CheckLuaThread);\n            TypeTraits<LuaBaseRef>.Init(_ck.CheckLuaBaseRef);\n\n            TypeTraits<LuaByteBuffer>.Init(_ck.CheckByteBuffer);\n            TypeTraits<EventObject>.Init(_ck.CheckEventObject);\n            TypeTraits<IEnumerator>.Init(_ck.CheckEnumerator);\n            TypeTraits<Type>.Init(_ck.CheckMonoType);\n            TypeTraits<GameObject>.Init(_ck.CheckGameObject);\n            TypeTraits<Transform>.Init(_ck.CheckTransform);\n            TypeTraits<Type[]>.Init(_ck.CheckTypeArray);\n            TypeTraits<object>.Init(_ck.CheckVariant);\n            TypeTraits<object[]>.Init(_ck.CheckObjectArray);\n        }\n\n        void InitStackTraits()\n        {\n            LuaStackOp op = new LuaStackOp();\n            StackTraits<sbyte>.Init(op.Push, op.CheckSByte, op.ToSByte);\n            StackTraits<byte>.Init(op.Push, op.CheckByte, op.ToByte);\n            StackTraits<short>.Init(op.Push, op.CheckInt16, op.ToInt16);\n            StackTraits<ushort>.Init(op.Push, op.CheckUInt16, op.ToUInt16);\n            StackTraits<char>.Init(op.Push, op.CheckChar, op.ToChar);\n            StackTraits<int>.Init(op.Push, op.CheckInt32, op.ToInt32);\n            StackTraits<uint>.Init(op.Push, op.CheckUInt32, op.ToUInt32);\n            StackTraits<decimal>.Init(op.Push, op.CheckDecimal, op.ToDecimal);\n            StackTraits<float>.Init(op.Push, op.CheckFloat, op.ToFloat);\n            StackTraits<double>.Init(LuaDLL.lua_pushnumber, LuaDLL.luaL_checknumber, LuaDLL.lua_tonumber);\n            StackTraits<bool>.Init(LuaDLL.lua_pushboolean, LuaDLL.luaL_checkboolean, LuaDLL.lua_toboolean);\n            StackTraits<long>.Init(LuaDLL.tolua_pushint64, LuaDLL.tolua_checkint64, LuaDLL.tolua_toint64);\n            StackTraits<ulong>.Init(LuaDLL.tolua_pushuint64, LuaDLL.tolua_checkuint64, LuaDLL.tolua_touint64);\n            StackTraits<string>.Init(LuaDLL.lua_pushstring, ToLua.CheckString, ToLua.ToString);\n\n            StackTraits<Nullable<sbyte>>.Init(op.Push, op.CheckNullSByte, op.ToNullSByte);\n            StackTraits<Nullable<byte>>.Init(op.Push, op.CheckNullByte, op.ToNullByte);\n            StackTraits<Nullable<short>>.Init(op.Push, op.CheckNullInt16, op.ToNullInt16);\n            StackTraits<Nullable<ushort>>.Init(op.Push, op.CheckNullUInt16, op.ToNullUInt16);\n            StackTraits<Nullable<char>>.Init(op.Push, op.CheckNullChar, op.ToNullChar);\n            StackTraits<Nullable<int>>.Init(op.Push, op.CheckNullInt32, op.ToNullInt32);\n            StackTraits<Nullable<uint>>.Init(op.Push, op.CheckNullUInt32, op.ToNullUInt32);\n            StackTraits<Nullable<decimal>>.Init(op.Push, op.CheckNullDecimal, op.ToNullDecimal);\n            StackTraits<Nullable<float>>.Init(op.Push, op.CheckNullFloat, op.ToNullFloat);\n            StackTraits<Nullable<double>>.Init(op.Push, op.CheckNullNumber, op.ToNullNumber);\n            StackTraits<Nullable<bool>>.Init(op.Push, op.CheckNullBool, op.ToNullBool);\n            StackTraits<Nullable<long>>.Init(op.Push, op.CheckNullInt64, op.ToNullInt64);\n            StackTraits<Nullable<ulong>>.Init(op.Push, op.CheckNullUInt64, op.ToNullUInt64);\n\n            StackTraits<byte[]>.Init(ToLua.Push, ToLua.CheckByteBuffer, ToLua.ToByteBuffer);\n            StackTraits<char[]>.Init(ToLua.Push, ToLua.CheckCharBuffer, ToLua.ToCharBuffer);\n            StackTraits<bool[]>.Init(ToLua.Push, ToLua.CheckBoolArray, ToLua.ToBoolArray);\n            StackTraits<sbyte[]>.Init(ToLua.Push, op.CheckSByteArray, op.ToSByteArray);\n            StackTraits<short[]>.Init(ToLua.Push, op.CheckInt16Array, op.ToInt16Array);\n            StackTraits<ushort[]>.Init(ToLua.Push, op.CheckUInt16Array, op.ToUInt16Array);\n            StackTraits<decimal[]>.Init(ToLua.Push, op.CheckDecimalArray, op.ToDecimalArray);\n            StackTraits<float[]>.Init(ToLua.Push, op.CheckFloatArray, op.ToFloatArray);\n            StackTraits<double[]>.Init(ToLua.Push, op.CheckDoubleArray, op.ToDoubleArray);\n            StackTraits<int[]>.Init(ToLua.Push, op.CheckInt32Array, op.ToInt32Array);\n            StackTraits<uint[]>.Init(ToLua.Push, op.CheckUInt32Array, op.ToUInt32Array);\n            StackTraits<long[]>.Init(ToLua.Push, op.CheckInt64Array, op.ToInt64Array);\n            StackTraits<ulong[]>.Init(ToLua.Push, op.CheckUInt64Array, op.ToUInt64Array);\n            StackTraits<string[]>.Init(ToLua.Push, ToLua.CheckStringArray, ToLua.ToStringArray);\n\n            StackTraits<Vector3>.Init(ToLua.Push, ToLua.CheckVector3, ToLua.ToVector3);\n            StackTraits<Quaternion>.Init(ToLua.Push, ToLua.CheckQuaternion, ToLua.ToQuaternion);\n            StackTraits<Vector2>.Init(ToLua.Push, ToLua.CheckVector2, ToLua.ToVector2);\n            StackTraits<Color>.Init(ToLua.Push, ToLua.CheckColor, ToLua.ToColor);\n            StackTraits<Color32>.Init(ToLua.Push, ToLua.CheckColor32, ToLua.ToColor32);\n            StackTraits<Vector4>.Init(ToLua.Push, ToLua.CheckVector4, ToLua.ToVector4);\n            StackTraits<Ray>.Init(ToLua.Push, ToLua.CheckRay, ToLua.ToRay);\n            StackTraits<Touch>.Init(ToLua.Push, null, null);\n            StackTraits<Bounds>.Init(ToLua.Push, ToLua.CheckBounds, ToLua.ToBounds);\n            StackTraits<LayerMask>.Init(ToLua.PushLayerMask, ToLua.CheckLayerMask, ToLua.ToLayerMask);\n            StackTraits<RaycastHit>.Init(ToLua.Push, null, null);\n\n            StackTraits<Nullable<Vector3>>.Init(op.Push, op.CheckNullVec3, op.ToNullVec3);\n            StackTraits<Nullable<Quaternion>>.Init(op.Push, op.CheckNullQuat, op.ToNullQuat);\n            StackTraits<Nullable<Vector2>>.Init(op.Push, op.CheckNullVec2, op.ToNullVec2);\n            StackTraits<Nullable<Color>>.Init(op.Push, op.CheckNullColor, op.ToNullColor);\n            StackTraits<Nullable<Color32>>.Init(op.Push, op.CheckNullColor32, op.ToNullColor32);\n            StackTraits<Nullable<Vector4>>.Init(op.Push, op.CheckNullVec4, op.ToNullVec4);\n            StackTraits<Nullable<Ray>>.Init(op.Push, op.CheckNullRay, op.ToNullRay);\n            StackTraits<Nullable<Touch>>.Init(op.Push, null, null);\n            StackTraits<Nullable<Bounds>>.Init(op.Push, op.CheckNullBounds, op.ToNullBounds);\n            StackTraits<Nullable<LayerMask>>.Init(op.Push, op.CheckNullLayerMask, op.ToNullLayerMask);\n            StackTraits<Nullable<RaycastHit>>.Init(op.Push, null, null);\n\n            StackTraits<Vector3[]>.Init(ToLua.Push, op.CheckVec3Array, op.ToVec3Array);\n            StackTraits<Quaternion[]>.Init(ToLua.Push, op.CheckQuatArray, op.ToQuatArray);\n            StackTraits<Vector2[]>.Init(ToLua.Push, op.CheckVec2Array, op.ToVec2Array);\n            StackTraits<Color[]>.Init(ToLua.Push, op.CheckColorArray, op.ToColorArray);\n            StackTraits<Color32[]>.Init(ToLua.Push, op.CheckColor32Array, op.ToColor32Array);\n            StackTraits<Vector4[]>.Init(ToLua.Push, op.CheckVec4Array, op.ToVec4Array);\n\n            StackTraits<UIntPtr>.Init(op.Push, op.CheckUIntPtr, op.CheckUIntPtr); //\"NYI\"\n            StackTraits<IntPtr>.Init(LuaDLL.lua_pushlightuserdata, ToLua.CheckIntPtr, ToLua.CheckIntPtr);\n            StackTraits<LuaFunction>.Init(ToLua.Push, ToLua.CheckLuaFunction, ToLua.ToLuaFunction);\n            StackTraits<LuaTable>.Init(ToLua.Push, ToLua.CheckLuaTable, ToLua.ToLuaTable);\n            StackTraits<LuaThread>.Init(ToLua.Push, ToLua.CheckLuaThread, ToLua.ToLuaThread);\n            StackTraits<LuaBaseRef>.Init(ToLua.Push, ToLua.CheckLuaBaseRef, ToLua.CheckLuaBaseRef);\n\n            StackTraits<LuaByteBuffer>.Init(ToLua.Push, op.CheckLuaByteBuffer, op.ToLuaByteBuffer);\n            StackTraits<EventObject>.Init(ToLua.Push, op.CheckEventObject, op.ToEventObject);\n            StackTraits<IEnumerator>.Init(ToLua.Push, ToLua.CheckIter, op.ToIter);\n            StackTraits<Type>.Init(ToLua.Push, ToLua.CheckMonoType, op.ToType);\n            StackTraits<Type[]>.Init(ToLua.Push, op.CheckTypeArray, op.ToTypeArray);\n            StackTraits<GameObject>.Init(op.Push, op.CheckGameObject, op.ToGameObject);\n            StackTraits<Transform>.Init(op.Push, op.CheckTransform, op.ToTransform);\n            StackTraits<object>.Init(ToLua.Push, ToLua.ToVarObject, ToLua.ToVarObject);\n            StackTraits<object[]>.Init(ToLua.Push, ToLua.CheckObjectArray, ToLua.ToObjectArray);\n\n            StackTraits<nil>.Init(ToLua.Push, null, null);\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaState.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 358b86bdf79858e46b17d8700238c397\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaStatePtr.cs",
    "content": "﻿using UnityEngine;\nusing System;\nusing System.IO;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace LuaInterface\n{\n    public class LuaStatePtr\n    {\n        protected IntPtr L;\n\n        string jit = @\"            \n        function Euler(x, y, z)\n            x = x * 0.0087266462599716\n            y = y * 0.0087266462599716\n            z = z * 0.0087266462599716\n\n            local sinX = math.sin(x)\n            local cosX = math.cos(x)\n            local sinY = math.sin(y)\n            local cosY = math.cos(y)\n            local sinZ = math.sin(z)\n            local cosZ = math.cos(z)\n\n            local w = cosY * cosX * cosZ + sinY * sinX * sinZ\n            x = cosY* sinX * cosZ + sinY* cosX * sinZ\n            y = sinY * cosX * cosZ - cosY * sinX * sinZ\n            z = cosY* cosX * sinZ - sinY* sinX * cosZ\n\n            return {x = x, y = y, z= z, w = w}\n        end\n\n        function Slerp(q1, q2, t)\n            local x1, y1, z1, w1 = q1.x, q1.y, q1.z, q1.w\n            local x2,y2,z2,w2 = q2.x, q2.y, q2.z, q2.w\n            local dot = x1* x2 + y1* y2 + z1* z2 + w1* w2\n\n            if dot< 0 then\n                dot = -dot\n                x2, y2, z2, w2 = -x2, -y2, -z2, -w2\n            end\n\n            if dot< 0.95 then\n                local sin = math.sin\n                local angle = math.acos(dot)\n                local invSinAngle = 1 / sin(angle)\n                local t1 = sin((1 - t) * angle) * invSinAngle\n                local t2 = sin(t * angle) * invSinAngle\n                return {x = x1* t1 + x2* t2, y = y1 * t1 + y2 * t2, z = z1 * t1 + z2 * t2, w = w1 * t1 + w2 * t2}\n            else\n                x1 = x1 + t* (x2 - x1)\n                y1 = y1 + t* (y2 - y1)                \n                z1 = z1 + t* (z2 - z1)                \n                w1 = w1 + t* (w2 - w1)\n                dot = x1* x1 + y1* y1 + z1* z1 + w1* w1\n\n                return {x = x1 / dot, y = y1 / dot, z = z1 / dot, w = w1 / dot}\n            end\n        end\n\n        if jit then\n    \t    if jit.status() then                \n                for i=1,10000 do\n                    local q1 = Euler(i, i, i)\n                    Slerp({ x = 0, y = 0, z = 0, w = 1}, q1, 0.5)\n                end                \n            end\t                   \n        end\";\n\n        public int LuaUpValueIndex(int i)\n        {\n            return LuaIndexes.LUA_GLOBALSINDEX - i;\n        }\n\n        public IntPtr LuaNewState()\n        {\n            return LuaDLL.luaL_newstate();            \n        }\n\n        public void LuaOpenJit()\n        {\n#if UNITY_ANDROID\n            //某些机型如三星arm64在jit on模式下会崩溃，临时关闭这里\n            if (IntPtr.Size == 8)\n            {\n                LuaDLL.luaL_dostring(L, \"jit.off()\");                                                \n            }\n            else if (!LuaDLL.luaL_dostring(L, jit))\n            {\n                string str = LuaDLL.lua_tostring(L, -1);\n                LuaDLL.lua_settop(L, 0);\n                throw new Exception(str);\n            }\n#endif\n        }\n\n        public void LuaClose()\n        {\n            LuaDLL.lua_close(L);\n            L = IntPtr.Zero;\n        }\n\n        public IntPtr LuaNewThread()\n        {\n            return LuaDLL.lua_newthread(L);\n        }        \n\n        public IntPtr LuaAtPanic(IntPtr panic)\n        {\n            return LuaDLL.lua_atpanic(L, panic);\n        }\n\n        public int LuaGetTop()\n        {\n            return LuaDLL.lua_gettop(L);\n        }\n\n        public void LuaSetTop(int newTop)\n        {\n            LuaDLL.lua_settop(L, newTop);\n        }\n\n        public void LuaPushValue(int idx)\n        {\n            LuaDLL.lua_pushvalue(L, idx);\n        }\n\n        public void LuaRemove(int index)\n        {\n            LuaDLL.lua_remove(L, index);\n        }\n\n        public void LuaInsert(int idx)\n        {\n            LuaDLL.lua_insert(L, idx);\n        }\n\n        public void LuaReplace(int idx)\n        {\n            LuaDLL.lua_replace(L, idx);\n        }\n\n        public bool LuaCheckStack(int args)\n        {\n            return LuaDLL.lua_checkstack(L, args) != 0;\n        }\n\n        public void LuaXMove(IntPtr to, int n)\n        {\n            LuaDLL.lua_xmove(L, to, n);\n        }\n\n        public bool LuaIsNumber(int idx)\n        {\n            return LuaDLL.lua_isnumber(L, idx) != 0;\n        }\n\n        public bool LuaIsString(int index)\n        {\n            return LuaDLL.lua_isstring(L, index) != 0;\n        }\n\n        public bool LuaIsCFunction(int index)\n        {\n            return LuaDLL.lua_iscfunction(L, index) != 0;\n        }\n\n        public bool LuaIsUserData(int index)\n        {\n            return LuaDLL.lua_isuserdata(L, index) != 0;\n        }\n\n        public bool LuaIsNil(int n)\n        {\n            return LuaDLL.lua_isnil(L, n);\n        }\n\n        public LuaTypes LuaType(int index)\n        {\n            return LuaDLL.lua_type(L, index);\n        }\n\n        public string LuaTypeName(LuaTypes type)\n        {\n            return LuaDLL.lua_typename(L, type);\n        }\n\n        public string LuaTypeName(int idx)\n        {\n            return LuaDLL.luaL_typename(L, idx);\n        }\n\n        public bool LuaEqual(int idx1, int idx2)\n        {\n            return LuaDLL.lua_equal(L, idx1, idx2) != 0;\n        }\n\n        public bool LuaRawEqual(int idx1, int idx2)\n        {\n            return LuaDLL.lua_rawequal(L, idx1, idx2) != 0;\n        }\n\n        public bool LuaLessThan(int idx1, int idx2)\n        {\n            return LuaDLL.lua_lessthan(L, idx1, idx2) != 0;\n        }\n\n        public double LuaToNumber(int idx)\n        {\n            return LuaDLL.lua_tonumber(L, idx);\n        }\n\n        public int LuaToInteger(int idx)\n        {\n            return LuaDLL.lua_tointeger(L, idx);\n        }\n\n        public bool LuaToBoolean(int idx)\n        {\n            return LuaDLL.lua_toboolean(L, idx);\n        }\n\n        public string LuaToString(int index)\n        {\n            string s =  LuaDLL.lua_tostring(L, index);\n            if (s == null) {\n                // 可能抛出一个table作为error参数,调用tostring获取其字符串\n                LuaDLL.lua_getglobal(L, \"tostring\");\n                LuaDLL.lua_pushvalue(L, index - 1);\n                LuaDLL.lua_pcall(L, 1, 1, 0);\n                s = LuaDLL.lua_tostring(L, -1);\n            }\n            return s;\n        }\n\n        public IntPtr LuaToLString(int index, out int len)\n        {\n            return LuaDLL.tolua_tolstring(L, index, out len);\n        }\n\n        public IntPtr LuaToCFunction(int idx)\n        {\n            return LuaDLL.lua_tocfunction(L, idx);\n        }\n\n        public IntPtr LuaToUserData(int idx)\n        {\n            return LuaDLL.lua_touserdata(L, idx);\n        }\n\n        public IntPtr LuaToThread(int idx)\n        {\n            return LuaDLL.lua_tothread(L, idx);\n        }\n\n        public IntPtr LuaToPointer(int idx)\n        {\n            return LuaDLL.lua_topointer(L, idx);\n        }\n\n        public int LuaObjLen(int index)\n        {\n            return LuaDLL.tolua_objlen(L, index);\n        }\n\n        public void LuaPushNil()\n        {\n            LuaDLL.lua_pushnil(L);\n        }\n\n        public void LuaPushNumber(double number)\n        {\n            LuaDLL.lua_pushnumber(L, number);\n        }\n\n        public void LuaPushInteger(int n)\n        {\n            LuaDLL.lua_pushnumber(L, n);\n        }\n\n        public void LuaPushLString(byte[] str, int size)\n        {\n            LuaDLL.lua_pushlstring(L, str, size);\n        }\n\n        public void LuaPushString(string str)\n        {\n            LuaDLL.lua_pushstring(L, str);\n        }\n\n        public void LuaPushCClosure(IntPtr fn, int n)\n        {\n            LuaDLL.lua_pushcclosure(L, fn, n);\n        }\n\n        public void LuaPushBoolean(bool value)\n        {\n            LuaDLL.lua_pushboolean(L, value ? 1 : 0);\n        }\n\n        public void LuaPushLightUserData(IntPtr udata)\n        {\n            LuaDLL.lua_pushlightuserdata(L, udata);\n        }\n\n        public int LuaPushThread()\n        {\n            return LuaDLL.lua_pushthread(L);\n        }\n\n        public void LuaGetTable(int idx)\n        {\n            LuaDLL.lua_gettable(L, idx);\n        }\n\n        public void LuaGetField(int index, string key)\n        {\n            LuaDLL.lua_getfield(L, index, key);\n        }\n\n        public void LuaRawGet(int idx)\n        {\n            LuaDLL.lua_rawget(L, idx);\n        }\n\n        public void LuaRawGetI(int tableIndex, int index)\n        {\n            LuaDLL.lua_rawgeti(L, tableIndex, index);\n        }\n\n        public void LuaCreateTable(int narr = 0, int nec = 0)\n        {\n            LuaDLL.lua_createtable(L, narr, nec);\n        }\n\n        public IntPtr LuaNewUserData(int size)\n        {\n            return LuaDLL.tolua_newuserdata(L, size);\n        }\n\n        public int LuaGetMetaTable(int idx)\n        {\n            return LuaDLL.lua_getmetatable(L, idx);\n        }\n\n        public void LuaGetEnv(int idx)\n        {\n            LuaDLL.lua_getfenv(L, idx);\n        }\n\n        public void LuaSetTable(int idx)\n        {\n            LuaDLL.lua_settable(L, idx);\n        }\n\n        public void LuaSetField(int idx, string key)\n        {\n            LuaDLL.lua_setfield(L, idx, key);\n        }\n\n        public void LuaRawSet(int idx)\n        {\n            LuaDLL.lua_rawset(L, idx);\n        }\n\n        public void LuaRawSetI(int tableIndex, int index)\n        {\n            LuaDLL.lua_rawseti(L, tableIndex, index);\n        }\n\n        public void LuaSetMetaTable(int objIndex)\n        {\n            LuaDLL.lua_setmetatable(L, objIndex);\n        }\n\n        public void LuaSetEnv(int idx)\n        {\n            LuaDLL.lua_setfenv(L, idx);\n        }\n\n        public void LuaCall(int nArgs, int nResults)\n        {\n            LuaDLL.lua_call(L, nArgs, nResults);\n        }\n\n        public int LuaPCall(int nArgs, int nResults, int errfunc)\n        {\n            return LuaDLL.lua_pcall(L, nArgs, nResults, errfunc);\n        }\n\n        public int LuaYield(int nresults)\n        {\n            return LuaDLL.lua_yield(L, nresults);\n        }\n\n        public int LuaResume(int narg)\n        {\n            return LuaDLL.lua_resume(L, narg);\n        }\n\n        public int LuaStatus()\n        {\n            return LuaDLL.lua_status(L);\n        }\n\n        public int LuaGC(LuaGCOptions what, int data = 0)\n        {\n            return LuaDLL.lua_gc(L, what, data);\n        }\n\n        public bool LuaNext(int index)\n        {\n            return LuaDLL.lua_next(L, index) != 0;\n        }\n\n        public void LuaConcat(int n)\n        {\n            LuaDLL.lua_concat(L, n);\n        }\n\n        public void LuaPop(int amount)\n        {\n            LuaDLL.lua_pop(L, amount);\n        }\n\n        public void LuaNewTable()\n        {\n            LuaDLL.lua_createtable(L, 0 , 0);\n        }\n\n        public void LuaPushFunction(LuaCSFunction func)\n        {\n            IntPtr fn = Marshal.GetFunctionPointerForDelegate(func);\n            LuaDLL.lua_pushcclosure(L, fn, 0);\n        }\n\n        public bool lua_isfunction(int n)\n        {\n            return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TFUNCTION;\n        }\n\n        public bool lua_istable(int n)\n        {\n            return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TTABLE;\n        }\n\n        public bool lua_islightuserdata(int n)\n        {\n            return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TLIGHTUSERDATA;\n        }\n\n        public bool lua_isnil(int n)\n        {\n            return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TNIL;\n        }\n\n        public bool lua_isboolean(int n)\n        {\n            LuaTypes type = LuaDLL.lua_type(L, n);\n            return type == LuaTypes.LUA_TBOOLEAN || type == LuaTypes.LUA_TNIL;\n        }\n\n        public bool lua_isthread(int n)\n        {\n            return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TTHREAD;\n        }\n\n        public bool lua_isnone(int n)\n        {\n            return LuaDLL.lua_type(L, n) == LuaTypes.LUA_TNONE;\n        }\n\n        public bool lua_isnoneornil(int n)\n        {\n            return LuaDLL.lua_type(L, n) <= LuaTypes.LUA_TNIL;\n        }\n\n        public void LuaRawGlobal(string name)\n        {\n            LuaDLL.lua_pushstring(L, name);\n            LuaDLL.lua_rawget(L, LuaIndexes.LUA_GLOBALSINDEX);\n        }\n\n        public void LuaSetGlobal(string name)\n        {\n            LuaDLL.lua_setglobal(L, name);\n        }\n\n        public void LuaGetGlobal(string name)\n        {\n            LuaDLL.lua_getglobal(L, name);\n        }\n\n        public void LuaOpenLibs()\n        {\n            LuaDLL.luaL_openlibs(L);\n        }\n\n        public int AbsIndex(int i)\n        {\n            return (i > 0 || i <= LuaIndexes.LUA_REGISTRYINDEX) ? i : LuaDLL.lua_gettop(L) + i + 1;\n        }\n\n        public int LuaGetN(int i)\n        {\n            return LuaDLL.luaL_getn(L, i);\n        }\n\n        public double LuaCheckNumber(int stackPos)\n        {\n            return LuaDLL.luaL_checknumber(L, stackPos);\n        }\n\n        public int LuaCheckInteger(int idx)\n        {\n            return LuaDLL.luaL_checkinteger(L, idx);\n        }\n\n        public bool LuaCheckBoolean(int stackPos)\n        {\n            return LuaDLL.luaL_checkboolean(L, stackPos);\n        }\n\n        public string LuaCheckLString(int numArg, out int len)\n        {\n            return LuaDLL.luaL_checklstring(L, numArg, out len);\n        }\n\n        public int LuaLoadBuffer(byte[] buff, int size, string name)\n        {\n            return LuaDLL.luaL_loadbuffer(L, buff, size, name);\n        }\n\n        public IntPtr LuaFindTable(int idx, string fname, int szhint = 1)\n        {\n            return LuaDLL.luaL_findtable(L, idx, fname, szhint);\n        }\n\n        public int LuaTypeError(int stackPos, string tname, string t2 = null)\n        {\n            return LuaDLL.luaL_typerror(L, stackPos, tname, t2);\n        }\n\n        public bool LuaDoString(string chunk, string chunkName = \"@LuaStatePtr.cs\")\n        {\n            byte[] buffer = Encoding.UTF8.GetBytes(chunk);\n            int status = LuaDLL.luaL_loadbuffer(L, buffer, buffer.Length, chunkName);\n\n            if (status != 0)\n            {\n                return false;                \n            }\n\n            return LuaDLL.lua_pcall(L, 0, LuaDLL.LUA_MULTRET, 0) == 0;\n            //return LuaDLL.luaL_dostring(L, chunk);\n        }\n\n        public bool LuaDoFile(string fileName)\n        {\n            int top = LuaGetTop();\n\n            if (LuaDLL.luaL_dofile(L, fileName))\n            {\n                return true;\n            }\n\n            string err = LuaToString(-1);\n            LuaSetTop(top);\n            throw new LuaException(err, LuaException.GetLastError());\n        }\n\n        public void LuaGetMetaTable(string meta)\n        {\n            LuaDLL.luaL_getmetatable(L, meta);\n        }\n\n        public int LuaRef(int t)\n        {\n            return LuaDLL.luaL_ref(L, t);\n        }\n\n        public void LuaGetRef(int reference)\n        {\n            LuaDLL.lua_getref(L, reference);\n        }\n\n        public void LuaUnRef(int reference)\n        {\n            LuaDLL.lua_unref(L, reference);\n        }\n\n        public int LuaRequire(string fileName)\n        {\n#if UNITY_EDITOR\n            string str = Path.GetExtension(fileName);\n\n            if (str == \".lua\")\n            {\n                throw new LuaException(\"Require not need file extension: \" + str);\n            }\n#endif\n            return LuaDLL.tolua_require(L, fileName);\n        }\n\n        //适合Awake OnSendMsg使用\n        public void ThrowLuaException(Exception e)\n        {\n            if (LuaException.InstantiateCount > 0 || LuaException.SendMsgCount > 0)\n            {\n                LuaDLL.toluaL_exception(LuaException.L, e);\n            }\n            else\n            {\n                throw e;\n            }\n        }\n\n        public int ToLuaRef()\n        {\n            return LuaDLL.toluaL_ref(L);\n        }\n\n        public int LuaUpdate(float delta, float unscaled)\n        {\n            return LuaDLL.tolua_update(L, delta, unscaled);\n        }\n\n        public int LuaLateUpdate()\n        {\n            return LuaDLL.tolua_lateupdate(L);\n        }\n\n        public int LuaFixedUpdate(float fixedTime)\n        {\n            return LuaDLL.tolua_fixedupdate(L, fixedTime);\n        }\n\n        public void OpenToLuaLibs()\n        {\n            LuaDLL.tolua_openlibs(L);\n            LuaOpenJit();\n        }\n\n        public void ToLuaPushTraceback()\n        {\n            LuaDLL.tolua_pushtraceback(L);\n        }\n\n        public void ToLuaUnRef(int reference)\n        {\n            LuaDLL.toluaL_unref(L, reference);\n        }\n\n        public int LuaGetStack(int level, ref Lua_Debug ar)\n        {\n            return LuaDLL.lua_getstack(L, level, ref ar);\n        }   \n           \n        public int LuaGetInfo(string what, ref Lua_Debug ar)\n        {\n            return LuaDLL.lua_getinfo(L, what, ref ar);\n        }\n        \n        public string LuaGetLocal(ref Lua_Debug ar, int n)\n        {\n            return LuaDLL.lua_getlocal(L, ref ar, n);\n        }\n        \n        public string LuaSetLocal(ref Lua_Debug ar, int n)\n        {\n            return LuaDLL.lua_setlocal(L, ref ar, n);\n        }\n        \n        public string LuaGetUpvalue(int funcindex, int n)\n        {\n            return LuaDLL.lua_getupvalue(L, funcindex, n);\n        }\n        \n        public string LuaSetUpvalue(int funcindex, int n)\n        {\n            return LuaDLL.lua_setupvalue(L, funcindex, n);\n        }\n        \n        public int LuaSetHook(LuaHookFunc func, int mask, int count)\n        {\n            return LuaDLL.lua_sethook(L, func, mask, count);\n        }\n        \n        public LuaHookFunc LuaGetHook()\n        {\n            return LuaDLL.lua_gethook(L);\n        }\n        \n        public  int LuaGetHookMask()\n        {\n            return LuaDLL.lua_gethookmask(L);\n        }\n        \n        public int LuaGetHookCount()\n        {\n            return LuaDLL.lua_gethookcount(L);\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaStatePtr.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e68c435592e3d3b47a315497b6150aae\ntimeCreated: 1515060461\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaStatic.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace LuaInterface\n{\n    public static class LuaStatic\n    {\n        public static int GetMetaReference(IntPtr L, Type t)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.GetMetaReference(t);\n        }\n\n        public static int GetMissMetaReference(IntPtr L, Type t)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.GetMissMetaReference(t);\n        }\n\n        public static Type GetClassType(IntPtr L, int reference)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.GetClassType(reference);\n        }\n\n        public static LuaFunction GetFunction(IntPtr L, int reference)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.GetFunction(reference);\n        }\n\n        public static LuaTable GetTable(IntPtr L, int reference)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.GetTable(reference);\n        }\n\n        public static LuaThread GetLuaThread(IntPtr L, int reference)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.GetLuaThread(reference);\n        }\n\n        public static void GetUnpackRayRef(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            LuaDLL.lua_getref(L, state.UnpackRay);\n        }\n\n        public static void GetUnpackBounds(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            LuaDLL.lua_getref(L, state.UnpackBounds);\n        }\n\n        public static void GetPackRay(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            LuaDLL.lua_getref(L, state.PackRay);\n        }\n\n        public static void GetPackRaycastHit(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            LuaDLL.lua_getref(L, state.PackRaycastHit);\n        }\n\n        public static void GetPackTouch(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            LuaDLL.lua_getref(L, state.PackTouch);\n        }\n\n        public static void GetPackBounds(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            LuaDLL.lua_getref(L, state.PackBounds);\n        }\n        \n        public static int GetArrayMetatable(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.ArrayMetatable;\n        }\n\n        public static int GetTypeMetatable(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.TypeMetatable;\n        }        \n\n        public static int GetDelegateMetatable(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.DelegateMetatable;\n        }\n\n        public static int GetEventMetatable(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.EventMetatable;\n        }\n\n        public static int GetIterMetatable(IntPtr L)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.IterMetatable;\n        }\n\n        public static int GetEnumObject(IntPtr L, System.Enum e, out object obj)\n        {\n            LuaState state = LuaState.Get(L);\n            obj = state.GetEnumObj(e);\n            return state.EnumMetatable;\n        }        \n\n        public static LuaCSFunction GetPreModule(IntPtr L, Type t)\n        {\n            LuaState state = LuaState.Get(L);\n            return state.GetPreModule(t);\n        }\n    }\n}"
  },
  {
    "path": "Assets/ToLua/Core/LuaStatic.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e7f8fdc4e97256748b422edf401c641d\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaTable.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace LuaInterface\n{\n    public class LuaTable : LuaBaseRef\n    {        \n        public LuaTable(int reference, LuaState state)\n        {\n            this.reference = reference;\n            this.luaState = state;            \n        }\n\n        public object this[string key]\n        {\n            get\n            {\n                int top = luaState.LuaGetTop();\n\n                try\n                {\n                    luaState.Push(this);\n                    luaState.Push(key);\n                    luaState.LuaGetTable(top + 1);\n                    object ret = luaState.ToVariant(top + 2);\n                    luaState.LuaSetTop(top);\n                    return ret;\n                }\n                catch (Exception e)\n                {\n                    luaState.LuaSetTop(top);\n                    throw e;                    \n                }                \n            }\n\n            set\n            {\n                int top = luaState.LuaGetTop();\n\n                try\n                {\n                    luaState.Push(this);\n                    luaState.Push(key);\n                    luaState.PushVariant(value);\n                    luaState.LuaSetTable(top + 1);\n                    luaState.LuaSetTop(top);\n                }\n                catch (Exception e)\n                {\n                    luaState.LuaSetTop(top);\n                    throw e;\n                }\n            }\n        }\n\n        public object this[int key]\n        {\n            get\n            {\n                int oldTop = luaState.LuaGetTop();\n\n                try\n                {\n                    luaState.Push(this);\n                    luaState.LuaRawGetI(oldTop + 1, key);\n                    object obj = luaState.ToVariant(oldTop + 2);\n                    luaState.LuaSetTop(oldTop);\n                    return obj;\n                }\n                catch (Exception e)\n                {\n                    luaState.LuaSetTop(oldTop);\n                    throw e;\n                }\n            }\n\n            set\n            {\n                int oldTop = luaState.LuaGetTop();\n\n                try\n                {\n                    luaState.Push(this);\n                    luaState.PushVariant(value);\n                    luaState.LuaRawSetI(oldTop + 1, key);\n                    luaState.LuaSetTop(oldTop);\n                }\n                catch (Exception e)\n                {\n                    luaState.LuaSetTop(oldTop);\n                    throw e;\n                }\n            }\n        }\n\n        public int Length\n        {\n            get\n            {\n                luaState.Push(this);\n                int n = luaState.LuaObjLen(-1);\n                luaState.LuaPop(1);\n                return n;\n            }\n        }\n\n        public T RawGetIndex<T>(int index)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);                \n                luaState.LuaRawGetI(top + 1, index);\n                T ret = luaState.CheckValue<T>(top + 2);\n                luaState.LuaSetTop(top);\n                return ret;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void RawSetIndex<T>(int index, T value)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                luaState.PushGeneric(value);\n                luaState.LuaRawSetI(top + 1, index);                \n                luaState.LuaSetTop(top);                \n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public V RawGet<K, V>(K key)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                luaState.PushGeneric(key);\n                luaState.LuaRawGet(top + 1);\n                V ret = luaState.CheckValue<V>(top + 2);\n                luaState.LuaSetTop(top);\n                return ret;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void RawSet<K, V>(K key, V arg)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                luaState.PushGeneric(key);\n                luaState.PushGeneric(arg);\n                luaState.LuaRawSet(top + 1);\n                luaState.LuaSetTop(top);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public T GetTable<T>(string key)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                luaState.Push(key);\n                luaState.LuaGetTable(top + 1);\n                T ret = luaState.CheckValue<T>(top + 2);\n                luaState.LuaSetTop(top);\n                return ret;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void SetTable<T>(string key, T arg)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                luaState.Push(key);\n                luaState.PushGeneric(arg);\n                luaState.LuaSetTable(top + 1);\n                luaState.LuaSetTop(top);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public LuaFunction RawGetLuaFunction(string key)\n        {            \n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                luaState.Push(key);\n                luaState.LuaRawGet(top + 1);\n                LuaFunction func = luaState.CheckLuaFunction(top + 2);\n                luaState.LuaSetTop(top);\n#if UNITY_EDITOR\n                if (func != null)\n                {\n                    func.name = name + \".\" + key;\n                }\n#endif\n                return func;\n            }\n            catch(Exception e)            \n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public LuaFunction GetLuaFunction(string key)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                luaState.Push(key);\n                luaState.LuaGetTable(top + 1);\n                LuaFunction func = luaState.CheckLuaFunction(top + 2);\n                luaState.LuaSetTop(top);\n#if UNITY_EDITOR\n                if (func != null)\n                {\n                    func.name = name + \".\" + key;\n                }\n#endif\n                return func;\n            }\n            catch(Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        bool BeginCall(string name, int top)\n        {\n            luaState.Push(this);\n            luaState.ToLuaPushTraceback();\n            luaState.Push(name);\n            luaState.LuaGetTable(top + 1);\n            return luaState.LuaType(top + 3) == LuaTypes.LUA_TFUNCTION;\n        }\n\n        public void Call(string name)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {                \n                if (BeginCall(name, top))\n                {\n                    luaState.Call(0, top + 2, top);                    \n                }\n\n                luaState.LuaSetTop(top);                \n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void Call<T1>(string name, T1 arg1)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.Call(1, top + 2, top);\n                }\n\n                luaState.LuaSetTop(top);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2>(string name, T1 arg1, T2 arg2)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.Call(2, top + 2, top);\n                }\n\n                luaState.LuaSetTop(top);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2, T3>(string name, T1 arg1, T2 arg2, T3 arg3)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.PushGeneric(arg3);\n                    luaState.Call(3, top + 2, top);\n                }\n\n                luaState.LuaSetTop(top);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2, T3, T4>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.PushGeneric(arg3);\n                    luaState.PushGeneric(arg4);\n                    luaState.Call(4, top + 2, top);\n                }\n\n                luaState.LuaSetTop(top);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2, T3, T4, T5>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.PushGeneric(arg3);\n                    luaState.PushGeneric(arg4);\n                    luaState.PushGeneric(arg5);\n                    luaState.Call(5, top + 2, top);\n                }\n\n                luaState.LuaSetTop(top);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public void Call<T1, T2, T3, T4, T5, T6>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.PushGeneric(arg3);\n                    luaState.PushGeneric(arg4);\n                    luaState.PushGeneric(arg5);\n                    luaState.PushGeneric(arg6);\n                    luaState.Call(6, top + 2, top);\n                }\n\n                luaState.LuaSetTop(top);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<R1>(string name)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                R1 ret1 = default(R1);\n\n                if (BeginCall(name, top))\n                {\n                    luaState.Call(0, top + 2, top);\n                    ret1 = luaState.CheckValue<R1>(top + 3);\n                }\n\n                luaState.LuaSetTop(top);\n                return ret1;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, R1>(string name, T1 arg1)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                R1 ret1 = default(R1);\n\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.Call(1, top + 2, top);\n                    ret1 = luaState.CheckValue<R1>(top + 3);\n                }\n\n                luaState.LuaSetTop(top);\n                return ret1;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, R1>(string name, T1 arg1, T2 arg2)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                R1 ret1 = default(R1);\n\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.Call(2, top + 2, top);\n                    ret1 = luaState.CheckValue<R1>(top + 3);\n                }\n\n                luaState.LuaSetTop(top);\n                return ret1;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, T3, R1>(string name, T1 arg1, T2 arg2, T3 arg3)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                R1 ret1 = default(R1);\n\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.PushGeneric(arg3);\n                    luaState.Call(3, top + 2, top);\n                    ret1 = luaState.CheckValue<R1>(top + 3);\n                }\n\n                luaState.LuaSetTop(top);\n                return ret1;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, R1>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                R1 ret1 = default(R1);\n\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.PushGeneric(arg3);\n                    luaState.PushGeneric(arg4);                    \n                    luaState.Call(4, top + 2, top);\n                    ret1 = luaState.CheckValue<R1>(top + 3);\n                }\n\n                luaState.LuaSetTop(top);\n                return ret1;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, R1>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                R1 ret1 = default(R1);\n\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.PushGeneric(arg3);\n                    luaState.PushGeneric(arg4);\n                    luaState.PushGeneric(arg5);\n                    luaState.Call(5, top + 2, top);\n                    ret1 = luaState.CheckValue<R1>(top + 3);\n                }\n\n                luaState.LuaSetTop(top);\n                return ret1;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public R1 Invoke<T1, T2, T3, T4, T5, T6, R1>(string name, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)\n        {\n            int top = luaState.LuaGetTop();\n\n            try\n            {\n                R1 ret1 = default(R1);\n\n                if (BeginCall(name, top))\n                {\n                    luaState.PushGeneric(arg1);\n                    luaState.PushGeneric(arg2);\n                    luaState.PushGeneric(arg3);\n                    luaState.PushGeneric(arg4);\n                    luaState.PushGeneric(arg5);\n                    luaState.PushGeneric(arg6);\n                    luaState.Call(6, top + 2, top);\n                    ret1 = luaState.CheckValue<R1>(top + 3);\n                }\n\n                luaState.LuaSetTop(top);\n                return ret1;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(top);\n                throw e;\n            }\n        }\n\n        public string GetStringField(string name)\n        {\n            int oldTop = luaState.LuaGetTop();\n     \n            try\n            {\n                luaState.Push(this);\n                luaState.LuaGetField(oldTop + 1, name);\n                string str = luaState.CheckString(-1);\n                luaState.LuaSetTop(oldTop);\n                return str;\n            }\n            catch(LuaException e)\n            {\n                luaState.LuaSetTop(oldTop);\n                throw e;\n            }\n        }\n\n        public void AddTable(string name)\n        {\n            int oldTop = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                luaState.Push(name);\n                luaState.LuaCreateTable();                \n                luaState.LuaRawSet(oldTop + 1);\n                luaState.LuaSetTop(oldTop);\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(oldTop);\n                throw e;\n            }\n        }\n\n        public object[] ToArray()\n        {\n            int oldTop = luaState.LuaGetTop();\n\n            try\n            {\n                luaState.Push(this);\n                int len = luaState.LuaObjLen(-1);\n                List<object> list = new List<object>(len + 1);\n                int index = 1;\n                object obj = null;\n\n                while(index <= len)\n                {\n                    luaState.LuaRawGetI(-1, index++);\n                    obj = luaState.ToVariant(-1);\n                    luaState.LuaPop(1);\n                    list.Add(obj);\n                }                \n\n                luaState.LuaSetTop(oldTop);\n                return list.ToArray();\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(oldTop);\n                throw e;\n            }\n        }\n\n        public override string ToString()\n        {\n            luaState.Push(this);\n            IntPtr p = luaState.LuaToPointer(-1);\n            luaState.LuaPop(1);\n            return string.Format(\"table:0x{0}\", p.ToString(\"X\"));            \n        }\n\n        public LuaArrayTable ToArrayTable()\n        {            \n            return new LuaArrayTable(this);\n        }\n\n        public LuaDictTable ToDictTable()\n        {\n            return new LuaDictTable(this);\n        }        \n\n        public LuaDictTable<K, V> ToDictTable<K, V>()\n        {\n            return new LuaDictTable<K, V>(this);\n        }\n\n        public LuaTable GetMetaTable()\n        {            \n            int oldTop = luaState.LuaGetTop();\n\n            try\n            {\n                LuaTable t = null;\n                luaState.Push(this);\n\n                if (luaState.LuaGetMetaTable(-1) != 0)\n                {\n                    t = luaState.CheckLuaTable(-1);\n                }\n\n                luaState.LuaSetTop(oldTop);\n                return t;\n            }\n            catch (Exception e)\n            {\n                luaState.LuaSetTop(oldTop);\n                throw e;\n            }\n        }\n    }\n\n    public class LuaArrayTable : IDisposable, IEnumerable<object>\n    {       \n        private LuaTable table = null;\n        private LuaState state = null;\n\n        public LuaArrayTable(LuaTable table)           \n        {\n            table.AddRef();\n            this.table = table;            \n            this.state = table.GetLuaState();\n        }\n\n        public void Dispose()\n        {\n            if (table != null)\n            {\n                table.Dispose();\n                table = null;\n            }\n        }\n\n        public int Length\n        {\n            get\n            {\n                return table.Length;\n            }\n        }\n\n        public object this[int key]\n        {\n            get\n            {\n                return table[key];\n            }\n            set \n            {\n                table[key] = value;\n            }\n        }\n\n        public void ForEach(Action<object> action)\n        {\n            using (var iter = this.GetEnumerator())\n            {\n                while (iter.MoveNext())\n                {\n                    action(iter.Current);\n                }                \n            }\n        }\n\n        public IEnumerator<object> GetEnumerator()\n        {\n            return new Enumerator(this);\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return GetEnumerator();\n        }\n\n        class Enumerator : IEnumerator<object>\n        {            \n            LuaState state;\n            int index = 1;\n            object current = null;\n            int top = -1;\n\n            public Enumerator(LuaArrayTable list)\n            {                \n                state = list.state;\n                top = state.LuaGetTop();\n                state.Push(list.table);                \n            }\n\n            public object Current\n            {\n                get\n                {\n                    return current;\n                }\n            }\n\n            public bool MoveNext()\n            {\n                state.LuaRawGetI(-1, index);\n                current = state.ToVariant(-1);\n                state.LuaPop(1);\n                ++index;\n                return current == null ? false : true;\n            }\n\n            public void Reset()\n            {\n                index = 1;\n                current = null;\n            }\n\n            public void Dispose()\n            {\n                if (state != null)\n                {\n                    state.LuaSetTop(top);\n                    state = null;\n                }\n            }\n        }\n    }\n\n    public class LuaDictTable : IDisposable, IEnumerable<DictionaryEntry>\n    {\n        LuaTable table;\n        LuaState state;\n\n        public LuaDictTable(LuaTable table)            \n        {\n            table.AddRef();\n            this.table = table;\n            this.state = table.GetLuaState() ;\n        }\n\n        public void Dispose()\n        {\n            if (table != null)\n            {\n                table.Dispose();\n                table = null;\n            }\n        }\n\n        public object this[string key]\n        {\n            get\n            {\n                return table[key];\n            }\n\n            set\n            {\n                table[key] = value;\n            }\n        }\n\n        public Hashtable ToHashtable()\n        {\n            Hashtable hash = new Hashtable();\n            var iter = GetEnumerator();\n\n            while (iter.MoveNext())\n            {\n                hash.Add(iter.Current.Key, iter.Current.Value);                \n            }\n\n            iter.Dispose();\n            return hash;\n        }\n\n        public IEnumerator<DictionaryEntry> GetEnumerator()\n        {\n            return new Enumerator(this);\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return GetEnumerator();\n        }\n\n        class Enumerator : IEnumerator<DictionaryEntry>\n        {            \n            LuaState state;                        \n            DictionaryEntry current = new DictionaryEntry();\n            int top = -1;\n\n            public Enumerator(LuaDictTable list)\n            {                \n                state = list.state;\n                top = state.LuaGetTop();\n                state.Push(list.table);\n                state.LuaPushNil();                \n            }\n\n            public DictionaryEntry Current\n            {\n                get \n                {\n                    return current;\n                }\n            }\n\n            object IEnumerator.Current\n            {\n                get\n                {\n                    return Current;\n                }\n            }\n\n            public bool MoveNext()\n            {\n                if (state.LuaNext(-2))\n                {\n                    current = new DictionaryEntry();\n                    current.Key = state.ToVariant(-2);\n                    current.Value = state.ToVariant(-1);\n                    state.LuaPop(1);\n                    return true;\n                }\n                else\n                {\n                    current = new DictionaryEntry();\n                    return false;\n                }                \n            }\n\n            public void Reset()\n            {\n                current = new DictionaryEntry();\n            }\n\n            public void Dispose()\n            {\n                if (state != null)\n                {\n                    state.LuaSetTop(top);\n                    state = null;\n                }\n            }\n        }\n    }\n\n    public struct LuaDictEntry<K, V>\n    {\n        public LuaDictEntry(K key, V value)\n            : this()\n        {\n            Key = key;\n            Value = value;\n        }\n\n        public K Key { get; set; }\n        public V Value { get; set; }\n    }\n\n    public class LuaDictTable<K, V> : IDisposable, IEnumerable<LuaDictEntry<K, V>>\n    {\n        LuaTable table;\n        LuaState state;\n\n        public LuaDictTable(LuaTable table)\n        {\n            table.AddRef();\n            this.table = table;\n            this.state = table.GetLuaState();\n        }\n\n        public void Dispose()\n        {\n            if (table != null)\n            {\n                table.Dispose();\n                table = null;\n            }\n        }\n\n        public V this[K key]\n        {\n            get\n            {\n                return table.RawGet<K, V>(key);\n            }\n\n            set\n            {                \n                table.RawSet(key, value);\n            }\n        }\n\n        public Dictionary<K, V> ToDictionary()\n        {\n            Dictionary<K, V> dict = new Dictionary<K, V>();\n            var iter = GetEnumerator();\n\n            while (iter.MoveNext())\n            {\n                dict.Add(iter.Current.Key, iter.Current.Value);\n            }\n\n            iter.Dispose();\n            return dict;\n        }\n\n        public IEnumerator<LuaDictEntry<K, V>> GetEnumerator()\n        {\n            return new Enumerator(this);\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return GetEnumerator();\n        }\n\n        class Enumerator : IEnumerator<LuaDictEntry<K, V>>\n        {\n            LuaState state;\n            LuaDictEntry<K, V> current = new LuaDictEntry<K, V>();\n            int top = -1;\n\n            public Enumerator(LuaDictTable<K, V> list)\n            {\n                state = list.state;\n                top = state.LuaGetTop();\n                state.Push(list.table);\n                state.LuaPushNil();\n            }\n\n            public LuaDictEntry<K, V> Current\n            {\n                get\n                {\n                    return current;\n                }\n            }\n\n            object IEnumerator.Current\n            {\n                get\n                {\n                    return Current;\n                }\n            }\n\n            public bool MoveNext()\n            {\n                if (state.LuaNext(-2))\n                {\n                    current = new LuaDictEntry<K, V>();\n                    current.Key = state.CheckValue<K>(-2);\n                    current.Value = state.CheckValue<V>(-1);\n                    state.LuaPop(1);\n                    return true;\n                }\n                else\n                {\n                    current = new LuaDictEntry<K, V>();\n                    return false;\n                }\n            }\n\n            public void Reset()\n            {\n                current = new LuaDictEntry<K, V>();\n            }\n\n            public void Dispose()\n            {\n                if (state != null)\n                {\n                    state.LuaSetTop(top);\n                    state = null;\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaTable.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b68fd1e3004ea4a4a879bf6fbda73510\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaThread.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\n\nnamespace LuaInterface\n{\n    public class LuaThread : LuaBaseRef\n    {        \n        public LuaThread(int reference, LuaState state)\n        {\n            this.luaState = state;\n            this.reference = reference;\n        }\n\n        protected int Resume(IntPtr L, int nArgs)\n        {\n            int ret = LuaDLL.lua_resume(L, nArgs);\n\n            if (ret > (int)LuaThreadStatus.LUA_YIELD)\n            {\n                string error = null;\n                int top = LuaDLL.lua_gettop(L);\n                LuaDLL.tolua_pushtraceback(L);\n                LuaDLL.lua_pushthread(L);\n                LuaDLL.lua_pushvalue(L, top);\n\n                if (LuaDLL.lua_pcall(L, 2, -1, 0) != 0)\n                {\n                    LuaDLL.lua_settop(L, top);\n                }\n\n                error = LuaDLL.lua_tostring(L, -1);                \n                luaState.LuaSetTop(0);\n                throw new LuaException(error);\n            }\n            \n            return ret;\n        }\n\n        public int Resume()\n        {                                    \n            luaState.Push(this);\n            IntPtr L = luaState.LuaToThread(-1);\n            luaState.LuaPop(1);\n            int ret = Resume(L, 0);\n            if (ret == 0)\n            {\n                Dispose();\n            }\n            return ret;\n        }\n\n        public int Resume<T1>(T1 arg1)\n        {\n            luaState.Push(this);\n            IntPtr L = luaState.LuaToThread(-1);\n            luaState.LuaPop(1);            \n            StackTraits<T1>.Push(L, arg1);\n            int ret = Resume(L, 1);\n            if (ret == 0)\n            {\n                Dispose();\n            }\n            return ret;\n        }\n\n        public int Resume<T1, T2>(T1 arg1, T2 arg2)\n        {\n            luaState.Push(this);\n            IntPtr L = luaState.LuaToThread(-1);\n            luaState.LuaPop(1);\n            StackTraits<T1>.Push(L, arg1);\n            StackTraits<T2>.Push(L, arg2);                        \n            int ret = Resume(L, 2);\n            if (ret == 0)\n            {\n                Dispose();\n            }\n            return ret;\n        }\n\n        public int Resume<T1, T2, T3>(T1 arg1, T2 arg2, T3 arg3)\n        {\n            luaState.Push(this);\n            IntPtr L = luaState.LuaToThread(-1);\n            luaState.LuaPop(1);\n            StackTraits<T1>.Push(L, arg1);\n            StackTraits<T2>.Push(L, arg2);\n            StackTraits<T3>.Push(L, arg3);\n            int ret = Resume(L, 3);\n            if (ret == 0)\n            {\n                Dispose();\n            }\n            return ret;\n        }\n\n        public int Resume<R1>(out R1 ret1)\n        {\n            luaState.Push(this);\n            IntPtr L = luaState.LuaToThread(-1);\n            luaState.LuaPop(1);\n            int ret = Resume(L, 0);\n\n            if (ret == 0)\n            {\n                ret1 = default(R1);\n                Dispose();\n            }\n            else\n            {\n                int top = LuaDLL.lua_gettop(L);\n                ret1 = StackTraits<R1>.Check(L, top);\n            }\n\n            return ret;\n        }\n\n        public int Resume<T1, R1>(T1 arg1, out R1 ret1)\n        {\n            luaState.Push(this);\n            IntPtr L = luaState.LuaToThread(-1);\n            luaState.LuaPop(1);\n            StackTraits<T1>.Push(L, arg1);            \n            int ret = Resume(L, 1);\n\n            if (ret == 0)\n            {\n                ret1 = default(R1);\n                Dispose();\n            }\n            else\n            {\n                int top = LuaDLL.lua_gettop(L);\n                ret1 = StackTraits<R1>.Check(L, top);\n            }\n\n            return ret;\n        }\n\n        public int Resume<T1, T2, R1>(T1 arg1, T2 arg2, out R1 ret1)\n        {\n            luaState.Push(this);\n            IntPtr L = luaState.LuaToThread(-1);\n            luaState.LuaPop(1);\n            StackTraits<T1>.Push(L, arg1);\n            StackTraits<T2>.Push(L, arg2);\n            int ret = Resume(L, 2);\n\n            if (ret == 0)\n            {\n                ret1 = default(R1);\n                Dispose();\n            }\n            else\n            {\n                int top = LuaDLL.lua_gettop(L);\n                ret1 = StackTraits<R1>.Check(L, top);\n            }\n\n            return ret;\n        }\n\n        public int Resume<T1, T2, T3, R1>(T1 arg1, T2 arg2, T3 arg3, out R1 ret1)\n        {\n            luaState.Push(this);\n            IntPtr L = luaState.LuaToThread(-1);\n            luaState.LuaPop(1);\n            StackTraits<T1>.Push(L, arg1);\n            StackTraits<T2>.Push(L, arg2);\n            StackTraits<T3>.Push(L, arg3);\n            int ret = Resume(L, 3);\n\n            if (ret == 0)\n            {\n                ret1 = default(R1);\n                Dispose();\n            }\n            else\n            {\n                int top = LuaDLL.lua_gettop(L);\n                ret1 = StackTraits<R1>.Check(L, top);\n            }\n\n            return ret;\n        }\n    }\n}"
  },
  {
    "path": "Assets/ToLua/Core/LuaThread.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c80e713269311db4689148e01949206a\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaUnityLibs.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Runtime.InteropServices;\nusing UnityEngine;\n\nnamespace LuaInterface\n{\n    public sealed class LuaUnityLibs\n    {\n        public static void OpenLibs(IntPtr L)\n        {\n            InitMathf(L);\n            InitLayer(L);\n        }\n\n        public static void OpenLuaLibs(IntPtr L)\n        {                        \n            if (LuaDLL.tolua_openlualibs(L) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                LuaDLL.lua_pop(L, 1);\n                throw new LuaException(error);\n            }\n\n            SetOutMethods(L, \"Vector3\", GetOutVector3);\n            SetOutMethods(L, \"Vector2\", GetOutVector2);\n            SetOutMethods(L, \"Vector4\", GetOutVector4);\n            SetOutMethods(L, \"Color\", GetOutColor);\n            SetOutMethods(L, \"Color32\", GetOutColor32);\n            SetOutMethods(L, \"Quaternion\", GetOutQuaternion);\n            SetOutMethods(L, \"Ray\", GetOutRay);\n            SetOutMethods(L, \"Bounds\", GetOutBounds);\n            SetOutMethods(L, \"Touch\", GetOutTouch);\n            SetOutMethods(L, \"RaycastHit\", GetOutRaycastHit);\n            SetOutMethods(L, \"LayerMask\", GetOutLayerMask);            \n        }\n\n        static void InitMathf(IntPtr L)\n        {\n            LuaDLL.lua_getglobal(L, \"Mathf\");\n            LuaDLL.lua_pushstring(L, \"PerlinNoise\");\n            LuaDLL.tolua_pushcfunction(L, PerlinNoise);\n            LuaDLL.lua_rawset(L, -3);\n            LuaDLL.lua_pop(L, 1);\n        }\n\n        static void InitLayer(IntPtr L)\n        {\n            LuaDLL.tolua_createtable(L, \"Layer\");\n\n            for (int i = 0; i < 32; i++)\n            {\n                string str = LayerMask.LayerToName(i);\n\n                if (!string.IsNullOrEmpty(str))\n                {\n                    LuaDLL.lua_pushstring(L, str);\n                    LuaDLL.lua_pushinteger(L, i);\n                    LuaDLL.lua_rawset(L, -3);\n                }\n            }\n\n            LuaDLL.lua_pop(L, 1);\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int PerlinNoise(IntPtr L)\n        {\n            try\n            {\n                float x = (float)LuaDLL.luaL_checknumber(L, 1);\n                float y = (float)LuaDLL.luaL_checknumber(L, 2);\n                float ret = Mathf.PerlinNoise(x, y);\n                LuaDLL.lua_pushnumber(L, ret);\n                return 1;\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }            \n        }\n\n        static void SetOutMethods(IntPtr L, string table, LuaCSFunction getOutFunc = null)\n        {\n            LuaDLL.lua_getglobal(L, table);\n            IntPtr get = Marshal.GetFunctionPointerForDelegate(getOutFunc);\n            LuaDLL.tolua_variable(L, \"out\", get, IntPtr.Zero);\n            \n            LuaDLL.lua_pop(L, 1);\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutVector3(IntPtr L)\n        {            \n            ToLua.PushOut<Vector3>(L, new LuaOut<Vector3>());\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutVector2(IntPtr L)\n        {            \n            ToLua.PushOut<Vector2>(L, new LuaOut<Vector2>());\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutVector4(IntPtr L)\n        {            \n            ToLua.PushOut<Vector4>(L, new LuaOut<Vector4>());\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutColor(IntPtr L)\n        {            \n            ToLua.PushOut<Color>(L, new LuaOut<Color>());\n            return 1;\n        }\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutColor32(IntPtr L)\n        {\n            ToLua.PushOut<Color32>(L, new LuaOut<Color32>());\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutQuaternion(IntPtr L)\n        {            \n            ToLua.PushOut<Quaternion>(L, new LuaOut<Quaternion>());\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutRay(IntPtr L)\n        {\n            ToLua.PushOut<Ray>(L, new LuaOut<Ray>());\n            return 1;            \n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutBounds(IntPtr L)\n        {\n            ToLua.PushOut<Bounds>(L, new LuaOut<Bounds>());\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutRaycastHit(IntPtr L)\n        {\n            ToLua.PushOut<RaycastHit>(L, new LuaOut<RaycastHit>());\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutTouch(IntPtr L)\n        {            \n            ToLua.PushOut<Touch>(L, new LuaOut<Touch>());\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetOutLayerMask(IntPtr L)\n        {\n            ToLua.PushOut<LayerMask>(L, new LuaOut<LayerMask>());\n            return 1;\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaUnityLibs.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6f293d0bd6470a044a8688cd9a61b433\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/LuaValueType.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Collections.Generic;\n\nnamespace LuaInterface\n{\n    public partial struct LuaValueType\n    {\n        public const int None = 0;\n        public const int Vector3 = 1;\n        public const int Quaternion = 2;\n        public const int Vector2 = 3;\n        public const int Color = 4;\n        public const int Vector4 = 5;\n        public const int Ray = 6;\n        public const int Bounds = 7;\n        public const int Touch = 8;\n        public const int LayerMask = 9;\n        public const int RaycastHit = 10;\n        public const int Int64 = 11;\n        public const int UInt64 = 12;\n        public const int Color32 = 13;\n        public const int Max = 64;\n\n        private int type;\n\n        public LuaValueType(int value)\n        {\n            type = value;\n        }\n\n        public static implicit operator int(LuaValueType mask)\n        {\n            return mask.type;\n        }\n\n        public static implicit operator LuaValueType(int intVal)\n        {\n            return new LuaValueType(intVal);\n        }\n\n        public override string ToString()\n        {\n            return LuaValueTypeName.Get(type);\n        }\n    }\n\n    public static class LuaValueTypeName\n    {\n        public static string[] names = new string[LuaValueType.Max];\n\n        static LuaValueTypeName()\n        {\n            names[LuaValueType.None] = \"None\";\n            names[LuaValueType.Vector3] = \"Vector3\";\n            names[LuaValueType.Quaternion] = \"Quaternion\";\n            names[LuaValueType.Vector2] = \"Vector2\";\n            names[LuaValueType.Color] = \"Color\";\n            names[LuaValueType.Color32] = \"Color32\";\n            names[LuaValueType.Vector4] = \"Vector4\";\n            names[LuaValueType.Ray] = \"Ray\";\n            names[LuaValueType.Bounds] = \"Bounds\";\n            names[LuaValueType.Touch] = \"Touch\";\n            names[LuaValueType.LayerMask] = \"LayerMask\";\n            names[LuaValueType.RaycastHit] = \"RaycastHit\";\n        }\n\n        static public string Get(int type)\n        {\n            if (type >= 0 && type < LuaValueType.Max)\n            {\n                return names[type];\n            }\n\n            return \"UnKnownType:\" + ConstStringTable.GetNumIntern(type);\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/LuaValueType.cs.meta",
    "content": "fileFormatVersion: 2\nguid: caa2d85e8d1314547a78624e7fec25a3\ntimeCreated: 1494919728\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Core/ObjectPool.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nusing System;\nusing System.Collections.Generic;\n\nnamespace LuaInterface\n{\n    public class LuaObjectPool\n    {        \n        class PoolNode\n        {\n            public int index;\n            public object obj;\n\n            public PoolNode(int index, object obj)\n            {\n                this.index = index;\n                this.obj = obj;\n            }\n        }\n\n        private List<PoolNode> list;\n        //同lua_ref策略，0作为一个回收链表头，不使用这个位置\n        private PoolNode head = null;   \n        private int count = 0;\n        private int collectStep = 2;\n        private int collectedIndex = -1;\n\n        public LuaObjectPool()\n        {\n            list = new List<PoolNode>(1024);\n            head = new PoolNode(0, null);\n            list.Add(head);\n            list.Add(new PoolNode(1, null));\n            count = list.Count;\n        }\n\n        public object this[int i]\n        {\n            get \n            {\n                if (i > 0 && i < count)\n                {\n                    return list[i].obj;\n                }\n\n                return null;\n            }\n        }\n\n        public void Clear()\n        {\n            list.Clear();\n            head = null;\n            count = 0;\n        }\n\n        public int Add(object obj)\n        {\n            int pos = -1;\n\n            if (head.index != 0)\n            {\n                pos = head.index;\n                list[pos].obj = obj;\n                head.index = list[pos].index;\n            }\n            else\n            {\n                pos = list.Count;\n                list.Add(new PoolNode(pos, obj));\n                count = pos + 1;\n            }\n\n            return pos;\n        }\n\n        public object TryGetValue(int index)\n        {\n            if (index > 0 && index < count)\n            {\n                return list[index].obj;                \n            }\n            \n            return null;\n        }\n\n        public object Remove(int pos)\n        {\n            if (pos > 0 && pos < count)\n            {\n                object o = list[pos].obj;\n                list[pos].obj = null;                \n                list[pos].index = head.index;\n                head.index = pos;\n\n                return o;\n            }\n\n            return null;\n        }\n\n        public object Destroy(int pos)\n        {\n            if (pos > 0 && pos < count)\n            {\n                object o = list[pos].obj;\n                list[pos].obj = null;\n                return o;\n            }\n\n            return null;\n        }\n\n        public void StepCollect(Action<object, int> collectListener)\n        {\n            ++collectedIndex;\n            for (int i = 0; i < collectStep; ++i)\n            {\n                collectedIndex += i;\n                if (collectedIndex >= count)\n                {\n                    collectedIndex = -1;\n                    return;\n                }\n\n                var node = list[collectedIndex];\n                object o = node.obj;\n                if (o != null && o.Equals(null))\n                {\n                    node.obj = null;\n                    if (collectListener != null)\n                    {\n                        collectListener(o, collectedIndex);\n                    }\n                }\n            }\n        }\n\n        public object Replace(int pos, object o)\n        {\n            if (pos > 0 && pos < count)\n            {\n                object obj = list[pos].obj;\n                list[pos].obj = o;\n                return obj;\n            }\n\n            return null;\n        }\n    }\n}"
  },
  {
    "path": "Assets/ToLua/Core/ObjectPool.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 375ac727a60642f4e9db9303e4025911\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/ObjectTranslator.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.CompilerServices;\nusing UnityEngine;\n\nnamespace LuaInterface\n{\n    public class ObjectTranslator\n    {        \n        private class DelayGC\n        {\n            public DelayGC(int id, UnityEngine.Object obj, float time)\n            {\n                this.id = id;\n                this.time = time;\n                this.obj = obj;\n            }\n\n            public int id;\n            public UnityEngine.Object obj;\n            public float time;\n        }\n\n        private class CompareObject : IEqualityComparer<object>\n        {\n            public new bool Equals(object x, object y)\n            {\n                return object.ReferenceEquals(x, y);                \n            }\n\n            public int GetHashCode(object obj)\n            {\n                return RuntimeHelpers.GetHashCode(obj);                \n            }\n        }\n\n        public bool LogGC { get; set; }\n        public readonly Dictionary<object, int> objectsBackMap = new Dictionary<object, int>(257, new CompareObject());\n        public readonly LuaObjectPool objects = new LuaObjectPool();\n        private List<DelayGC> gcList = new List<DelayGC>();\n        private Action<object, int> removeInvalidObject;\n\n#if !MULTI_STATE\n        private static ObjectTranslator _translator = null;\n#endif\n\n        public ObjectTranslator()\n        {\n            LogGC = false;\n#if !MULTI_STATE\n            _translator = this;\n#endif\n            removeInvalidObject = RemoveObject;\n        }\n\n        public int AddObject(object obj)\n        {\n            int index = objects.Add(obj);\n\n            if (!TypeChecker.IsValueType(obj.GetType()))\n            {\n                objectsBackMap[obj] = index;\n            }\n\n            return index;\n        }\n\n        public static ObjectTranslator Get(IntPtr L)\n        {\n#if !MULTI_STATE\n                return _translator;\n#else\n                return LuaState.GetTranslator(L);\n#endif\n        }\n\n        //fixed 枚举唯一性问题（对象唯一，没有实现__eq操作符）\n        void RemoveObject(object o, int udata)\n        {\n            int index = -1;\n            \n            if (objectsBackMap.TryGetValue(o, out index) && index == udata)\n            {\n                objectsBackMap.Remove(o);\n            }\n        }\n\n        //lua gc一个对象(lua 库不再引用，但不代表c#没使用)\n        public void RemoveObject(int udata)\n        {            \n            //只有lua gc才能移除\n            object o = objects.Remove(udata);\n\n            if (o != null)\n            {\n                if (!TypeChecker.IsValueType(o.GetType()))\n                {\n                    RemoveObject(o, udata);\n                }\n\n                if (LogGC)\n                {\n                    Debugger.Log(\"gc object {0}, id {1}\", o, udata);\n                }\n            }\n        }\n\n        public object GetObject(int udata)\n        {\n            return objects.TryGetValue(udata);         \n        }\n\n        //预删除，但不移除一个lua对象(移除id只能由gc完成)\n        public void Destroy(int udata)\n        {            \n            object o = objects.Destroy(udata);\n\n            if (o != null)\n            {\n                if (!TypeChecker.IsValueType(o.GetType()))\n                {\n                    RemoveObject(o, udata);\n                }\n\n                if (LogGC)\n                {\n                    Debugger.Log(\"destroy object {0}, id {1}\", o, udata);\n                }\n            }\n        }\n\n        //Unity Object 延迟删除\n        public void DelayDestroy(int id, float time)\n        {\n            UnityEngine.Object obj = (UnityEngine.Object)GetObject(id);\n\n            if (obj != null)\n            {\n                gcList.Add(new DelayGC(id, obj, time));\n            }            \n        }\n\n        public bool Getudata(object o, out int index)\n        {\n            index = -1;\n            return objectsBackMap.TryGetValue(o, out index);\n        }\n\n        public void Destroyudata(int udata)\n        {\n            objects.Destroy(udata);\n        }\n\n        public void SetBack(int index, object o)\n        {\n            objects.Replace(index, o);            \n        }\n\n        bool RemoveFromGCList(int id)\n        {\n            int index = gcList.FindIndex((p) => { return p.id == id; });\n\n            if (index >= 0)\n            {\n                gcList.RemoveAt(index);\n                return true;                       \n            }\n\n            return false;\n        }\n        \n        //延迟删除处理\n        void DestroyUnityObject(int udata, UnityEngine.Object obj)\n        {\n            object o = objects.TryGetValue(udata);\n\n            if (object.ReferenceEquals(o, obj))\n            {\n                RemoveObject(o, udata);\n                //一定不能Remove, 因为GC还可能再来一次\n                objects.Destroy(udata);     \n\n                if (LogGC)\n                {\n                    Debugger.Log(\"destroy object {0}, id {1}\", o, udata);\n                }\n            }\n\n            UnityEngine.Object.Destroy(obj);\n        }\n\n        public void Collect()\n        {\n            if (gcList.Count == 0)\n            {\n                return;\n            }\n\n            float delta = Time.deltaTime;\n\n            for (int i = gcList.Count - 1; i >= 0; i--)\n            {\n                float time = gcList[i].time - delta;\n\n                if (time <= 0)\n                {\n                    DestroyUnityObject(gcList[i].id, gcList[i].obj);                    \n                    gcList.RemoveAt(i);\n                }\n                else\n                {\n                    gcList[i].time = time;\n                }\n            }\n        }\n\n        public void StepCollect()\n        {\n            objects.StepCollect(removeInvalidObject);\n        }\n\n        public void Dispose()\n        {\n            objectsBackMap.Clear();\n            objects.Clear();     \n            \n#if !MULTI_STATE\n            _translator = null;\n#endif\n        }\n    }\n}"
  },
  {
    "path": "Assets/ToLua/Core/ObjectTranslator.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 607902915586ecd43b863b154c1337ad\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/ToLua.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Runtime.InteropServices;\nusing System.Text;\n\n#if UNITY_EDITOR  \nusing UnityEditor;\nusing UnityEditor.Callbacks;\nusing System.Reflection;\n#endif\n\nnamespace LuaInterface\n{\n    public static class ToLua\n    {\n        public delegate object LuaTableToVar(IntPtr L, int pos);\n        public delegate void LuaPushVarObject(IntPtr L, object o);\n        static Type monoType = typeof(Type).GetType();\n        static public LuaTableToVar[] ToVarMap = new LuaTableToVar[LuaValueType.Max];        \n        static public Dictionary<Type, LuaPushVarObject> VarPushMap  = new Dictionary<Type, LuaPushVarObject>();\n\n#if UNITY_EDITOR\n        static int _instanceID = -1;\n        static int _line = 203;\n        private static object consoleWindow;\n        private static object logListView;\n        private static FieldInfo logListViewCurrentRow;\n        private static MethodInfo LogEntriesGetEntry;\n        private static MethodInfo StartGettingEntries;\n        private static MethodInfo EndGettingEntries;\n        private static object logEntry;\n        private static FieldInfo logEntryCondition;            \n#endif\n\n        static ToLua()\n        {\n            ToVarMap[LuaValueType.Vector3] = ToObjectVec3;\n            ToVarMap[LuaValueType.Quaternion] = ToObjectQuat;\n            ToVarMap[LuaValueType.Vector2] = ToObjectVec2;\n            ToVarMap[LuaValueType.Color] = ToObjectColor;\n            ToVarMap[LuaValueType.Color32] = ToObjectColor32;\n            ToVarMap[LuaValueType.Vector4] = ToObjectVec4;\n            ToVarMap[LuaValueType.Ray] = ToObjectRay;\n            ToVarMap[LuaValueType.LayerMask] = ToObjectLayerMask;\n            ToVarMap[LuaValueType.Bounds] = ToObjectBounds;\n        }\n\n        public static void OpenLibs(IntPtr L)\n        {\n            AddLuaLoader(L);\n            LuaDLL.tolua_atpanic(L, Panic);\n            LuaDLL.tolua_pushcfunction(L, Print);\n            LuaDLL.lua_setglobal(L, \"print\");\n            LuaDLL.tolua_pushcfunction(L, DoFile);\n            LuaDLL.lua_setglobal(L, \"dofile\");\n            LuaDLL.tolua_pushcfunction(L, LoadFile);\n            LuaDLL.lua_setglobal(L, \"loadfile\");\n\n            LuaDLL.lua_getglobal(L, \"tolua\");\n\n            LuaDLL.lua_pushstring(L, \"isnull\");\n            LuaDLL.lua_pushcfunction(L, IsNull);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"typeof\");\n            LuaDLL.lua_pushcfunction(L, GetClassType);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"tolstring\");\n            LuaDLL.tolua_pushcfunction(L, BufferToString);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"toarray\");\n            LuaDLL.tolua_pushcfunction(L, TableToArray);\n            LuaDLL.lua_rawset(L, -3);\n\n            //手动模拟gc\n            //LuaDLL.lua_pushstring(L, \"collect\");\n            //LuaDLL.lua_pushcfunction(L, Collect);\n            //LuaDLL.lua_rawset(L, -3);            \n\n            int meta = LuaStatic.GetMetaReference(L, typeof(NullObject));\n            LuaDLL.lua_pushstring(L, \"null\");\n            LuaDLL.tolua_pushnewudata(L, meta, 1);\n            LuaDLL.lua_rawset(L, -3);\n            LuaDLL.lua_pop(L, 1);\n\n            LuaDLL.tolua_pushudata(L, 1);\n            LuaDLL.lua_setfield(L, LuaIndexes.LUA_GLOBALSINDEX, \"null\");\n\n#if UNITY_EDITOR\n            GetToLuaInstanceID();\n            GetConsoleWindowListView();\n#endif\n        }\n\n        /*--------------------------------对于tolua扩展函数------------------------------------------*/\n        #region TOLUA_EXTEND_FUNCTIONS\n        static void AddLuaLoader(IntPtr L)\n        {\n            LuaDLL.lua_getglobal(L, \"package\");\n            LuaDLL.lua_getfield(L, -1, \"loaders\");\n            LuaDLL.tolua_pushcfunction(L, Loader);\n\n            for (int i = LuaDLL.lua_objlen(L, -2) + 1; i > 2; i--)\n            {\n                LuaDLL.lua_rawgeti(L, -2, i - 1);\n                LuaDLL.lua_rawseti(L, -3, i);\n            }\n\n            LuaDLL.lua_rawseti(L, -2, 2);\n            LuaDLL.lua_pop(L, 2);\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int Panic(IntPtr L)\n        {\n            string reason = String.Format(\"PANIC: unprotected error in call to Lua API ({0})\", LuaDLL.lua_tostring(L, -1));\n            throw new LuaException(reason);\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int Print(IntPtr L)\n        {\n            try\n            {\n                int n = LuaDLL.lua_gettop(L);   \n                             \n                using (CString.Block())\n                {\n                    CString sb = CString.Alloc(256);\n#if UNITY_EDITOR\n                    int line = LuaDLL.tolua_where(L, 1);\n                    string filename = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_settop(L, n);\n                    int offset = filename[0] == '@' ? 1 : 0;\n\n                    if (!filename.Contains(\".\"))\n                    {\n                        sb.Append('[').Append(filename, offset, filename.Length - offset).Append(\".lua:\").Append(line).Append(\"]:\");\n                    }\n                    else\n                    {\n                        sb.Append('[').Append(filename, offset, filename.Length - offset).Append(':').Append(line).Append(\"]:\");\n                    }\n#endif\n\n                    for (int i = 1; i <= n; i++)\n                    {\n                        if (i > 1) sb.Append(\"    \");\n\n                        if (LuaDLL.lua_isstring(L, i) == 1)\n                        {\n                            sb.Append(LuaDLL.lua_tostring(L, i));\n                        }\n                        else if (LuaDLL.lua_isnil(L, i))\n                        {\n                            sb.Append(\"nil\");\n                        }\n                        else if (LuaDLL.lua_isboolean(L, i))\n                        {\n                            sb.Append(LuaDLL.lua_toboolean(L, i) ? \"true\" : \"false\");\n                        }\n                        else\n                        {\n                            IntPtr p = LuaDLL.lua_topointer(L, i);\n\n                            if (p == IntPtr.Zero)\n                            {\n                                sb.Append(\"nil\");\n                            }\n                            else\n                            {\n                                sb.Append(LuaDLL.luaL_typename(L, i)).Append(\":0x\").Append(p.ToString(\"X\"));\n                            }\n                        }\n                    }\n\n                    Debugger.Log(sb.ToString());            //203行与_line一致\n                }\n                return 0;\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int Loader(IntPtr L)\n        {\n            try\n            {\n                string fileName = LuaDLL.lua_tostring(L, 1);\n                fileName = fileName.Replace(\".\", \"/\");\n                byte[] buffer = LuaFileUtils.Instance.ReadFile(fileName);\n\n                if (buffer == null)\n                {\n                    string error = LuaFileUtils.Instance.FindFileError(fileName);\n                    LuaDLL.lua_pushstring(L, error);\n                    return 1;\n                }\n\n                if (LuaConst.openLuaDebugger)\n                {\n                    fileName = LuaFileUtils.Instance.FindFile(fileName);\n                }                \n\n                if (LuaDLL.luaL_loadbuffer(L, buffer, buffer.Length, \"@\"+ fileName) != 0)\n                {\n                    string err = LuaDLL.lua_tostring(L, -1);\n                    throw new LuaException(err, LuaException.GetLastError());\n                }\n\n                return 1;\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        public static int DoFile(IntPtr L)\n        {\n            try\n            {\n                string fileName = LuaDLL.lua_tostring(L, 1);\n                int n = LuaDLL.lua_gettop(L);\n                byte[] buffer = LuaFileUtils.Instance.ReadFile(fileName);\n\n                if (buffer == null)\n                {\n                    string error = string.Format(\"cannot open {0}: No such file or directory\", fileName);\n                    error += LuaFileUtils.Instance.FindFileError(fileName);\n                    throw new LuaException(error);\n                }\n\n                if (LuaDLL.luaL_loadbuffer(L, buffer, buffer.Length, fileName) == 0)\n                {\n                    if (LuaDLL.lua_pcall(L, 0, LuaDLL.LUA_MULTRET, 0) != 0)\n                    {\n                        string error = LuaDLL.lua_tostring(L, -1);\n                        throw new LuaException(error, LuaException.GetLastError());\n                    }\n                }\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstring err = LuaDLL.lua_tostring(L, -1);\n\t\t\t\t\tthrow new LuaException(err, LuaException.GetLastError());\n\t\t\t\t}\n\n                return LuaDLL.lua_gettop(L) - n;\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        public static int LoadFile(IntPtr L)\n        {\n            try\n            {\n                string fileName = LuaDLL.lua_tostring(L, 1);\n                byte[] buffer = LuaFileUtils.Instance.ReadFile(fileName);\n\n                if (buffer == null)\n                {\n                    string error = string.Format(\"cannot open {0}: No such file or directory\", fileName);\n                    error += LuaFileUtils.Instance.FindFileError(fileName);\n                    throw new LuaException(error);\n                }\n\n                if (LuaDLL.luaL_loadbuffer(L, buffer, buffer.Length, fileName) == 0)\n                {\n                    return 1;\n                }\n\n                LuaDLL.lua_pushnil(L);\n                LuaDLL.lua_insert(L, -2);  /* put before error message */\n                return 2;\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n        }\n\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int IsNull(IntPtr L)\n        {\n            LuaTypes t = LuaDLL.lua_type(L, 1);\n\n            if (t == LuaTypes.LUA_TNIL)\n            {\n                LuaDLL.lua_pushboolean(L, true);\n            }\n            else\n            {\n                object o = ToLua.ToObject(L, -1);\n\n                if (o == null || o.Equals(null))\n                {\n                    LuaDLL.lua_pushboolean(L, true);\n                }\n                else\n                {\n                    LuaDLL.lua_pushboolean(L, false);\n                }\n            }\n\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int BufferToString(IntPtr L)\n        {\n            try\n            {\n                object o = CheckObject(L, 1);\n\n                if (o is byte[])\n                {\n                    byte[] buff = (byte[])o;\n                    LuaDLL.lua_pushlstring(L, buff, buff.Length);\n                }\n                else if (o is char[])\n                {\n                    byte[] buff = System.Text.Encoding.UTF8.GetBytes((char[])o);\n                    LuaDLL.lua_pushlstring(L, buff, buff.Length);\n                }\n                else if (o is string)\n                {\n                    LuaDLL.lua_pushstring(L, (string)o);\n                }\n                else\n                {\n                    LuaDLL.luaL_typerror(L, 1, \"byte[] or char[]\");\n                }\n\n                return 1;\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }            \n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetClassType(IntPtr L)\n        {\n            int reference = LuaDLL.tolua_getmetatableref(L, 1);\n\n            if (reference > 0)\n            {\n                Type t = LuaStatic.GetClassType(L, reference);\n                Push(L, t);\n            }\n            else\n            {\n                int ret = LuaDLL.tolua_getvaluetype(L, -1);\n\n                if (ret != LuaValueType.None)\n                {\n                    Type t = TypeChecker.LuaValueTypeMap[ret];\n                    Push(L, t);\n                }\n                else\n                {\n                    Debugger.LogError(\"type not register to lua\");\n                    LuaDLL.lua_pushnil(L);\n                }\n            }\n\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int TableToArray(IntPtr L)\n        {\n            try\n            {\n                object[] objs = ToLua.CheckObjectArray(L, 1);\n                Type t = ToLua.CheckMonoType(L, 2);\n                Array ret = System.Array.CreateInstance(t, objs.Length);\n\n                for (int i = 0; i < objs.Length; i++)\n                {\n                    ret.SetValue(objs[i], i);\n                }\n\n                ToLua.Push(L, ret);\n                return 1;\n            }\n            catch(LuaException e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }            \n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        public static int op_ToString(IntPtr L)\n        {\n            object obj = ToLua.ToObject(L, 1);\n\n            if (obj != null)\n            {\n                LuaDLL.lua_pushstring(L, obj.ToString());\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            return 1;\n        }\n\n#if UNITY_EDITOR\n        private static bool GetConsoleWindowListView()\n        {\n            if (logListView == null)\n            {\n                Assembly unityEditorAssembly = Assembly.GetAssembly(typeof(EditorWindow));\n                Type consoleWindowType = unityEditorAssembly.GetType(\"UnityEditor.ConsoleWindow\");\n                FieldInfo fieldInfo = consoleWindowType.GetField(\"ms_ConsoleWindow\", BindingFlags.Static | BindingFlags.NonPublic);                \n                consoleWindow = fieldInfo.GetValue(null);\n\n                if (consoleWindow == null)\n                {\n                    logListView = null;\n                    return false;\n                }\n\n                FieldInfo listViewFieldInfo = consoleWindowType.GetField(\"m_ListView\", BindingFlags.Instance | BindingFlags.NonPublic);\n                logListView = listViewFieldInfo.GetValue(consoleWindow);\n                logListViewCurrentRow = listViewFieldInfo.FieldType.GetField(\"row\", BindingFlags.Instance | BindingFlags.Public);\n#if UNITY_2017_1_OR_NEWER\n                Type logEntriesType = unityEditorAssembly.GetType(\"UnityEditor.LogEntries\");                \n                LogEntriesGetEntry = logEntriesType.GetMethod(\"GetEntryInternal\", BindingFlags.Static | BindingFlags.Public);                \n                Type logEntryType = unityEditorAssembly.GetType(\"UnityEditor.LogEntry\");                                \n#else\n                Type logEntriesType = unityEditorAssembly.GetType(\"UnityEditorInternal.LogEntries\");                \n                LogEntriesGetEntry = logEntriesType.GetMethod(\"GetEntryInternal\", BindingFlags.Static | BindingFlags.Public);\n                Type logEntryType = unityEditorAssembly.GetType(\"UnityEditorInternal.LogEntry\");                \n#endif                                \n                logEntryCondition = logEntryType.GetField(\"condition\", BindingFlags.Instance | BindingFlags.Public);\n                StartGettingEntries = logEntriesType.GetMethod(\"StartGettingEntries\", BindingFlags.Static | BindingFlags.Public);\n                EndGettingEntries = logEntriesType.GetMethod(\"EndGettingEntries\", BindingFlags.Static | BindingFlags.Public);\n                logEntry = Activator.CreateInstance(logEntryType);\n            }\n\n            return true;\n        }\n\n\n        private static string GetListViewRowCount(ref int line)\n        {\n#if UNITY_2017_1_OR_NEWER\n            object rows = StartGettingEntries.Invoke(null, null);\n#endif\n            int row = (int)logListViewCurrentRow.GetValue(logListView);            \n            LogEntriesGetEntry.Invoke(null, new object[] { row, logEntry });                            \n            string condition = logEntryCondition.GetValue(logEntry) as string;\n#if UNITY_2017_1_OR_NEWER\n            EndGettingEntries.Invoke(null, null);\n#endif\n            condition = condition.Substring(0, condition.IndexOf('\\n'));\n            int index = condition.IndexOf(\".lua:\");            \n\n            if (index >= 0)\n            {\n                int start = condition.IndexOf(\"[\");\n                int end = condition.IndexOf(\"]:\");\n                string _line = condition.Substring(index + 5, end - index - 5);\n                Int32.TryParse(_line, out line);\n                return condition.Substring(start + 1, index + 3 - start);\n            }\n\n            index = condition.IndexOf(\".cs:\");\n\n            if (index >= 0)\n            {\n                int start = condition.IndexOf(\"[\");\n                int end = condition.IndexOf(\"]:\");\n                string _line = condition.Substring(index + 4, end - index - 4);\n                Int32.TryParse(_line, out line);\n                return condition.Substring(start + 1, index + 2 - start);\n            }\n\n            return null;\n        }\n\n        static void GetToLuaInstanceID()\n        {\n            if (_instanceID == -1)\n            {\n                int start = LuaConst.toluaDir.IndexOf(\"Assets\");\n                int end = LuaConst.toluaDir.LastIndexOf(\"/Lua\");\n                string dir = LuaConst.toluaDir.Substring(start, end - start);\n                dir += \"/Core/ToLua.cs\";\n                _instanceID = AssetDatabase.LoadAssetAtPath(dir, typeof(MonoScript)).GetInstanceID();//\"Assets/ToLua/Core/ToLua.cs\"\n            }\n        }\n\n        [OnOpenAssetAttribute(0)]\n        public static bool OnOpenAsset(int instanceID, int line)\n        {\n            GetToLuaInstanceID();\n\n            if (!GetConsoleWindowListView() || (object)EditorWindow.focusedWindow != consoleWindow)\n            {\n                return false;\n            }\n\n            if (instanceID == _instanceID && line == _line)\n            {\n                string fileName = GetListViewRowCount(ref line);\n\n                if (fileName == null)\n                {\n                    return false;\n                }\n\n                if (fileName.EndsWith(\".cs\"))\n                {\n                    string filter = fileName.Substring(0, fileName.Length - 3);\n                    filter += \" t:MonoScript\";\n                    string[] searchPaths = AssetDatabase.FindAssets(filter);\n\n                    for (int i = 0; i < searchPaths.Length; i++)\n                    {\n                        string path = AssetDatabase.GUIDToAssetPath(searchPaths[i]);\n\n                        if (path.EndsWith(fileName))\n                        {\n                            UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(MonoScript));\n                            AssetDatabase.OpenAsset(obj, line);\n                            return true;\n                        }\n                    }\n                }\n                else\n                {\n                    string filter = fileName.Substring(0, fileName.Length - 4);\n                    int index = filter.IndexOf(\"/\");\n                    if (index > 0)\n                    {\n                        filter = filter.Substring(index + 1);\n                    }\n                    string[] searchPaths = AssetDatabase.FindAssets(filter);\n\n                    for (int i = 0; i < searchPaths.Length; i++)\n                    {\n                        string path = AssetDatabase.GUIDToAssetPath(searchPaths[i]);\n\n                        if (path.EndsWith(fileName) || path.EndsWith(fileName + \".bytes\"))\n                        {\n                            UnityEngine.Object obj = AssetDatabase.LoadMainAssetAtPath(path);\n#if !UNITY_2017_1_OR_NEWER\n                            EditorApplication.delayCall += () => { AssetDatabase.OpenAsset(obj, line); };\n#else\n                            AssetDatabase.OpenAsset(obj, line);\n#endif\n\n                            return true;\n                        }\n                    }\n\n                }\n            }\n\n            return false;\n        }\n#endif\n#endregion\n                            /*-------------------------------------------------------------------------------------------*/\n\n                            public static string ToString(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TSTRING:\n                    return LuaDLL.lua_tostring(L, stackPos);\n                case LuaTypes.LUA_TUSERDATA:\n                    return (string)ToObject(L, stackPos);\n                default:\n                    return null;\n            }\n        }\n\n        public static object ToObject(IntPtr L, int stackPos)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                return translator.GetObject(udata);\n            }\n\n            return null;\n        }\n\n        public static LuaFunction ToLuaFunction(IntPtr L, int stackPos)\n        {\n            LuaTypes type = LuaDLL.lua_type(L, stackPos);\n\n            if (type == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.lua_pushvalue(L, stackPos);\n            int reference = LuaDLL.toluaL_ref(L);\n            return LuaStatic.GetFunction(L, reference);\n        }\n\n        public static LuaTable ToLuaTable(IntPtr L, int stackPos)\n        {\n            LuaTypes type = LuaDLL.lua_type(L, stackPos);\n\n            if (type == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.lua_pushvalue(L, stackPos);\n            int reference = LuaDLL.toluaL_ref(L);\n            return LuaStatic.GetTable(L, reference);\n        }\n\n        public static LuaThread ToLuaThread(IntPtr L, int stackPos)\n        {\n            LuaTypes type = LuaDLL.lua_type(L, stackPos);\n\n            if (type == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.lua_pushvalue(L, stackPos);\n            int reference = LuaDLL.toluaL_ref(L);\n            return LuaStatic.GetLuaThread(L, reference);\n        }\n\n        public static Vector3 ToVector3(IntPtr L, int stackPos)\n        {\n            float x = 0, y = 0, z = 0;\n            LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z);\n            return new Vector3(x, y, z);\n        }\n\n        public static Vector4 ToVector4(IntPtr L, int stackPos)\n        {\n            float x, y, z, w;\n            LuaDLL.tolua_getvec4(L, stackPos, out x, out y, out z, out w);\n            return new Vector4(x, y, z, w);\n        }\n\n        public static Vector2 ToVector2(IntPtr L, int stackPos)\n        {\n            float x, y;\n            LuaDLL.tolua_getvec2(L, stackPos, out x, out y);\n            return new Vector2(x, y);\n        }\n\n        public static Quaternion ToQuaternion(IntPtr L, int stackPos)\n        {\n            float x, y, z, w;\n            LuaDLL.tolua_getquat(L, stackPos, out x, out y, out z, out w);\n            return new Quaternion(x, y, z, w);\n        }\n\n        public static Color ToColor(IntPtr L, int stackPos)\n        {\n            float r, g, b, a;\n            LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a);\n            return new Color(r, g, b, a);\n        }\n\n        public static Color32 ToColor32(IntPtr L, int stackPos)\n        {\n            float r, g, b, a;\n            LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a);\n            return new Color32((byte)r, (byte)g, (byte)b, (byte)a);\n        }\n\n        public static Ray ToRay(IntPtr L, int stackPos)\n        {\n            int top = LuaDLL.lua_gettop(L);\n            LuaStatic.GetUnpackRayRef(L);\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.lua_pushvalue(L, stackPos);\n\n            if (LuaDLL.lua_pcall(L, 1, 6, 0) == 0)\n            {            \n                float ox = (float)LuaDLL.lua_tonumber(L, top + 1);\n                float oy = (float)LuaDLL.lua_tonumber(L, top + 2);\n                float oz = (float)LuaDLL.lua_tonumber(L, top + 3);\n                float dx = (float)LuaDLL.lua_tonumber(L, top + 4);\n                float dy = (float)LuaDLL.lua_tonumber(L, top + 5);\n                float dz = (float)LuaDLL.lua_tonumber(L, top + 6);\n                LuaDLL.lua_settop(L, top);\n                return new Ray(new Vector3(ox, oy, oz), new Vector3(dx, dy, dz));\n            }\n            else\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                LuaDLL.lua_settop(L, top);\n                throw new LuaException(error);\n            }\n        }\n\n        public static Bounds ToBounds(IntPtr L, int stackPos)\n        {\n            int top = LuaDLL.lua_gettop(L);\n            LuaStatic.GetUnpackBounds(L);\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            LuaDLL.lua_pushvalue(L, stackPos);\n\n            if (LuaDLL.lua_pcall(L, 1, 2, 0) == 0)\n            {\n                Vector3 center = ToVector3(L, top + 1);\n                Vector3 size = ToVector3(L, top + 2);\n                LuaDLL.lua_settop(L, top);\n                return new Bounds(center, size);\n            }\n            else\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                LuaDLL.lua_settop(L, top);\n                throw new LuaException(error);\n            }\n        }\n\n        public static LayerMask ToLayerMask(IntPtr L, int stackPos)\n        {\n            return LuaDLL.tolua_getlayermask(L, stackPos);\n        }\n\n        public static object ToVarObject(IntPtr L, int stackPos)\n        {\n            LuaTypes type = LuaDLL.lua_type(L, stackPos);\n\n            switch (type)\n            {\n                case LuaTypes.LUA_TNUMBER:                    \n                    return LuaDLL.lua_tonumber(L, stackPos);\n                case LuaTypes.LUA_TSTRING:\n                    return LuaDLL.lua_tostring(L, stackPos);\n                case LuaTypes.LUA_TUSERDATA:                    \n                    switch(LuaDLL.tolua_getvaluetype(L, stackPos))\n                    {                                                    \n                        case LuaValueType.Int64:\n                            return LuaDLL.tolua_toint64(L, stackPos);\n                        case LuaValueType.UInt64:\n                            return LuaDLL.tolua_touint64(L, stackPos);\n                        default:\n                            return ToObject(L, stackPos);\n                    }\n                case LuaTypes.LUA_TBOOLEAN:\n                    return LuaDLL.lua_toboolean(L, stackPos);\n                case LuaTypes.LUA_TFUNCTION:\n                    return ToLuaFunction(L, stackPos);\n                case LuaTypes.LUA_TTABLE:\n                    return ToVarTable(L, stackPos);\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TLIGHTUSERDATA:\n                    return LuaDLL.lua_touserdata(L, stackPos);\n                case LuaTypes.LUA_TTHREAD:\n                    return ToLuaThread(L, stackPos);\n                default:\n                    return null;\n            }\n        }\n\n        //for Generic Array and List, 转换double为指定type在存入object\n        public static object ToVarObject(IntPtr L, int stackPos, Type t)\n        {\n            LuaTypes type = LuaDLL.lua_type(L, stackPos);\n\n            if (type == LuaTypes.LUA_TNUMBER)\n            {\n                object o = LuaDLL.lua_tonumber(L, stackPos);\n                o = Convert.ChangeType(o, t);\n                return o;\n            }\n\n            return ToVarObject(L, stackPos);\n        }\n\n        public static object ToVarTable(IntPtr L, int stackPos)\n        {\n            stackPos = LuaDLL.abs_index(L, stackPos);\n            int ret = LuaDLL.tolua_getvaluetype(L, stackPos);\n            LuaTableToVar _ToObject = ToVarMap[ret];\n\n            if (_ToObject != null)\n            {\n                return _ToObject(L, stackPos);\n            }\n            else\n            {\n                LuaDLL.lua_pushvalue(L, stackPos);\n                int reference = LuaDLL.toluaL_ref(L);\n                return LuaStatic.GetTable(L, reference);\n            }\n        }\n\n        public static Nullable<T> ToNullable<T>(IntPtr L, int stackPos) where T : struct\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return StackTraits<T>.To(L, stackPos);\n        }\n\n        static object ToObjectVec3(IntPtr L, int stackPos)\n        {\n            return ToVector3(L, stackPos);\n        }\n\n        static object ToObjectQuat(IntPtr L, int stackPos)\n        {\n            return ToQuaternion(L, stackPos);\n        }\n\n        static object ToObjectColor(IntPtr L, int stackPos)\n        {\n            return ToColor(L, stackPos);\n        }\n        static object ToObjectColor32(IntPtr L, int stackPos)\n        {\n            return ToColor32(L, stackPos);\n        }\n\n        static object ToObjectVec4(IntPtr L, int stackPos)\n        {\n            return ToVector4(L, stackPos);\n        }\n\n        static object ToObjectVec2(IntPtr L, int stackPos)\n        {\n            return ToVector2(L, stackPos);\n        }\n\n        static object ToObjectRay(IntPtr L, int stackPos)\n        {\n            return ToRay(L, stackPos);\n        }\n\n        static object ToObjectLayerMask(IntPtr L, int stackPos)\n        {\n            return ToLayerMask(L, stackPos);\n        }\n\n        static object ToObjectBounds(IntPtr L, int stackPos)\n        {\n            return ToBounds(L, stackPos);\n        }\n      \n        public static IEnumerator ToIEnumerator(IntPtr L, int stackPos) \n        {\n            var luaTable = ToLuaTable(L, stackPos);\n            if (luaTable != null) \n            {\n                return CSharpLua.LuaIEnumerator.Create(luaTable);\n            }\n            return (IEnumerator)ToObject(L, 2);\n        }\n\n        public static LuaFunction CheckLuaFunction(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TFUNCTION:\n                    stackPos = LuaDLL.abs_index(L, stackPos);\n                    LuaDLL.lua_pushvalue(L, stackPos);\n                    int reference = LuaDLL.toluaL_ref(L);\n                    return LuaStatic.GetFunction(L, reference);\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"function\");\n                    return null;\n            }\n        }\n\n        public static LuaTable CheckLuaTable(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    stackPos = LuaDLL.abs_index(L, stackPos);\n                    LuaDLL.lua_pushvalue(L, stackPos);\n                    int reference = LuaDLL.toluaL_ref(L);\n                    return LuaStatic.GetTable(L, reference);\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"table\");\n                    return null;\n            }\n        }\n\n        public static LuaThread CheckLuaThread(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTHREAD:\n                    stackPos = LuaDLL.abs_index(L, stackPos);\n                    LuaDLL.lua_pushvalue(L, stackPos);\n                    int reference = LuaDLL.toluaL_ref(L);\n                    return LuaStatic.GetLuaThread(L, reference);\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"thread\");\n                    return null;\n            }\n        }\n\n        public static LuaBaseRef CheckLuaBaseRef(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TFUNCTION:\n                    stackPos = LuaDLL.abs_index(L, stackPos);\n                    LuaDLL.lua_pushvalue(L, stackPos);\n                    int ref1 = LuaDLL.toluaL_ref(L);\n                    return LuaStatic.GetFunction(L, ref1);\n                case LuaTypes.LUA_TTABLE:\n                    stackPos = LuaDLL.abs_index(L, stackPos);\n                    LuaDLL.lua_pushvalue(L, stackPos);\n                    int ref2 = LuaDLL.toluaL_ref(L);\n                    return LuaStatic.GetTable(L, ref2);\n                case LuaTypes.LUA_TTHREAD:\n                    stackPos = LuaDLL.abs_index(L, stackPos);\n                    LuaDLL.lua_pushvalue(L, stackPos);\n                    int ref3 = LuaDLL.toluaL_ref(L);\n                    return LuaStatic.GetLuaThread(L, ref3);\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"function or table or thread\");\n                    return null;\n            }\n        }\n\n        public static string CheckString(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TNUMBER:\n                    return LuaDLL.lua_tostring(L, stackPos);\n                case LuaTypes.LUA_TSTRING:\n                    return LuaDLL.lua_tostring(L, stackPos);\n                case LuaTypes.LUA_TUSERDATA:\n                    int udata = LuaDLL.tolua_rawnetobj(L, stackPos);                    \n\n                    if (udata != -1)\n                    {\n                        ObjectTranslator translator = ObjectTranslator.Get(L);\n                        object obj = translator.GetObject(udata);\n\n                        if (obj != null)\n                        {                            \n                            if (obj is string)\n                            {\n                                return (string)obj;\n                            }\n\n                            LuaDLL.luaL_argerror(L, stackPos, string.Format(\"string expected, got {0}\", obj.GetType().FullName));\n                        }\n\n                        return null;\n                    }\n\n                    break;\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, \"string\");\n            return null;\n        }\n\n        public static IntPtr CheckIntPtr(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return IntPtr.Zero;\n                case LuaTypes.LUA_TLIGHTUSERDATA:\n                    return LuaDLL.lua_touserdata(L, stackPos);\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"IntPtr\");\n                    return IntPtr.Zero;\n            }\n        }\n\n        static public Type CheckMonoType(IntPtr L, int stackPos)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                object obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {\n                    if (obj is Type)\n                    {\n                        return (Type)obj;\n                    }\n\n                    LuaDLL.luaL_argerror(L, stackPos, string.Format(\"Type expected, got {0}\", obj.GetType().FullName));\n                }\n\n                return null;\n            }\n            else if (LuaDLL.lua_isnil(L, stackPos))\n            {\n                return null;\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, \"Type\");\n            return null;\n        }\n\n        public static IEnumerator CheckIter(IntPtr L, int stackPos)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                object obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {                    \n                    if (obj is IEnumerator)\n                    {\n                        return (IEnumerator)obj;\n                    }\n\n                    LuaDLL.luaL_argerror(L, stackPos, string.Format(\"Type expected, got {0}\", obj.GetType().FullName));\n                }\n\n                return null;\n            }\n            else if (LuaDLL.lua_isnil(L, stackPos))\n            {\n                return null;\n            }\n            else \n            {\n                var luaTable = ToLuaTable(L, stackPos);\n                if (luaTable != null) \n                {\n                    return CSharpLua.LuaIEnumerator.Create(luaTable);\n                }\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, \"Type\");\n            return null;\n        }\n\n        public static object CheckObject(IntPtr L, int stackPos)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                return translator.GetObject(udata);\n            }\n            else if (LuaDLL.lua_isnil(L, stackPos))\n            {\n                return null;\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, \"object\");\n            return null;\n        }\n\n        public static object CheckObject(IntPtr L, int stackPos, Type type)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                object obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {\n                    Type objType = obj.GetType();\n\n                    if (type == objType || type.IsAssignableFrom(objType))\n                    {\n                        return obj;\n                    }\n\n                    LuaDLL.luaL_argerror(L, stackPos, string.Format(\"{0} expected, got {1}\", LuaMisc.GetTypeName(type), LuaMisc.GetTypeName(objType)));\n                }\n\n                return null;\n            }\n            else if (LuaDLL.lua_isnil(L, stackPos))\n            {\n                return null;\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, LuaMisc.GetTypeName(type));\n            return null;\n        }\n\n        public static object CheckObject<T>(IntPtr L, int stackPos) where T : class\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                object obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {\n                    if (obj is T)\n                    {\n                        return obj;\n                    }\n\n                    Type objType = obj.GetType();\n                    LuaDLL.luaL_argerror(L, stackPos, string.Format(\"{0} expected, got {1}\", TypeTraits<T>.GetTypeName(), objType.FullName));\n                }\n\n                return null;\n            }\n            else if (LuaDLL.lua_isnil(L, stackPos))\n            {\n                return null;\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, TypeTraits<T>.GetTypeName());\n            return null;\n        }\n\n        static public Vector3 CheckVector3(IntPtr L, int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Vector3)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"Vector3\", LuaValueTypeName.Get(type));\n                return Vector3.zero;\n            }\n\n            float x, y, z;\n            LuaDLL.tolua_getvec3(L, stackPos, out x, out y, out z);\n            return new Vector3(x, y, z);\n        }\n\n        static public Quaternion CheckQuaternion(IntPtr L, int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Quaternion)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"Quaternion\", LuaValueTypeName.Get(type));\n                return Quaternion.identity;\n            }\n\n            float x, y, z, w;\n            LuaDLL.tolua_getquat(L, stackPos, out x, out y, out z, out w);\n            return new Quaternion(x, y, z, w);\n        }\n\n        static public Vector2 CheckVector2(IntPtr L, int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Vector2)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"Vector2\", LuaValueTypeName.Get(type));\n                return Vector2.zero;\n            }\n\n            float x, y;\n            LuaDLL.tolua_getvec2(L, stackPos, out x, out y);\n            return new Vector2(x, y);\n        }\n\n        static public Vector4 CheckVector4(IntPtr L, int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Vector4)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"Vector4\", LuaValueTypeName.Get(type));\n                return Vector4.zero;\n            }\n\n            float x, y, z, w;\n            LuaDLL.tolua_getvec4(L, stackPos, out x, out y, out z, out w);\n            return new Vector4(x, y, z, w);\n        }\n\n        static public Color CheckColor(IntPtr L, int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Color)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"Color\", LuaValueTypeName.Get(type));\n                return Color.black;\n            }\n\n            float r, g, b, a;\n            LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a);\n            return new Color(r, g, b, a);\n        }\n\n        static public Color32 CheckColor32(IntPtr L, int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Color32)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"Color32\", LuaValueTypeName.Get(type));\n                return new Color32();\n            }\n\n            float r, g, b, a;\n            LuaDLL.tolua_getclr(L, stackPos, out r, out g, out b, out a);\n            return new Color32((byte)r, (byte)g, (byte)b, (byte)a);\n        }\n        static public Ray CheckRay(IntPtr L, int stackPos)\n        {            \n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Ray)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"Ray\", LuaValueTypeName.Get(type));\n                return new Ray();\n            }\n\n            return ToRay(L, stackPos);\n        }\n\n        static public Bounds CheckBounds(IntPtr L, int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.Bounds)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"Bounds\", LuaValueTypeName.Get(type));\n                return new Bounds();\n            }\n\n            return ToBounds(L, stackPos);\n        }\n\n        static public LayerMask CheckLayerMask(IntPtr L, int stackPos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, stackPos);\n\n            if (type != LuaValueType.LayerMask)\n            {\n                LuaDLL.luaL_typerror(L, stackPos, \"LayerMask\", LuaValueTypeName.Get(type));\n                return 0;\n            }\n\n            return LuaDLL.tolua_getlayermask(L, stackPos);\n        }\n\n        public static T CheckValue<T>(IntPtr L, int stackPos) where T : struct\n        {\n            return StackTraits<T>.Check(L, stackPos);\n        }\n\n        public static Nullable<T> CheckNullable<T>(IntPtr L, int stackPos) where T : struct\n        {\n            if (LuaDLL.lua_type(L, stackPos) == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            return StackTraits<T>.Check(L, stackPos);\n        }\n\n        public static object CheckVarObject(IntPtr L, int stackPos, Type t)\n        {\n            bool beValue = TypeChecker.IsValueType(t);            \n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            if (!beValue && luaType == LuaTypes.LUA_TNIL)\n            {\n                return null;\n            }\n\n            TypeCode code = Type.GetTypeCode(t);\n            switch (code) {\n              case TypeCode.Boolean: {\n                return LuaDLL.luaL_checkboolean(L, stackPos);\n              }\n              case TypeCode.Char:\n              case TypeCode.SByte:\n              case TypeCode.Byte:\n              case TypeCode.Int16:\n              case TypeCode.UInt16:\n              case TypeCode.Int32:\n              case TypeCode.UInt32:\n              case TypeCode.Int64:\n              case TypeCode.UInt64:\n              case TypeCode.Single:\n              case TypeCode.Double: {\n                double d = LuaDLL.luaL_checknumber(L, stackPos);\n                return Convert.ChangeType(d, t);\n              }\n              case TypeCode.String: {\n                return CheckString(L, stackPos);\n              }\n            }\n\n            if (beValue)\n            {\n                if (TypeChecker.IsNullable(t))\n                {\n                    if (luaType == LuaTypes.LUA_TNIL)\n                    {\n                        return null;\n                    }\n\n                    Type[] ts = t.GetGenericArguments();\n                    t = ts[0];\n                }\n\n                if (t == typeof(bool))\n                {\n                    return LuaDLL.luaL_checkboolean(L, stackPos);\n                }\n                else if (t == typeof(long))\n                {\n                    return LuaDLL.tolua_checkint64(L, stackPos);\n                }\n                else if (t == typeof(ulong))\n                {\n                    return LuaDLL.tolua_checkuint64(L, stackPos);\n                }\n                else if (t.IsPrimitive)\n                {\n                    double d = LuaDLL.luaL_checknumber(L, stackPos);\n                    return Convert.ChangeType(d, t);\n                }\n                else if (t == typeof(LuaByteBuffer))\n                {\n                    int len = 0;\n                    IntPtr source = LuaDLL.tolua_tolstring(L, stackPos, out len);\n                    return new LuaByteBuffer(source, len);\n                }\n                else if (t == typeof(Vector3))\n                {\n                    return CheckVector3(L, stackPos);\n                }\n                else if (t == typeof(Quaternion))\n                {\n                    return CheckQuaternion(L, stackPos);\n                }\n                else if (t == typeof(Vector2))\n                {\n                    return CheckVector2(L, stackPos);\n                }\n                else if (t == typeof(Vector4))\n                {\n                    return CheckVector4(L, stackPos);\n                }\n                else if (t == typeof(Color))\n                {\n                    return CheckColor(L, stackPos);\n                }\n                else if (t == typeof(Color32))\n                {\n                    return CheckColor32(L, stackPos);\n                }\n                else if (t == typeof(Ray))\n                {\n                    return CheckRay(L, stackPos);\n                }\n                else if (t == typeof(Bounds))\n                {\n                    return CheckBounds(L, stackPos);\n                }\n                else if (t == typeof(LayerMask))\n                {\n                    return CheckLayerMask(L, stackPos);\n                }\n                else\n                {\n                    if (luaType == LuaTypes.LUA_TTABLE)\n                    {\n                        object o = ToVarTable(L, stackPos);\n\n                        if (o.GetType() != t)\n                        {\n                            LuaDLL.luaL_typerror(L, stackPos, LuaMisc.GetTypeName(t));\n                        }\n\n                        return o;\n                    }\n                    else\n                    {\n                        return CheckObject(L, stackPos, t);\n                    }\n                }\n            }\n            else\n            {\n                if (t.IsEnum)\n                {\n                    return ToLua.CheckObject(L, stackPos, t);\n                }\n                else if (t == typeof(string))\n                {\n                    return CheckString(L, stackPos);\n                }\n                else\n                {\n                    return CheckObject(L, stackPos, t);\n                }\n            }\n        }\n\n        public static UnityEngine.Object CheckUnityObject(IntPtr L, int stackPos, Type type)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n            object obj = null;\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {\n                    UnityEngine.Object uObj = (UnityEngine.Object)obj;\n\n                    if (uObj == null)\n                    {\n                        LuaDLL.luaL_argerror(L, stackPos, string.Format(\"{0} expected, got nil\", type.FullName));\n                        return null;\n                    }\n\n                    Type objType = uObj.GetType();\n\n                    if (type == objType || objType.IsSubclassOf(type))\n                    {\n                        return uObj;\n                    }\n\n                    LuaDLL.luaL_argerror(L, stackPos, string.Format(\"{0} expected, got {1}\", type.FullName, objType.FullName));\n                }\n\n                //传递了tolua.null过来\n                return null;\n            }\n            else if (LuaDLL.lua_isnil(L, stackPos))\n            {\n                return null;\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, type.FullName);\n            return null;\n        }\n\n        public static UnityEngine.TrackedReference CheckTrackedReference(IntPtr L, int stackPos, Type type)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n            object obj = null;\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {                    \n                    UnityEngine.TrackedReference uObj = (UnityEngine.TrackedReference)obj;\n\n                    if (uObj == null)\n                    {\n                        LuaDLL.luaL_argerror(L, stackPos, string.Format(\"{0} expected, got nil\", type.FullName));\n                        return null;\n                    }\n\n                    Type objType = uObj.GetType();\n\n                    if (type == objType || objType.IsSubclassOf(type))\n                    {\n                        return uObj;\n                    }\n\n                    LuaDLL.luaL_argerror(L, stackPos, string.Format(\"{0} expected, got {1}\", type.FullName, objType.FullName));\n                }\n\n                return null;\n            }\n            else if (LuaDLL.lua_isnil(L, stackPos))\n            {\n                return null;\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, type.FullName);\n            return null;\n        }\n\n        //必须检测类型\n        public static object[] CheckObjectArray(IntPtr L, int stackPos)\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch (luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    object[] list = new object[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n                        list[i - 1] = ToVarObject(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (object[])CheckObject(L, stackPos, typeof(object[]));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"object[] or table\");\n                    return null;\n            }\n        }\n\n        public static T[] CheckObjectArray<T>(IntPtr L, int stackPos) where T : class\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch(luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    T[] list = new T[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n\n                        if (!TypeTraits<T>.Check(L, pos))\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, typeof(T[]).FullName);\n                            return list;\n                        }\n\n                        list[i - 1] = StackTraits<T>.To(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (T[])CheckObject(L, stackPos, typeof(T[]));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, TypeTraits<T[]>.GetTypeName());\n                    return null;\n            }\n        }\n\n        public static T[] CheckStructArray<T>(IntPtr L, int stackPos) where T : struct\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch (luatype)\n            {\n                case LuaTypes.LUA_TTABLE:                    \n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    T[] list = new T[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);                        \n\n                        if (!TypeTraits<T>.Check(L, pos))\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, typeof(T[]).FullName);\n                            return list;\n                        }\n                        \n                        list[i-1] = StackTraits<T>.To(L, pos);\n                        LuaDLL.lua_pop(L, 1);                        \n                    }\n                    return list;       \n                case LuaTypes.LUA_TUSERDATA:\n                    return (T[])CheckObject(L, stackPos, typeof(T[]));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, TypeTraits<T[]>.GetTypeName());\n                    return null;\n            }\n        }\n\n        public static char[] CheckCharBuffer(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);            \n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TSTRING:\n                    string str = LuaDLL.lua_tostring(L, stackPos);\n                    return str.ToCharArray(); ;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (char[])CheckObject(L, stackPos, typeof(char[]));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"string or char[]\");\n                    return null;\n            }\n        }\n\n        public static byte[] CheckByteBuffer(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TSTRING:\n                    int len;\n                    IntPtr source = LuaDLL.lua_tolstring(L, stackPos, out len);\n                    byte[] buffer = new byte[len];\n                    Marshal.Copy(source, buffer, 0, len);\n                    return buffer;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (byte[])CheckObject(L, stackPos, typeof(byte[]));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"string or byte[]\");\n                    return null;\n            }\n        }\n\n        public static T[] CheckNumberArray<T>(IntPtr L, int stackPos) where T : struct\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch(luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:                    \n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    T[] list = new T[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);                        \n\n                        if (!TypeTraits<T>.Check(L, pos))\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, TypeTraits<T[]>.GetTypeName());\n                            return list;\n                        }\n\n                        list[i - 1] = StackTraits<T>.To(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (T[])CheckObject(L, stackPos, typeof(T[]));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, TypeTraits<T[]>.GetTypeName());\n                    return null;\n            }\n        }\n        \n\n        public static bool[] CheckBoolArray(IntPtr L, int stackPos)\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch(luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    bool[] list = new bool[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n\n                        if (LuaDLL.lua_type(L, pos) != LuaTypes.LUA_TBOOLEAN)\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, \"bool[]\");\n                            return list;\n                        }\n\n                        list[i - 1] = LuaDLL.lua_toboolean(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (bool[])CheckObject(L, stackPos, typeof(bool[]));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"bool[]\");\n                    return null;\n            }                 \n        }\n\n        public static string[] CheckStringArray(IntPtr L, int stackPos)\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch(luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    string[] list = new string[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n\n                        if (!TypeTraits<string>.Check(L, pos))\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, \"string[]\");\n                            return list;\n                        }\n\n                        list[i - 1] = StackTraits<string>.To(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (string[])CheckObject(L, stackPos, typeof(string[]));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, \"string[]\");\n                    return null;\n            }\n        }\n\n        public static object CheckGenericObject(IntPtr L, int stackPos, Type type, out Type ArgType)\n        {\n            object obj = ToLua.ToObject(L, 1);\n            Type t = obj.GetType();\n            ArgType = null;\n\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == type)\n            {\n                Type[] ts = t.GetGenericArguments();\n                ArgType = ts[0];\n                return obj;\n            }\n\n            LuaDLL.luaL_argerror(L, stackPos, LuaMisc.GetTypeName(type));\n            return null;\n        }\n\n        public static object CheckGenericObject(IntPtr L, int stackPos, Type type, out Type t1, out Type t2)\n        {\n            object obj = ToLua.ToObject(L, 1);\n            Type t = obj.GetType();\n            t1 = null;\n            t2 = null;\n\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == type)\n            {\n                Type[] ts = t.GetGenericArguments();\n                t1 = ts[0];\n                t2 = ts[1];\n                return obj;\n            }\n\n            LuaDLL.luaL_argerror(L, stackPos, LuaMisc.GetTypeName(type));\n            return null;\n        }\n\n        public static object CheckGenericObject(IntPtr L, int stackPos, Type type)\n        {\n            object obj = ToLua.ToObject(L, 1);\n            Type t = obj.GetType();\n\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == type)\n            {\n                return obj;\n            }\n\n            LuaDLL.luaL_argerror(L, stackPos, LuaMisc.GetTypeName(type));\n            return null;\n        }\n\n        public static object[] ToParamsObject(IntPtr L, int stackPos, int count)\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            object[] list = new object[count];\n            int pos = 0;\n\n            while (pos < count)\n            {\n                list[pos++] = ToVarObject(L, stackPos++);                                                \n            }\n\n            return list;\n        }\n\n        public static T[] ToParamsObject<T>(IntPtr L, int stackPos, int count)\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            T[] list = new T[count];            \n            int pos = 0; \n\n            while (pos < count)\n            {\n                list[pos++] = StackTraits<T>.To(L, stackPos++);                 \n            }\n\n            return list;\n        }\n\n        public static string[] ToParamsString(IntPtr L, int stackPos, int count)\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            string[] list = new string[count];\n            int pos = 0;   \n\n            while (pos < count)\n            {\n                list[pos++] = ToString(L, stackPos++);                       \n            }\n\n            return list;\n        }\n\n        public static T[] ToParamsNumber<T>(IntPtr L, int stackPos, int count) where T : struct\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            T[] list = new T[count];            \n            int pos = 0;       \n\n            while (pos < count)\n            {                                \n                list[pos++] = StackTraits<T>.To(L, stackPos++);\n            }\n\n            return list;\n        }\n\n        public static char[] ToParamsChar(IntPtr L, int stackPos, int count)\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            char[] list = new char[count];\n            int pos = 0;\n\n            while (pos < count)\n            {\n                list[pos++] = (char)LuaDLL.lua_tointeger(L, stackPos++);                                 \n            }\n\n            return list;\n        }\n\n        public static bool[] CheckParamsBool(IntPtr L, int stackPos, int count)\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            bool[] list = new bool[count];\n            int pos = 0;\n\n            while (pos < count)\n            {\n                list[pos++] = LuaDLL.luaL_checkboolean(L, stackPos++);                \n            }\n\n            return list;\n        }\n\n        public static T[] CheckParamsNumber<T>(IntPtr L, int stackPos, int count) where T : struct\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            T[] list = new T[count];                                    \n            int pos = 0;\n\n            while (pos < count)\n            {                                \n                list[pos++] = StackTraits<T>.Check(L, stackPos++);\n            }\n\n            return list;\n        }\n\n        public static char[] CheckParamsChar(IntPtr L, int stackPos, int count)\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            char[] list = new char[count];\n            int pos = 0;\n\n            while (pos < count)\n            {\n                list[pos++] = (char)LuaDLL.luaL_checkinteger(L, stackPos++);                \n            }\n\n            return list;\n        }\n\n        public static string[] CheckParamsString(IntPtr L, int stackPos, int count)\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            string[] list = new string[count];                        \n            int pos = 0;\n\n            while (pos < count)\n            {\n                list[pos++] = CheckString(L, stackPos++);                                                \n            }\n\n            return list;\n        }\n\n        public static T[] CheckParamsObject<T>(IntPtr L, int stackPos, int count)\n        {\n            if (count <= 0)\n            {\n                return null;\n            }\n\n            T[] list = new T[count];            \n            int pos = 0;\n\n            while (pos < count)\n            {                \n                list[pos++] = StackTraits<T>.Check(L, stackPos++);\n            }\n\n            return list;\n        }\n\n        static public char[] ToCharBuffer(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TSTRING:\n                    string str = LuaDLL.lua_tostring(L, stackPos);\n                    return str.ToCharArray();\n                case LuaTypes.LUA_TUSERDATA:\n                    return (char[])ToObject(L, stackPos);\n                default:                    \n                    return null;\n            }\n        }\n\n        static public byte[] ToByteBuffer(IntPtr L, int stackPos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, stackPos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TSTRING:\n                    int len;\n                    IntPtr source = LuaDLL.lua_tolstring(L, stackPos, out len);\n                    byte[] buffer = new byte[len];\n                    Marshal.Copy(source, buffer, 0, len);\n                    return buffer;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (byte[])ToObject(L, stackPos);\n                default:                    \n                    return null;\n            }\n        }\n\n        public static T[] ToNumberArray<T>(IntPtr L, int stackPos) where T : struct\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch (luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    T[] list = new T[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n\n                        if (!TypeTraits<T>.Check(L, pos))\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, TypeTraits<T[]>.GetTypeName());\n                            return list;\n                        }\n\n                        list[i - 1] = StackTraits<T>.To(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (T[])ToObject(L, stackPos);\n                default:\n                    return null;\n            }\n        }\n\n        public static bool[] ToBoolArray(IntPtr L, int stackPos)\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch (luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    bool[] list = new bool[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n\n                        if (LuaDLL.lua_type(L, pos) != LuaTypes.LUA_TBOOLEAN)\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, \"bool[]\");\n                            return list;\n                        }\n\n                        list[i - 1] = LuaDLL.lua_toboolean(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (bool[])ToObject(L, stackPos);\n                default:\n                    return null;\n            }\n        }\n\n\n        public static string[] ToStringArray(IntPtr L, int stackPos)\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch(luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    string[] list = new string[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n\n                        if (!TypeTraits<string>.Check(L, pos))\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, \"string[]\");\n                            return list;\n                        }\n\n                        list[i - 1] = StackTraits<string>.To(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (string[])ToObject(L, stackPos);\n                default:\n                    return null;\n            }                    \n        }\n\n        public static object[] ToObjectArray(IntPtr L, int stackPos)\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch(luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    object[] list = new object[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n                        list[i - 1] = ToVarObject(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (object[])ToObject(L, stackPos);\n                default:\n                    return null;\n            }\n        }\n\n\n        public static T[] ToObjectArray<T>(IntPtr L, int stackPos) where T : class\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch (luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    T[] list = new T[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n\n                        if (!TypeTraits<T>.Check(L, pos))\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, typeof(T[]).FullName);\n                            return list;\n                        }\n\n                        list[i - 1] = StackTraits<T>.To(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (T[])ToObject(L, stackPos);\n                default:\n                    return null;\n            }\n        }\n\n\n        public static T[] ToStructArray<T>(IntPtr L, int stackPos) where T : struct\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch (luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TTABLE:\n                    int len = LuaDLL.lua_objlen(L, stackPos);\n                    T[] list = new T[len];\n                    int pos = LuaDLL.lua_gettop(L) + 1;\n\n                    for (int i = 1; i <= len; i++)\n                    {\n                        LuaDLL.lua_rawgeti(L, stackPos, i);\n\n                        if (!TypeTraits<T>.Check(L, pos))\n                        {\n                            LuaDLL.lua_pop(L, 1);\n                            LuaDLL.luaL_typerror(L, stackPos, typeof(T[]).FullName);\n                            return list;\n                        }\n\n                        list[i - 1] = StackTraits<T>.To(L, pos);\n                        LuaDLL.lua_pop(L, 1);\n                    }\n                    return list;\n                case LuaTypes.LUA_TUSERDATA:\n                    return (T[])ToObject(L, stackPos);\n                default:\n                    return null;\n            }\n        }\n\n\n        public static void Push(IntPtr L, Vector3 v3)\n        {\n            LuaDLL.tolua_pushvec3(L, v3.x, v3.y, v3.z);\n        }\n\n        public static void Push(IntPtr L, Vector2 v2)\n        {            \n            LuaDLL.tolua_pushvec2(L, v2.x, v2.y);\n        }\n\n        public static void Push(IntPtr L, Vector4 v4)\n        {            \n            LuaDLL.tolua_pushvec4(L, v4.x, v4.y, v4.z, v4.w);\n        }\n\n        public static void Push(IntPtr L, Quaternion q)\n        {            \n            LuaDLL.tolua_pushquat(L, q.x, q.y, q.z, q.w);\n        }\n\n        public static void Push(IntPtr L, Color clr)\n        {            \n            LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a);\n        }\n\n        public static void Push(IntPtr L, Color32 clr)\n        {\n            LuaDLL.tolua_pushclr(L, clr.r, clr.g, clr.b, clr.a);\n        }\n\n\n        public static void Push(IntPtr L, Ray ray)\n        {\n            LuaStatic.GetPackRay(L);\n            Push(L, ray.direction);\n            Push(L, ray.origin);\n\n            if (LuaDLL.lua_pcall(L, 2, 1, 0) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        public static void Push(IntPtr L, Bounds bound)\n        {                        \n            LuaStatic.GetPackBounds(L);\n            Push(L, bound.center);\n            Push(L, bound.size);\n\n            if (LuaDLL.lua_pcall(L, 2, 1, 0) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        public static void Push(IntPtr L, RaycastHit hit)\n        {            \n            LuaStatic.GetPackRaycastHit(L);\n            Push(L, hit.collider);\n            LuaDLL.lua_pushnumber(L, hit.distance);\n            Push(L, hit.normal);\n            Push(L, hit.point);\n            Push(L, hit.rigidbody);\n            Push(L, hit.transform);\n\n            if (LuaDLL.lua_pcall(L, 6, 1, 0) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        public static void Push(IntPtr L, RaycastHit hit, int flag)\n        {                        \n            LuaStatic.GetPackRaycastHit(L);\n\n            if ((flag & RaycastBits.Collider) != 0)\n            {\n                Push(L, hit.collider);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            LuaDLL.lua_pushnumber(L, hit.distance);\n\n            if ((flag & RaycastBits.Normal) != 0)\n            {\n                Push(L, hit.normal);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            if ((flag & RaycastBits.Point) != 0)\n            {\n                Push(L, hit.point);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            if ((flag & RaycastBits.Rigidbody) != 0)\n            {            \n                Push(L, hit.rigidbody);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            if ((flag & RaycastBits.Transform) != 0)\n            {\n                Push(L, hit.transform);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            if (LuaDLL.lua_pcall(L, 6, 1, 0) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        public static void Push(IntPtr L, Touch t)\n        {\n            Push(L, t, TouchBits.ALL);\n        }\n\n        public static void Push(IntPtr L, Touch t, int flag)\n        {                                    \n            LuaStatic.GetPackTouch(L);\n            LuaDLL.lua_pushinteger(L, t.fingerId);\n\n            if ((flag & TouchBits.Position) != 0)\n            {\n                Push(L, t.position);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            if ((flag & TouchBits.RawPosition) != 0)\n            {\n                Push(L, t.rawPosition);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            if ((flag & TouchBits.DeltaPosition) != 0)\n            {\n                Push(L, t.deltaPosition);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n\n            LuaDLL.lua_pushnumber(L, t.deltaTime);\n            LuaDLL.lua_pushinteger(L, t.tapCount);\n            LuaDLL.lua_pushinteger(L, (int)t.phase);\n\n            if (LuaDLL.lua_pcall(L, 7, -1, 0) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                throw new LuaException(error);\n            }\n        }\n\n        public static void PushLayerMask(IntPtr L, LayerMask l)\n        {\n            LuaDLL.tolua_pushlayermask(L, l.value);\n        }\n\n        public static void Push(IntPtr L, LuaByteBuffer bb)\n        {            \n            LuaDLL.lua_pushlstring(L, bb.buffer, bb.buffer.Length);\n        }\n\n        public static void PushByteBuffer(IntPtr L, byte[] buffer)\n        {\n            LuaDLL.tolua_pushlstring(L, buffer, buffer.Length);\n        }\n\n        public static void Push(IntPtr L, Array array)\n        {\n            if (array == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {                \n                int arrayMetaTable = LuaStatic.GetArrayMetatable(L);\n                PushUserData(L, array, arrayMetaTable);\n            }\n        }\n\n        public static void Push(IntPtr L, LuaBaseRef lbr)\n        {\n            if (lbr == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {                \n                LuaDLL.lua_getref(L, lbr.GetReference());\n            }\n        }\n\n        public static void Push(IntPtr L, Type t)\n        {\n            if (t == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                int typeMetatable = LuaStatic.GetTypeMetatable(L);\n                PushUserData(L, t, typeMetatable);\n            }\n        }\n\n        public static void Push(IntPtr L, Delegate ev)\n        {            \n            if (ev == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {                \n                int delegateMetatable = LuaStatic.GetDelegateMetatable(L);\n                PushUserData(L, ev, delegateMetatable);\n            }\n        }\n\n        public static void Push(IntPtr L, EventObject ev)\n        {\n            if (ev == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                int eventMetatable = LuaStatic.GetEventMetatable(L);                \n                PushUserData(L, ev, eventMetatable);\n            }\n        }\n\n        public static void Push(IntPtr L, IEnumerator iter)\n        {\n            if (iter == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else \n            {\n                var luaIEnumerator = iter as CSharpLua.LuaIEnumerator;\n                if (luaIEnumerator != null) \n                {\n                    luaIEnumerator.Push(L);\n                }\n                else \n                {\n                    int reference = LuaStatic.GetMetaReference(L, iter.GetType());\n                    if (reference > 0) \n                    {\n                        PushUserData(L, iter, reference);\n                    } \n                    else \n                    {\n                        int iterMetatable = LuaStatic.GetIterMetatable(L);\n                        PushUserData(L, iter, iterMetatable);\n                    }\n                }\n            }\n        }\n\n        public static void Push(IntPtr L, System.Enum e)\n        {\n            LuaDLL.lua_pushinteger(L, (int)(ValueType)e);\n        }\n\n        //基础类型获取需要一个函数\n        public static void PushOut<T>(IntPtr L, LuaOut<T> lo)\n        {\n            ObjectTranslator translator = ObjectTranslator.Get(L);\n            int index = translator.AddObject(lo);\n            LuaDLL.tolua_pushnewudata(L, LuaIndexes.LUA_REGISTRYINDEX, index);\n        }\n\n        public static void PushStruct(IntPtr L, object o)\n        {\n            if (o == null || o.Equals(null))\n            {\n                LuaDLL.lua_pushnil(L);\n                return;\n            }\n\n            if (o is Enum)\n            {\n                ToLua.Push(L, (Enum)o);\n                return;\n            }\n\n            Type type = o.GetType();\n            int reference = LuaStatic.GetMetaReference(L, type);            \n\n            if (reference <= 0)\n            {\n                reference = LoadPreType(L, type);\n            }\n\n            ObjectTranslator translator = ObjectTranslator.Get(L);\n            int index = translator.AddObject(o);\n            LuaDLL.tolua_pushnewudata(L, reference, index);\n        }\n\n        public static void PushValue<T>(IntPtr L, T v) where T : struct\n        {\n            StackTraits<T>.Push(L, v);\n        }\n\n        public static void PusNullable<T>(IntPtr L, Nullable<T> v) where T : struct\n        {\n            if (v == null)\n            {\n                LuaDLL.lua_pushnil(L);\n                return;\n            }\n\n            StackTraits<T>.Push(L, v.Value);\n        }\n\n        public static void PushUserData(IntPtr L, object o, int reference)\n        {\n            int index;\n            ObjectTranslator translator = ObjectTranslator.Get(L);\n\n            if (translator.Getudata(o, out index))\n            {\n                if (LuaDLL.tolua_pushudata(L, index))\n                {\n                    return;\n                }\n\n                translator.Destroyudata(index);\n            }\n\n            index = translator.AddObject(o);\n            LuaDLL.tolua_pushnewudata(L, reference, index);\n        }\n\n        static int LuaPCall(IntPtr L, LuaCSFunction func)\n        {\n            int top = LuaDLL.lua_gettop(L);\n            LuaDLL.tolua_pushcfunction(L, func);\n\n            if (LuaDLL.lua_pcall(L, 0, -1, 0) != 0)\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                LuaDLL.lua_settop(L, top);\n                throw new LuaException(error, LuaException.GetLastError());\n            }\n\n            int reference = LuaDLL.tolua_getclassref(L, -1);              \n            LuaDLL.lua_settop(L, top);\n            return reference;\n        }\n\n        public static int LoadPreType(IntPtr L, Type type)\n        {\n            LuaCSFunction LuaOpenLib = LuaStatic.GetPreModule(L, type);\n            int reference = -1;\n\n            if (LuaOpenLib != null)\n            {\n#if UNITY_EDITOR\n                Debugger.LogWarning(\"register PreLoad type {0} to lua\", LuaMisc.GetTypeName(type));\n#endif\n                reference = LuaPCall(L, LuaOpenLib);                \n            }\n            else\n            {\n                //类型未Wrap                            \n                reference = LuaStatic.GetMissMetaReference(L, type);                \n            }\n                        \n            return reference;\n        }\n        \n        //o 不为 null\n        static void PushUserObject(IntPtr L, object o)\n        {\n            Type type = o.GetType();\n            int reference = LuaStatic.GetMetaReference(L, type);\n\n            if (reference <= 0)\n            {\n                reference = LoadPreType(L, type);\n            }\n                        \n            PushUserData(L, o, reference);\n        }\n\n        public static void Push(IntPtr L, UnityEngine.Object obj)\n        {\n            if (obj == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                PushUserObject(L, obj);\n            }\n        }\n\n        public static void Push(IntPtr L, UnityEngine.TrackedReference obj)\n        {\n            if (obj == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                PushUserObject(L, obj);\n            }\n        }\n\n        public static void PushSealed<T>(IntPtr L, T o)\n        {\n            if (o == null || o.Equals(null))\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                int reference = TypeTraits<T>.GetLuaReference(L);\n\n                if (reference <= 0)\n                {\n                    reference = LoadPreType(L, o.GetType());\n                }\n\n                ToLua.PushUserData(L, o, reference);\n            }\n        }\n\n        public static void PushObject(IntPtr L, object o)\n        {\n            if (o == null || o.Equals(null))\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                if (o is Enum)\n                {\n                    ToLua.Push(L, (Enum)o);\n                }\n                else\n                {\n                    PushUserObject(L, o);\n                }\n            }\n        }\n\n        /*static void PushNull(IntPtr L)\n        {\n            LuaDLL.tolua_pushudata(L, 1);\n        }*/\n\n        public static void Push(IntPtr L, nil obj)\n        {\n            LuaDLL.lua_pushnil(L);\n        }\n\n        //PushVarObject\n        public static void Push(IntPtr L, object obj)\n        {\n            if (obj == null || obj.Equals(null))\n            {\n                LuaDLL.lua_pushnil(L);\n                return;\n            }\n\n            Type t = obj.GetType();\n            TypeCode code = Type.GetTypeCode(t);\n            switch (code) {\n              case TypeCode.Boolean: {\n                bool b = (bool)obj;\n                LuaDLL.lua_pushboolean(L, b);\n                return;\n              }\n              case TypeCode.Char: {\n                char ch = (char)obj;\n                LuaDLL.lua_pushnumber(L, ch);\n                return;\n              }\n              case TypeCode.SByte: {\n                LuaDLL.lua_pushnumber(L, (sbyte)obj);\n                return;\n              }\n              case TypeCode.Byte: {\n                LuaDLL.lua_pushnumber(L, (byte)obj);\n                return;\n              }\n              case TypeCode.Int16: {\n                LuaDLL.lua_pushnumber(L, (Int16)obj);\n                return;\n              }\n              case TypeCode.UInt16: {\n                LuaDLL.lua_pushnumber(L, (UInt16)obj);\n                return;\n              }\n              case TypeCode.Int32: {\n                LuaDLL.lua_pushnumber(L, (Int32)obj);\n                return;\n              }\n              case TypeCode.UInt32: {\n                LuaDLL.lua_pushnumber(L, (UInt32)obj);\n                return;\n              }\n              case TypeCode.Int64: {\n                LuaDLL.lua_pushnumber(L, (Int64)obj);\n                return;\n              }\n              case TypeCode.UInt64: {\n                LuaDLL.lua_pushnumber(L, (UInt64)obj);\n                return;\n              }\n              case TypeCode.Single: {\n                LuaDLL.lua_pushnumber(L, (Single)obj);\n                return; ;\n              }\n              case TypeCode.Double: {\n                LuaDLL.lua_pushnumber(L, (double)obj);\n                return;\n              }\n              case TypeCode.String: {\n                LuaDLL.lua_pushstring(L, (string)obj);\n                return;\n              }\n            }\n\n            if (t.IsValueType)\n            {\n                if (TypeChecker.IsNullable(t))\n                {\n                    Type[] ts = t.GetGenericArguments();\n                    t = ts[0];\n                }\n\n                if (t == typeof(bool))\n                {\n                    bool b = (bool)obj;\n                    LuaDLL.lua_pushboolean(L, b);\n                }\n                else if (obj is Enum)\n                {\n                    Push(L, (System.Enum)obj);\n                }\n                else if (t == typeof(long))\n                {\n                    LuaDLL.tolua_pushint64(L, (long)obj);\n                }\n                else if (t == typeof(ulong))\n                {\n                    LuaDLL.tolua_pushuint64(L, (ulong)obj);\n                }\n                else if (t.IsPrimitive)\n                {\n                    double d = LuaMisc.ToDouble(obj);\n                    LuaDLL.lua_pushnumber(L, d);\n                }\n                else if (t == typeof(LuaByteBuffer))\n                {\n                    LuaByteBuffer lbb = (LuaByteBuffer)obj;\n                    LuaDLL.lua_pushlstring(L, lbb.buffer, lbb.buffer.Length);\n                }\n                else if (t == typeof(Vector3))\n                {\n                    Push(L, (Vector3)obj);\n                }\n                else if (t == typeof(Quaternion))\n                {\n                    Push(L, (Quaternion)obj);\n                }\n                else if (t == typeof(Vector2))\n                {\n                    Push(L, (Vector2)obj);\n                }\n                else if (t == typeof(Vector4))\n                {\n                    Push(L, (Vector4)obj);\n                }\n                else if (t == typeof(Color))\n                {\n                    Push(L, (Color)obj);\n                }\n                else if (t == typeof(Color32))\n                {\n                    Push(L, (Color32)obj);\n                }\n                else if (t == typeof(RaycastHit))\n                {\n                    Push(L, (RaycastHit)obj);\n                }\n                else if (t == typeof(Touch))\n                {\n                    Push(L, (Touch)obj);\n                }\n                else if (t == typeof(Ray))\n                {\n                    Push(L, (Ray)obj);\n                }\n                else if (t == typeof(Bounds))\n                {\n                    Push(L, (Bounds)obj);\n                }\n                else if (t == typeof(LayerMask))\n                {\n                    PushLayerMask(L, (LayerMask)obj);\n                }\n                else\n                {\n                    LuaPushVarObject _Push = null;\n\n                    if (VarPushMap.TryGetValue(t, out _Push))\n                    {\n                        _Push(L, obj);\n                    }\n                    else\n                    {\n                        PushStruct(L, obj);\n                    }\n                }\n            }\n            else\n            {\n                if (t.IsArray)\n                {\n                    Push(L, (Array)obj);\n                }\n                else if(t == typeof(string))\n                {\n                    LuaDLL.lua_pushstring(L, (string)obj);\n                }\n                else if (obj is LuaBaseRef)\n                {\n                    Push(L, (LuaBaseRef)obj);\n                }\n                else if (obj is UnityEngine.Object)\n                {\n                    Push(L, (UnityEngine.Object)obj);\n                }\n                else if (obj is UnityEngine.TrackedReference)\n                {\n                    Push(L, (UnityEngine.TrackedReference)obj);\n                }\n                else if (obj is Delegate)\n                {\n                    Push(L, (Delegate)obj);\n                }\n                else if (obj is IEnumerator)\n                {\n                    Push(L, (IEnumerator)obj);\n                }\n                else if (t == typeof(EventObject))\n                {\n                    Push(L, (EventObject)obj);\n                }\n                else if (t == monoType)\n                {\n                    Push(L, (Type)obj);\n                }\n                else\n                {\n                    PushObject(L, obj);                    \n                }\n            }\n        }\n\n        public static void SetBack(IntPtr L, int stackPos, object o)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);\n            ObjectTranslator translator = ObjectTranslator.Get(L);\n\n            if (udata != -1)\n            {\n                translator.SetBack(udata, o);\n            }\n        }\n\n        public static int Destroy(IntPtr L)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, 1);\n            ObjectTranslator translator = ObjectTranslator.Get(L);\n            translator.Destroy(udata);\n            return 0;\n        }\n\n        public static void CheckArgsCount(IntPtr L, string method, int count)\n        {\n            int c = LuaDLL.lua_gettop(L);\n\n            if (c != count)\n            {\n                throw new LuaException(string.Format(\"no overload for method '{0}' takes '{1}' arguments\", method, c));\n            }\n        }\n\n        public static void CheckArgsCount(IntPtr L, int count)\n        {\n            int c = LuaDLL.lua_gettop(L);\n\n            if (c != count)\n            {\n                throw new LuaException(string.Format(\"no overload for method takes '{0}' arguments\", c));\n            }\n        }  \n\n        public static Delegate CheckDelegate(Type t, IntPtr L, int stackPos)\n        {                        \n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch (luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TFUNCTION:\n                case LuaTypes.LUA_TTABLE:\n                    LuaFunction func = ToLua.ToLuaFunction(L, stackPos);\n                    return DelegateFactory.CreateDelegate(t, func);\n                case LuaTypes.LUA_TUSERDATA:\n                    return (Delegate)ToLua.CheckObject(L, stackPos, t);\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, LuaMisc.GetTypeName(t));\n                    return null;                    \n            }\n        }\n\n        public static Delegate CheckDelegate<T>(IntPtr L, int stackPos)\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, stackPos);\n\n            switch (luatype)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return null;\n                case LuaTypes.LUA_TFUNCTION:\n                case LuaTypes.LUA_TTABLE:\n                    LuaFunction func = ToLua.ToLuaFunction(L, stackPos);\n                    return DelegateTraits<T>.Create(func);\n                case LuaTypes.LUA_TUSERDATA:\n                    return (Delegate)ToLua.CheckObject(L, stackPos, typeof(T));\n                default:\n                    LuaDLL.luaL_typerror(L, stackPos, TypeTraits<T>.GetTypeName());\n                    return null;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/ToLua.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8558028e53ff5d946b0ef857634815da\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/TypeChecker.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing System;\nusing System.Collections.Generic;\n\nnamespace LuaInterface\n{\n    public static class TypeChecker\n    {\n        public static Type[] LuaValueTypeMap = new Type[LuaValueType.Max];                \n\n        static TypeChecker()\n        {\n            LuaValueTypeMap[LuaValueType.None] = null;\n            LuaValueTypeMap[LuaValueType.Vector3] = typeof(Vector3);\n            LuaValueTypeMap[LuaValueType.Quaternion] = typeof(Quaternion);\n            LuaValueTypeMap[LuaValueType.Vector2] = typeof(Vector2);\n            LuaValueTypeMap[LuaValueType.Color] = typeof(Color);\n            LuaValueTypeMap[LuaValueType.Color32] = typeof(Color32);\n            LuaValueTypeMap[LuaValueType.Vector4] = typeof(Vector4);\n            LuaValueTypeMap[LuaValueType.Ray] = typeof(Ray);\n            LuaValueTypeMap[LuaValueType.Bounds] = typeof(Bounds);\n            LuaValueTypeMap[LuaValueType.Touch] = typeof(Touch);\n            LuaValueTypeMap[LuaValueType.LayerMask] = typeof(LayerMask);\n            LuaValueTypeMap[LuaValueType.RaycastHit] = typeof(RaycastHit);\n            LuaValueTypeMap[LuaValueType.Int64] = typeof(long);\n            LuaValueTypeMap[LuaValueType.UInt64] = typeof(ulong);\n        }        \n\n        public static bool IsValueType(Type t)\n        {\n            return !t.IsEnum && t.IsValueType;\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0)\n        {\n            return CheckType(L, type0, begin);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) &&\n                   CheckType(L, type5, begin + 5);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) &&\n                   CheckType(L, type5, begin + 5) && CheckType(L, type6, begin + 6);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) &&\n                   CheckType(L, type5, begin + 5) && CheckType(L, type6, begin + 6) && CheckType(L, type7, begin + 7);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7, Type type8)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) &&\n                   CheckType(L, type5, begin + 5) && CheckType(L, type6, begin + 6) && CheckType(L, type7, begin + 7) && CheckType(L, type8, begin + 8);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, Type type0, Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7, Type type8, Type type9)\n        {\n            return CheckType(L, type0, begin) && CheckType(L, type1, begin + 1) && CheckType(L, type2, begin + 2) && CheckType(L, type3, begin + 3) && CheckType(L, type4, begin + 4) &&\n                   CheckType(L, type5, begin + 5) && CheckType(L, type6, begin + 6) && CheckType(L, type7, begin + 7) && CheckType(L, type8, begin + 8) && CheckType(L, type9, begin + 9);\n        }\n\n        public static bool CheckTypes(IntPtr L, int begin, params Type[] types)\n        {\n            for (int i = 0; i < types.Length; i++)\n            {\n                if (!CheckType(L, types[i], i + begin))\n                {\n                    return false;\n                }\n            }\n\n            return true;\n        }\n\n        public static bool CheckParamsType(IntPtr L, Type t, int begin, int count)\n        {\n            if (t == typeof(object))\n            {\n                return true;\n            }\n\n            for (int i = 0; i < count; i++)\n            {\n                if (!CheckType(L, t, i + begin))\n                {\n                    return false;\n                }\n            }\n\n            return true;\n        }\n\n        static bool IsNilType(Type t)\n        {\n            if (!t.IsValueType)\n            {\n                return true;\n            }\n\n            if (IsNullable(t))\n            {\n                return true;\n            }\n\n            return false;\n        }\n\n        public static bool IsNullable(Type t)\n        {\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))\n            {\n                return true;\n            }\n\n            return false;\n        }\n\n        public static Type GetNullableType(Type t)\n        {\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))\n            {\n                Type[] ts = t.GetGenericArguments();\n                t = ts[0];\n            }\n\n            return t;\n        }\n\n        public static bool CheckType(IntPtr L, Type type, int pos)\n        {\n            //默认都可以转 object\n            if (type == typeof(object))\n            {\n                return true;\n            }\n\n            Type t = GetNullableType(type);\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNUMBER:\n                    return IsNumberType(t);\n                case LuaTypes.LUA_TSTRING:\n                    return t == typeof(string) || t == typeof(byte[]) || t == typeof(char[]) || t == typeof(LuaByteBuffer);\n                case LuaTypes.LUA_TUSERDATA:\n                    return IsMatchUserData(L, t, pos);\n                case LuaTypes.LUA_TBOOLEAN:\n                    return t == typeof(bool);\n                case LuaTypes.LUA_TFUNCTION:\n                    return t == typeof(LuaFunction);\n                case LuaTypes.LUA_TTABLE:\n                    return IsUserTable(t, L, pos);\n                case LuaTypes.LUA_TLIGHTUSERDATA:\n                    return t == typeof(IntPtr) || t == typeof(UIntPtr);\n                case LuaTypes.LUA_TNIL:\n                    return IsNilType(type);\n                default:\n                    break;\n            }\n\n            throw new LuaException(\"undefined type to check\" + LuaDLL.luaL_typename(L, pos));\n        }\n\n        static Type monoType = typeof(Type).GetType();\n\n        public static T ChangeType<T>(object temp, Type type)\n        {\n            var tempType = temp.GetType();\n            if (tempType == monoType || type.IsAssignableFrom(tempType))\n            {\n                return (T)temp;\n            }\n            else\n            {\n                return (T)Convert.ChangeType(temp, type);\n            }\n        }\n\n        public static object ChangeType(object temp, Type type)\n        {\n            var tempType = temp.GetType();\n            if (tempType == monoType)\n            {\n                return (Type)temp;\n            }\n            else if (type.IsAssignableFrom(tempType))\n            {\n                return temp;\n            }\n            else\n            {\n                return Convert.ChangeType(temp, type);\n            }\n        }\n\n        static bool IsMatchUserData(IntPtr L, Type t, int pos)\n        {\n            if (t == typeof(long))\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Int64;                \n            }\n            else if (t == typeof(ulong))\n            {\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.UInt64;                \n            }\n\n            object obj = null;\n            int udata = LuaDLL.tolua_rawnetobj(L, pos);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {\n                    Type objType = obj.GetType();\n\n                    if (t == objType || t.IsAssignableFrom(objType))\n                    {\n                        return true;\n                    }\n                }\n                else\n                {\n                    return !t.IsValueType;\n                }\n            }\n\n            return false;\n        }\n\n        public static bool IsNumberType(Type t)\n        {\n            if (t.IsPrimitive)\n            {\n                if (t == typeof(bool) || t == typeof(IntPtr) || t == typeof(UIntPtr))\n                {\n                    return false;\n                }\n\n                return true;\n            }\n\n            return false;\n        }\n\n        public static bool IsUserTable(Type t, IntPtr L, int pos)\n        {\n            int type = LuaDLL.tolua_getvaluetype(L, pos);\n\n            if (type != LuaValueType.None)\n            {\n                return t == LuaValueTypeMap[type];\n            }\n\n            if (t.IsArray)\n            {\n                if (t.GetElementType().IsArray || t.GetArrayRank() > 1)\n                {\n                    return false;\n                }\n\n                return true;\n            }\n            else if (t == typeof(LuaTable))\n            {\n                return true;\n            }\n            else if (LuaDLL.tolua_isvptrtable(L, pos))\n            {\n                return IsMatchUserData(L, t, pos);\n            }\n\n            return false;\n        }\n\n        public static bool CheckTypes<T1>(IntPtr L, int pos)\n        {            \n            return TypeTraits<T1>.Check(L, pos);\n        }\n\n        public static bool CheckTypes<T1, T2>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1);\n        }\n\n        public static bool CheckTypes<T1, T2, T3>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4, T5>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3) && TypeTraits<T5>.Check(L, pos + 4);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4, T5, T6>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3) && TypeTraits<T5>.Check(L, pos + 4) &&\n                TypeTraits<T6>.Check(L, pos + 5);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4, T5, T6, T7>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3) && TypeTraits<T5>.Check(L, pos + 4) &&\n                TypeTraits<T6>.Check(L, pos + 5) && TypeTraits<T7>.Check(L, pos + 6);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4, T5, T6, T7, T8>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3) && TypeTraits<T5>.Check(L, pos + 4) &&\n                TypeTraits<T6>.Check(L, pos + 5) && TypeTraits<T7>.Check(L, pos + 6) && TypeTraits<T8>.Check(L, pos + 7);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4, T5, T6, T7, T8, T9>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3) && TypeTraits<T5>.Check(L, pos + 4) &&\n                TypeTraits<T6>.Check(L, pos + 5) && TypeTraits<T7>.Check(L, pos + 6) && TypeTraits<T8>.Check(L, pos + 7) && TypeTraits<T9>.Check(L, pos + 8);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3) && TypeTraits<T5>.Check(L, pos + 4) &&\n                TypeTraits<T6>.Check(L, pos + 5) && TypeTraits<T7>.Check(L, pos + 6) && TypeTraits<T8>.Check(L, pos + 7) && TypeTraits<T9>.Check(L, pos + 8) && TypeTraits<T10>.Check(L, pos + 9);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3) && TypeTraits<T5>.Check(L, pos + 4) &&\n                TypeTraits<T6>.Check(L, pos + 5) && TypeTraits<T7>.Check(L, pos + 6) && TypeTraits<T8>.Check(L, pos + 7) && TypeTraits<T9>.Check(L, pos + 8) && TypeTraits<T10>.Check(L, pos + 9) &&\n                TypeTraits<T11>.Check(L, pos + 10);\n        }\n\n        public static bool CheckTypes<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(IntPtr L, int pos)\n        {\n            return TypeTraits<T1>.Check(L, pos) && TypeTraits<T2>.Check(L, pos + 1) && TypeTraits<T3>.Check(L, pos + 2) && TypeTraits<T4>.Check(L, pos + 3) && TypeTraits<T5>.Check(L, pos + 4) &&\n                TypeTraits<T6>.Check(L, pos + 5) && TypeTraits<T7>.Check(L, pos + 6) && TypeTraits<T8>.Check(L, pos + 7) && TypeTraits<T9>.Check(L, pos + 8) && TypeTraits<T10>.Check(L, pos + 9) &&\n                TypeTraits<T11>.Check(L, pos + 10) && TypeTraits<T12>.Check(L, pos + 11);\n        }\n\n        public static bool CheckParamsType<T>(IntPtr L, int begin, int count)\n        {\n            if (typeof(T) == typeof(object))\n            {\n                return true;\n            }\n\n            for (int i = 0; i < count; i++)\n            {\n                if (!TypeTraits<T>.Check(L, i + begin))\n                {\n                    return false;\n                }\n            }\n\n            return true;\n        }\n\n        static public bool CheckDelegateType(Type type, IntPtr L, int pos)\n        {\n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return true;\n                case LuaTypes.LUA_TUSERDATA:                    \n                    int udata = LuaDLL.tolua_rawnetobj(L, pos);\n\n                    if (udata != -1)\n                    {\n                        ObjectTranslator translator = ObjectTranslator.Get(L);\n                        object obj = translator.GetObject(udata);\n                        return obj == null ? true : type == obj.GetType();\n                    }\n                    return false;\n                default:\n                    return false;\n            }\n        }\n\n        static public bool CheckEnumType(Type type, IntPtr L, int pos)\n        {\n            if (LuaDLL.lua_type(L, pos) == LuaTypes.LUA_TUSERDATA)\n            {                \n                int udata = LuaDLL.tolua_rawnetobj(L, pos);\n\n                if (udata != -1)\n                {\n                    ObjectTranslator translator = ObjectTranslator.Get(L);\n                    object obj = translator.GetObject(udata);\n                    return obj == null ? false : type == obj.GetType();\n                }\n            }\n\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/TypeChecker.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b2c5d493c1805784994fefe7b22da126\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Core/TypeTraits.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing System;\nusing System.Collections;\n\nnamespace LuaInterface\n{\n    public static class TypeTraits<T>\n    {        \n        static public Func<IntPtr, int, bool> Check = DefaultCheck;\n        static public Type type = typeof(T);\n        static public bool IsValueType = type.IsValueType;\n        static public bool IsArray = type.IsArray;\n\n        static string typeName = string.Empty;                \n        static int nilType = -1;\n        static int metaref = -1;\n\n        static public void Init(Func<IntPtr, int, bool> check)\n        {            \n            if (check != null)\n            {\n                Check = check;\n            }\n        }\n\n        static public string GetTypeName()\n        {\n            if (typeName == string.Empty)\n            {\n                typeName = LuaMisc.GetTypeName(type);\n            }\n\n            return typeName;\n        }\n\n        static public int GetLuaReference(IntPtr L)\n        {\n#if MULTI_STATE\n            return LuaStatic.GetMetaReference(L, type);\n#else\n            if (metaref > 0)\n            {                \n                return metaref;\n            }\n\n            metaref = LuaStatic.GetMetaReference(L, type);\n\n            if (metaref > 0)\n            {\n                LuaState.Get(L).OnDestroy += () => { metaref = -1; };\n            }\n\n            return metaref;\n#endif\n        }   \n\n        static bool DefaultCheck(IntPtr L, int pos)\n        {            \n            LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n            switch (luaType)\n            {\n                case LuaTypes.LUA_TNIL:\n                    return IsNilType();\n                case LuaTypes.LUA_TUSERDATA:\n                    return IsUserData(L, pos);\n                case LuaTypes.LUA_TTABLE:\n                    return IsUserTable(L, pos);\n                default:\n                    return false;\n            }            \n        }\n\n        static bool IsNilType()\n        {\n            if (nilType != -1)\n            {\n                return nilType != 0;\n            }\n\n            if (!IsValueType)\n            {\n                nilType = 1;\n                return true;\n            }\n\n            if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))\n            {\n                nilType = 1;\n                return true;\n            }\n\n            nilType = 0;\n            return false;            \n        }\n\n        static bool IsUserData(IntPtr L, int pos)\n        {\n            object obj = null;\n            int udata = LuaDLL.tolua_rawnetobj(L, pos);\n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {\n                    return obj is T;\n                }\n                else\n                {\n                    return !IsValueType;\n                }\n            }\n\n            return false;\n        }\n\n        static bool IsUserTable(IntPtr L, int pos)\n        {            \n            if (type == typeof(LuaTable))\n            {\n                return true;\n            }\n            else if (type.IsArray)\n            {\n                if (type.GetElementType().IsArray || type.GetArrayRank() > 1)\n                {\n                    return false;\n                }\n\n                return true;\n            }\n            else if (LuaDLL.tolua_isvptrtable(L, pos))\n            {\n                return IsUserData(L, pos);\n            }\n\n            return false;\n        }\n    }    \n\n    public static class DelegateTraits<T>\n    {        \n        static DelegateFactory.DelegateCreate _Create = null;        \n\n        static public void Init(DelegateFactory.DelegateCreate func)\n        {\n            _Create = func;            \n        }\n\n        static public Delegate Create(LuaFunction func)\n        {\n#if UNITY_EDITOR\n            if (_Create == null)\n            {\n                throw new LuaException(string.Format(\"Delegate {0} not register\", TypeTraits<T>.GetTypeName()));\n            }\n#endif\n            if (func != null)\n            {\n                LuaState state = func.GetLuaState();\n                LuaDelegate target = state.GetLuaDelegate(func);\n\n                if (target != null)\n                {\n                    return Delegate.CreateDelegate(typeof(T), target, target.method);\n                }\n                else\n                {\n                    Delegate d = _Create(func, null, false);\n                    target = d.Target as LuaDelegate;\n                    state.AddLuaDelegate(target, func);\n                    return d;\n                }\n            }\n\n            return _Create(null, null, false);            \n        }\n\n        static public Delegate Create(LuaFunction func, LuaTable self)\n        {\n#if UNITY_EDITOR\n            if (_Create == null)\n            {\n                throw new LuaException(string.Format(\"Delegate {0} not register\", TypeTraits<T>.GetTypeName()));\n            }\n#endif\n            if (func != null)\n            {\n                LuaState state = func.GetLuaState();\n                LuaDelegate target = state.GetLuaDelegate(func, self);\n\n                if (target != null)\n                {\n                    return Delegate.CreateDelegate(typeof(T), target, target.method);\n                }\n                else\n                {\n                    Delegate d = _Create(func, self, true);\n                    target = d.Target as LuaDelegate;\n                    state.AddLuaDelegate(target, func, self);\n                    return d;\n                }\n            }\n\n            return _Create(null, null, true);            \n        }\n    }\n\n    public static class StackTraits<T>\n    {\n        static public Action<IntPtr, T> Push = SelectPush();\n        static public Func<IntPtr, int, T> Check = DefaultCheck;\n        static public Func<IntPtr, int, T> To = DefaultTo;               \n\n        static public void Init(Action<IntPtr, T> push, Func<IntPtr, int, T> check, Func<IntPtr, int, T> to)\n        {\n            if (push != null)\n            {\n                Push = push;\n            }\n\n            if (to != null)\n            {\n                To = to;\n            }\n\n            if (check != null)\n            {\n                Check = check;\n            }            \n        }\n\n        static Action<IntPtr, T> SelectPush()\n        {\n            if (TypeTraits<T>.IsValueType)\n            {\n                return PushValue;\n            }\n            else if (TypeTraits<T>.IsArray)\n            {\n                return PushArray;\n            }\n            else\n            {\n                return PushObject;\n            }\n        }\n\n        static void PushValue(IntPtr L, T o)\n        {\n            ToLua.PushStruct(L, o);\n        }\n\n        static void PushObject(IntPtr L, T o)\n        {\n            ToLua.PushObject(L, o);\n        }\n\n        static void PushArray(IntPtr L, T array)\n        {\n            if (array == null)\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n            else\n            {\n                int arrayMetaTable = LuaStatic.GetArrayMetatable(L);\n                ToLua.PushUserData(L, array, arrayMetaTable);\n            }\n        }\n\n        static T DefaultTo(IntPtr L, int pos)\n        {\n            return (T)ToLua.ToObject(L, pos);\n        }           \n        \n        static T DefaultCheck(IntPtr L, int stackPos)\n        {\n            int udata = LuaDLL.tolua_rawnetobj(L, stackPos);            \n\n            if (udata != -1)\n            {\n                ObjectTranslator translator = ObjectTranslator.Get(L);\n                object obj = translator.GetObject(udata);\n\n                if (obj != null)\n                {                    \n                    if (obj is T)\n                    {\n                        return (T)obj;\n                    }\n\n                    LuaDLL.luaL_argerror(L, stackPos, string.Format(\"{0} expected, got {1}\", TypeTraits<T>.GetTypeName(), obj.GetType().FullName));\n                }\n\n                if (!TypeTraits<T>.IsValueType)\n                {\n                    return default(T);\n                }\n            }\n            else if (LuaDLL.lua_isnil(L, stackPos) && !TypeTraits<T>.IsValueType)\n            {\n                return default(T);\n            }\n\n            LuaDLL.luaL_typerror(L, stackPos, TypeTraits<T>.GetTypeName());\n            return default(T);            \n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Core/TypeTraits.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 82858b365ef4145429c2f3227be8c845\ntimeCreated: 1494572166\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Core.meta",
    "content": "fileFormatVersion: 2\nguid: 7714c4ebcd6e6474da6ec5df53bca350\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_EventObject.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class ToLua_LuaInterface_EventObject\n{\n    [NoToLuaAttribute]\n    public static string op_AdditionDefined =\n@\"        try\n        {\n            EventObject arg0 = (EventObject)ToLua.CheckObject(L, 1, typeof(EventObject));\n            arg0.func = ToLua.CheckDelegate(arg0.type, L, 2);\n            arg0.op = EventOp.Add;\n            ToLua.Push(L, arg0);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n\n    [NoToLuaAttribute]\n    public static string op_SubtractionDefined =\n@\"        try\n        {\n            EventObject arg0 = (EventObject)ToLua.CheckObject(L, 1, typeof(EventObject));\n            arg0.func = ToLua.CheckDelegate(arg0.type, L, 2);\n            arg0.op = EventOp.Sub;\n            ToLua.Push(L, arg0);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n\n    [UseDefinedAttribute]\n    public static ToLua_LuaInterface_EventObject operator +(ToLua_LuaInterface_EventObject a, ToLua_LuaInterface_EventObject b)\n    {\n        return null;\n    }\n\n    [UseDefinedAttribute]\n    public static ToLua_LuaInterface_EventObject operator -(ToLua_LuaInterface_EventObject a, ToLua_LuaInterface_EventObject b)\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_EventObject.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6a98ce054e1b9e848a9ed23974b72436\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_LuaConstructor.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class ToLua_LuaInterface_LuaConstructor\n{\n    public static string CallDefined =\n@\"\t\ttry\n\t\t{\t\t\t\n\t\t\tLuaConstructor obj = (LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaConstructor));            \n\t\t\treturn obj.Call(L);\t\t\t\t\t\t\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    public static string DestroyDefined =\n@\"\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tLuaConstructor obj = (LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaConstructor));\n\t\t\tobj.Destroy();\n            ToLua.Destroy(L);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    [UseDefinedAttribute]\n    public void Destroy()\n    {\n\n    }\n\n    [UseDefinedAttribute]\n    public int Call(IntPtr L)\n    {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_LuaConstructor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 24ae6f8094d27814db58bed92723e5eb\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_LuaField.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class ToLua_LuaInterface_LuaField\n{\n    public static string GetDefined =\n@\"\t\ttry\n\t\t{\t\t\t\n\t\t\tLuaField obj = (LuaField)ToLua.CheckObject(L, 1, typeof(LuaField));            \n            return obj.Get(L);\t\t\t\t\t\t\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    public static string SetDefined =\n@\"\t\ttry\n\t\t{\t\t\t\n            LuaField obj = (LuaField)ToLua.CheckObject(L, 1, typeof(LuaField));            \n            return obj.Set(L);\n        }\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    [UseDefinedAttribute]\n    public int Set(IntPtr L)\n    {\n        return 0;\n    }\n\n    [UseDefinedAttribute]\n    public int Get(IntPtr L)\n    {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_LuaField.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f6b190ca703de424fafa500033a782a3\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_LuaMethod.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class ToLua_LuaInterface_LuaMethod\n{\n    public static string CallDefined =\n@\"\t\ttry\n\t\t{\t\t\t\n\t\t\tLuaMethod obj = (LuaMethod)ToLua.CheckObject(L, 1, typeof(LuaMethod));            \n\t\t\treturn obj.Call(L);\t\t\t\t\t\t\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    public static string DestroyDefined =\n@\"\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tLuaMethod obj = (LuaMethod)ToLua.CheckObject(L, 1, typeof(LuaMethod));\n\t\t\tobj.Destroy();\n            ToLua.Destroy(L);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    [UseDefinedAttribute]\n    public int Call(IntPtr L)\n    {\n        return 0;\n    }\n\n    [UseDefinedAttribute]\n    public void Destroy()\n    {\n\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_LuaMethod.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6eac87eec04d6e547ac028d69e0eeb71\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_LuaProperty.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class ToLua_LuaInterface_LuaProperty\n{\n    public static string GetDefined =\n@\"\t\ttry\n\t\t{\t\t\t\n\t\t\tLuaProperty obj = (LuaProperty)ToLua.CheckObject(L, 1, typeof(LuaProperty));            \n            return obj.Get(L);\t\t\t\t\t\t\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    public static string SetDefined =\n@\"\t\ttry\n\t\t{\t\t\t\n            LuaProperty obj = (LuaProperty)ToLua.CheckObject(L, 1, typeof(LuaProperty));            \n            return obj.Set(L);\n        }\n        catch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n\n    [UseDefinedAttribute]\n    public int Set(IntPtr L)\n    {\n        return 0;\n    }\n\n    [UseDefinedAttribute]\n    public int Get(IntPtr L)\n    {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_LuaInterface_LuaProperty.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e00a567610c97754bbae9672db75a1f2\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_Delegate.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class ToLua_System_Delegate\n{    \n    public static string AdditionNameSpace = \"System.Collections.Generic\";\n\n    [NoToLuaAttribute]\n    public static string op_AdditionDefined =\n@\"        try\n        {                        \n            LuaTypes type = LuaDLL.lua_type(L, 1);\n\n            switch (type)\n            {\n                case LuaTypes.LUA_TFUNCTION:\n                    Delegate arg0 = ToLua.ToObject(L, 2) as Delegate;\n                    LuaFunction func = ToLua.ToLuaFunction(L, 1);\n                    Type t = arg0.GetType();\n                    Delegate arg1 = DelegateFactory.CreateDelegate(t, func);\n                    Delegate arg2 = Delegate.Combine(arg0, arg1);\n                    ToLua.Push(L, arg2);\n                    return 1;\n                case LuaTypes.LUA_TNIL:\n                    LuaDLL.lua_pushvalue(L, 2);\n                    return 1;\n                case LuaTypes.LUA_TUSERDATA:\n                    Delegate a0 = ToLua.ToObject(L, 1) as Delegate;\n                    Delegate a1 = ToLua.CheckDelegate(a0.GetType(), L, 2);\n                    Delegate ret = Delegate.Combine(a0, a1);\n                    ToLua.Push(L, ret);\n                    return 1;\n                default:\n                    LuaDLL.luaL_typerror(L, 1, \"\"Delegate\"\");\n                    return 0;\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n\n    [NoToLuaAttribute]\n    public static string op_SubtractionDefined =\n@\"        try\n        {            \n            Delegate arg0 = (Delegate)ToLua.CheckObject<Delegate>(L, 1);\n            LuaTypes type = LuaDLL.lua_type(L, 2);\n\n            if (type == LuaTypes.LUA_TFUNCTION)\n            {\n                LuaState state = LuaState.Get(L);\n                LuaFunction func = ToLua.ToLuaFunction(L, 2);\n                Delegate[] ds = arg0.GetInvocationList();\n\n                for (int i = 0; i < ds.Length; i++)\n                {\n                    LuaDelegate ld = ds[i].Target as LuaDelegate;\n\n                    if (ld != null && ld.func == func && ld.self == null)\n                    {\n                        arg0 = Delegate.Remove(arg0, ds[i]);\n                        state.DelayDispose(ld.func);\n                        break;\n                    }\n                }\n\n                func.Dispose();\n                ToLua.Push(L, arg0);\n                return 1;\n            }\n            else\n            {\n                Delegate arg1 = (Delegate)ToLua.CheckObject<Delegate>(L, 2);\n                arg0 = DelegateFactory.RemoveDelegate(arg0, arg1);                \n                ToLua.Push(L, arg0);\n                return 1;\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n\n    public static bool operator ==(ToLua_System_Delegate lhs, ToLua_System_Delegate rhs)\n    {\n        return false;\n    }\n\n    public static bool operator !=(ToLua_System_Delegate lhs, ToLua_System_Delegate rhs)\n    {\n        return false;\n    }\n\n    [UseDefinedAttribute]\n    public static ToLua_System_Delegate operator +(ToLua_System_Delegate a, ToLua_System_Delegate b)\n    {\n        return null;\n    }\n\n    [UseDefinedAttribute]\n    public static ToLua_System_Delegate operator -(ToLua_System_Delegate a, ToLua_System_Delegate b)\n    {\n        return null;\n    }\n\n\n    public override bool Equals(object other)\n    {\n        return false;\n    }\n\n    public override int GetHashCode()\n    {\n        return 0;\n    }\n\n    public static string DestroyDefined =\n@\"        Delegate arg0 = (Delegate)ToLua.CheckObject<Delegate>(L, 1);\n        Delegate[] ds = arg0.GetInvocationList();\n\n        for (int i = 0; i < ds.Length; i++)\n        {\n            LuaDelegate ld = ds[i].Target as LuaDelegate;\n\n            if (ld != null)\n            {                \n                ld.Dispose();                \n            }\n        }\n\n        return 0;\";\n\n    [UseDefinedAttribute]\n    public static void Destroy(object obj)\n    {\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_Delegate.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 6f0591686bc09e74e9a4fe2ad4e9fdb2\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_Enum.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class ToLua_System_Enum\n{\n    public static string ToIntDefined =\n@\"\t\ttry\n        {\n            object arg0 = ToLua.CheckObject<System.Enum>(L, 1);\n            int ret = Convert.ToInt32(arg0);\n            LuaDLL.lua_pushinteger(L, ret);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n\n    public static string ParseDefined =\n@\"\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<System.Type, string>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tobject o = System.Enum.Parse(arg0, arg1);\n\t\t\t\tToLua.Push(L, (Enum)o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<System.Type, string, bool>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tbool arg2 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tobject o = System.Enum.Parse(arg0, arg1, arg2);\n\t\t\t\tToLua.Push(L, (Enum)o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"\"invalid arguments to method: System.Enum.Parse\"\");\n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    public static string ToObjectDefined =\n@\"\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<System.Type, int>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tobject o = System.Enum.ToObject(arg0, arg1);\n\t\t\t\tToLua.Push(L, (Enum)o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<System.Type, object>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Type arg0 = (System.Type)ToLua.ToObject(L, 1);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 2);\n\t\t\t\tobject o = System.Enum.ToObject(arg0, arg1);\n\t\t\t\tToLua.Push(L, (Enum)o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"\"invalid arguments to method: System.Enum.ToObject\"\");\n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    [UseDefinedAttribute]\n    public static void ToInt(System.Enum obj)\n    {\n    }\n\n    [UseDefinedAttribute]\n    public static object ToObject(Type enumType, int value)\n    {\n        return null;\n    }\n\n    [UseDefinedAttribute]\n    public static object Parse(Type enumType, string value)\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_Enum.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ff4fa54c22d6f7c428ef9aa02f6c10d4\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_Object.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic class ToLua_System_Object \n{\n    public static string DestroyDefined = \"\\t\\treturn ToLua.Destroy(L);\";\n\n    [UseDefinedAttribute]\n    public static void Destroy(object obj)\n    {\n    }\n\n    public static bool op_Equality(Object x, Object y)\n    {\n        return false;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_Object.cs.meta",
    "content": "fileFormatVersion: 2\nguid: afb4e6913f506df4c9eb98f70781a578\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_String.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\n\npublic class ToLua_System_String\n{\n    [NoToLuaAttribute]\n    public static string ToLua_System_StringDefined =\n@\"        try\n        {\n            LuaTypes luatype = LuaDLL.lua_type(L, 1);\n\n            if (luatype == LuaTypes.LUA_TSTRING)\n            {\n                string arg0 = LuaDLL.lua_tostring(L, 1);\n                ToLua.PushSealed(L, arg0);\n                return 1;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"\"invalid arguments to string's ctor method\"\");\n            }            \n        }\n        catch(Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n\n    [UseDefinedAttribute]\n    public ToLua_System_String()\n    {\n\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_String.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7cc775dacb56ec34587e28d9e3f68417\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_Type.cs",
    "content": "﻿using System;\nusing System.Reflection;\nusing LuaInterface;\n\npublic class ToLua_System_Type \n{\n    [NoToLuaAttribute]\n    public EventInfo GetEvent(string name)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public EventInfo GetEvent(string name, BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public EventInfo[] GetEvents()\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public EventInfo[] GetEvents(BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MethodInfo GetMethod(string name)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MethodInfo GetMethod(string name, Type[] types)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MethodInfo GetMethod(string name, BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MethodInfo GetMethod(string name, Type[] types, ParameterModifier[] modifiers)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MethodInfo[] GetMethods()\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MethodInfo[] GetMethods(BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo[] GetProperties()\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo[] GetProperties(BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo GetProperty(string name)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo GetProperty(string name, Type[] types)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo GetProperty(string name, Type returnType)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo GetProperty(string name, BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo GetProperty(string name, Type returnType, Type[] types)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo GetProperty(string name, Type returnType, Type[] types, ParameterModifier[] modifiers)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public FieldInfo GetField(string name)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public FieldInfo GetField(string name, BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public FieldInfo[] GetFields()\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public FieldInfo[] GetFields(BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public ConstructorInfo GetConstructor(Type[] types)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public ConstructorInfo[] GetConstructors()\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MemberInfo[] GetMember(string name)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MemberInfo[] GetMember(string name, BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr)\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MemberInfo[] GetMembers()\n    {\n        return null;\n    }\n\n    [NoToLuaAttribute]\n    public MemberInfo[] GetMembers(BindingFlags bindingAttr)\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_System_Type.cs.meta",
    "content": "fileFormatVersion: 2\nguid: a67e5f490d5d4cd4f8754c921a414d9a\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_UnityEngine_GameObject.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System;\n\npublic class ToLua_UnityEngine_GameObject\n{\n    public static string SendMessageDefined =\n@\"\t\tIntPtr L0 = LuaException.L;\n\n\t\ttry\n\t\t{\n            ++LuaException.SendMsgCount;\n            LuaException.L = L;\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobj.SendMessage(arg0);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                \n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, UnityEngine.SendMessageOptions>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tUnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3);\n\t\t\t\tobj.SendMessage(arg0, arg1);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, object>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 3);\n\t\t\t\tobj.SendMessage(arg0, arg1);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, object, UnityEngine.SendMessageOptions>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 3);\n\t\t\t\tUnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4);\n\t\t\t\tobj.SendMessage(arg0, arg1, arg2);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n                --LuaException.SendMsgCount;      \n                LuaException.L = L0;                          \n                return LuaDLL.luaL_throw(L, \"\"invalid arguments to method: UnityEngine.GameObject.SendMessage\"\");     \n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\t--LuaException.SendMsgCount;\n\t\t\tLuaException.L = L0;\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    public static string SendMessageUpwardsDefined =\n@\"\t\tIntPtr L0 = LuaException.L;\n\n\t\ttry\n\t\t{\n            ++LuaException.SendMsgCount;\n            LuaException.L = L;\n            int count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobj.SendMessageUpwards(arg0);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return 0;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, UnityEngine.SendMessageOptions>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tUnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3);\n\t\t\t\tobj.SendMessageUpwards(arg0, arg1);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return 0;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, object>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 3);\n\t\t\t\tobj.SendMessageUpwards(arg0, arg1);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return 0;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, object, UnityEngine.SendMessageOptions>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 3);\n\t\t\t\tUnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4);\n\t\t\t\tobj.SendMessageUpwards(arg0, arg1, arg2);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;                \n                return LuaDLL.luaL_throw(L, \"\"invalid arguments to method: UnityEngine.GameObject.SendMessageUpwards\"\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\t--LuaException.SendMsgCount;\n\t\t\tLuaException.L = L0;\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n    public static string BroadcastMessageDefined =\n@\"\t\tIntPtr L0 = LuaException.L;\n    \n\t\ttry\n\t\t{\n            ++LuaException.SendMsgCount;\n            LuaException.L = L;\n            int count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<string>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobj.BroadcastMessage(arg0);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return 0;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, UnityEngine.SendMessageOptions>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tUnityEngine.SendMessageOptions arg1 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 3);\n\t\t\t\tobj.BroadcastMessage(arg0, arg1);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return 0;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<string, object>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 3);\n\t\t\t\tobj.BroadcastMessage(arg0, arg1);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return 0;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<string, object, UnityEngine.SendMessageOptions>(L, 2))\n\t\t\t{\n\t\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tobject arg1 = ToLua.ToVarObject(L, 3);\n\t\t\t\tUnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)ToLua.ToObject(L, 4);\n\t\t\t\tobj.BroadcastMessage(arg0, arg1, arg2);                \n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n\n\t\t\t\t--LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n                --LuaException.SendMsgCount;\n                LuaException.L = L0;\n                return LuaDLL.luaL_throw(L, \"\"invalid arguments to method: UnityEngine.GameObject.BroadcastMessage\"\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\t--LuaException.SendMsgCount;\n\t\t\tLuaException.L = L0;\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n\n\n    public static string AddComponentDefined = \n@\"\t\tIntPtr L0 = LuaException.L;\n\n        try\n        {\n            ++LuaException.InstantiateCount;\n            LuaException.L = L;\n            ToLua.CheckArgsCount(L, 2);\n\t\t\tUnityEngine.GameObject obj = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\tSystem.Type arg0 = ToLua.CheckMonoType(L, 2);\n\t\t\tUnityEngine.Component o = obj.AddComponent(arg0);\n\n            if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n            {\n                string error = LuaDLL.lua_tostring(L, -1);\n                LuaDLL.lua_pop(L, 1);\n                throw new LuaException(error, LuaException.GetLastError());\n            }\n\n            ToLua.Push(L, o);\n            LuaException.L = L0;\n            --LuaException.InstantiateCount;\n            return 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n            LuaException.L = L0;\n            --LuaException.InstantiateCount;\n            return LuaDLL.toluaL_exception(L, e);\n\t\t}\";\n    [UseDefinedAttribute]\n    public void SendMessage(string methodName)\n    {\n    }\n\n    [UseDefinedAttribute]\n    public void SendMessageUpwards(string methodName)\n    {\n    }\n\n    [UseDefinedAttribute]\n    public void BroadcastMessage(string methodName)\n    {\n\n    }\n\n    [UseDefinedAttribute]\n    public void AddComponent(Type t)\n    {\n\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_UnityEngine_GameObject.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1ed77ac31b521ad4bae3fe7e8b84cab4\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_UnityEngine_Input.cs",
    "content": "﻿using UnityEngine;\nusing LuaInterface;\n\npublic class ToLua_UnityEngine_Input\n{\n    public static string GetTouchDefined =\n@\"        try\n        {\n\t\t    int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);\n            int arg1 = LuaDLL.luaL_optinteger(L, 2, TouchBits.ALL);        \n\t\t    UnityEngine.Touch o = UnityEngine.Input.GetTouch(arg0);\n            ToLua.Push(L, o, arg1);\n            return 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\t\t\t\n\t\t}\";\n\n    [UseDefinedAttribute]\n    public static Touch GetTouch(int index, int flag)\n    {        \n        return new Touch();\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_UnityEngine_Input.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3cee476932ca9a04da9cff77f92e1894\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_UnityEngine_Object.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\n\npublic class ToLua_UnityEngine_Object     \n{        \n    public static string DestroyDefined =\n@\"        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                ToLua.Destroy(L);\n                UnityEngine.Object.Destroy(arg0);\n                return 0;\n            }\n            else if (count == 2)\n            {                \n                float arg1 = (float)LuaDLL.luaL_checknumber(L, 2);\n                int udata = LuaDLL.tolua_rawnetobj(L, 1);\n                ObjectTranslator translator = LuaState.GetTranslator(L);\n                translator.DelayDestroy(udata, arg1);\n                return 0;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"\"invalid arguments to method: Object.Destroy\"\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n    \n    public static string DestroyImmediateDefined =\n@\"        try\n        {\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                ToLua.Destroy(L);\n                UnityEngine.Object.DestroyImmediate(arg0);\n                return 0;\n            }\n            else if (count == 2)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                bool arg1 = LuaDLL.luaL_checkboolean(L, 2);\n                ToLua.Destroy(L);\n                UnityEngine.Object.DestroyImmediate(arg0, arg1);\n                return 0;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"\"invalid arguments to method: Object.DestroyImmediate\"\");\n            }\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n\n    public static string InstantiateDefined =\n@\"\t\tIntPtr L0 = LuaException.L;\n\n        try\n        {\n            ++LuaException.InstantiateCount;            \n            LuaException.L = L;\n            int count = LuaDLL.lua_gettop(L);\n\n            if (count == 1)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n#if UNITY_5_4_OR_NEWER\n            else if (count == 2)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.CheckObject<UnityEngine.Transform>(L, 2);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n#endif\n            else if (count == 3 && TypeChecker.CheckTypes<UnityEngine.Vector3, UnityEngine.Quaternion>(L, 2))\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 2);\n                UnityEngine.Quaternion arg2 = ToLua.ToQuaternion(L, 3);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n#if UNITY_5_4_OR_NEWER\n            else if (count == 3 && TypeChecker.CheckTypes<UnityEngine.Transform, bool>(L, 2))\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.ToObject(L, 2);\n                bool arg2 = LuaDLL.lua_toboolean(L, 3);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n            else if (count == 4)\n            {\n                UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject<UnityEngine.Object>(L, 1);\n                UnityEngine.Vector3 arg1 = ToLua.CheckVector3(L, 2);\n                UnityEngine.Quaternion arg2 = ToLua.CheckQuaternion(L, 3);\n                UnityEngine.Transform arg3 = (UnityEngine.Transform)ToLua.CheckObject<UnityEngine.Transform>(L, 4);\n                UnityEngine.Object o = UnityEngine.Object.Instantiate(arg0, arg1, arg2, arg3);\n\n                if (LuaDLL.lua_toboolean(L, LuaDLL.lua_upvalueindex(1)))\n                {\n                    string error = LuaDLL.lua_tostring(L, -1);\n                    LuaDLL.lua_pop(L, 1);\n                    throw new LuaException(error, LuaException.GetLastError());\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return 1;\n            }\n#endif\n            else\n            {\n                LuaException.L = L0;\n                --LuaException.InstantiateCount;\n                return LuaDLL.luaL_throw(L, \"\"invalid arguments to method: UnityEngine.Object.Instantiate\"\");\n            }\n        }\n        catch (Exception e)\n        {\n            LuaException.L = L0;\n            --LuaException.InstantiateCount;\n            return LuaDLL.toluaL_exception(L, e);\n        }\";\n\n\n    [UseDefinedAttribute]\n    public static void Destroy(Object obj)\n    {\n        \n    }\n\n    [UseDefinedAttribute]\n    public static void DestroyImmediate(Object obj)\n    {\n\n    }\n\n    [NoToLuaAttribute]\n    public static void DestroyObject(Object obj)\n    {\n\n    }\n\n    [NoToLuaAttribute]\n    public static void DestroyObject(Object obj, float t)\n    {\n\n    }\n\n    [UseDefinedAttribute]\n    public static void Instantiate(Object original)\n    {\n\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_UnityEngine_Object.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ed2a77b78fd7258438b2b5a9e881d7c2\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_UnityEngine_RectTransform.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\n\npublic class ToLua_UnityEngine_RectTransform\n{\n    public static string GetLocalCornersDefined =\n@\"            if (count == 1)\n            {\n                UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform));\n                UnityEngine.Vector3[] arg0 = new UnityEngine.Vector3[4];\n                obj.GetLocalCorners(arg0);\n                ToLua.Push(L, arg0);\n                return 1;\n            }\";\n\n    public static string GetWorldCornersDefined =\n@\"            if (count == 1)\n            {\n                UnityEngine.RectTransform obj = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform));\n                UnityEngine.Vector3[] arg0 = new UnityEngine.Vector3[4];\n                obj.GetWorldCorners(arg0);\n                ToLua.Push(L, arg0);\n                return 1;\n            }\";\n\n    [OverrideDefinedAttribute]\n    public Vector3[] GetLocalCorners()\n    {\n        return null;\n    }\n\n    [OverrideDefinedAttribute]\n    public Vector3[] GetWorldCorners()\n    {\n        return null;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend/ToLua_UnityEngine_RectTransform.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 2479ef1b120013c478a5f7148251be9e\ntimeCreated: 1501832587\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Editor/Extend.meta",
    "content": "fileFormatVersion: 2\nguid: bdd2718c24fc3014d96c208f87886fe3\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/ToLuaExport.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing System;\nusing System.Collections;\nusing System.Text;\nusing System.Reflection;\nusing System.Collections.Generic;\nusing LuaInterface;\n\nusing Object = UnityEngine.Object;\nusing System.IO;\nusing System.Text.RegularExpressions;\nusing System.Runtime.CompilerServices;\n\npublic enum MetaOp\n{\n    None = 0,\n    Add = 1,\n    Sub = 2,\n    Mul = 4,\n    Div = 8,\n    Eq = 16,\n    Neg = 32,\n    ToStr = 64,\n    ALL = Add | Sub | Mul | Div | Eq | Neg | ToStr,\n}\n\npublic enum ObjAmbig\n{\n    None = 0, \n    U3dObj = 1,\n    NetObj = 2,\n    All = 3\n}\n\npublic class DelegateType\n{\n    public string name;\n    public Type type;\n    public string abr = null;\n\n    public string strType = \"\";\n\n    public DelegateType(Type t)\n    {\n        type = t;\n        strType = ToLuaExport.GetTypeStr(t);                \n        name = ToLuaExport.ConvertToLibSign(strType);        \n    }\n\n    public DelegateType SetAbrName(string str)\n    {\n        abr = str;\n        return this;\n    }\n}\n\npublic static class ToLuaExport \n{\n    public static string className = string.Empty;\n    public static Type type = null;\n    public static Type baseType = null;\n        \n    public static bool isStaticClass = true;    \n\n    static HashSet<string> usingList = new HashSet<string>();\n    static MetaOp op = MetaOp.None;    \n    static StringBuilder sb = null;\n    static List<_MethodBase> methods = new List<_MethodBase>();\n    static Dictionary<string, int> nameCounter = new Dictionary<string, int>();\n    static FieldInfo[] fields = null;\n    static PropertyInfo[] props = null;    \n    static List<PropertyInfo> propList = new List<PropertyInfo>();  //非静态属性\n    static List<PropertyInfo> allProps = new List<PropertyInfo>();\n    static EventInfo[] events = null;\n    static List<EventInfo> eventList = new List<EventInfo>();\n    static List<_MethodBase> ctorList = new List<_MethodBase>();\n    static List<ConstructorInfo> ctorExtList = new List<ConstructorInfo>();\n    static List<_MethodBase> getItems = new List<_MethodBase>();   //特殊属性\n    static List<_MethodBase> setItems = new List<_MethodBase>();\n\n    static BindingFlags binding = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase;\n        \n    static ObjAmbig ambig = ObjAmbig.NetObj;    \n    //wrapClaaName + \"Wrap\" = 导出文件名，导出类名\n    public static string wrapClassName = \"\";\n\n    public static string libClassName = \"\";\n    public static string extendName = \"\";\n    public static Type extendType = null;\n\n    public static HashSet<Type> eventSet = new HashSet<Type>();\n    public static List<Type> extendList = new List<Type>();    \n\n    public static List<string> memberFilter = new List<string>\n    {\n        \"String.Chars\",\n        \"Directory.SetAccessControl\",\n        \"File.GetAccessControl\",\n        \"File.SetAccessControl\",\n        //UnityEngine\n        \"AnimationClip.averageDuration\",\n        \"AnimationClip.averageAngularSpeed\",\n        \"AnimationClip.averageSpeed\",\n        \"AnimationClip.apparentSpeed\",\n        \"AnimationClip.isLooping\",\n        \"AnimationClip.isAnimatorMotion\",\n        \"AnimationClip.isHumanMotion\",\n        \"AnimatorOverrideController.PerformOverrideClipListCleanup\",\n        \"AnimatorControllerParameter.name\",\n        \"Caching.SetNoBackupFlag\",\n        \"Caching.ResetNoBackupFlag\",\n        \"Light.areaSize\",\n        \"Light.lightmappingMode\",\n        \"Light.lightmapBakeType\",\n\t\t\"Light.shadowAngle\",\n\t\t\"Light.shadowRadius\",\n\t\t\"Light.SetLightDirty\",\n\t\t\"Security.GetChainOfTrustValue\",\n        \"Texture2D.alphaIsTransparency\",\n        \"WWW.movie\",\n        \"WWW.GetMovieTexture\",\n        \"WebCamTexture.MarkNonReadable\",\n        \"WebCamTexture.isReadable\",\n        \"Graphic.OnRebuildRequested\",\n        \"Text.OnRebuildRequested\",\n        \"Resources.LoadAssetAtPath\",\n        \"Application.ExternalEval\",\n        \"Handheld.SetActivityIndicatorStyle\",\n        \"CanvasRenderer.OnRequestRebuild\",\n        \"CanvasRenderer.onRequestRebuild\",\n        \"Terrain.bakeLightProbesForTrees\",\n        \"MonoBehaviour.runInEditMode\",\n        \"TextureFormat.DXT1Crunched\",\n        \"TextureFormat.DXT5Crunched\",\n        \"Texture.imageContentsHash\",\n        \"QualitySettings.streamingMipmapsMaxLevelReduction\",\n        \"QualitySettings.streamingMipmapsRenderersPerFrame\",\t\t\n        //NGUI\n        \"UIInput.ProcessEvent\",\n        \"UIWidget.showHandlesWithMoveTool\",\n        \"UIWidget.showHandles\",\n        \"Input.IsJoystickPreconfigured\",\n        \"UIDrawCall.isActive\",\n        \"Dictionary.TryAdd\",\n        \"KeyValuePair.Deconstruct\",\n        \"ParticleSystem.SetJob\",\n        \"ParticleSystem.subEmitters\", /*2019.09 ios编译出错，也可能是unity版本问题*/\n        \"Type.IsSZArray\"\n    };\n\n    class _MethodBase\n    {\n        public bool IsStatic\n        {\n            get\n            {\n                return method.IsStatic;\n            }\n        }\n\n        public bool IsConstructor\n        {\n            get\n            {\n                return method.IsConstructor;\n            }\n        }\n\n        public string Name\n        {\n            get\n            {\n                return method.Name;\n            }\n        }\n\n        public MethodBase Method\n        {\n            get\n            {\n                return method;\n            }\n        }\n\n        public bool IsGenericMethod\n        {\n            get\n            {\n                return method.IsGenericMethod;\n            }\n        }\n        \n\n        MethodBase method;\n        ParameterInfo[] args;\n\n        public _MethodBase(MethodBase m, int argCount = -1)\n        {\n            method = m;\n            ParameterInfo[] infos = m.GetParameters();\n            argCount = argCount != -1 ? argCount : infos.Length;\n            args = new ParameterInfo[argCount];\n            Array.Copy(infos, args, argCount);\n        }\n\n        public ParameterInfo[] GetParameters()\n        {\n            return args;\n        }\n\n        public int GetParamsCount()\n        {\n            int c = method.IsStatic ? 0 : 1;\n            return args.Length + c;\n        }\n\n        public int GetEqualParamsCount(_MethodBase b)\n        {\n            int count = 0;\n            List<Type> list1 = new List<Type>();\n            List<Type> list2 = new List<Type>();            \n\n            if (!IsStatic)\n            {\n                list1.Add(type);\n            }\n\n            if (!b.IsStatic)\n            {\n                list2.Add(type);\n            }\n            \n            for (int i = 0; i < args.Length; i++)\n            {\n                list1.Add(GetParameterType(args[i]));\n            }\n\n            ParameterInfo[] p = b.args;\n\n            for (int i = 0; i < p.Length; i++)\n            {\n                list2.Add(GetParameterType(p[i]));\n            }\n\n            for (int i = 0; i < list1.Count; i++)\n            {\n                if (list1[i] != list2[i])\n                {\n                    break;\n                }\n\n                ++count;\n            }\n\n            return count;\n        }\n\n        public string GenParamTypes(int offset = 0)\n        {\n            StringBuilder sb = new StringBuilder();\n            List<Type> list = new List<Type>();\n\n            if (!method.IsStatic)\n            {\n                list.Add(type);\n            }\n\n            for (int i = 0; i < args.Length; i++)\n            {\n                if (IsParams(args[i]))\n                {\n                    continue;\n                }\n\n                if (args[i].ParameterType.IsByRef && (args[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None)\n                {\n\t\t\t\t\tType genericClass = typeof(LuaOut<>);\n\t\t\t\t\tType t = genericClass.MakeGenericType(args[i].ParameterType.GetElementType());\n\t\t\t\t\tlist.Add(t);\t\t\t\t\t\n                }\n                else\n                {\n\t\t\t\t\tlist.Add(GetGenericBaseType(method, args[i].ParameterType));\n\t\t\t\t}\n            }\n\n            for (int i = offset; i < list.Count - 1; i++)\n            {\n                sb.Append(GetTypeOf(list[i], \", \"));\n            }\n\n            if (list.Count > 0)\n            {\n                sb.Append(GetTypeOf(list[list.Count - 1], \"\"));\n            }\n\n            return sb.ToString();\n        }\n\n        public bool HasSetIndex()\n        {\n            if (method.Name == \"set_Item\")\n            {\n                return true;\n            }\n\n            object[] attrs = type.GetCustomAttributes(true);\n\n            for (int i = 0; i < attrs.Length; i++)\n            {\n                if (attrs[i] is DefaultMemberAttribute)\n                {\n                    return method.Name == \"set_ItemOf\";\n                }\n            }\n\n            return false;\n        }\n\n        public bool HasGetIndex()\n        {\n            if (method.Name == \"get_Item\")\n            {\n                return true;\n            }\n\n            object[] attrs = type.GetCustomAttributes(true);\n\n            for (int i = 0; i < attrs.Length; i++)\n            {\n                if (attrs[i] is DefaultMemberAttribute)\n                {\n                    return method.Name == \"get_ItemOf\";\n                }\n            }\n\n            return false;\n        }\n\n        public Type GetReturnType()\n        {\n            MethodInfo m = method as MethodInfo;\n\n            if (m != null)\n            {\n                return m.ReturnType;\n            }\n\n            return null;\n        }\n\n        public string GetTotalName()\n        {\n            string[] ss = new string[args.Length];\n\n            for (int i = 0; i < args.Length; i++)\n            {\n                ss[i] = GetTypeStr(args[i].GetType());\n            }\n\n            if (!ToLuaExport.IsGenericMethod(method))\n            {\n                return Name + \"(\" + string.Join(\",\", ss) + \")\";\n            }\n            else\n            {\n                Type[] gts = method.GetGenericArguments();\n                string[] ts = new string[gts.Length];\n\n                for (int i = 0; i < gts.Length; i++)\n                {\n                    ts[i] = GetTypeStr(gts[i]);\n                }\n\n                return Name + \"<\" + string.Join(\",\", ts) + \">\" + \"(\" + string.Join(\",\", ss) + \")\";\n            }\n        }\n\n        public bool BeExtend = false;\n\n        public int ProcessParams(int tab, bool beConstruct, int checkTypePos)\n        {\n            ParameterInfo[] paramInfos = args;                        \n\n            if (BeExtend)\n            {\n                ParameterInfo[] pt = new ParameterInfo[paramInfos.Length - 1];\n                Array.Copy(paramInfos, 1, pt, 0, pt.Length);\n                paramInfos = pt;\n            }\n\n            int count = paramInfos.Length;\n            string head = string.Empty;\n            PropertyInfo pi = null;\n            int methodType = GetMethodType(method, out pi);\n            int offset = ((method.IsStatic && !BeExtend) || beConstruct) ? 1 : 2;\n\n            if (method.Name == \"op_Equality\")\n            {\n                checkTypePos = -1;\n            }\n\n            for (int i = 0; i < tab; i++)\n            {\n                head += \"\\t\";\n            }\n\n            if ((!method.IsStatic && !beConstruct) || BeExtend)\n            {\n                if (checkTypePos > 0)\n                {\n                    CheckObject(head, type, className, 1);\n                }\n                else\n                {\n                    if (method.Name == \"Equals\")\n                    {\n                        if (!type.IsValueType && checkTypePos > 0)\n                        {\n                            CheckObject(head, type, className, 1);\n                        }\n                        else\n                        {\n                            sb.AppendFormat(\"{0}{1} obj = ({1})ToLua.ToObject(L, 1);\\r\\n\", head, className);\n                        }\n                    }\n                    else if (checkTypePos > 0)// && methodType == 0)\n                    {\n                        CheckObject(head, type, className, 1);\n                    }\n                    else\n                    {\n                        ToObject(head, type, className, 1);\n                    }\n                }\n            }\n\n            StringBuilder sbArgs = new StringBuilder();\n            List<string> refList = new List<string>();\n            List<Type> refTypes = new List<Type>();\n            checkTypePos = checkTypePos - offset + 1;\n\n            for (int j = 0; j < count; j++)\n            {\n                ParameterInfo param = paramInfos[j];\n                string arg = \"arg\" + j;\n                bool beOutArg = param.ParameterType.IsByRef && ((param.Attributes & ParameterAttributes.Out) != ParameterAttributes.None);\n                bool beParams = IsParams(param);\n                Type t = GetGenericBaseType(method, param.ParameterType);\n                ProcessArg(t, head, arg, offset + j, j >= checkTypePos, beParams, beOutArg);\n            }\n\n            for (int j = 0; j < count; j++)\n            {\n                ParameterInfo param = paramInfos[j];\n\n                if (!param.ParameterType.IsByRef)\n                {\n                    sbArgs.Append(\"arg\");\n                }\n                else\n                {\n                    if ((param.Attributes & ParameterAttributes.Out) != ParameterAttributes.None)\n\t\t\t\t\t{\n                        sbArgs.Append(\"out arg\");\n                    }\n                    else\n                    {\n                        sbArgs.Append(\"ref arg\");\n                    }\n\n                    refList.Add(\"arg\" + j);\n                    refTypes.Add(GetRefBaseType(param.ParameterType));\n                }\n\n                sbArgs.Append(j);\n\n                if (j != count - 1)\n                {\n                    sbArgs.Append(\", \");\n                }\n            }\n\n            if (beConstruct)\n            {\n                sb.AppendFormat(\"{2}{0} obj = new {0}({1});\\r\\n\", className, sbArgs.ToString(), head);\n                string str = GetPushFunction(type);\n                sb.AppendFormat(\"{0}ToLua.{1}(L, obj);\\r\\n\", head, str);\n\n                for (int i = 0; i < refList.Count; i++)\n                {\n                    GenPushStr(refTypes[i], refList[i], head);\n                }\n\n                return refList.Count + 1;\n            }\n\n            string obj = (method.IsStatic && !BeExtend) ? className : \"obj\";\n            Type retType = GetReturnType();\n\n            if (retType == typeof(void))\n            {\n                if (HasSetIndex())\n                {\n                    if (methodType == 2)\n                    {\n                        string str = sbArgs.ToString();\n                        string[] ss = str.Split(',');\n                        str = string.Join(\",\", ss, 0, ss.Length - 1);\n\n                        sb.AppendFormat(\"{0}{1}[{2}] ={3};\\r\\n\", head, obj, str, ss[ss.Length - 1]);\n                    }\n                    else if (methodType == 1)\n                    {\n                        sb.AppendFormat(\"{0}{1}.Item = arg0;\\r\\n\", head, obj, pi.Name);\n                    }\n                    else\n                    {\n                        sb.AppendFormat(\"{0}{1}.{2}({3});\\r\\n\", head, obj, method.Name, sbArgs.ToString());\n                    }\n                }\n                else if (methodType == 1)\n                {\n                    sb.AppendFormat(\"{0}{1}.{2} = arg0;\\r\\n\", head, obj, pi.Name);\n                }\n                else\n                {\n                    sb.AppendFormat(\"{3}{0}.{1}({2});\\r\\n\", obj, method.Name, sbArgs.ToString(), head);\n                }\n            }\n            else\n            {\n                Type genericType = GetGenericBaseType(method, retType);\n                string ret = GetTypeStr(genericType);\n\n                if (method.Name.StartsWith(\"op_\"))\n                {\n                    CallOpFunction(method.Name, tab, ret);\n                }\n                else if (HasGetIndex())\n                {\n                    if (methodType == 2)\n                    {\n                        sb.AppendFormat(\"{0}{1} o = {2}[{3}];\\r\\n\", head, ret, obj, sbArgs.ToString());\n                    }\n                    else if (methodType == 1)\n                    {\n                        sb.AppendFormat(\"{0}{1} o = {2}.Item;\\r\\n\", head, ret, obj);\n                    }\n                    else\n                    {\n                        sb.AppendFormat(\"{0}{1} o = {2}.{3}({4});\\r\\n\", head, ret, obj, method.Name, sbArgs.ToString());\n                    }\n                }\n                else if (method.Name == \"Equals\")\n                {\n                    if (type.IsValueType || method.GetParameters().Length > 1)\n                    {\n                        sb.AppendFormat(\"{0}{1} o = obj.Equals({2});\\r\\n\", head, ret, sbArgs.ToString());\n                    }\n                    else\n                    {\n                        sb.AppendFormat(\"{0}{1} o = obj != null ? obj.Equals({2}) : arg0 == null;\\r\\n\", head, ret, sbArgs.ToString());\n                    }\n                }\n                else if (methodType == 1)\n                {\n                    sb.AppendFormat(\"{0}{1} o = {2}.{3};\\r\\n\", head, ret, obj, pi.Name);\n                }\n                else\n                {\n                    sb.AppendFormat(\"{0}{1} o = {2}.{3}({4});\\r\\n\", head, ret, obj, method.Name, sbArgs.ToString());\n                }\n\n                bool isbuffer = IsByteBuffer();\n                GenPushStr(retType, \"o\", head, isbuffer);\n            }\n\n            for (int i = 0; i < refList.Count; i++)\n            {\n                if (refTypes[i] == typeof(RaycastHit) && method.Name == \"Raycast\" && (type == typeof(Physics) || type == typeof(Collider)))\n                {\n                    sb.AppendFormat(\"{0}if (o) ToLua.Push(L, {1}); else LuaDLL.lua_pushnil(L);\\r\\n\", head, refList[i]);\n                }\n                else\n                {\n                    GenPushStr(refTypes[i], refList[i], head);\n                }\n            }\n\n            if (!method.IsStatic && type.IsValueType && method.Name != \"ToString\")\n            {\n                sb.Append(head + \"ToLua.SetBack(L, 1, obj);\\r\\n\");\n            }\n\n            return refList.Count;\n        }\n\n        bool IsByteBuffer()\n        {\n            object[] attrs = method.GetCustomAttributes(true);\n\n            for (int j = 0; j < attrs.Length; j++)\n            {\n                Type t = attrs[j].GetType();\n\n                if (t == typeof(LuaByteBufferAttribute))\n                {\n                    return true;\n                }\n            }\n\n            return false;\n        }\n    }\n\n\tpublic static List<MemberInfo> memberInfoFilter = new List<MemberInfo>\n\t{\n        //可精确查找一个函数\n\t\t//Type.GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);\t\t\n    };\n\n    public static bool IsMemberFilter(MemberInfo mi)\n    {\n\t\tif (type.IsGenericType)\n\t\t{\n\t\t\tType genericType = type.GetGenericTypeDefinition();\n\n\t\t\tif (genericType == typeof(Dictionary<,>) && mi.Name == \"Remove\")\n\t\t\t{\n\t\t\t\tMethodBase mb = (MethodBase)mi;\n\t\t\t\treturn mb.GetParameters().Length == 2;\n\t\t\t}\n\n\t\t\tif (genericType == typeof(Dictionary<,>) || genericType == typeof(KeyValuePair<,>))\n\t\t\t{\n\t\t\t\tstring str = genericType.Name;\t\t\t\t\n\t\t\t\tstr = str.Substring(0, str.IndexOf(\"`\"));\n\t\t\t\treturn memberFilter.Contains(str + \".\" + mi.Name);\n\t\t\t}\t\t\t\n\t\t}\n\n\t\treturn memberInfoFilter.Contains(mi) || memberFilter.Contains(type.Name + \".\" + mi.Name);\n    }\n\n    public static bool IsMemberFilter(Type t)\n    {\n        string name = LuaMisc.GetTypeName(t);\n        return memberInfoFilter.Contains(t) || memberFilter.Find((p) => { return name.Contains(p); }) != null;\n    }\n\n    static ToLuaExport()\n    {\n        Debugger.useLog = true;\n    }\n\n    public static void Clear()\n    {\n        className = null;\n        type = null;\n        baseType = null;\n        isStaticClass = false;        \n        usingList.Clear();\n        op = MetaOp.None;    \n        sb = new StringBuilder();        \n        fields = null;\n        props = null;\n        methods.Clear();\n        allProps.Clear();\n        propList.Clear();\n        eventList.Clear();\n        ctorList.Clear();\n        ctorExtList.Clear();        \n        ambig = ObjAmbig.NetObj;\n        wrapClassName = \"\";\n        libClassName = \"\";\n        extendName = \"\";\n        eventSet.Clear();\n        extendType = null;\n        nameCounter.Clear();\n        events = null;\n        getItems.Clear();\n        setItems.Clear();        \n    }\n\n    private static MetaOp GetOp(string name)\n    {\n        if (name == \"op_Addition\")\n        {\n            return MetaOp.Add;\n        }\n        else if (name == \"op_Subtraction\")\n        {\n            return MetaOp.Sub;\n        }\n        else if (name == \"op_Equality\")\n        {\n            return MetaOp.Eq;\n        }\n        else if (name == \"op_Multiply\")\n        {\n            return MetaOp.Mul;\n        }\n        else if (name == \"op_Division\")\n        {\n            return MetaOp.Div;\n        }\n        else if (name == \"op_UnaryNegation\")\n        {\n            return MetaOp.Neg;\n        }\n        else if (name == \"ToString\" && !isStaticClass)\n        {\n            return MetaOp.ToStr;\n        }\n\n        return MetaOp.None;\n    }\n\n    //操作符函数无法通过继承metatable实现\n    static void GenBaseOpFunction(List<_MethodBase> list)\n    {        \n        Type baseType = type.BaseType;\n\n        while (baseType != null)\n        {\n            if (allTypes.IndexOf(baseType) >= 0)\n            {\n                MethodInfo[] methods = baseType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase);\n\n                for (int i = 0; i < methods.Length; i++)\n                {\n                    MetaOp baseOp = GetOp(methods[i].Name);\n\n                    if (baseOp != MetaOp.None && (op & baseOp) == 0)\n                    {\n                        if (baseOp != MetaOp.ToStr)\n                        {\n                            list.Add(new _MethodBase(methods[i]));\n                        }\n\n                        op |= baseOp;\n                    }\n                }\n            }\n\n            baseType = baseType.BaseType;\n        }\n    }\n\n    public static void Generate(string dir)\n    {\n#if !EXPORT_INTERFACE\n        Type iterType = typeof(System.Collections.IEnumerator);\n\n        if (type.IsInterface && type != iterType)\n        {\n            return;\n        }\n#endif\n\n        //Debugger.Log(\"Begin Generate lua Wrap for class {0}\", className);        \n        sb = new StringBuilder();\n        usingList.Add(\"System\");\n\n        if (wrapClassName == \"\")\n        {\n            wrapClassName = className;\n        }\n\n        if (type.IsEnum)\n        {\n            BeginCodeGen();\n            GenEnum();                                    \n            EndCodeGen(dir);\n            return;\n        }\n\n        InitMethods();\n        InitPropertyList();\n        InitCtorList();\n\n        BeginCodeGen();\n\n        GenRegisterFunction();\n        GenConstructFunction();\n        GenItemPropertyFunction();             \n        GenFunctions();\n        //GenToStringFunction();\n        GenIndexFunc();\n        GenNewIndexFunc();\n        GenOutFunction();\n        GenEventFunctions();\n        if (type.IsValueType && !type.IsEnum) \n        {\n            GenCSharpLuaValueTypeDefault();\n            GenCSharpLuaValueTypeClone();\n        }\n\n        EndCodeGen(dir);\n    }\n\n    //记录所有的导出类型\n    public static List<Type> allTypes = new List<Type>();\n\n    static bool BeDropMethodType(MethodInfo md)\n    {\n        Type t = md.DeclaringType;\n\n        if (t == type)\n        {\n            return true;\n        }\n\n        return allTypes.IndexOf(t) < 0;        \n    }\n\n    //是否为委托类型，没处理废弃\n    public static bool IsDelegateType(Type t)\n    {\n        if (!typeof(System.MulticastDelegate).IsAssignableFrom(t) || t == typeof(System.MulticastDelegate))\n        {\n            return false;\n        }        \n\n        if (IsMemberFilter(t))\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    static void BeginCodeGen()\n    {\n        sb.AppendFormat(\"public class {0}Wrap\\r\\n\", wrapClassName);\n        sb.AppendLineEx(\"{\");\n    }\n\n    static void EndCodeGen(string dir)\n    {\n        sb.AppendLineEx(\"}\\r\\n\");\n        SaveFile(dir + wrapClassName + \"Wrap.cs\");\n    }\n\n    static void InitMethods()\n    {\n        bool flag = false;\n\n        if (baseType != null || isStaticClass)\n        {\n            binding |= BindingFlags.DeclaredOnly;\n            flag = true;\n        }\n\n        List<_MethodBase> list = new List<_MethodBase>();\n        MethodInfo[] infos = type.GetMethods(BindingFlags.Instance | binding);\n\n        for (int i = 0; i < infos.Length; i++)\n        {\n            list.Add(new _MethodBase(infos[i]));\n        }\n\n        for (int i = list.Count - 1; i >= 0; --i)\n        {\n            //去掉操作符函数\n            if (list[i].Name.StartsWith(\"op_\") || list[i].Name.StartsWith(\"add_\") || list[i].Name.StartsWith(\"remove_\"))\n            {\n                if (!IsNeedOp(list[i].Name))\n                {\n                    list.RemoveAt(i);\n                }\n\n                continue;\n            }\n\n            //扔掉 unity3d 废弃的函数                \n            if (IsObsolete(list[i].Method))\n            {\n                list.RemoveAt(i);\n            }\n        }\n\n        PropertyInfo[] ps = type.GetProperties();\n\n        for (int i = 0; i < ps.Length; i++)\n        {\n            if (IsObsolete(ps[i]))\n            {\n                list.RemoveAll((p) => { return p.Method == ps[i].GetGetMethod() || p.Method == ps[i].GetSetMethod(); });\n            }\n            else\n            {\n                MethodInfo md = ps[i].GetGetMethod();\n\n                if (md != null)\n                {\n                    int index = list.FindIndex((m) => { return m.Method == md; });\n\n                    if (index >= 0)\n                    {\n                        if (md.GetParameters().Length == 0)\n                        {\n                            list.RemoveAt(index);\n                        }\n                        else if (list[index].HasGetIndex())\n                        {\n                            getItems.Add(list[index]);\n                        }\n                    }\n                }\n\n                md = ps[i].GetSetMethod();\n\n                if (md != null)\n                {\n                    int index = list.FindIndex((m) => { return m.Method == md; });\n\n                    if (index >= 0)\n                    {\n                        if (md.GetParameters().Length == 1)\n                        {\n                            list.RemoveAt(index);\n                        }\n                        else if (list[index].HasSetIndex())\n                        {\n                            setItems.Add(list[index]);\n                        }\n                    }\n                }\n            }\n        }\n\n        if (flag && !isStaticClass)\n        {\n            List<MethodInfo> baseList = new List<MethodInfo>(type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.IgnoreCase));\n\n            for (int i = baseList.Count - 1; i >= 0; i--)\n            {\n                if (BeDropMethodType(baseList[i]))\n                {\n                    baseList.RemoveAt(i);\n                }\n            }\n\n            HashSet<MethodInfo> addList = new HashSet<MethodInfo>();\n\n            for (int i = 0; i < list.Count; i++)\n            {\n                List<MethodInfo> mds = baseList.FindAll((p) => { return p.Name == list[i].Name; });\n\n                for (int j = 0; j < mds.Count; j++)\n                {\n                    addList.Add(mds[j]);\n                    baseList.Remove(mds[j]);\n                }\n            }\n            \n            foreach(var iter in addList)\n            {\n                list.Add(new _MethodBase(iter));\n            }\n        }\n\n        for (int i = 0; i < list.Count; i++)\n        {\n            GetDelegateTypeFromMethodParams(list[i]);\n        }\n\n        ProcessExtends(list);\n        GenBaseOpFunction(list);\n\n        for (int i = 0; i < list.Count; i++)\n        {\n            int count = GetDefalutParamCount(list[i].Method);\n            int length = list[i].GetParameters().Length;\n\n            for (int j = 0; j < count + 1; j++)\n            {\n                _MethodBase r = new _MethodBase(list[i].Method, length - j);\n                r.BeExtend = list[i].BeExtend;\n                methods.Add(r);                \n            }\n        }\n    }\n\n    static void InitPropertyList()\n    {\n        props = type.GetProperties(BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.Instance | binding);\n        propList.AddRange(type.GetProperties(BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase));\n        fields = type.GetFields(BindingFlags.GetField | BindingFlags.SetField | BindingFlags.Instance | binding);\n        events = type.GetEvents(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static);\n        eventList.AddRange(type.GetEvents(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public));\n\n        List<FieldInfo> fieldList = new List<FieldInfo>();\n        fieldList.AddRange(fields);\n\n        for (int i = fieldList.Count - 1; i >= 0; i--)\n        {\n            if (IsObsolete(fieldList[i]))\n            {\n                fieldList.RemoveAt(i);\n            }\n            else if (IsDelegateType(fieldList[i].FieldType))\n            {\n                eventSet.Add(fieldList[i].FieldType);\n            }\n        }\n\n        fields = fieldList.ToArray();\n\n        List<PropertyInfo> piList = new List<PropertyInfo>();\n        piList.AddRange(props);\n\n        for (int i = piList.Count - 1; i >= 0; i--)\n        {\n            if (IsObsolete(piList[i]))\n            {\n                piList.RemoveAt(i);\n            }\n            else if (piList[i].Name == \"Item\" && IsItemThis(piList[i]))\n            {\n                piList.RemoveAt(i);\n            }\n            else if(piList[i].GetGetMethod() != null && HasGetIndex(piList[i].GetGetMethod()))\n            {\n                piList.RemoveAt(i);\n            }\n            else if (piList[i].GetSetMethod() != null && HasSetIndex(piList[i].GetSetMethod()))\n            {\n                piList.RemoveAt(i);\n            }\n            else if (IsDelegateType(piList[i].PropertyType))\n            {\n                eventSet.Add(piList[i].PropertyType);\n            }\n        }\n\n        props = piList.ToArray();\n\n        for (int i = propList.Count - 1; i >= 0; i--)\n        {\n            if (IsObsolete(propList[i]))\n            {\n                propList.RemoveAt(i);\n            }\n        }\n\n        allProps.AddRange(props);\n        allProps.AddRange(propList);\n\n        List<EventInfo> evList = new List<EventInfo>();\n        evList.AddRange(events);\n\n        for (int i = evList.Count - 1; i >= 0; i--)\n        {\n            if (IsObsolete(evList[i]))\n            {\n                evList.RemoveAt(i);\n            }\n            else if (IsDelegateType(evList[i].EventHandlerType))\n            {\n                eventSet.Add(evList[i].EventHandlerType);\n            }\n        }\n\n        events = evList.ToArray();\n\n        for (int i = eventList.Count - 1; i >= 0; i--)\n        {\n            if (IsObsolete(eventList[i]))\n            {\n                eventList.RemoveAt(i);\n            }\n        }\n    }\n\n    static void SaveFile(string file)\n    {        \n        using (StreamWriter textWriter = new StreamWriter(file, false, Encoding.UTF8))\n        {            \n            StringBuilder usb = new StringBuilder();\n            usb.AppendLineEx(\"//this source code was auto-generated by tolua#, do not modify it\");\n\n            foreach (string str in usingList)\n            {\n                usb.AppendFormat(\"using {0};\\r\\n\", str);\n            }\n\n            usb.AppendLineEx(\"using LuaInterface;\");\n\n            if (ambig == ObjAmbig.All)\n            {\n                usb.AppendLineEx(\"using Object = UnityEngine.Object;\");\n            }\n\n            usb.AppendLineEx();\n\n            textWriter.Write(usb.ToString());\n            textWriter.Write(sb.ToString());\n            textWriter.Flush();\n            textWriter.Close();\n        }  \n    }\n\n    static string GetMethodName(MethodBase md)\n    {\n        if (md.Name.StartsWith(\"op_\"))\n        {\n            return md.Name;\n        }\n\n        object[] attrs = md.GetCustomAttributes(true);\n\n        for (int i = 0; i < attrs.Length; i++)\n        {            \n            if (attrs[i] is LuaRenameAttribute)\n            {\n                LuaRenameAttribute attr = attrs[i] as LuaRenameAttribute;\n                return attr.Name;\n            }\n        }\n\n        return md.Name;\n    }\n\n    static bool HasGetIndex(MemberInfo md)\n    {\n        if (md.Name == \"get_Item\")\n        {\n            return true;\n        }\n\n        object[] attrs = type.GetCustomAttributes(true);\n\n        for (int i = 0; i < attrs.Length; i++)\n        {\n            if (attrs[i] is DefaultMemberAttribute)\n            {\n                return md.Name == \"get_ItemOf\";\n            }\n        }\n\n        return false;\n    }\n\n    static bool HasSetIndex(MemberInfo md)\n    {\n        if (md.Name == \"set_Item\")\n        {\n            return true;\n        }\n\n        object[] attrs = type.GetCustomAttributes(true);\n\n        for (int i = 0; i < attrs.Length; i++)\n        {\n            if (attrs[i] is DefaultMemberAttribute)\n            {\n                return md.Name == \"set_ItemOf\";\n            }\n        }\n\n        return false;\n    }\n\n    static bool IsThisArray(MethodBase md, int count)\n    {\n        ParameterInfo[] pis = md.GetParameters();\n\n        if (pis.Length != count)\n        {\n            return false;\n        }\n\n        if (pis[0].ParameterType == typeof(int))\n        {\n            return true;\n        }\n\n        return false;\n    }\n\n    static void GenRegisterFuncItems()\n    {\n        //bool isList = type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>);\n        //注册库函数\n        for (int i = 0; i < methods.Count; i++)\n        {\n            _MethodBase m = methods[i];\n            int count = 1;\n\n            if (IsGenericMethod(m.Method))\n            {\n                continue;\n            }\n\n            string name = GetMethodName(m.Method);\n\n            if (!nameCounter.TryGetValue(name, out count))\n            {\n                if (name == \"get_Item\" && IsThisArray(m.Method, 1))\n                {\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"{0}\\\", get_Item);\\r\\n\", \".geti\");\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"{0}\\\", get_Item);\\r\\n\", \"get\");\n                }\n                else if (name == \"set_Item\" && IsThisArray(m.Method, 2))\n                {\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"{0}\\\", set_Item);\\r\\n\", \".seti\");\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"{0}\\\", get_Item);\\r\\n\", \"set\");\n                 }\n\n                if (!name.StartsWith(\"op_\"))\n                {\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"{0}\\\", {1});\\r\\n\", name, name == \"Register\" ? \"_Register\" : name);\n                    if (m.Method.IsSpecialName) \n                    {\n                        GenCSharpLuaGetOrSet(m, name);\n                    }\n                }\n\n                nameCounter[name] = 1;\n            }\n            else\n            {\n                nameCounter[name] = count + 1;\n            }\n        }\n\n        if (ctorList.Count > 0 || type.IsValueType || ctorExtList.Count > 0)\n        {\n            sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"New\\\", _Create{0});\\r\\n\", wrapClassName);\n        }\n\n        if (getItems.Count > 0 || setItems.Count > 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.RegVar(\\\"this\\\", _this, null);\");\n        }\n    }\n\n    static void GenRegisterOpItems()\n    {\n        if ((op & MetaOp.Add) != 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.RegFunction(\\\"__add\\\", op_Addition);\");                                            \n        }\n\n        if ((op & MetaOp.Sub) != 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.RegFunction(\\\"__sub\\\", op_Subtraction);\");\n        }\n\n        if ((op & MetaOp.Mul) != 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.RegFunction(\\\"__mul\\\", op_Multiply);\");\n        }\n\n        if ((op & MetaOp.Div) != 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.RegFunction(\\\"__div\\\", op_Division);\");\n        }\n\n        if ((op & MetaOp.Eq) != 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.RegFunction(\\\"__eq\\\", op_Equality);\");    \n        }\n\n        if ((op & MetaOp.Neg) != 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.RegFunction(\\\"__unm\\\", op_UnaryNegation);\");    \n        }\n\n        if ((op & MetaOp.ToStr) != 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.RegFunction(\\\"__tostring\\\", ToLua.op_ToString);\");\n        }\n    }\n\n    static bool IsItemThis(PropertyInfo info)\n    {        \n        MethodInfo md = info.GetGetMethod();\n\n        if (md != null)\n        {\n            return md.GetParameters().Length != 0;\n        }\n\n        md = info.GetSetMethod();\n\n        if (md != null)\n        {\n            return md.GetParameters().Length != 1;\n        }\n\n        return true;\n    }\n\n    static void GenRegisterVariables()\n    {\n        if (fields.Length == 0 && props.Length == 0 && events.Length == 0 && isStaticClass && baseType == null)\n        {\n            return;\n        }\n\n        for (int i = 0; i < fields.Length; i++)\n        {\n            if (fields[i].IsLiteral || fields[i].IsPrivate || fields[i].IsInitOnly)\n            {\n                if (fields[i].IsLiteral && fields[i].FieldType.IsPrimitive && !fields[i].FieldType.IsEnum)\n                {\n                    double d = Convert.ToDouble(fields[i].GetValue(null));\n                    sb.AppendFormat(\"\\t\\tL.RegConstant(\\\"{0}\\\", {1});\\r\\n\", fields[i].Name, d);\n                }\n                else\n                {\n                    sb.AppendFormat(\"\\t\\tL.RegVar(\\\"{0}\\\", get_{0}, null);\\r\\n\", fields[i].Name);\n                }\n            }\n            else\n            {\n                sb.AppendFormat(\"\\t\\tL.RegVar(\\\"{0}\\\", get_{0}, set_{0});\\r\\n\", fields[i].Name);\n            }\n        }\n\n        for (int i = 0; i < props.Length; i++)\n        {\n            if (props[i].CanRead && props[i].CanWrite && props[i].GetSetMethod(true).IsPublic)\n            {\n                _MethodBase md = methods.Find((p) => { return p.Name == \"get_\" + props[i].Name; });\n                string get = md == null ? \"get\" : \"_get\";\n                md = methods.Find((p) => { return p.Name == \"set_\" + props[i].Name; });\n                string set = md == null ? \"set\" : \"_set\";\n                sb.AppendFormat(\"\\t\\tL.RegVar(\\\"{0}\\\", {1}_{0}, {2}_{0});\\r\\n\", props[i].Name, get, set);\n                sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"get{0}\\\", {1}_{0});\\r\\n\", props[i].Name, get);\n                if(props[i].GetSetMethod().IsStatic)\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"set{0}\\\", {1}_{0}ter);\\r\\n\", props[i].Name, set);\n                else\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"set{0}\\\", {1}_{0});\\r\\n\", props[i].Name, set);\n            }\n            else if (props[i].CanRead)\n            {\n                _MethodBase md = methods.Find((p) => { return p.Name == \"get_\" + props[i].Name; });\n                sb.AppendFormat(\"\\t\\tL.RegVar(\\\"{0}\\\", {1}_{0}, null);\\r\\n\", props[i].Name, md == null ? \"get\" : \"_get\");\n                sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"get{0}\\\", {1}_{0});\\r\\n\", props[i].Name, md == null ? \"get\" : \"_get\");\n            }\n            else if (props[i].CanWrite)\n            {\n                _MethodBase md = methods.Find((p) => { return p.Name == \"set_\" + props[i].Name; });\n                sb.AppendFormat(\"\\t\\tL.RegVar(\\\"{0}\\\", null, {1}_{0});\\r\\n\", props[i].Name, md == null ? \"set\" : \"_set\");\n                if (props[i].GetSetMethod().IsStatic)\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"set{0}\\\", {1}_{0}ter);\\r\\n\", props[i].Name, md == null ? \"set\" : \"_set\");\n                else\n                    sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"set{0}\\\", {1}_{0});\\r\\n\", props[i].Name, md == null ? \"set\" : \"_set\");\n            }\n        }\n\n        for (int i = 0; i < events.Length; i++)\n        {\n            sb.AppendFormat(\"\\t\\tL.RegVar(\\\"{0}\\\", get_{0}, set_{0});\\r\\n\", events[i].Name);\n            sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"add{0}\\\", add{0});\\r\\n\", events[i].Name);\n            sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"remove{0}\\\", remove{0});\\r\\n\", events[i].Name);\n        }\n    }\n\n    static void GenRegisterEventTypes()\n    {\n        List<Type> list = new List<Type>();\n\n        foreach (Type t in eventSet)\n        {\n            string funcName = null;\n            string space = GetNameSpace(t, out funcName);\n\n            if (space != className)\n            {\n                list.Add(t);\n                continue;\n            }\n                        \n            funcName = ConvertToLibSign(funcName);            \n            int index = Array.FindIndex<DelegateType>(CustomSettings.customDelegateList, (p) => { return p.type == t; });\n            string abr = null;\n            if (index >= 0) abr = CustomSettings.customDelegateList[index].abr;\n            abr = abr == null ? funcName : abr;\n            funcName = ConvertToLibSign(space) + \"_\" + funcName;\n\n            sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"{0}\\\", {1});\\r\\n\", abr, funcName);\n        }\n\n        for (int i = 0; i < list.Count; i++)\n        {\n            eventSet.Remove(list[i]);\n        }\n    }\n\n    static void GenRegisterFunction()\n    {\n        sb.AppendLineEx(\"\\tpublic static void Register(LuaState L)\");\n        sb.AppendLineEx(\"\\t{\");\n\n        if (isStaticClass)\n        {\n            sb.AppendFormat(\"\\t\\tL.BeginStaticLibs(\\\"{0}\\\");\\r\\n\", libClassName);            \n        }\n        else if (!type.IsGenericType)\n        {\n            if (baseType == null)\n            {\n                sb.AppendFormat(\"\\t\\tL.BeginClass(typeof({0}), null);\\r\\n\", className);\n            }\n            else\n            {\n                sb.AppendFormat(\"\\t\\tL.BeginClass(typeof({0}), typeof({1}));\\r\\n\", className, GetBaseTypeStr(baseType));\n            }\n        }\n        else\n        {\n            if (baseType == null)\n            {\n                sb.AppendFormat(\"\\t\\tL.BeginClass(typeof({0}), null, \\\"{1}\\\");\\r\\n\", className, libClassName);\n            }\n            else\n            {\n                sb.AppendFormat(\"\\t\\tL.BeginClass(typeof({0}), typeof({1}), \\\"{2}\\\");\\r\\n\", className, GetBaseTypeStr(baseType), libClassName);\n            }\n        }\n\n        GenRegisterFuncItems();\n        GenRegisterOpItems();\n        GenRegisterVariables();\n        GenRegisterEventTypes();            //注册事件类型\n        \n        if (type.IsValueType && !type.IsEnum) \n        {\n            sb.Append(\"\\t\\tL.RegFunction(\\\"default\\\", __default__);\\r\\n\");\n            sb.Append(\"\\t\\tL.RegFunction(\\\"__clone__\\\", __clone__);\\r\\n\");\n        }\n\n        if (!isStaticClass)\n        {\n            if (CustomSettings.outList.IndexOf(type) >= 0)\n            {\n                sb.AppendLineEx(\"\\t\\tL.RegVar(\\\"out\\\", get_out, null);\");\n            }\n\n            sb.AppendFormat(\"\\t\\tL.EndClass();\\r\\n\");\n        }\n        else\n        {\n            sb.AppendFormat(\"\\t\\tL.EndStaticLibs();\\r\\n\");\n        }\n\n        sb.AppendLineEx(\"\\t}\");\n    }\n\n    static bool IsParams(ParameterInfo param)\n    {\n        return param.GetCustomAttributes(typeof(ParamArrayAttribute), false).Length > 0;\n    }\n\n    static void GenFunction(_MethodBase m)\n    {        \n        string name = GetMethodName(m.Method);\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int {0}(IntPtr L)\\r\\n\", name == \"Register\" ? \"_Register\" : name);\n        sb.AppendLineEx(\"\\t{\");\n\n        if (HasAttribute(m.Method, typeof(UseDefinedAttribute)))\n        {\n            FieldInfo field = extendType.GetField(name + \"Defined\");\n            string strfun = field.GetValue(null) as string;\n            sb.AppendLineEx(strfun);\n            sb.AppendLineEx(\"\\t}\");\n            return;\n        }\n\n        ParameterInfo[] paramInfos = m.GetParameters();\n        int offset = m.IsStatic ? 0 : 1;\n        bool haveParams = HasOptionalParam(paramInfos);\n        int rc = m.GetReturnType() == typeof(void) ? 0 : 1;\n\n        BeginTry();\n\n        if (!haveParams)\n        {\n            int count = paramInfos.Length + offset;\n            if (m.Name == \"op_UnaryNegation\") count = 2;\n            sb.AppendFormat(\"\\t\\t\\tToLua.CheckArgsCount(L, {0});\\r\\n\", count);\n        }\n        else\n        {\n            sb.AppendLineEx(\"\\t\\t\\tint count = LuaDLL.lua_gettop(L);\");\n        }\n        \n        rc += m.ProcessParams(3, false, int.MaxValue);\n        sb.AppendFormat(\"\\t\\t\\treturn {0};\\r\\n\", rc);\n        EndTry();\n        sb.AppendLineEx(\"\\t}\");\n    }\n\n    //没有未知类型的模版类型List<int> 返回false, List<T>返回true\n    static bool IsGenericConstraintType(Type t)\n    {\n        if (!t.IsGenericType)\n        {\n            return t.IsGenericParameter || t == typeof(System.ValueType);\n        }\n\n        Type[] types = t.GetGenericArguments();\n\n        for (int i = 0; i < types.Length; i++)\n        {\n            Type t1 = types[i];\n\n            if (t1.IsGenericParameter || t1 == typeof(System.ValueType))\n            {\n                return true;\n            }\n\n            if (IsGenericConstraintType(t1))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    static bool IsGenericConstraints(Type[] constraints)\n    {\n        for (int i = 0; i < constraints.Length; i++)\n        {\n            if (!IsGenericConstraintType(constraints[i]))\n            {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    static bool IsGenericMethod(MethodBase md)\n    {\n        if (md.IsGenericMethod)\n        {\n            Type[] gts = md.GetGenericArguments();\n            List<ParameterInfo> list = new List<ParameterInfo>(md.GetParameters());\n\n            for (int i = 0; i < gts.Length; i++)\n            {\n                Type[] ts = gts[i].GetGenericParameterConstraints();\n\n                if (ts == null || ts.Length == 0 || IsGenericConstraints(ts))\n                {\n                    return true;\n                }\n\n                ParameterInfo p = list.Find((iter) => { return iter.ParameterType == gts[i]; });\n\n                if (p == null)\n                {\n                    return true;\n                }\n\n                list.RemoveAll((iter) => { return iter.ParameterType == gts[i]; });\n            }\n\n            for (int i = 0; i < list.Count; i++)\n            {                \n                Type t = list[i].ParameterType;\n\n                if (IsGenericConstraintType(t))\n                {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    }\n\n    static void GenFunctions()\n    {\n        HashSet<string> set = new HashSet<string>();\n\n        for (int i = 0; i < methods.Count; i++)\n        {\n            _MethodBase m = methods[i];\n\n            if (IsGenericMethod(m.Method))\n            {\n                Debugger.Log(\"Generic Method {0}.{1} cannot be export to lua\", LuaMisc.GetTypeName(type), m.GetTotalName());\n                continue;\n            }\n\n            string name = GetMethodName(m.Method);\n\n            if (nameCounter[name] > 1)\n            {\n                if (!set.Contains(name))\n                {\n                    _MethodBase mi = GenOverrideFunc(name);\n\n                    if (mi == null)\n                    {\n                        set.Add(name);\n                        continue;\n                    }\n                    else\n                    {\n                        m = mi;     //非重载函数，或者折叠之后只有一个函数\n                    }\n                }\n                else\n                {\n                    continue;\n                }\n            }\n            \n            set.Add(name);\n            GenFunction(m);\n        }\n    }\n\n    static bool IsSealedType(Type t)\n    {\n        if (t.IsSealed || CustomSettings.sealedList.Contains(t))\n        {\n            return true;\n        }\n\n        if (t.IsGenericType && (t.GetGenericTypeDefinition() == typeof(List<>) || t.GetGenericTypeDefinition() == typeof(Dictionary<,>)))\n        {\n            return true;\n        }\n\n        return false;\n    }\n\n    static bool IsIEnumerator(Type t)\n    {\n        if (t == typeof(IEnumerator) || t == typeof(CharEnumerator)) return true;\n\n        if (typeof(IEnumerator).IsAssignableFrom(t))\n        {\n            if (t.IsGenericType)\n            {\n                Type gt = t.GetGenericTypeDefinition();\n\n                if (gt == typeof(List<>.Enumerator) || gt == typeof(Dictionary<,>.Enumerator))\n                {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    }\n\n    static string GetPushFunction(Type t, bool isByteBuffer = false)\n    {        \n        if (t.IsEnum || t.IsPrimitive || t == typeof(string) || t == typeof(LuaTable) || t == typeof(LuaCSFunction) || t == typeof(LuaThread) || t == typeof(LuaFunction)\n            || t == typeof(Type) || t == typeof(IntPtr) || typeof(Delegate).IsAssignableFrom(t) || t == typeof(LuaByteBuffer) // || t == typeof(LuaInteger64)\n            || t == typeof(Vector3) || t == typeof(Vector2) || t == typeof(Vector4) || t == typeof(Quaternion) || t == typeof(Color) || t == typeof(RaycastHit)\n            || t == typeof(Ray) || t == typeof(Touch) || t == typeof(Bounds) || t == typeof(object))\n        {\n            return \"Push\";\n        }\n        else if (t.IsArray || t == typeof(System.Array))\n        {\n            return \"Push\";\n        }\n        else if (IsIEnumerator(t))\n        {\n            return \"Push\";\n        }\n        else if (t == typeof(LayerMask))\n        {\n            return \"PushLayerMask\";\n        }\n        else if (typeof(UnityEngine.Object).IsAssignableFrom(t) || typeof(UnityEngine.TrackedReference).IsAssignableFrom(t))\n        {\n            return IsSealedType(t) ? \"PushSealed\" : \"Push\";\n        }\n        else if (t.IsValueType)\n        {\n            if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))\n            {\n                return \"PusNullable\";\n            }\n\n            return \"PushValue\";\n        }\n        else if (IsSealedType(t))\n        {\n            return \"PushSealed\";\n        }\n\n        return \"PushObject\";\n    }\n\n    static void DefaultConstruct()\n    {\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int _Create{0}(IntPtr L)\\r\\n\", wrapClassName);\n        sb.AppendLineEx(\"\\t{\");        \n        sb.AppendFormat(\"\\t\\t{0} obj = new {0}();\\r\\n\", className);\n        GenPushStr(type, \"obj\", \"\\t\\t\");\n        sb.AppendLineEx(\"\\t\\treturn 1;\");\n        sb.AppendLineEx(\"\\t}\");\n    }\n\n    static string GetCountStr(int count)\n    {\n        if (count != 0)\n        {\n            return string.Format(\"count - {0}\", count);\n        }\n\n        return \"count\";\n    }\n\n    static void GenOutFunction()\n    {\n        if (isStaticClass || CustomSettings.outList.IndexOf(type) < 0)\n        {\n            return;\n        }\n\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendLineEx(\"\\tstatic int get_out(IntPtr L)\");\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendFormat(\"\\t\\tToLua.PushOut<{0}>(L, new LuaOut<{0}>());\\r\\n\", className);\n        sb.AppendLineEx(\"\\t\\treturn 1;\");\n        sb.AppendLineEx(\"\\t}\");\n    }\n\n    static int GetDefalutParamCount(MethodBase md)\n    {\n        int count = 0;\n        ParameterInfo[] infos = md.GetParameters();\n\n        for (int i = 0; i < infos.Length; i++)\n        {\n            if (!(infos[i].DefaultValue is DBNull))\n            {\n                ++count;\n            }\n        }\n\n        return count;\n    }\n\n\tstatic void InitCtorList()\n\t{\n\t\tif (isStaticClass || type.IsAbstract || typeof(MonoBehaviour).IsAssignableFrom(type))\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tConstructorInfo[] constructors = type.GetConstructors(BindingFlags.Instance | binding);\n\n\t\tif (extendType != null)\n\t\t{\n\t\t\tConstructorInfo[] ctorExtends = extendType.GetConstructors(BindingFlags.Instance | binding);\n\n\t\t\tif (HasAttribute(ctorExtends[0], typeof(UseDefinedAttribute)))\n\t\t\t{\n\t\t\t\tctorExtList.AddRange(ctorExtends);\n\t\t\t}\n\t\t}\n\n\t\tif (constructors.Length == 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tbool isGenericType = type.IsGenericType;\n\t\tType genericType = isGenericType ? type.GetGenericTypeDefinition() : null;\n\t\tType dictType = typeof(Dictionary<,>);\n\n\t\tfor (int i = 0; i < constructors.Length; i++)\n\t\t{\n\t\t\tif (IsObsolete(constructors[i]))\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tint count = GetDefalutParamCount(constructors[i]);\n\t\t\tint length = constructors[i].GetParameters().Length;\n\n\t\t\tif (genericType == dictType && length >= 1)\n\t\t\t{\n\t\t\t\tType pt = constructors[i].GetParameters()[0].ParameterType;\n\n\t\t\t\tif (pt.IsGenericType && pt.GetGenericTypeDefinition() == typeof(System.Collections.Generic.IEnumerable<>))\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int j = 0; j < count + 1; j++)\n            {\n                _MethodBase r = new _MethodBase(constructors[i], length - j);\n                int index = ctorList.FindIndex((p) => { return CompareMethod(p, r) >= 0; });\n\n                if (index >= 0)\n                {\n                    if (CompareMethod(ctorList[index], r) == 2)\n                    {\n                        ctorList.RemoveAt(index);\n                        ctorList.Add(r);\n                    }\n                }\n                else\n                {\n                    ctorList.Add(r);\n                }\n            }\n        }\n    }\n\n    static void GenConstructFunction()\n    {\n        if (ctorExtList.Count  > 0)\n        {\n            if (HasAttribute(ctorExtList[0], typeof(UseDefinedAttribute)))\n            {\n                sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n                sb.AppendFormat(\"\\tstatic int _Create{0}(IntPtr L)\\r\\n\", wrapClassName);\n                sb.AppendLineEx(\"\\t{\");\n\n                FieldInfo field = extendType.GetField(extendName + \"Defined\");\n                string strfun = field.GetValue(null) as string;\n                sb.AppendLineEx(strfun);\n                sb.AppendLineEx(\"\\t}\");\n                return;\n            }\n        }\n\n        if (ctorList.Count == 0)\n        {\n            if (type.IsValueType)\n            {\n                DefaultConstruct();\n            }\n\n            return;\n        }\n\n        ctorList.Sort(Compare);\n        int[] checkTypeMap = CheckCheckTypePos(ctorList);\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int _Create{0}(IntPtr L)\\r\\n\", wrapClassName);\n        sb.AppendLineEx(\"\\t{\");\n\n        BeginTry();\n        sb.AppendLineEx(\"\\t\\t\\tint count = LuaDLL.lua_gettop(L);\");          \n        sb.AppendLineEx();\n\n        _MethodBase md = ctorList[0];\n        bool hasEmptyCon = ctorList[0].GetParameters().Length == 0 ? true : false;                   \n\n        //处理重载构造函数\n        if (HasOptionalParam(md.GetParameters()))\n        {\n            ParameterInfo[] paramInfos = md.GetParameters();\n            ParameterInfo param = paramInfos[paramInfos.Length - 1];\n            string str = GetTypeStr(param.ParameterType.GetElementType());\n\n            if (paramInfos.Length > 1)\n            {                \n                string strParams = md.GenParamTypes(1);\n                sb.AppendFormat(\"\\t\\t\\tif (TypeChecker.CheckTypes<{0}>(L, 1) && TypeChecker.CheckParamsType<{1}>(L, {2}, {3}))\\r\\n\", strParams, str, paramInfos.Length, GetCountStr(paramInfos.Length - 1));\n            }\n            else\n            {\n                sb.AppendFormat(\"\\t\\t\\tif (TypeChecker.CheckParamsType<{0}>(L, {1}, {2}))\\r\\n\", str, paramInfos.Length, GetCountStr(paramInfos.Length - 1));\n            }\n        }\n        else\n        {\n            ParameterInfo[] paramInfos = md.GetParameters();\n\n            if (ctorList.Count == 1 || paramInfos.Length == 0 || paramInfos.Length + 1 <= checkTypeMap[0])\n            {\n                sb.AppendFormat(\"\\t\\t\\tif (count == {0})\\r\\n\", paramInfos.Length);                \n            }\n            else\n            {\n                string strParams = md.GenParamTypes(checkTypeMap[0]);\n                sb.AppendFormat(\"\\t\\t\\tif (count == {0} && TypeChecker.CheckTypes<{1}>(L, {2}))\\r\\n\", paramInfos.Length, strParams, checkTypeMap[0]);\n            }\n        }\n\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        int rc = md.ProcessParams(4, true, checkTypeMap[0] - 1);\n        sb.AppendFormat(\"\\t\\t\\t\\treturn {0};\\r\\n\", rc);\n        sb.AppendLineEx(\"\\t\\t\\t}\");\n\n        for (int i = 1; i < ctorList.Count; i++)\n        {\n            hasEmptyCon = ctorList[i].GetParameters().Length == 0 ? true : hasEmptyCon;\n            md = ctorList[i];\n            ParameterInfo[] paramInfos = md.GetParameters();\n\n            if (!HasOptionalParam(md.GetParameters()))\n            {\n                string strParams = md.GenParamTypes(checkTypeMap[i]);\n\n                if (paramInfos.Length + 1 > checkTypeMap[i])\n                {\n                    sb.AppendFormat(\"\\t\\t\\telse if (count == {0} && TypeChecker.CheckTypes<{1}>(L, {2}))\\r\\n\", paramInfos.Length, strParams, checkTypeMap[i]);\n                }\n                else\n                {\n                    sb.AppendFormat(\"\\t\\t\\telse if (count == {0})\\r\\n\", paramInfos.Length);\n                }\n            }\n            else\n            {\n                ParameterInfo param = paramInfos[paramInfos.Length - 1];\n                string str = GetTypeStr(param.ParameterType.GetElementType());\n\n                if (paramInfos.Length > 1)\n                {\n                    string strParams = md.GenParamTypes(1);\n                    sb.AppendFormat(\"\\t\\t\\telse if (TypeChecker.CheckTypes<{0}>(L, 1) && TypeChecker.CheckParamsType<{1}>(L, {2}, {3}))\\r\\n\", strParams, str, paramInfos.Length, GetCountStr(paramInfos.Length - 1));\n                }\n                else\n                {\n                    sb.AppendFormat(\"\\t\\t\\telse if (TypeChecker.CheckParamsType<{0}>(L, {1}, {2}))\\r\\n\", str, paramInfos.Length, GetCountStr(paramInfos.Length - 1));\n                }\n            }\n\n            sb.AppendLineEx(\"\\t\\t\\t{\");            \n            rc = md.ProcessParams(4, true, checkTypeMap[i] - 1);\n            sb.AppendFormat(\"\\t\\t\\t\\treturn {0};\\r\\n\", rc);\n            sb.AppendLineEx(\"\\t\\t\\t}\");\n        }\n\n        if (type.IsValueType && !hasEmptyCon)\n        {\n            sb.AppendLineEx(\"\\t\\t\\telse if (count == 0)\");\n            sb.AppendLineEx(\"\\t\\t\\t{\");\n            sb.AppendFormat(\"\\t\\t\\t\\t{0} obj = new {0}();\\r\\n\", className);                                    \n            GenPushStr(type, \"obj\", \"\\t\\t\\t\\t\");\n            sb.AppendLineEx(\"\\t\\t\\t\\treturn 1;\");\n            sb.AppendLineEx(\"\\t\\t\\t}\");\n        }\n\n        sb.AppendLineEx(\"\\t\\t\\telse\");\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        sb.AppendFormat(\"\\t\\t\\t\\treturn LuaDLL.luaL_throw(L, \\\"invalid arguments to ctor method: {0}.New\\\");\\r\\n\", className);\n        sb.AppendLineEx(\"\\t\\t\\t}\");\n                        \n        EndTry();\n        sb.AppendLineEx(\"\\t}\");\n    }\n\n\n    //this[] 非静态函数\n    static void GenItemPropertyFunction()\n    {\n        int flag = 0;\n\n        if (getItems.Count > 0)\n        {\n            sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n            sb.AppendLineEx(\"\\tstatic int _get_this(IntPtr L)\");\n            sb.AppendLineEx(\"\\t{\");\n            BeginTry();\n\n            if (getItems.Count == 1)\n            {\n                _MethodBase m = getItems[0];\n                int count = m.GetParameters().Length + 1;\n                sb.AppendFormat(\"\\t\\t\\tToLua.CheckArgsCount(L, {0});\\r\\n\", count);\n                m.ProcessParams(3, false, int.MaxValue);\n                sb.AppendLineEx(\"\\t\\t\\treturn 1;\\r\\n\");\n            }\n            else\n            {\n                getItems.Sort(Compare);\n                int[] checkTypeMap = CheckCheckTypePos(getItems);\n\n                sb.AppendLineEx(\"\\t\\t\\tint count = LuaDLL.lua_gettop(L);\");\n                sb.AppendLineEx();\n\n                for (int i = 0; i < getItems.Count; i++)\n                {\n                    GenOverrideFuncBody(getItems[i], i == 0, checkTypeMap[i]);\n                }\n\n                sb.AppendLineEx(\"\\t\\t\\telse\");\n                sb.AppendLineEx(\"\\t\\t\\t{\");                \n                sb.AppendFormat(\"\\t\\t\\t\\treturn LuaDLL.luaL_throw(L, \\\"invalid arguments to operator method: {0}.this\\\");\\r\\n\", className);\n                sb.AppendLineEx(\"\\t\\t\\t}\");\n            }            \n            \n            EndTry();\n            sb.AppendLineEx(\"\\t}\");\n            flag |= 1;\n        }\n\n        if (setItems.Count > 0)\n        {            \n            sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n            sb.AppendLineEx(\"\\tstatic int _set_this(IntPtr L)\");\n            sb.AppendLineEx(\"\\t{\");\n            BeginTry();\n\n            if (setItems.Count == 1)\n            {\n                _MethodBase m = setItems[0];\n                int count = m.GetParameters().Length + 1;\n                sb.AppendFormat(\"\\t\\t\\tToLua.CheckArgsCount(L, {0});\\r\\n\", count);\n                m.ProcessParams(3, false, int.MaxValue);\n                sb.AppendLineEx(\"\\t\\t\\treturn 0;\\r\\n\");\n            }\n            else\n            {\n                setItems.Sort(Compare);\n                int[] checkTypeMap = CheckCheckTypePos(setItems);\n\n                sb.AppendLineEx(\"\\t\\t\\tint count = LuaDLL.lua_gettop(L);\");\n                sb.AppendLineEx();\n\n                for (int i = 0; i < setItems.Count; i++)\n                {\n                    GenOverrideFuncBody(setItems[i], i == 0, checkTypeMap[i]);\n                }\n\n                sb.AppendLineEx(\"\\t\\t\\telse\");\n                sb.AppendLineEx(\"\\t\\t\\t{\");\n                sb.AppendFormat(\"\\t\\t\\t\\treturn LuaDLL.luaL_throw(L, \\\"invalid arguments to operator method: {0}.this\\\");\\r\\n\", className);\n                sb.AppendLineEx(\"\\t\\t\\t}\");\n            }\n\n\n            EndTry();\n            sb.AppendLineEx(\"\\t}\");\n            flag |= 2;\n        }\n\n        if (flag != 0)\n        {\n            sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n            sb.AppendLineEx(\"\\tstatic int _this(IntPtr L)\");\n            sb.AppendLineEx(\"\\t{\");\n            BeginTry();\n            sb.AppendLineEx(\"\\t\\t\\tLuaDLL.lua_pushvalue(L, 1);\");\n            sb.AppendFormat(\"\\t\\t\\tLuaDLL.tolua_bindthis(L, {0}, {1});\\r\\n\", (flag & 1) == 1 ? \"_get_this\" : \"null\", (flag & 2) == 2 ? \"_set_this\" : \"null\");\n            sb.AppendLineEx(\"\\t\\t\\treturn 1;\");\n            EndTry();\n            sb.AppendLineEx(\"\\t}\");\n        }\n    }\n\n    static int GetOptionalParamPos(ParameterInfo[] infos)\n    {\n        for (int i = 0; i < infos.Length; i++)\n        {\n            if (IsParams(infos[i]))\n            {\n                return i;\n            }\n        }\n\n        return -1;\n    }\n\n    static bool Is64bit(Type t)\n    {\n        return t == typeof(long) || t == typeof(ulong);\n    }\n\n    static int Compare(_MethodBase lhs, _MethodBase rhs)\n    {\n        int off1 = lhs.IsStatic ? 0 : 1;\n        int off2 = rhs.IsStatic ? 0 : 1;\n\n        ParameterInfo[] lp = lhs.GetParameters();\n        ParameterInfo[] rp = rhs.GetParameters();\n\n        int pos1 = GetOptionalParamPos(lp);\n        int pos2 = GetOptionalParamPos(rp);\n\n        if (pos1 >= 0 && pos2 < 0)\n        {\n            return 1;\n        }\n        else if (pos1 < 0 && pos2 >= 0)\n        {\n            return -1;\n        }\n        else if (pos1 >= 0 && pos2 >= 0)\n        {\n            pos1 += off1;\n            pos2 += off2;\n\n            if (pos1 != pos2)\n            {\n                return pos1 > pos2 ? -1 : 1;\n            }\n            else\n            {\n                pos1 -= off1;\n                pos2 -= off2;\n\n                if (lp[pos1].ParameterType.GetElementType() == typeof(object) && rp[pos2].ParameterType.GetElementType() != typeof(object))\n                {\n                    return 1;\n                }\n                else if (lp[pos1].ParameterType.GetElementType() != typeof(object) && rp[pos2].ParameterType.GetElementType() == typeof(object))\n                {\n                    return -1;\n                }\n            }\n        }\n\n        int c1 = off1 + lp.Length;\n        int c2 = off2 + rp.Length;\n\n        if (c1 > c2)\n        {\n            return 1;\n        }\n        else if (c1 == c2)\n        {\n            List<ParameterInfo> list1 = new List<ParameterInfo>(lp);\n            List<ParameterInfo> list2 = new List<ParameterInfo>(rp);\n\n            if (list1.Count > list2.Count)\n            {\n                if (list1[0].ParameterType == typeof(object))\n                {\n                    return 1;\n                }\n                else if (list1[0].ParameterType.IsPrimitive)\n                {\n                    return -1;\n                }\n\n                list1.RemoveAt(0);\n            }\n            else if (list2.Count > list1.Count)\n            {\n                if (list2[0].ParameterType == typeof(object))\n                {\n                    return -1;\n                }\n                else if (list2[0].ParameterType.IsPrimitive)\n                {\n                    return 1;\n                }\n\n                list2.RemoveAt(0);\n            }\n\n            for (int i = 0; i < list1.Count; i++)\n            {\n                if (list1[i].ParameterType == typeof(object) && list2[i].ParameterType != typeof(object))\n                {\n                    return 1;\n                }\n                else if (list1[i].ParameterType != typeof(object) && list2[i].ParameterType == typeof(object))\n                {\n                    return -1;\n                }\n                else if (list1[i].ParameterType.IsPrimitive && !list2[i].ParameterType.IsPrimitive)\n                {\n                    return -1;\n                }\n                else if (!list1[i].ParameterType.IsPrimitive && list2[i].ParameterType.IsPrimitive)\n                {\n                    return 1;\n                }\n                else if (list1[i].ParameterType.IsPrimitive && list2[i].ParameterType.IsPrimitive)\n                {\n                    if (Is64bit(list1[i].ParameterType) && !Is64bit(list2[i].ParameterType))\n                    {\n                        return 1;\n                    }\n                    else if (!Is64bit(list1[i].ParameterType) && Is64bit(list2[i].ParameterType))\n                    {\n                        return -1;\n                    }\n                    else if (Is64bit(list1[i].ParameterType) && Is64bit(list2[i].ParameterType) && list1[i].ParameterType != list2[i].ParameterType)\n                    {\n                        if (list1[i].ParameterType == typeof(ulong))\n                        {\n                            return 1;\n                        }\n\n                        return -1;\n                    }\n                }\n            }\n\n            return 0;\n        }\n        else\n        {\n            return -1;\n        }\n    }\n\n    static bool HasOptionalParam(ParameterInfo[] infos)\n    {        \n        for (int i = 0; i < infos.Length; i++)\n        {\n            if (IsParams(infos[i]))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    static void CheckObject(string head, Type type, string className, int pos)\n    {\n        if (type == typeof(object))\n        {\n            sb.AppendFormat(\"{0}object obj = ToLua.CheckObject(L, {1});\\r\\n\", head, pos);\n        }\n        else if (type == typeof(Type))\n        {\n            sb.AppendFormat(\"{0}{1} obj = ToLua.CheckMonoType(L, {2});\\r\\n\", head, className, pos);\n        }\n        else if (IsIEnumerator(type))\n        {\n            sb.AppendFormat(\"{0}{1} obj = ToLua.CheckIter(L, {2});\\r\\n\", head, className, pos);\n        }\n        else\n        {\n            if (IsSealedType(type))\n            {\n                sb.AppendFormat(\"{0}{1} obj = ({1})ToLua.CheckObject(L, {2}, typeof({1}));\\r\\n\", head, className, pos);\n            }\n            else\n            {\n                sb.AppendFormat(\"{0}{1} obj = ({1})ToLua.CheckObject<{1}>(L, {2});\\r\\n\", head, className, pos);\n            }\n        }\n    }\n\n    static void ToObject(string head, Type type, string className, int pos)\n    {\n        if (type == typeof(object))\n        {\n            sb.AppendFormat(\"{0}object obj = ToLua.ToObject(L, {1});\\r\\n\", head, pos);\n        }\n        else\n        {\n            sb.AppendFormat(\"{0}{1} obj = ({1})ToLua.ToObject(L, {2});\\r\\n\", head, className, pos);\n        }\n    }\n\n    static void BeginTry()\n    {\n        sb.AppendLineEx(\"\\t\\ttry\");\n        sb.AppendLineEx(\"\\t\\t{\");\n    }\n\n    static void EndTry()\n    {\n        sb.AppendLineEx(\"\\t\\t}\");\n        sb.AppendLineEx(\"\\t\\tcatch (Exception e)\");\n        sb.AppendLineEx(\"\\t\\t{\");\n        sb.AppendLineEx(\"\\t\\t\\treturn LuaDLL.toluaL_exception(L, e);\");  \n        sb.AppendLineEx(\"\\t\\t}\");        \n    }\n    \n    static Type GetRefBaseType(Type argType)\n    {\n        if (argType.IsByRef)\n        {\n            return argType.GetElementType();\n        }\n\n        return argType;\n    }\n\n    static void ProcessArg(Type varType, string head, string arg, int stackPos, bool beCheckTypes = false, bool beParams = false, bool beOutArg = false)\n    {\n        varType = GetRefBaseType(varType);\n        string str = GetTypeStr(varType);     \n        string checkStr = beCheckTypes ? \"To\" : \"Check\";        \n\n        if (beOutArg)\n        {            \n            if (varType.IsValueType)\n            {\n                sb.AppendFormat(\"{0}{1} {2};\\r\\n\", head, str, arg);\n            }\n            else\n            {\n                sb.AppendFormat(\"{0}{1} {2} = null;\\r\\n\", head, str, arg);\n            }\n        }\n        else if (varType == typeof(bool))\n        {\n            string chkstr = beCheckTypes ? \"lua_toboolean\" : \"luaL_checkboolean\";\n            sb.AppendFormat(\"{0}bool {1} = LuaDLL.{2}(L, {3});\\r\\n\", head, arg, chkstr, stackPos);\n        }\n        else if (varType == typeof(string))\n        {\n            sb.AppendFormat(\"{0}string {1} = ToLua.{2}String(L, {3});\\r\\n\", head, arg, checkStr, stackPos);\n        }\n        else if (varType == typeof(IntPtr))\n        {\n            sb.AppendFormat(\"{0}{1} {2} = ToLua.CheckIntPtr(L, {3});\\r\\n\", head, str, arg, stackPos);                        \n        }\n        else if (varType == typeof(long))\n        {\n            string chkstr = beCheckTypes ? \"tolua_toint64\" : \"tolua_checkint64\";\n            sb.AppendFormat(\"{0}{1} {2} = LuaDLL.{3}(L, {4});\\r\\n\", head, str, arg, chkstr, stackPos);\n        }\n        else if (varType == typeof(ulong))\n        {\n            string chkstr = beCheckTypes ? \"tolua_touint64\" : \"tolua_checkuint64\";\n            sb.AppendFormat(\"{0}{1} {2} = LuaDLL.{3}(L, {4});\\r\\n\", head, str, arg, chkstr, stackPos);\n        }\n        else if (varType.IsPrimitive || IsNumberEnum(varType))\n        {\n            string chkstr = beCheckTypes ? \"lua_tonumber\" : \"luaL_checknumber\";\n            sb.AppendFormat(\"{0}{1} {2} = ({1})LuaDLL.{3}(L, {4});\\r\\n\", head, str, arg, chkstr, stackPos);\n        }\n        else if (varType == typeof(LuaFunction))\n        {\n            sb.AppendFormat(\"{0}LuaFunction {1} = ToLua.{2}LuaFunction(L, {3});\\r\\n\", head, arg, checkStr, stackPos);\n        }\n        else if (varType.IsSubclassOf(typeof(System.MulticastDelegate)))\n        {\n            if (beCheckTypes)\n            {\n                sb.AppendFormat(\"{0}{1} {2} = ({1})ToLua.ToObject(L, {3});\\r\\n\", head, str, arg, stackPos);                \n            }\n            else\n            {\n                sb.AppendFormat(\"{0}{1} {2} = ({1})ToLua.CheckDelegate<{1}>(L, {3});\\r\\n\", head, str, arg, stackPos);\n            }\n        }\n        else if (varType == typeof(LuaTable))\n        {\n            sb.AppendFormat(\"{0}LuaTable {1} = ToLua.{2}LuaTable(L, {3});\\r\\n\", head, arg, checkStr, stackPos);\n        }\n        else if (varType == typeof(Vector2))\n        {\n            sb.AppendFormat(\"{0}UnityEngine.Vector2 {1} = ToLua.ToVector2(L, {2});\\r\\n\", head, arg, stackPos);\n        }\n        else if (varType == typeof(Vector3))\n        {\n            sb.AppendFormat(\"{0}UnityEngine.Vector3 {1} = ToLua.ToVector3(L, {2});\\r\\n\", head, arg, stackPos);\n        }\n        else if (varType == typeof(Vector4))\n        {\n            sb.AppendFormat(\"{0}UnityEngine.Vector4 {1} = ToLua.ToVector4(L, {2});\\r\\n\", head, arg, stackPos);\n        }\n        else if (varType == typeof(Quaternion))\n        {\n            sb.AppendFormat(\"{0}UnityEngine.Quaternion {1} = ToLua.ToQuaternion(L, {2});\\r\\n\", head, arg, stackPos);\n        }\n        else if (varType == typeof(Color))\n        {\n            sb.AppendFormat(\"{0}UnityEngine.Color {1} = ToLua.ToColor(L, {2});\\r\\n\", head, arg, stackPos);\n        }\n        else if (varType == typeof(Ray))\n        {\n            sb.AppendFormat(\"{0}UnityEngine.Ray {1} = ToLua.ToRay(L, {2});\\r\\n\", head, arg, stackPos);\n        }\n        else if (varType == typeof(Bounds))\n        {\n            sb.AppendFormat(\"{0}UnityEngine.Bounds {1} = ToLua.ToBounds(L, {2});\\r\\n\", head, arg, stackPos);\n        }\n        else if (varType == typeof(LayerMask))\n        {\n            sb.AppendFormat(\"{0}UnityEngine.LayerMask {1} = ToLua.ToLayerMask(L, {2});\\r\\n\", head, arg, stackPos);            \n        }\n        else if (varType == typeof(object))\n        {\n            sb.AppendFormat(\"{0}object {1} = ToLua.ToVarObject(L, {2});\\r\\n\", head, arg, stackPos);         \n        }\n        else if (varType == typeof(LuaByteBuffer))\n        {\n            sb.AppendFormat(\"{0}LuaByteBuffer {1} = new LuaByteBuffer(ToLua.CheckByteBuffer(L, {2}));\\r\\n\", head, arg, stackPos);\n        }\n        else if (varType == typeof(Type))\n        {\n            if (beCheckTypes)\n            {\n                sb.AppendFormat(\"{0}System.Type {1} = (System.Type)ToLua.ToObject(L, {2});\\r\\n\", head, arg, stackPos);\n            }\n            else\n            {\n                sb.AppendFormat(\"{0}System.Type {1} = ToLua.CheckMonoType(L, {2});\\r\\n\", head, arg, stackPos);\n            }\n        }\n        else if (IsIEnumerator(varType))\n        {\n            if (beCheckTypes)\n            {                \n                sb.AppendFormat(\"{0}System.Collections.IEnumerator {1} = ToLua.ToIEnumerator(L, {2});\\r\\n\", head, arg, stackPos);\n            }\n            else\n            {\n                sb.AppendFormat(\"{0}System.Collections.IEnumerator {1} = ToLua.CheckIter(L, {2});\\r\\n\", head, arg, stackPos);\n            }\n        }\n        else if (varType.IsArray && varType.GetArrayRank() == 1)\n        {\n            Type et = varType.GetElementType();\n            string atstr = GetTypeStr(et);\n            string fname;          \n            bool flag = false;                          //是否模版函数\n            bool isObject = false;\n\n            if (et.IsPrimitive)\n            {\n                if (beParams)\n                {                    \n                    if (et == typeof(bool))\n                    {                        \n                        fname = beCheckTypes ? \"ToParamsBool\" : \"CheckParamsBool\";\n                    }\n                    else if (et == typeof(char))\n                    {\n                        //char用的多些，特殊处理一下减少gcalloc\n                        fname = beCheckTypes ? \"ToParamsChar\" : \"CheckParamsChar\";\n                    }\n                    else\n                    {\n                        flag = true;\n                        fname = beCheckTypes ? \"ToParamsNumber\" : \"CheckParamsNumber\";\n                    }\n                }\n                else if(et == typeof(char))\n                {\n                    fname = \"CheckCharBuffer\";      \n                }\n                else if (et == typeof(byte))\n                {\n                    fname = \"CheckByteBuffer\";\n                }\n                else if (et == typeof(bool))\n                {\n                    fname = \"CheckBoolArray\";\n                }\n                else\n                {\n                    fname = beCheckTypes ? \"ToNumberArray\" : \"CheckNumberArray\";\n                    flag = true;\n                }\n            }\n            else if (et == typeof(string))\n            {\n                if (beParams)\n                {\n                    fname = beCheckTypes ? \"ToParamsString\" : \"CheckParamsString\";\n                }\n                else\n                {\n                    fname = beCheckTypes ? \"ToStringArray\" : \"CheckStringArray\";\n                }                \n            }\n            else //if (et == typeof(object))\n            {\n                flag = true;\n\n                if (et == typeof(object))\n                {\n                    isObject = true;\n                    flag = false;\n                }\n\n                if (beParams)\n                {\n                    fname = (isObject || beCheckTypes) ? \"ToParamsObject\" : \"CheckParamsObject\";\n                }\n                else\n                {\n                    if (et.IsValueType)\n                    {\n                        fname = beCheckTypes ? \"ToStructArray\" : \"CheckStructArray\";\n                    }\n                    else\n                    {\n                        fname = beCheckTypes ? \"ToObjectArray\" : \"CheckObjectArray\";\n                    }\n                }\n\n                if (et == typeof(UnityEngine.Object))\n                {\n                    ambig |= ObjAmbig.U3dObj;\n                }\n            }\n\n            if (flag)\n            {\n                if (beParams)\n                {\n                    if (!isObject)\n                    {                        \n                        sb.AppendFormat(\"{0}{1}[] {2} = ToLua.{3}<{1}>(L, {4}, {5});\\r\\n\", head, atstr, arg, fname, stackPos, GetCountStr(stackPos - 1));\n                    }\n                    else\n                    {                        \n                        sb.AppendFormat(\"{0}object[] {1} = ToLua.{2}(L, {3}, {4});\\r\\n\", head, arg, fname, stackPos, GetCountStr(stackPos - 1));\n                    }\n                }\n                else\n                {                    \n                    sb.AppendFormat(\"{0}{1}[] {2} = ToLua.{3}<{1}>(L, {4});\\r\\n\", head, atstr, arg, fname, stackPos);\n                }\n            }\n            else\n            {\n                if (beParams)\n                {                    \n                    sb.AppendFormat(\"{0}{1}[] {2} = ToLua.{3}(L, {4}, {5});\\r\\n\", head, atstr, arg, fname, stackPos, GetCountStr(stackPos - 1));\n                }\n                else\n                {                    \n                    sb.AppendFormat(\"{0}{1}[] {2} = ToLua.{3}(L, {4});\\r\\n\", head, atstr, arg, fname, stackPos);\n                }\n            }\n        }\n        else if (varType.IsGenericType && varType.GetGenericTypeDefinition() == typeof(Nullable<>))\n        {\n            Type t = TypeChecker.GetNullableType(varType);\n\n            if (beCheckTypes)\n            {\n                sb.AppendFormat(\"{0}{1} {2} = ToLua.ToNullable<{3}>(L, {4});\\r\\n\", head, str, arg, GetTypeStr(t), stackPos);\n            }\n            else\n            {\n                sb.AppendFormat(\"{0}{1} {2} = ToLua.CheckNullable<{3}>(L, {4});\\r\\n\", head, str, arg, GetTypeStr(t), stackPos);\n            }\n        }\n        else if (varType.IsValueType && !varType.IsEnum)\n        {\n            string func = beCheckTypes ? \"To\" : \"Check\";\n            sb.AppendFormat(\"{0}{1} {2} = StackTraits<{1}>.{3}(L, {4});\\r\\n\", head, str, arg, func, stackPos);\n        }\n        else //从object派生但不是object\n        {\n            if (beCheckTypes)\n            {\n                sb.AppendFormat(\"{0}{1} {2} = ({1})ToLua.ToObject(L, {3});\\r\\n\", head, str, arg, stackPos);\n            }\n            //else if (varType == typeof(UnityEngine.TrackedReference) || typeof(UnityEngine.TrackedReference).IsAssignableFrom(varType))\n            //{\n            //    sb.AppendFormat(\"{3}{0} {1} = ({0})ToLua.CheckTrackedReference(L, {2}, typeof({0}));\\r\\n\", str, arg, stackPos, head);\n            //}\n            //else if (typeof(UnityEngine.Object).IsAssignableFrom(varType))\n            //{\n            //    sb.AppendFormat(\"{3}{0} {1} = ({0})ToLua.CheckUnityObject(L, {2}, typeof({0}));\\r\\n\", str, arg, stackPos, head);\n            //}\n            else\n            {\n                if (IsSealedType(varType))\n                {\n                    sb.AppendFormat(\"{0}{1} {2} = ({1})ToLua.CheckObject(L, {3}, typeof({1}));\\r\\n\", head, str, arg, stackPos);\n                }\n                else\n                {\n                    sb.AppendFormat(\"{0}{1} {2} = ({1})ToLua.CheckObject<{1}>(L, {3});\\r\\n\", head, str, arg, stackPos);\n                }\n            }\n        }\n    }\n\n    static int GetMethodType(MethodBase md, out PropertyInfo pi)\n    {\n        pi = null;\n\n        if (!md.IsSpecialName)\n        {\n            return 0;\n        }\n\n        int methodType = 0;        \n        int pos = allProps.FindIndex((p) => { return p.GetGetMethod() == md || p.GetSetMethod() == md; });\n\n        if (pos >= 0)\n        {\n            methodType = 1;\n            pi = allProps[pos];\n\n            if (md == pi.GetGetMethod())\n            {\n                if (md.GetParameters().Length > 0)\n                {\n                    methodType = 2;\n                }\n            }\n            else if (md == pi.GetSetMethod())\n            {\n                if (md.GetParameters().Length > 1)\n                {\n                    methodType = 2;\n                }\n            }\n        }\n\n        return methodType;\n    }\n\n    static Type GetGenericBaseType(MethodBase md, Type t)\n    {\n        if (!md.IsGenericMethod)\n        {\n            return t;\n        }\n\n        List<Type> list = new List<Type>(md.GetGenericArguments());\n\n        if (list.Contains(t))\n        {            \n            return t.BaseType;\n        }\n\n        return t;\n    }\n\n    static bool IsNumberEnum(Type t)\n    {\n        if (t.IsEnum) \n        {\n            return true;\n        }\n\n        if (t == typeof(BindingFlags))\n        {\n            return true;\n        }\n\n        return false;\n    }\n\n    static void GenPushStr(Type t, string arg, string head, bool isByteBuffer = false)\n    {\n        if (t == typeof(int))\n        {\n            sb.AppendFormat(\"{0}LuaDLL.lua_pushinteger(L, {1});\\r\\n\", head, arg);\n        }\n        else if (t == typeof(bool))\n        {\n            sb.AppendFormat(\"{0}LuaDLL.lua_pushboolean(L, {1});\\r\\n\", head, arg);\n        }\n        else if (t == typeof(string))\n        {\n            sb.AppendFormat(\"{0}LuaDLL.lua_pushstring(L, {1});\\r\\n\", head, arg);\n        }\n        else if (t == typeof(IntPtr))\n        {\n            sb.AppendFormat(\"{0}LuaDLL.lua_pushlightuserdata(L, {1});\\r\\n\", head, arg);\n        }\n        else if (t == typeof(long))\n        {\n            sb.AppendFormat(\"{0}LuaDLL.tolua_pushint64(L, {1});\\r\\n\", head, arg);\n        }\n        else if (t == typeof(ulong))\n        {\n            sb.AppendFormat(\"{0}LuaDLL.tolua_pushuint64(L, {1});\\r\\n\", head, arg);\n        }\n        else if ((t.IsPrimitive))\n        {\n            sb.AppendFormat(\"{0}LuaDLL.lua_pushnumber(L, {1});\\r\\n\", head, arg);\n        }\n        else if (t.IsEnum) \n        {\n            sb.AppendFormat(\"{0}LuaDLL.lua_pushinteger(L, (int){1});\\r\\n\", head, arg);\n        }\n        else\n        {           \n            if (isByteBuffer && t == typeof(byte[]))\n            {                \n                sb.AppendFormat(\"{0}LuaDLL.tolua_pushlstring(L, {1}, {1}.Length);\\r\\n\", head, arg);\n            }\n            else\n            {\n                string str = GetPushFunction(t);\n                sb.AppendFormat(\"{0}ToLua.{1}(L, {2});\\r\\n\", head, str, arg);\n            }\n        }\n    }\n\n    static bool CompareParmsCount(_MethodBase l, _MethodBase r)\n    {\n        if (l == r)\n        {\n            return false;\n        }\n\n        int c1 = l.IsStatic ? 0 : 1;\n        int c2 = r.IsStatic ? 0 : 1;\n\n        c1 += l.GetParameters().Length;\n        c2 += r.GetParameters().Length;\n\n        return c1 == c2;\n    }\n\n    //decimal 类型扔掉了\n    static Dictionary<Type, int> typeSize = new Dictionary<Type, int>()\n    {        \n        { typeof(char), 2 },\n        { typeof(byte), 3 },\n        { typeof(sbyte), 4 },\n        { typeof(ushort),5 },      \n        { typeof(short), 6 },        \n        { typeof(uint), 7 },\n        { typeof(int), 8 },                \n        //{ typeof(ulong), 9 },\n        //{ typeof(long), 10 },\n        { typeof(decimal), 11 },\n        { typeof(float), 12 },\n        { typeof(double), 13 },\n\n    };\n\n    //-1 不存在替换, 1 保留左面， 2 保留右面\n    static int CompareMethod(_MethodBase l, _MethodBase r)\n    {\n        int s = 0;\n\n        if (!CompareParmsCount(l, r))\n        {\n            return -1;\n        }\n        else\n        {\n            ParameterInfo[] lp = l.GetParameters();\n            ParameterInfo[] rp = r.GetParameters();\n\n            List<Type> ll = new List<Type>();\n            List<Type> lr = new List<Type>();\n\n            if (!l.IsStatic)\n            {\n                ll.Add(type);\n            }\n\n            if (!r.IsStatic)\n            {\n                lr.Add(type);\n            }\n\n            for (int i = 0; i < lp.Length; i++)\n            {\n                ll.Add(GetParameterType(lp[i]));\n            }\n\n            for (int i = 0; i < rp.Length; i++)\n            {\n                lr.Add(GetParameterType(rp[i]));\n            }\n\n            for (int i = 0; i < ll.Count; i++)\n            {\n                if (!typeSize.ContainsKey(ll[i]) || !typeSize.ContainsKey(lr[i]))\n                {\n                    if (ll[i] == lr[i])\n                    {\n                        continue;\n                    }\n                    else\n                    {\n                        return -1;\n                    }\n                }\n                else if (ll[i].IsPrimitive && lr[i].IsPrimitive && s == 0)\n                {\n                    s = typeSize[ll[i]] >= typeSize[lr[i]] ? 1 : 2;\n                }\n                else if (ll[i] != lr[i] && !ll[i].IsPrimitive && !lr[i].IsPrimitive)\n                {\n                    return -1;\n                }\n            }\n\n            if (s == 0 && l.IsStatic)\n            {\n                s = 2;\n            }\n        }\n\n        return s;\n    }   \n\n    static void Push(List<_MethodBase> list, _MethodBase r)\n    {\n        string name = GetMethodName(r.Method);\n        int index = list.FindIndex((p) => { return GetMethodName(p.Method) == name && CompareMethod(p, r) >= 0; });\n\n        if (index >= 0)\n        {\n            if (CompareMethod(list[index], r) == 2)\n            {                \n                Debugger.LogWarning(\"{0}.{1} has been dropped as function {2} more match lua\", className, list[index].GetTotalName(), r.GetTotalName());\n                list.RemoveAt(index);\n                list.Add(r);\n                return;\n            }\n            else\n            {\n                Debugger.LogWarning(\"{0}.{1} has been dropped as function {2} more match lua\", className, r.GetTotalName(), list[index].GetTotalName());\n                return;\n            }\n        }\n\n        list.Add(r);        \n    }\n\n    static void GenOverrideFuncBody(_MethodBase md, bool beIf, int checkTypeOffset)\n    {\n        int offset = md.IsStatic ? 0 : 1;\n        int ret = md.GetReturnType() == typeof(void) ? 0 : 1;\n        string strIf = beIf ? \"if \" : \"else if \";\n\n        if (HasOptionalParam(md.GetParameters()))\n        {\n            ParameterInfo[] paramInfos = md.GetParameters();\n            ParameterInfo param = paramInfos[paramInfos.Length - 1];\n            string str = GetTypeStr(param.ParameterType.GetElementType());\n\n            if (paramInfos.Length + offset > 1)\n            {\n                string strParams = md.GenParamTypes(0);\n                sb.AppendFormat(\"\\t\\t\\t{0}(TypeChecker.CheckTypes<{1}>(L, 1) && TypeChecker.CheckParamsType<{2}>(L, {3}, {4}))\\r\\n\", strIf, strParams, str, paramInfos.Length + offset, GetCountStr(paramInfos.Length + offset - 1));\n            }\n            else\n            {\n                sb.AppendFormat(\"\\t\\t\\t{0}(TypeChecker.CheckParamsType<{1}>(L, {2}, {3}))\\r\\n\", strIf, str, paramInfos.Length + offset, GetCountStr(paramInfos.Length + offset - 1));\n            }\n        }\n        else\n        {\n            ParameterInfo[] paramInfos = md.GetParameters();\n\n            if (paramInfos.Length + offset > checkTypeOffset)\n            {\n                string strParams = md.GenParamTypes(checkTypeOffset);\n                sb.AppendFormat(\"\\t\\t\\t{0}(count == {1} && TypeChecker.CheckTypes<{2}>(L, {3}))\\r\\n\", strIf, paramInfos.Length + offset, strParams, checkTypeOffset + 1);\n            }\n            else\n            {\n                sb.AppendFormat(\"\\t\\t\\t{0}(count == {1})\\r\\n\", strIf, paramInfos.Length + offset);\n            }\n        }\n\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        int count = md.ProcessParams(4, false, checkTypeOffset);\n        sb.AppendFormat(\"\\t\\t\\t\\treturn {0};\\r\\n\", ret + count);\n        sb.AppendLineEx(\"\\t\\t\\t}\");\n    }\n\n    static int[] CheckCheckTypePos<T>(List<T> list) where T : _MethodBase\n    {\n        int[] map = new int[list.Count];\n\n        for (int i = 0; i < list.Count;)\n        {\n            if (HasOptionalParam(list[i].GetParameters()))\n            {\n                if (list[0].IsConstructor)\n                {\n                    for (int k = 0; k < map.Length; k++)\n                    {\n                        map[k] = 1;\n                    }\n                }\n                else\n                {\n                    Array.Clear(map, 0, map.Length);\n                }\n\n                return map;\n            }\n\n            int c1 = list[i].GetParamsCount();\n            int count = c1;\n            map[i] = count;\n            int j = i + 1;\n\n            for (; j < list.Count; j++)\n            {\n                int c2 = list[j].GetParamsCount();\n\n                if (c1 == c2)\n                {\n                    count = Mathf.Min(count, list[i].GetEqualParamsCount(list[j]));\n                }\n                else\n                {\n                    map[j] = c2;\n                    break;\n                }\n\n                for (int m = i; m <= j; m++)\n                {\n                    map[m] = count;\n                }\n            }\n\n            i = j;\n        }\n\n        return map;\n    }\n\n    static void GenOverrideDefinedFunc(MethodBase method)\n    {\n        string name = GetMethodName(method);\n        FieldInfo field = extendType.GetField(name + \"Defined\");\n        string strfun = field.GetValue(null) as string;\n        sb.AppendLineEx(strfun);        \n        return;\n    }\n\n    static _MethodBase GenOverrideFunc(string name)\n    {\n        List<_MethodBase> list = new List<_MethodBase>();        \n\n        for (int i = 0; i < methods.Count; i++)\n        {\n            string curName = GetMethodName(methods[i].Method);\n\n            if (curName == name && !IsGenericMethod(methods[i].Method))\n            {\n                Push(list, methods[i]);\n            }\n        }\n\n        if (list.Count == 1)\n        {\n            return list[0];\n        }\n        else if(list.Count == 0)\n        {\n            return null;\n        }\n\n        list.Sort(Compare);\n        int[] checkTypeMap = CheckCheckTypePos(list);\n\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int {0}(IntPtr L)\\r\\n\", name == \"Register\" ? \"_Register\" : name);\n        sb.AppendLineEx(\"\\t{\");\n\n        BeginTry();\n        sb.AppendLineEx(\"\\t\\t\\tint count = LuaDLL.lua_gettop(L);\");        \n        sb.AppendLineEx();        \n                                            \n        for (int i = 0; i < list.Count; i++)\n        {\n            if (HasAttribute(list[i].Method, typeof(OverrideDefinedAttribute)))\n            {\n                GenOverrideDefinedFunc(list[i].Method);\n            }\n            else\n            {\n                GenOverrideFuncBody(list[i], i == 0, checkTypeMap[i]);\n            }\n        }\n\n        sb.AppendLineEx(\"\\t\\t\\telse\");\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        sb.AppendFormat(\"\\t\\t\\t\\treturn LuaDLL.luaL_throw(L, \\\"invalid arguments to method: {0}.{1}\\\");\\r\\n\", className, name);\n        sb.AppendLineEx(\"\\t\\t\\t}\");\n\n        EndTry();\n        sb.AppendLineEx(\"\\t}\");\n        return null;\n    }\n\n    public static string CombineTypeStr(string space, string name)\n    {\n        if (string.IsNullOrEmpty(space))\n        {\n            return name;\n        }\n        else\n        {\n            return space + \".\" + name;\n        }\n    }\n\n    public static string GetBaseTypeStr(Type t)\n    {\n        if(t.IsGenericType)\n        {\n            return LuaMisc.GetTypeName(t);            \n        }\n        else\n        {\n            return t.FullName.Replace(\"+\", \".\");\n        }\n    }\n\n    //获取类型名字\n    public static string GetTypeStr(Type t)\n    {\n        if (t.IsByRef)\n        {\n            t = t.GetElementType();\n            return GetTypeStr(t);\n        }\n        else if (t.IsArray)\n        {            \n            string str = GetTypeStr(t.GetElementType());\n            str += LuaMisc.GetArrayRank(t);\n            return str;\n        }\n        else if(t == extendType)\n        {            \n            return GetTypeStr(type);\n        }\n        else if(IsIEnumerator(t))\n        {\n            return LuaMisc.GetTypeName(typeof(IEnumerator));\n        }\n\n        return LuaMisc.GetTypeName(t);\n    }\n\n    //获取 typeof(string) 这样的名字\n    static string GetTypeOf(Type t, string sep)\n    {\n        string str;\n\n        if (t.IsByRef)\n        {\n            t = t.GetElementType();\n        }\n\n        if (IsNumberEnum(t))\n        {\n            str = string.Format(\"uint{0}\", sep);\n        }\n        else if (IsIEnumerator(t))\n        {            \n            str = string.Format(\"{0}{1}\", GetTypeStr(typeof(IEnumerator)), sep);\n        }\n        else\n        {\n            str = string.Format(\"{0}{1}\", GetTypeStr(t), sep);\n        }\n\n        return str;\n    }\n\n    static string GenParamTypes(ParameterInfo[] p, MethodBase mb, int offset = 0)\n    {\n        StringBuilder sb = new StringBuilder();\n        List<Type> list = new List<Type>();        \n\n        if (!mb.IsStatic)\n        {\n            list.Add(type);\n        }\n\n        for (int i = 0; i < p.Length; i++)\n        {\n            if (IsParams(p[i]))\n            {\n                continue;\n            }\n\n\t\t\tif (p[i].ParameterType.IsByRef && (p[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None)\n\t\t\t{\n\t\t\t\tType genericClass = typeof(LuaOut<>);\n\t\t\t\tType t = genericClass.MakeGenericType(p[i].ParameterType);\n\t\t\t\tlist.Add(t);\t\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlist.Add(GetGenericBaseType(mb, p[i].ParameterType));\n\t\t\t}\n        }\n\n        for (int i = offset; i < list.Count - 1; i++)\n        {\n            sb.Append(GetTypeOf(list[i], \", \"));\n        }\n\n        if (list.Count > 0)\n        {\n            sb.Append(GetTypeOf(list[list.Count - 1], \"\"));\n        }\n\n        return sb.ToString();\n    }\n\n    static void CheckObjectNull()\n    {\n        if (type.IsValueType)\n        {\n            sb.AppendLineEx(\"\\t\\t\\tif (o == null)\");\n        }\n        else\n        {\n            sb.AppendLineEx(\"\\t\\t\\tif (obj == null)\");\n        }\n    }\n\n    static void GenGetFieldStr(string varName, Type varType, bool isStatic, bool isByteBuffer, bool beOverride = false)\n    {\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int {0}_{1}(IntPtr L)\\r\\n\", beOverride ? \"_get\" : \"get\", varName);\n        sb.AppendLineEx(\"\\t{\");\n\n        if (isStatic)\n        {\n            string arg = string.Format(\"{0}.{1}\", className, varName);\n            BeginTry();\n            GenPushStr(varType, arg, \"\\t\\t\\t\", isByteBuffer);\n            sb.AppendLineEx(\"\\t\\t\\treturn 1;\");\n            EndTry();\n        }\n        else\n        {\n            sb.AppendLineEx(\"\\t\\tobject o = null;\\r\\n\");\n            BeginTry();\n            sb.AppendLineEx(\"\\t\\t\\to = ToLua.ToObject(L, 1);\");\n            sb.AppendFormat(\"\\t\\t\\t{0} obj = ({0})o;\\r\\n\", className);                               \n            sb.AppendFormat(\"\\t\\t\\t{0} ret = obj.{1};\\r\\n\", GetTypeStr(varType), varName);\n            GenPushStr(varType, \"ret\", \"\\t\\t\\t\", isByteBuffer);\n            sb.AppendLineEx(\"\\t\\t\\treturn 1;\");\n\n            sb.AppendLineEx(\"\\t\\t}\");\n            sb.AppendLineEx(\"\\t\\tcatch(Exception e)\");\n            sb.AppendLineEx(\"\\t\\t{\");\n            \n            sb.AppendFormat(\"\\t\\t\\treturn LuaDLL.toluaL_exception(L, e, o, \\\"attempt to index {0} on a nil value\\\");\\r\\n\", varName);\n            sb.AppendLineEx(\"\\t\\t}\");                       \n        }\n\n        sb.AppendLineEx(\"\\t}\");\n    }\n\n    static void GenGetEventStr(string varName, Type varType)\n    {\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int get_{0}(IntPtr L)\\r\\n\", varName);\n        sb.AppendLineEx(\"\\t{\");                \n        sb.AppendFormat(\"\\t\\tToLua.Push(L, new EventObject(typeof({0})));\\r\\n\",GetTypeStr(varType));\n        sb.AppendLineEx(\"\\t\\treturn 1;\");\n        sb.AppendLineEx(\"\\t}\");\n    }\n\n    static void GenIndexFunc()\n    {\n        for(int i = 0; i < fields.Length; i++)\n        {\n            if (fields[i].IsLiteral && fields[i].FieldType.IsPrimitive && !fields[i].FieldType.IsEnum)\n            {\n                continue;\n            }\n\n            bool beBuffer = IsByteBuffer(fields[i]);\n            GenGetFieldStr(fields[i].Name, fields[i].FieldType, fields[i].IsStatic, beBuffer);\n        }\n\n        for (int i = 0; i < props.Length; i++)\n        {\n            if (!props[i].CanRead)\n            {\n                continue;\n            }\n\n            bool isStatic = true;\n            int index = propList.IndexOf(props[i]);\n\n            if (index >= 0)\n            {\n                isStatic = false;\n            }\n\n            _MethodBase md = methods.Find((p) => { return p.Name == \"get_\" + props[i].Name; });\n            bool beBuffer = IsByteBuffer(props[i]);            \n\n            GenGetFieldStr(props[i].Name, props[i].PropertyType, isStatic, beBuffer, md != null);\n        }\n\n        for (int i = 0; i < events.Length; i++)\n        {            \n            GenGetEventStr(events[i].Name, events[i].EventHandlerType);\n        }\n    }\n\n    static void GenSetFieldStr(string varName, Type varType, bool isStatic, bool beOverride = false, bool csharpLike = false)\n    {\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int {0}_{1}(IntPtr L)\\r\\n\", beOverride ? \"_set\" : \"set\",  varName + (csharpLike ? \"ter\" : string.Empty)); \n        sb.AppendLineEx(\"\\t{\");        \n\n        if (!isStatic)\n        {            \n            sb.AppendLineEx(\"\\t\\tobject o = null;\\r\\n\");\n            BeginTry();\n            sb.AppendLineEx(\"\\t\\t\\to = ToLua.ToObject(L, 1);\");\n            sb.AppendFormat(\"\\t\\t\\t{0} obj = ({0})o;\\r\\n\", className);\n            ProcessArg(varType, \"\\t\\t\\t\", \"arg0\", 2);                                             \n            sb.AppendFormat(\"\\t\\t\\tobj.{0} = arg0;\\r\\n\", varName);\n\n            if (type.IsValueType)\n            {\n                sb.AppendLineEx(\"\\t\\t\\tToLua.SetBack(L, 1, obj);\");\n            }\n            sb.AppendLineEx(\"\\t\\t\\treturn 0;\");\n            sb.AppendLineEx(\"\\t\\t}\");\n            sb.AppendLineEx(\"\\t\\tcatch(Exception e)\");\n            sb.AppendLineEx(\"\\t\\t{\");            \n            sb.AppendFormat(\"\\t\\t\\treturn LuaDLL.toluaL_exception(L, e, o, \\\"attempt to index {0} on a nil value\\\");\\r\\n\", varName);      \n            sb.AppendLineEx(\"\\t\\t}\");                        \n        }\n        else\n        {\n            BeginTry();\n            ProcessArg(varType, \"\\t\\t\\t\", \"arg0\", csharpLike ? 1 : 2);\n            sb.AppendFormat(\"\\t\\t\\t{0}.{1} = arg0;\\r\\n\", className, varName);\n            sb.AppendLineEx(\"\\t\\t\\treturn 0;\");\n            EndTry();\n        }\n        \n        sb.AppendLineEx(\"\\t}\");\n    }\n\n    static void GenSetEventStr(string varName, Type varType, bool isStatic)\n    {\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int set_{0}(IntPtr L)\\r\\n\", varName);\n        sb.AppendLineEx(\"\\t{\");\n        BeginTry();\n\n        if (!isStatic)\n        {\n            sb.AppendFormat(\"\\t\\t\\t{0} obj = ({0})ToLua.CheckObject(L, 1, typeof({0}));\\r\\n\", className);\n        }\n\n        string strVarType = GetTypeStr(varType);\n        string objStr = isStatic ? className : \"obj\";\n\n        sb.AppendLineEx(\"\\t\\t\\tEventObject arg0 = null;\\r\\n\");\n        sb.AppendLineEx(\"\\t\\t\\tif (LuaDLL.lua_isuserdata(L, 2) != 0)\");\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        sb.AppendLineEx(\"\\t\\t\\t\\targ0 = (EventObject)ToLua.ToObject(L, 2);\");\n        sb.AppendLineEx(\"\\t\\t\\t}\");\n        sb.AppendLineEx(\"\\t\\t\\telse\");\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        sb.AppendFormat(\"\\t\\t\\t\\treturn LuaDLL.luaL_throw(L, \\\"The event '{0}.{1}' can only appear on the left hand side of += or -= when used outside of the type '{0}'\\\");\\r\\n\", className, varName);\n        sb.AppendLineEx(\"\\t\\t\\t}\\r\\n\");\n\n        sb.AppendLineEx(\"\\t\\t\\tif (arg0.op == EventOp.Add)\");\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        sb.AppendFormat(\"\\t\\t\\t\\t{0} ev = ({0})arg0.func;\\r\\n\", strVarType);\n        sb.AppendFormat(\"\\t\\t\\t\\t{0}.{1} += ev;\\r\\n\", objStr, varName);\n        sb.AppendLineEx(\"\\t\\t\\t}\");\n        sb.AppendLineEx(\"\\t\\t\\telse if (arg0.op == EventOp.Sub)\");\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        sb.AppendFormat(\"\\t\\t\\t\\t{0} ev = ({0})arg0.func;\\r\\n\", strVarType);\n        sb.AppendFormat(\"\\t\\t\\t\\t{0}.{1} -= ev;\\r\\n\", objStr, varName);\n        sb.AppendLineEx(\"\\t\\t\\t}\\r\\n\");\n\n        sb.AppendLineEx(\"\\t\\t\\treturn 0;\");\n        EndTry();\n\n        sb.AppendLineEx(\"\\t}\");\n        GenCSharpLuaEvent(varName, varType, isStatic, true);\n        GenCSharpLuaEvent(varName, varType, isStatic, false);\n    }\n\n  private static void GenCSharpLuaEvent(string varName, Type type, bool isStatic, bool isAdd) \n  {\n      sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n      sb.AppendFormat(\"\\tstatic int {0}{1}(IntPtr L)\\r\\n\", isAdd ? \"add\" : \"remove\", varName);\n      sb.AppendLineEx(\"\\t{\");\n      BeginTry();\n      sb.AppendFormat(\"\\t\\t\\tToLua.CheckArgsCount(L, {0});\\r\\n\", isStatic ? 1 : 2);\n\n      string strVarType = GetTypeStr(type);\n      string objStr = isStatic ? className : \"obj\";\n\n      if (!isStatic) \n      {\n          sb.AppendFormat(\"\\t\\t\\tvar obj = ({0})ToLua.CheckObject(L, 1, typeof({0}));\\r\\n\", className);\n      }\n\n      sb.AppendFormat(\"\\t\\t\\tvar arg0 = ({0})ToLua.CheckDelegate<{0}>(L, {1});\\r\\n\", strVarType, isStatic ? 1 : 2);\n      sb.AppendFormat(\"\\t\\t\\t{0}.{1} {2} arg0;\\r\\n\", objStr, varName, isAdd ? \"+=\" : \"-=\");\n      sb.AppendLineEx(\"\\t\\t\\treturn 0;\");\n      EndTry();\n      sb.AppendLineEx(\"\\t}\");\n  }\n\n  private static void GenCSharpLuaValueTypeDefault() {\n    sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n    sb.AppendFormat(\"\\tstatic int __default__(IntPtr L)\\r\\n\");\n    sb.AppendLineEx(\"\\t{\");\n    BeginTry();\n    sb.AppendFormat(\"\\t\\t\\tvar o = new {0}();\\r\\n\", className);\n    sb.Append(\"\\t\\t\\tToLua.PushValue(L, o);\\r\\n\");\n    sb.AppendLineEx(\"\\t\\t\\treturn 1;\");\n    EndTry();\n    sb.AppendLineEx(\"\\t}\");\n  }\n\n  private static void GenCSharpLuaValueTypeClone() \n  {\n      sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n      sb.AppendFormat(\"\\tstatic int __clone__(IntPtr L)\\r\\n\");\n      sb.AppendLineEx(\"\\t{\");\n      BeginTry();\n      sb.AppendFormat(\"\\t\\t\\tToLua.CheckArgsCount(L, 1);\\r\\n\");\n      sb.AppendFormat(\"\\t\\t\\tvar obj = ({0})ToLua.CheckObject(L, 1, typeof({0}));\\r\\n\", className);\n      sb.Append(\"\\t\\t\\tvar o = obj;\\r\\n\");\n      sb.Append(\"\\t\\t\\tToLua.PushValue(L, o);\\r\\n\");\n      sb.Append(\"\\t\\t\\tToLua.SetBack(L, 1, obj);\\r\\n\");\n      sb.AppendLineEx(\"\\t\\t\\treturn 1;\");\n      EndTry();\n      sb.AppendLineEx(\"\\t}\");\n  }\n\n  private static void GenCSharpLuaGetOrSet(_MethodBase m, string methodName) \n  {\n      string name = m.HasGetIndex() ? \"get\" : (m.HasSetIndex() ? \"set\" : null);\n      if (name != null) \n      {\n          sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"{0}\\\", {1});\\r\\n\", name, methodName);\n      }\n  }\n\n    static void GenNewIndexFunc()\n    {\n        for (int i = 0; i < fields.Length; i++)\n        {\n            if (fields[i].IsLiteral || fields[i].IsInitOnly || fields[i].IsPrivate)\n            {\n                continue;\n            }\n\n            GenSetFieldStr(fields[i].Name, fields[i].FieldType, fields[i].IsStatic);\n        }\n\n        for (int i = 0; i < props.Length; i++)\n        {\n            if (!props[i].CanWrite || !props[i].GetSetMethod(true).IsPublic)\n            {\n                continue;\n            }\n\n            bool isStatic = true;\n            int index = propList.IndexOf(props[i]);\n\n            if (index >= 0)\n            {\n                isStatic = false;\n            }\n\n            _MethodBase md = methods.Find((p) => { return p.Name == \"set_\" + props[i].Name; });\n            GenSetFieldStr(props[i].Name, props[i].PropertyType, isStatic, md != null);\n            // 生成CSharp.lua兼容的版本\n            if(isStatic)\n                GenSetFieldStr(props[i].Name, props[i].PropertyType, isStatic, md != null, true);\n        }\n\n        for (int i = 0; i < events.Length; i++)\n        {\n            bool isStatic = eventList.IndexOf(events[i]) < 0;\n            GenSetEventStr(events[i].Name, events[i].EventHandlerType, isStatic);\n        }\n    }\n\n    static void GenLuaFunctionRetValue(StringBuilder sb, Type t, string head, string name , bool beDefined = false)\n    {\n        if (t == typeof(bool))\n        {\n            name = beDefined ? name : \"bool \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckBoolean();\\r\\n\", head, name);\n        }\n        else if (t == typeof(long))\n        {\n            name = beDefined ? name : \"long \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckLong();\\r\\n\", head, name);\n        }\n        else if (t == typeof(ulong))\n        {\n            name = beDefined ? name : \"ulong \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckULong();\\r\\n\", head, name);\n        }\n        else if (t.IsPrimitive || IsNumberEnum(t))\n        {\n            string type = GetTypeStr(t);\n            name = beDefined ? name : type + \" \" + name;\n            sb.AppendFormat(\"{0}{1} = ({2})func.CheckNumber();\\r\\n\", head, name, type);\n        }\n        else if (t == typeof(string))\n        {\n            name = beDefined ? name : \"string \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckString();\\r\\n\", head, name);\n        }\n        else if (typeof(System.MulticastDelegate).IsAssignableFrom(t))\n        {\n            name = beDefined ? name : GetTypeStr(t) + \" \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckDelegate();\\r\\n\", head, name);\n        }\n        else if (t == typeof(Vector3))\n        {\n            name = beDefined ? name : \"UnityEngine.Vector3 \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckVector3();\\r\\n\", head, name);\n        }\n        else if (t == typeof(Quaternion))\n        {\n            name = beDefined ? name : \"UnityEngine.Quaternion \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckQuaternion();\\r\\n\", head, name);\n        }\n        else if (t == typeof(Vector2))\n        {\n            name = beDefined ? name : \"UnityEngine.Vector2 \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckVector2();\\r\\n\", head, name);\n        }\n        else if (t == typeof(Vector4))\n        {\n            name = beDefined ? name : \"UnityEngine.Vector4 \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckVector4();\\r\\n\", head, name);\n        }\n        else if (t == typeof(Color))\n        {\n            name = beDefined ? name : \"UnityEngine.Color \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckColor();\\r\\n\", head, name);\n        }\n        else if (t == typeof(Ray))\n        {\n            name = beDefined ? name : \"UnityEngine.Ray \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckRay();\\r\\n\", head, name);\n        }\n        else if (t == typeof(Bounds))\n        {\n            name = beDefined ? name : \"UnityEngine.Bounds \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckBounds();\\r\\n\", head, name);\n        }\n        else if (t == typeof(LayerMask))\n        {\n            name = beDefined ? name : \"UnityEngine.LayerMask \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckLayerMask();\\r\\n\", head, name);\n        }\n        else if (t == typeof(object))\n        {\n            name = beDefined ? name : \"object \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckVariant();\\r\\n\", head, name);\n        }\n        else if (t == typeof(byte[]))\n        {\n            name = beDefined ? name : \"byte[] \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckByteBuffer();\\r\\n\", head, name);\n        }\n        else if (t == typeof(char[]))\n        {\n            name = beDefined ? name : \"char[] \" + name;\n            sb.AppendFormat(\"{0}{1} = func.CheckCharBuffer();\\r\\n\", head, name);\n        }\n        else\n        {\n            string type = GetTypeStr(t);\n            name = beDefined ? name : type + \" \" + name;\n            sb.AppendFormat(\"{0}{1} = ({2})func.CheckObject(typeof({2}));\\r\\n\", head, name, type);\n\n            //Debugger.LogError(\"GenLuaFunctionCheckValue undefined type:\" + t.FullName);\n        }\n    }\n\n    public static bool IsByteBuffer(Type type)\n    {\n        object[] attrs = type.GetCustomAttributes(true);\n\n        for (int j = 0; j < attrs.Length; j++)\n        {\n            Type t = attrs[j].GetType();\n\n            if (t == typeof(LuaByteBufferAttribute))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    public static bool IsByteBuffer(MemberInfo mb)\n    {\n        object[] attrs = mb.GetCustomAttributes(true);\n\n        for (int j = 0; j < attrs.Length; j++)\n        {\n            Type t = attrs[j].GetType();\n\n            if (t == typeof(LuaByteBufferAttribute))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    /*static void LuaFuncToDelegate(Type t, string head)\n    {        \n        MethodInfo mi = t.GetMethod(\"Invoke\");\n        ParameterInfo[] pi = mi.GetParameters();            \n        int n = pi.Length;\n\n        if (n == 0)\n        {\n            sb.AppendLineEx(\"() =>\");\n\n            if (mi.ReturnType == typeof(void))\n            {\n                sb.AppendFormat(\"{0}{{\\r\\n{0}\\tfunc.Call();\\r\\n{0}}};\\r\\n\", head);\n            }\n            else\n            {\n                sb.AppendFormat(\"{0}{{\\r\\n{0}\\tfunc.BeginPCall();\\r\\n\", head);\n                sb.AppendFormat(\"{0}\\tfunc.PCall();\\r\\n\", head);\n                GenLuaFunctionRetValue(sb, mi.ReturnType, head + \"\\t\", \"ret\");\n                sb.AppendFormat(\"{0}\\tfunc.EndPCall();\\r\\n\", head);\n                sb.AppendLineEx(head + \"\\treturn ret;\");            \n                sb.AppendFormat(\"{0}}};\\r\\n\", head);\n            }\n\n            return;\n        }\n\n        sb.AppendFormat(\"(param0\");\n\n        for (int i = 1; i < n; i++)\n        {\n            sb.AppendFormat(\", param{0}\", i);\n        }\n\n        sb.AppendFormat(\") =>\\r\\n{0}{{\\r\\n{0}\", head);\n        sb.AppendLineEx(\"\\tfunc.BeginPCall();\");\n\n        for (int i = 0; i < n; i++)\n        {\n            string push = GetPushFunction(pi[i].ParameterType);\n\n            if (!IsParams(pi[i]))\n            {\n                if (pi[i].ParameterType == typeof(byte[]) && IsByteBuffer(t))\n                {\n                    sb.AppendFormat(\"{0}\\tfunc.PushByteBuffer(param{1});\\r\\n\", head, i);\n                }\n                else\n                {\n                    sb.AppendFormat(\"{0}\\tfunc.{1}(param{2});\\r\\n\", head, push, i);\n                }\n            }\n            else\n            {\n                sb.AppendLineEx();\n                sb.AppendFormat(\"{0}\\tfor (int i = 0; i < param{1}.Length; i++)\\r\\n\", head, i);\n                sb.AppendLineEx(head + \"\\t{\");\n                sb.AppendFormat(\"{0}\\t\\tfunc.{1}(param{2}[i]);\\r\\n\", head, push, i);\n                sb.AppendLineEx(head + \"\\t}\\r\\n\");\n            }\n        }\n\n        sb.AppendFormat(\"{0}\\tfunc.PCall();\\r\\n\", head);\n\n        if (mi.ReturnType == typeof(void))\n        {\n            for (int i = 0; i < pi.Length; i++)\n            {\n                if ((pi[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None)\n                {\n                    GenLuaFunctionRetValue(sb, pi[i].ParameterType, head + \"\\t\", \"param\" + i, true);\n                }\n            }\n\n            sb.AppendFormat(\"{0}\\tfunc.EndPCall();\\r\\n\", head);\n        }\n        else\n        {\n            GenLuaFunctionRetValue(sb, mi.ReturnType, head + \"\\t\", \"ret\");\n\n            for (int i = 0; i < pi.Length; i++)\n            {\n                if ((pi[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None)\n                {\n                    GenLuaFunctionRetValue(sb, pi[i].ParameterType, head + \"\\t\", \"param\" + i, true);\n                }\n            }\n\n            sb.AppendFormat(\"{0}\\tfunc.EndPCall();\\r\\n\", head);\n            sb.AppendLineEx(head + \"\\treturn ret;\");            \n        }\n\n        sb.AppendFormat(\"{0}}};\\r\\n\", head);\n    }*/\n\n    static void GenDelegateBody(StringBuilder sb, Type t, string head, bool hasSelf = false)\n    {        \n        MethodInfo mi = t.GetMethod(\"Invoke\");\n        ParameterInfo[] pi = mi.GetParameters();\n        int n = pi.Length;\n\n        if (n == 0)\n        {\n            if (mi.ReturnType == typeof(void))\n            {\n                if (!hasSelf)\n                {\n                    sb.AppendFormat(\"{0}{{\\r\\n{0}\\tfunc.Call();\\r\\n{0}}}\\r\\n\", head);\n                }\n                else\n                {\n                    sb.AppendFormat(\"{0}{{\\r\\n{0}\\tfunc.BeginPCall();\\r\\n\", head);\n                    sb.AppendFormat(\"{0}\\tfunc.Push(self);\\r\\n\", head);\n                    sb.AppendFormat(\"{0}\\tfunc.PCall();\\r\\n\", head);                    \n                    sb.AppendFormat(\"{0}\\tfunc.EndPCall();\\r\\n\", head);                    \n                    sb.AppendFormat(\"{0}}}\\r\\n\", head);\n                }\n            }\n            else\n            {\n                sb.AppendFormat(\"{0}{{\\r\\n{0}\\tfunc.BeginPCall();\\r\\n\", head);\n                if (hasSelf) sb.AppendFormat(\"{0}\\tfunc.Push(self);\\r\\n\", head);\n                sb.AppendFormat(\"{0}\\tfunc.PCall();\\r\\n\", head);\n                GenLuaFunctionRetValue(sb, mi.ReturnType, head + \"\\t\", \"ret\");\n                sb.AppendFormat(\"{0}\\tfunc.EndPCall();\\r\\n\", head);\n                sb.AppendLineEx(head + \"\\treturn ret;\");\n                sb.AppendFormat(\"{0}}}\\r\\n\", head);\n            }\n\n            return;\n        }\n\n        sb.AppendFormat(\"{0}{{\\r\\n{0}\", head);\n        sb.AppendLineEx(\"\\tfunc.BeginPCall();\");\n        if (hasSelf) sb.AppendFormat(\"{0}\\tfunc.Push(self);\\r\\n\", head);\n\n        for (int i = 0; i < n; i++)\n        {                        \n            string push = GetPushFunction(pi[i].ParameterType);\n\n            if (!IsParams(pi[i]))\n            {\n                if (pi[i].ParameterType == typeof(byte[]) && IsByteBuffer(t))\n                {\n                    sb.AppendFormat(\"{2}\\tfunc.PushByteBuffer(param{1});\\r\\n\", push, i, head);\n                }\n                else if ((pi[i].Attributes & ParameterAttributes.Out) == ParameterAttributes.None)\n                {\n                    sb.AppendFormat(\"{2}\\tfunc.{0}(param{1});\\r\\n\", push, i, head);\n                }\n            }\n            else\n            {\n                sb.AppendLineEx();\n                sb.AppendFormat(\"{0}\\tfor (int i = 0; i < param{1}.Length; i++)\\r\\n\", head, i);\n                sb.AppendLineEx(head + \"\\t{\");\n                sb.AppendFormat(\"{2}\\t\\tfunc.{0}(param{1}[i]);\\r\\n\", push, i, head);\n                sb.AppendLineEx(head + \"\\t}\\r\\n\");\n            }\n        }\n\n        sb.AppendFormat(\"{0}\\tfunc.PCall();\\r\\n\", head);\n\n        if (mi.ReturnType == typeof(void))\n        {\n            for (int i = 0; i < pi.Length; i++)\n            {\n                if ((pi[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None)\n                {\n                    GenLuaFunctionRetValue(sb, pi[i].ParameterType.GetElementType(), head + \"\\t\", \"param\" + i, true);\n                }\n            }\n\n            sb.AppendFormat(\"{0}\\tfunc.EndPCall();\\r\\n\", head);\n        }\n        else\n        {\n            GenLuaFunctionRetValue(sb, mi.ReturnType, head + \"\\t\", \"ret\");\n\n            for (int i = 0; i < pi.Length; i++)\n            {\n                if ((pi[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None)\n                {\n                    GenLuaFunctionRetValue(sb, pi[i].ParameterType.GetElementType(), head + \"\\t\", \"param\" + i, true);\n                }\n            }\n\n            sb.AppendFormat(\"{0}\\tfunc.EndPCall();\\r\\n\", head);\n            sb.AppendLineEx(head + \"\\treturn ret;\");\n        }\n\n        sb.AppendFormat(\"{0}}}\\r\\n\", head);\n    }      \n\n    //static void GenToStringFunction()\n    //{                \n    //    if ((op & MetaOp.ToStr) == 0)\n    //    {\n    //        return;\n    //    }\n\n    //    sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n    //    sb.AppendLineEx(\"\\tstatic int Lua_ToString(IntPtr L)\");\n    //    sb.AppendLineEx(\"\\t{\");\n    //    sb.AppendLineEx(\"\\t\\tobject obj = ToLua.ToObject(L, 1);\\r\\n\");\n\n    //    sb.AppendLineEx(\"\\t\\tif (obj != null)\");\n    //    sb.AppendLineEx(\"\\t\\t{\");\n    //    sb.AppendLineEx(\"\\t\\t\\tLuaDLL.lua_pushstring(L, obj.ToString());\");\n    //    sb.AppendLineEx(\"\\t\\t}\");\n    //    sb.AppendLineEx(\"\\t\\telse\");\n    //    sb.AppendLineEx(\"\\t\\t{\");\n    //    sb.AppendLineEx(\"\\t\\t\\tLuaDLL.lua_pushnil(L);\");\n    //    sb.AppendLineEx(\"\\t\\t}\");\n    //    sb.AppendLineEx();\n    //    sb.AppendLineEx(\"\\t\\treturn 1;\");\n    //    sb.AppendLineEx(\"\\t}\");\n    //}\n\n    static bool IsNeedOp(string name)\n    {\n        if (name == \"op_Addition\")\n        {\n            op |= MetaOp.Add;\n        }\n        else if (name == \"op_Subtraction\")\n        {\n            op |= MetaOp.Sub;\n        }\n        else if (name == \"op_Equality\")\n        {\n            op |= MetaOp.Eq;\n        }\n        else if (name == \"op_Multiply\")\n        {\n            op |= MetaOp.Mul;\n        }\n        else if (name == \"op_Division\")\n        {\n            op |= MetaOp.Div;\n        }\n        else if (name == \"op_UnaryNegation\")\n        {\n            op |= MetaOp.Neg;\n        }\n        else if (name == \"ToString\" && !isStaticClass)\n        {\n            op |= MetaOp.ToStr;\n        }\n        else\n        {\n            return false;\n        }\n        \n\n        return true;\n    }\n\n    static void CallOpFunction(string name, int count, string ret)\n    {\n        string head = string.Empty;\n\n        for (int i = 0; i < count; i++)\n        {\n            head += \"\\t\";\n        }\n\n        if (name == \"op_Addition\")\n        {\n            sb.AppendFormat(\"{0}{1} o = arg0 + arg1;\\r\\n\", head, ret);\n        }\n        else if (name == \"op_Subtraction\")\n        {\n            sb.AppendFormat(\"{0}{1} o = arg0 - arg1;\\r\\n\", head, ret);            \n        }\n        else if (name == \"op_Equality\")\n        {\n            sb.AppendFormat(\"{0}{1} o = arg0 == arg1;\\r\\n\", head, ret);\n        }\n        else if (name == \"op_Multiply\")\n        {\n            sb.AppendFormat(\"{0}{1} o = arg0 * arg1;\\r\\n\", head, ret);\n        }\n        else if (name == \"op_Division\")\n        {\n            sb.AppendFormat(\"{0}{1} o = arg0 / arg1;\\r\\n\", head, ret);            \n        }\n        else if (name == \"op_UnaryNegation\")\n        {\n            sb.AppendFormat(\"{0}{1} o = -arg0;\\r\\n\", head, ret);\n        }\n    }\n\n    public static bool IsObsolete(MemberInfo mb)\n    {\n        object[] attrs = mb.GetCustomAttributes(true);\n\n        for (int j = 0; j < attrs.Length; j++)\n        {\n            Type t = attrs[j].GetType() ;            \n\n            if (t == typeof(System.ObsoleteAttribute) || t == typeof(NoToLuaAttribute) || t == typeof(MonoPInvokeCallbackAttribute) ||\n                t.Name == \"MonoNotSupportedAttribute\" || t.Name == \"MonoTODOAttribute\") // || t.ToString() == \"UnityEngine.WrapperlessIcall\")\n            {\n                return true;               \n            }\n        }\n\n        if (IsMemberFilter(mb))\n        {\n            return true;\n        }        \n\n        return false;\n    }    \n\n    public static bool HasAttribute(MemberInfo mb, Type atrtype)\n    {\n        object[] attrs = mb.GetCustomAttributes(true);\n\n        for (int j = 0; j < attrs.Length; j++)\n        {\n            Type t = attrs[j].GetType();\n\n            if (t == atrtype)\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    static void GenEnum()\n    {\n        fields = type.GetFields(BindingFlags.GetField | BindingFlags.Public | BindingFlags.Static);\n        List<FieldInfo> list = new List<FieldInfo>(fields);\n\n        for (int i = list.Count - 1; i > 0; i--)\n        {\n            if (IsObsolete(list[i]))\n            {\n                list.RemoveAt(i);\n            }\n        }\n\n        fields = list.ToArray();                \n\n        sb.AppendLineEx(\"\\tpublic static void Register(LuaState L)\");\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendFormat(\"\\t\\tL.BeginEnum(typeof({0}));\\r\\n\", className);\n\n        for (int i = 0; i < fields.Length; i++)\n        {\n            //sb.AppendFormat(\"\\t\\tL.RegVar(\\\"{0}\\\", get_{0}, null);\\r\\n\", fields[i].Name);\n            string name = fields[i].Name;\n            sb.AppendFormat(\"\\t\\tL.RegConstant(\\\"{0}\\\", {1});\\r\\n\", name, className + '.' + name);\n        }\n\n        //sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"IntToEnum\\\", IntToEnum);\\r\\n\");\n        sb.AppendFormat(\"\\t\\tL.EndEnum();\\r\\n\");\n        sb.AppendFormat(\"\\t\\tTypeTraits<{0}>.Check = CheckType;\\r\\n\", className);\n        sb.AppendFormat(\"\\t\\tStackTraits<{0}>.Push = Push;\\r\\n\", className);\n        sb.AppendLineEx(\"\\t}\");\n        sb.AppendLineEx();\n\n        sb.AppendFormat(\"\\tstatic void Push(IntPtr L, {0} arg)\\r\\n\", className);\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendLineEx(\"\\t\\tToLua.Push(L, arg);\");\n        sb.AppendLineEx(\"\\t}\");\n        sb.AppendLineEx();\n\n        sb.AppendLineEx(\"\\tstatic bool CheckType(IntPtr L, int pos)\");\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendFormat(\"\\t\\treturn TypeChecker.CheckEnumType(typeof({0}), L, pos);\\r\\n\", className);\n        sb.AppendLineEx(\"\\t}\");        \n\n        /*\n        for (int i = 0; i < fields.Length; i++)\n        {\n            sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n            sb.AppendFormat(\"\\tstatic int get_{0}(IntPtr L)\\r\\n\", fields[i].Name);\n            sb.AppendLineEx(\"\\t{\");\n            sb.AppendFormat(\"\\t\\tToLua.Push(L, {0}.{1});\\r\\n\", className, fields[i].Name);\n            sb.AppendLineEx(\"\\t\\treturn 1;\");\n            sb.AppendLineEx(\"\\t}\");            \n        }\n\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendLineEx(\"\\tstatic int IntToEnum(IntPtr L)\");\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendLineEx(\"\\t\\tint arg0 = (int)LuaDLL.lua_tonumber(L, 1);\");\n        sb.AppendFormat(\"\\t\\t{0} o = ({0})arg0;\\r\\n\", className);\n        sb.AppendLineEx(\"\\t\\tToLua.Push(L, o);\");\n        sb.AppendLineEx(\"\\t\\treturn 1;\");\n        sb.AppendLineEx(\"\\t}\"); */   \n    }\n\n    static string CreateDelegate = @\"    \n    public static Delegate CreateDelegate(Type t, LuaFunction func = null)\n    {\n        DelegateCreate Create = null;\n\n        if (!dict.TryGetValue(t, out Create))\n        {\n            throw new LuaException(string.Format(\"\"Delegate {0} not register\"\", LuaMisc.GetTypeName(t)));            \n        }\n\n        if (func != null)\n        {\n            LuaState state = func.GetLuaState();\n            LuaDelegate target = state.GetLuaDelegate(func);\n            \n            if (target != null)\n            {\n                return Delegate.CreateDelegate(t, target, target.method);\n            }  \n            else\n            {\n                Delegate d = Create(func, null, false);\n                target = d.Target as LuaDelegate;\n                state.AddLuaDelegate(target, func);\n                return d;\n            }       \n        }\n\n        return Create(null, null, false);        \n    }\n    \n    public static Delegate CreateDelegate(Type t, LuaFunction func, LuaTable self)\n    {\n        DelegateCreate Create = null;\n\n        if (!dict.TryGetValue(t, out Create))\n        {\n            throw new LuaException(string.Format(\"\"Delegate {0} not register\"\", LuaMisc.GetTypeName(t)));\n        }\n\n        if (func != null)\n        {\n            LuaState state = func.GetLuaState();\n            LuaDelegate target = state.GetLuaDelegate(func, self);\n\n            if (target != null)\n            {\n                return Delegate.CreateDelegate(t, target, target.method);\n            }\n            else\n            {\n                Delegate d = Create(func, self, true);\n                target = d.Target as LuaDelegate;\n                state.AddLuaDelegate(target, func, self);\n                return d;\n            }\n        }\n\n        return Create(null, null, true);\n    }\n\";\n\n    static string RemoveDelegate = @\"    \n    public static Delegate RemoveDelegate(Delegate obj, LuaFunction func)\n    {\n        LuaState state = func.GetLuaState();\n        Delegate[] ds = obj.GetInvocationList();\n\n        for (int i = 0; i < ds.Length; i++)\n        {\n            LuaDelegate ld = ds[i].Target as LuaDelegate;\n\n            if (ld != null && ld.func == func)\n            {\n                obj = Delegate.Remove(obj, ds[i]);\n                state.DelayDispose(ld.func);\n                break;\n            }\n        }\n\n        return obj;\n    }\n    \n    public static Delegate RemoveDelegate(Delegate obj, Delegate dg)\n    {\n        LuaDelegate remove = dg.Target as LuaDelegate;\n\n        if (remove == null)\n        {\n            obj = Delegate.Remove(obj, dg);\n            return obj;\n        }\n\n        LuaState state = remove.func.GetLuaState();\n        Delegate[] ds = obj.GetInvocationList();        \n\n        for (int i = 0; i < ds.Length; i++)\n        {\n            LuaDelegate ld = ds[i].Target as LuaDelegate;\n\n            if (ld != null && ld == remove)\n            {\n                obj = Delegate.Remove(obj, ds[i]);\n                state.DelayDispose(ld.func);\n                state.DelayDispose(ld.self);\n                break;\n            }\n        }\n\n        return obj;\n    }\n\";\n\n    static string GetDelegateParams(MethodInfo mi)\n    {\n        ParameterInfo[] infos = mi.GetParameters();\n        List<string> list = new List<string>();\n\n        for (int i = 0; i < infos.Length; i++)\n        {      \n            string s2 = GetTypeStr(infos[i].ParameterType) + \" param\" + i;            \n\n            if (infos[i].ParameterType.IsByRef)\n            {\n                if (infos[i].Attributes == ParameterAttributes.Out)\n                {\n                    s2 = \"out \" + s2;\n                }\n                else\n                {\n                    s2 = \"ref \" + s2;\n                }\n            }\n\n            list.Add(s2);\n        }\n\n        return string.Join(\", \", list.ToArray());\n    }\n\n    static string GetReturnValue(Type t)\n    {\n        if (t.IsPrimitive)\n        {\n            if (t == typeof(bool))\n            {\n                return \"false\";\n            }\n            else if (t == typeof(char))\n            {\n                return \"'\\\\0'\";\n            }\n            else\n            {\n                return \"0\";\n            }\n        }\n        else if (!t.IsValueType)\n        {\n            return \"null\";\n        }\n        else\n        {\n            return string.Format(\"default({0})\", GetTypeStr(t));\n        }\n    }\n\n    static string GetDefaultDelegateBody(MethodInfo md)\n    {        \n        string str = \"\\r\\n\\t\\t\\t{\\r\\n\";\n        bool flag = false;\n        ParameterInfo[] pis = md.GetParameters();\n\n        for (int i = 0; i < pis.Length; i++)\n        {\n            if ((pis[i].Attributes & ParameterAttributes.Out) != ParameterAttributes.None)\n\t\t\t{\n                str += string.Format(\"\\t\\t\\t\\tparam{0} = {1};\\r\\n\", i, GetReturnValue(pis[i].ParameterType.GetElementType()));\n                flag = true;\n            }\n        }\n\n        if (flag)\n        {\n            if (md.ReturnType != typeof(void))\n            {\n                str += \"\\t\\t\\treturn \";\n                str += GetReturnValue(md.ReturnType);\n                str += \";\";\n            }\n\n            str += \"\\t\\t\\t};\\r\\n\\r\\n\";\n            return str;\n        }\n\n        if (md.ReturnType == typeof(void))\n        {\n            return \"{ };\\r\\n\";\n        }        \n        else\n        {\n            return string.Format(\"{{ return {0}; }};\\r\\n\", GetReturnValue(md.ReturnType));\n        }\n    }\n\n    public static void GenDelegates(DelegateType[] list)\n    {        \n        usingList.Add(\"System\");\n        usingList.Add(\"System.Collections.Generic\");        \n\n        for (int i = 0; i < list.Length; i++)\n        {\n            Type t = list[i].type;\n\n            if (!typeof(System.Delegate).IsAssignableFrom(t))\n            {\n                Debug.LogError(t.FullName + \" not a delegate type\");\n                return;\n            }          \n        }\n\n        sb.Append(\"public class DelegateFactory\\r\\n\");\n        sb.Append(\"{\\r\\n\");        \n        sb.Append(\"\\tpublic delegate Delegate DelegateCreate(LuaFunction func, LuaTable self, bool flag);\\r\\n\");\n        sb.Append(\"\\tpublic static Dictionary<Type, DelegateCreate> dict = new Dictionary<Type, DelegateCreate>();\\r\\n\");\n        sb.Append(\"\\tstatic DelegateFactory factory = new DelegateFactory();\\r\\n\");\n        sb.AppendLineEx();\n        sb.Append(\"\\tpublic static void Init()\\r\\n\");\n        sb.Append(\"\\t{\\r\\n\");\n        sb.Append(\"\\t\\tRegister();\\r\\n\");\n        sb.AppendLineEx(\"\\t}\\r\\n\");        \n        \n        sb.Append(\"\\tpublic static void Register()\\r\\n\");\n        sb.Append(\"\\t{\\r\\n\");\n        sb.Append(\"\\t\\tdict.Clear();\\r\\n\");\n\n        for (int i = 0; i < list.Length; i++)\n        {            \n            string type = list[i].strType;\n            string name = list[i].name;\n            sb.AppendFormat(\"\\t\\tdict.Add(typeof({0}), factory.{1});\\r\\n\", type, name);            \n        }\n\n        sb.AppendLineEx();\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            string type = list[i].strType;\n            string name = list[i].name;            \n            sb.AppendFormat(\"\\t\\tDelegateTraits<{0}>.Init(factory.{1});\\r\\n\", type, name);                        \n        }\n\n        sb.AppendLineEx();\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            string type = list[i].strType;\n            string name = list[i].name;            \n            sb.AppendFormat(\"\\t\\tTypeTraits<{0}>.Init(factory.Check_{1});\\r\\n\", type, name);            \n        }\n\n        sb.AppendLineEx();\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            string type = list[i].strType;\n            string name = list[i].name;\n            sb.AppendFormat(\"\\t\\tStackTraits<{0}>.Push = factory.Push_{1};\\r\\n\", type, name);            \n        }\n\n        sb.Append(\"\\t}\\r\\n\");\n        sb.Append(CreateDelegate);\n        sb.AppendLineEx(RemoveDelegate);\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            Type t = list[i].type;\n            string strType = list[i].strType;\n            string name = list[i].name;\n            MethodInfo mi = t.GetMethod(\"Invoke\");\n            string args = GetDelegateParams(mi);\n\n            //生成委托类\n            sb.AppendFormat(\"\\tclass {0}_Event : LuaDelegate\\r\\n\", name);\n            sb.AppendLineEx(\"\\t{\");\n            sb.AppendFormat(\"\\t\\tpublic {0}_Event(LuaFunction func) : base(func) {{ }}\\r\\n\", name);\n            sb.AppendFormat(\"\\t\\tpublic {0}_Event(LuaFunction func, LuaTable self) : base(func, self) {{ }}\\r\\n\", name);\n            sb.AppendLineEx();\n            sb.AppendFormat(\"\\t\\tpublic {0} Call({1})\\r\\n\", GetTypeStr(mi.ReturnType), args);\n            GenDelegateBody(sb, t, \"\\t\\t\");\n            sb.AppendLineEx();\n            sb.AppendFormat(\"\\t\\tpublic {0} CallWithSelf({1})\\r\\n\", GetTypeStr(mi.ReturnType), args);\n            GenDelegateBody(sb, t, \"\\t\\t\", true);\n            sb.AppendLineEx(\"\\t}\\r\\n\");\n\n            //生成转换函数1\n            sb.AppendFormat(\"\\tpublic {0} {1}(LuaFunction func, LuaTable self, bool flag)\\r\\n\", strType, name);\n            sb.AppendLineEx(\"\\t{\");\n            sb.AppendLineEx(\"\\t\\tif (func == null)\");\n            sb.AppendLineEx(\"\\t\\t{\");\n            sb.AppendFormat(\"\\t\\t\\t{0} fn = delegate({1}) {2}\", strType, args, GetDefaultDelegateBody(mi));\n            sb.AppendLineEx(\"\\t\\t\\treturn fn;\");\n            sb.AppendLineEx(\"\\t\\t}\\r\\n\");\n            sb.AppendLineEx(\"\\t\\tif(!flag)\");\n            sb.AppendLineEx(\"\\t\\t{\");\n            sb.AppendFormat(\"\\t\\t\\t{0}_Event target = new {0}_Event(func);\\r\\n\", name);\n            sb.AppendFormat(\"\\t\\t\\t{0} d = target.Call;\\r\\n\", strType);\n            sb.AppendLineEx(\"\\t\\t\\ttarget.method = d.Method;\");\n            sb.AppendLineEx(\"\\t\\t\\treturn d;\");\n            sb.AppendLineEx(\"\\t\\t}\");\n            sb.AppendLineEx(\"\\t\\telse\");\n            sb.AppendLineEx(\"\\t\\t{\");\n            sb.AppendFormat(\"\\t\\t\\t{0}_Event target = new {0}_Event(func, self);\\r\\n\", name);\n            sb.AppendFormat(\"\\t\\t\\t{0} d = target.CallWithSelf;\\r\\n\", strType);\n            sb.AppendLineEx(\"\\t\\t\\ttarget.method = d.Method;\");\n            sb.AppendLineEx(\"\\t\\t\\treturn d;\");\n            sb.AppendLineEx(\"\\t\\t}\");\n            sb.AppendLineEx(\"\\t}\\r\\n\");\n\n            sb.AppendFormat(\"\\tbool Check_{0}(IntPtr L, int pos)\\r\\n\", name);\n            sb.AppendLineEx(\"\\t{\");\n            sb.AppendFormat(\"\\t\\treturn TypeChecker.CheckDelegateType(typeof({0}), L, pos);\\r\\n\", strType);\n            sb.AppendLineEx(\"\\t}\\r\\n\");\n\n            sb.AppendFormat(\"\\tvoid Push_{0}(IntPtr L, {1} o)\\r\\n\", name, strType);\n            sb.AppendLineEx(\"\\t{\");\n            sb.AppendLineEx(\"\\t\\tToLua.Push(L, o);\");\n            sb.AppendLineEx(\"\\t}\\r\\n\");\n        }\n\n        sb.AppendLineEx(\"}\\r\\n\");        \n        SaveFile(CustomSettings.saveDir + \"DelegateFactory.cs\");\n\n        Clear();\n    }\n\n    static bool IsUseDefinedAttributee(MemberInfo mb)\n    {\n        object[] attrs = mb.GetCustomAttributes(false);\n\n        for (int j = 0; j < attrs.Length; j++)\n        {\n            Type t = attrs[j].GetType();\n\n            if (t == typeof(UseDefinedAttribute))\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    static bool IsMethodEqualExtend(MethodBase a, MethodBase b)\n    {\n        if (a.Name != b.Name)\n        {\n            return false;\n        }\n\n        int c1 = a.IsStatic ? 0 : 1;\n        int c2 = b.IsStatic ? 0 : 1;\n\n        c1 += a.GetParameters().Length;\n        c2 += b.GetParameters().Length;\n\n        if (c1 != c2) return false;\n\n        ParameterInfo[] lp = a.GetParameters();\n        ParameterInfo[] rp = b.GetParameters();\n\n        List<Type> ll = new List<Type>();\n        List<Type> lr = new List<Type>();\n\n        if (!a.IsStatic)\n        {\n            ll.Add(type);\n        }\n\n        if (!b.IsStatic)\n        {\n            lr.Add(type);\n        }\n\n        for (int i = 0; i < lp.Length; i++)\n        {\n            ll.Add(GetParameterType(lp[i]));\n        }\n\n        for (int i = 0; i < rp.Length; i++)\n        {\n            lr.Add(GetParameterType(rp[i]));\n        }\n\n        for (int i = 0; i < ll.Count; i++)\n        {\n            if (ll[i] != lr[i])\n            {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    static void ProcessEditorExtend(Type extendType, List<_MethodBase> list)\n    {        \n        if (extendType != null)\n        {\n            List<MethodInfo> list2 = new List<MethodInfo>();\n            list2.AddRange(extendType.GetMethods(BindingFlags.Instance | binding | BindingFlags.DeclaredOnly));\n\n            for (int i = list2.Count - 1; i >= 0; i--)\n            {\n                if (list2[i].Name.StartsWith(\"op_\") || list2[i].Name.StartsWith(\"add_\") || list2[i].Name.StartsWith(\"remove_\"))\n                {\n                    if (!IsNeedOp(list2[i].Name))\n                    {\n                        continue;\n                    }\n                }                \n\n                if (IsUseDefinedAttributee(list2[i]))\n                {\n                    list.RemoveAll((md) => { return md.Name == list2[i].Name; });                    \n                }\n                else\n                {\n                    int index = list.FindIndex((md) => { return IsMethodEqualExtend(md.Method, list2[i]); });\n\n                    if (index >= 0)\n                    {                        \n                        list.RemoveAt(index);\n                    }\n                }\n\n                if (!IsObsolete(list2[i]))\n                {\n                    list.Add(new _MethodBase(list2[i]));\n                }\n            }\n\n            FieldInfo field = extendType.GetField(\"AdditionNameSpace\");\n\n            if (field != null)\n            {\n                string str = field.GetValue(null) as string;\n                string[] spaces = str.Split(new char[] { ';' });\n\n                for (int i = 0; i < spaces.Length; i++)\n                {\n                    usingList.Add(spaces[i]);\n                }\n            }\n        }\n    }\n\n    static bool IsGenericType(MethodInfo md, Type t)\n    {\n        Type[] list = md.GetGenericArguments();\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            if (list[i] == t)\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    static void ProcessExtendType(Type extendType, List<_MethodBase> list)\n    {        \n        if (extendType != null)\n        {\n            List<MethodInfo> list2 = new List<MethodInfo>();\n            list2.AddRange(extendType.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly));\n\n            for (int i = list2.Count - 1; i >= 0; i--)\n            {\n                MethodInfo md = list2[i];\n\n                if (!md.IsDefined(typeof(ExtensionAttribute), false))\n                {\n                    continue;\n                }\n\n                ParameterInfo[] plist = md.GetParameters();\n                Type t = plist[0].ParameterType;\n\n                if (t == type || t.IsAssignableFrom(type) || (IsGenericType(md, t) && (type == t.BaseType || type.IsSubclassOf(t.BaseType))))\n                {                    \n                    if (!IsObsolete(list2[i]))\n                    {\n                        _MethodBase mb = new _MethodBase(md);\n                        mb.BeExtend = true;                        \n                        list.Add(mb);\n                    }\n                }\n            }\n        }\n    }\n\n    static void ProcessExtends(List<_MethodBase> list)\n    {\n        extendName = \"ToLua_\" + className.Replace(\".\", \"_\");\n        extendType = Type.GetType(extendName + \", Assembly-CSharp-Editor\");\n        ProcessEditorExtend(extendType, list);\n        string temp = null;\n\n        for (int i = 0; i < extendList.Count; i++)\n        {\n            ProcessExtendType(extendList[i], list);\n            string nameSpace = GetNameSpace(extendList[i], out temp);\n\n            if (!string.IsNullOrEmpty(nameSpace))\n            {\n                usingList.Add(nameSpace);\n            }\n        }\n    }\n\n    static void GetDelegateTypeFromMethodParams(_MethodBase m)\n    {\n        if (m.IsGenericMethod)\n        {\n            return;\n        }\n\n        ParameterInfo[] pifs = m.GetParameters();\n\n        for (int k = 0; k < pifs.Length; k++)\n        {\n            Type t = pifs[k].ParameterType;\n\n            if (IsDelegateType(t))\n            {\n                eventSet.Add(t);\n            }\n        }\n    }\n\n    public static void GenEventFunction(Type t, StringBuilder sb)\n    {\n        string funcName;\n        string space = GetNameSpace(t, out funcName);\n        funcName = CombineTypeStr(space, funcName);\n        funcName = ConvertToLibSign(funcName);\n        \n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int {0}(IntPtr L)\\r\\n\", funcName);\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendLineEx(\"\\t\\ttry\");\n        sb.AppendLineEx(\"\\t\\t{\");\n        sb.AppendLineEx(\"\\t\\t\\tint count = LuaDLL.lua_gettop(L);\");\n        sb.AppendLineEx(\"\\t\\t\\tLuaFunction func = ToLua.CheckLuaFunction(L, 1);\");\n        sb.AppendLineEx();\n        sb.AppendLineEx(\"\\t\\t\\tif (count == 1)\");\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        sb.AppendFormat(\"\\t\\t\\t\\tDelegate arg1 = DelegateTraits<{0}>.Create(func);\\r\\n\", GetTypeStr(t));\n        sb.AppendLineEx(\"\\t\\t\\t\\tToLua.Push(L, arg1);\");\n        sb.AppendLineEx(\"\\t\\t\\t}\");\n        sb.AppendLineEx(\"\\t\\t\\telse\");\n        sb.AppendLineEx(\"\\t\\t\\t{\");\n        sb.AppendLineEx(\"\\t\\t\\t\\tLuaTable self = ToLua.CheckLuaTable(L, 2);\");\n        sb.AppendFormat(\"\\t\\t\\t\\tDelegate arg1 = DelegateTraits<{0}>.Create(func, self);\\r\\n\", GetTypeStr(t));\n        sb.AppendFormat(\"\\t\\t\\t\\tToLua.Push(L, arg1);\\r\\n\");\n        sb.AppendLineEx(\"\\t\\t\\t}\");\n\n        sb.AppendLineEx(\"\\t\\t\\treturn 1;\");\n        sb.AppendLineEx(\"\\t\\t}\");\n        sb.AppendLineEx(\"\\t\\tcatch(Exception e)\");\n        sb.AppendLineEx(\"\\t\\t{\");\n        sb.AppendLineEx(\"\\t\\t\\treturn LuaDLL.toluaL_exception(L, e);\");\n        sb.AppendLineEx(\"\\t\\t}\");\n        sb.AppendLineEx(\"\\t}\");\n    }    \n\n    static void GenEventFunctions()\n    {\n        foreach (Type t in eventSet)\n        {\n            GenEventFunction(t, sb);\n        }\n    }\n\n    static string RemoveChar(string str, char c)\n    {\n        int index = str.IndexOf(c);\n\n        while (index > 0)\n        {\n            str = str.Remove(index, 1);\n            index = str.IndexOf(c);\n        }\n\n        return str;\n    }\n\n    public static string ConvertToLibSign(string str)\n    {\n        if (string.IsNullOrEmpty(str))\n        {\n            return null;\n        }\n  \n        str = str.Replace('<', '_');\n        str = RemoveChar(str, '>');\n        str = str.Replace('[', 's');\n        str = RemoveChar(str, ']');\n        str = str.Replace('.', '_');\n        return str.Replace(',', '_');        \n    }\n\n    public static string GetNameSpace(Type t, out string libName)\n    {\n        if (t.IsGenericType)\n        {\n            return GetGenericNameSpace(t, out libName);            \n        }\n        else\n        {\n            string space = t.FullName;\n\n            if (space.Contains(\"+\"))\n            {\n                space = space.Replace('+', '.');\n                int index = space.LastIndexOf('.');\n                libName = space.Substring(index + 1);\n                return space.Substring(0, index);\n            }\n            else\n            {\n                libName = t.Namespace == null ? space : space.Substring(t.Namespace.Length + 1);\n                return t.Namespace;\n            }\n        }\n    }\n\n    static string GetGenericNameSpace(Type t, out string libName)\n    {        \n        Type[] gArgs = t.GetGenericArguments();\n        string typeName = t.FullName;\n        int count = gArgs.Length;\n        int pos = typeName.IndexOf(\"[\");\n        typeName = typeName.Substring(0, pos);\n\n        string str = null;\n        string name = null;\n        int offset = 0;\n        pos = typeName.IndexOf(\"+\");\n\n        while (pos > 0)\n        {\n            str = typeName.Substring(0, pos);\n            typeName = typeName.Substring(pos + 1);\n            pos = str.IndexOf('`');\n\n            if (pos > 0)\n            {\n                count = (int)(str[pos + 1] - '0');\n                str = str.Substring(0, pos);\n                str += \"<\" + string.Join(\",\", LuaMisc.GetGenericName(gArgs, offset, count)) + \">\";\n                offset += count;\n            }\n\n            name = CombineTypeStr(name, str);            \n            pos = typeName.IndexOf(\"+\");\n        }\n\n        string space = name;\n        str = typeName;\n\n        if (offset < gArgs.Length)\n        {\n            pos = str.IndexOf('`');\n            count = (int)(str[pos + 1] - '0');\n            str = str.Substring(0, pos);\n            str += \"<\" + string.Join(\",\", LuaMisc.GetGenericName(gArgs, offset, count)) + \">\";\n        }\n\n        libName = str;\n\n        if (string.IsNullOrEmpty(space))\n        {\n            space = t.Namespace;\n\n            if (space != null)\n            {\n                libName = str.Substring(space.Length + 1);\n            }            \n        }\n\n        return space; \n    }\n\n    static Type GetParameterType(ParameterInfo info)\n    {\n        if (info.ParameterType == extendType)\n        {\n            return type;\n        }\n\n        return info.ParameterType;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/ToLuaExport.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 73e814f0ef0ab914181c1f1e0a989935\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/ToLuaMenu.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n//打开开关没有写入导出列表的纯虚类自动跳过\n//#define JUMP_NODEFINED_ABSTRACT         \n\nusing UnityEngine;\nusing UnityEditor;\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing System.Text;\nusing System.IO;\nusing System.Diagnostics;\nusing LuaInterface;\n\nusing Object = UnityEngine.Object;\nusing Debug = UnityEngine.Debug;\nusing Debugger = LuaInterface.Debugger;\nusing System.Threading;\n\n[InitializeOnLoad]\npublic static class ToLuaMenu\n{\n    //不需要导出或者无法导出的类型\n    public static List<Type> dropType = new List<Type>\n    {\n        typeof(ValueType),                                  //不需要\n#if UNITY_4_6 || UNITY_4_7\n        typeof(Motion),                                     //很多平台只是空类\n#endif\n\n#if UNITY_5_3_OR_NEWER\n        typeof(UnityEngine.CustomYieldInstruction),\n#endif\n\n        //typeof(UnityEngine.YieldInstruction),               //无需导出的类      \n        //typeof(UnityEngine.WaitForEndOfFrame),              //内部支持\n        //typeof(UnityEngine.WaitForFixedUpdate),\n        //typeof(UnityEngine.WaitForSeconds),        \n        typeof(UnityEngine.Mathf),                          //lua层支持                \n        typeof(Plane),                                      \n        typeof(LayerMask),                                  \n        typeof(Vector3),\n        typeof(Vector4),\n        typeof(Vector2),\n        typeof(Quaternion),\n        typeof(Ray),\n        typeof(Bounds),\n        typeof(Color),                                    \n        typeof(Touch),\n        typeof(RaycastHit),                                 \n        typeof(TouchPhase),     \n        //typeof(LuaInterface.LuaOutMetatable),               //手写支持\n        typeof(LuaInterface.NullObject),             \n        typeof(System.Array),                        \n        typeof(System.Reflection.MemberInfo),    \n        typeof(System.Reflection.BindingFlags),\n        typeof(LuaClient),\n        typeof(LuaInterface.LuaFunction),\n        typeof(LuaInterface.LuaTable),\n        typeof(LuaInterface.LuaThread),\n        typeof(LuaInterface.LuaByteBuffer),                 //只是类型标识符\n        typeof(DelegateFactory),                            //无需导出，导出类支持lua函数转换为委托。如UIEventListener.OnClick(luafunc)\n    };\n\n    //可以导出的内部支持类型\n    public static List<Type> baseType = new List<Type>\n    {\n        typeof(System.Object),\n        typeof(System.Delegate),\n        typeof(System.String),\n        typeof(System.Enum),\n        typeof(System.Type),\n        typeof(System.Collections.IEnumerator),\n        typeof(UnityEngine.Object),\n        typeof(LuaInterface.EventObject),\n        typeof(LuaInterface.LuaMethod),\n        typeof(LuaInterface.LuaProperty),\n        typeof(LuaInterface.LuaField),\n        typeof(LuaInterface.LuaConstructor),        \n    };\n\n    private static bool beAutoGen = false;\n    private static bool beCheck = true;        \n    static List<BindType> allTypes = new List<BindType>();\n\n    static ToLuaMenu()\n    {\n        string dir = CustomSettings.saveDir;\n        string[] files = Directory.GetFiles(dir, \"*.cs\", SearchOption.TopDirectoryOnly);\n\n        if (files.Length < 3 && beCheck)\n        {\n            if (EditorUtility.DisplayDialog(\"自动生成\", \"点击确定自动生成常用类型注册文件， 也可通过菜单逐步完成此功能\", \"确定\", \"取消\"))\n            {\n                beAutoGen = true;\n                GenLuaDelegates();\n                AssetDatabase.Refresh();\n                GenerateClassWraps();\n                GenLuaBinder();\n                beAutoGen = false;                \n            }\n\n            beCheck = false;\n        }\n    }\n\n    static string RemoveNameSpace(string name, string space)\n    {\n        if (space != null)\n        {\n            name = name.Remove(0, space.Length + 1);\n        }\n\n        return name;\n    }\n\n    public class BindType\n    {\n        public string name;                 //类名称\n        public Type type;\n        public bool IsStatic;        \n        public string wrapName = \"\";        //产生的wrap文件名字\n        public string libName = \"\";         //注册到lua的名字\n        public Type baseType = null;\n        public string nameSpace = null;     //注册到lua的table层级\n\n        public List<Type> extendList = new List<Type>();\n\n        public BindType(Type t)\n        {\n            if (typeof(System.MulticastDelegate).IsAssignableFrom(t))\n            {\n                throw new NotSupportedException(string.Format(\"\\nDon't export Delegate {0} as a class, register it in customDelegateList\", LuaMisc.GetTypeName(t)));\n            }            \n\n            //if (IsObsolete(t))\n            //{\n            //    throw new Exception(string.Format(\"\\n{0} is obsolete, don't export it!\", LuaMisc.GetTypeName(t)));\n            //}\n\n            type = t;                        \n            nameSpace = ToLuaExport.GetNameSpace(t, out libName);\n            name = ToLuaExport.CombineTypeStr(nameSpace, libName);            \n            libName = ToLuaExport.ConvertToLibSign(libName);\n\n            if (name == \"object\")\n            {\n                wrapName = \"System_Object\";\n                name = \"System.Object\";\n            }\n            else if (name == \"string\")\n            {\n                wrapName = \"System_String\";\n                name = \"System.String\";\n            }\n            else\n            {\n                wrapName = name.Replace('.', '_');\n                wrapName = ToLuaExport.ConvertToLibSign(wrapName);\n            }\n\n            int index = CustomSettings.staticClassTypes.IndexOf(type);\n\n            if (index >= 0 || (type.IsAbstract && type.IsSealed))\n            {\n                IsStatic = true;                \n            }\n\n            baseType = LuaMisc.GetExportBaseType(type);\n        }\n\n        public BindType SetBaseType(Type t)\n        {\n            baseType = t;\n            return this;\n        }\n\n        public BindType AddExtendType(Type t)\n        {\n            if (!extendList.Contains(t))\n            {\n                extendList.Add(t);\n            }\n\n            return this;\n        }\n\n        public BindType SetWrapName(string str)\n        {\n            wrapName = str;\n            return this;\n        }\n\n        public BindType SetLibName(string str)\n        {\n            libName = str;\n            return this;\n        }\n\n        public BindType SetNameSpace(string space)\n        {\n            nameSpace = space;            \n            return this;\n        }\n\n        public static bool IsObsolete(Type type)\n        {\n            object[] attrs = type.GetCustomAttributes(true);\n\n            for (int j = 0; j < attrs.Length; j++)\n            {\n                Type t = attrs[j].GetType();\n\n                if (t == typeof(System.ObsoleteAttribute) || t == typeof(NoToLuaAttribute) || t.Name == \"MonoNotSupportedAttribute\" || t.Name == \"MonoTODOAttribute\")\n                {\n                    return true;\n                }\n            }\n\n            return false;\n        }\n    }\n\n    static void AutoAddBaseType(BindType bt, bool beDropBaseType)\n    {\n        Type t = bt.baseType;\n\n        if (t == null)\n        {\n            return;\n        }\n\n        if (CustomSettings.sealedList.Contains(t))\n        {\n            CustomSettings.sealedList.Remove(t);\n            Debugger.LogError(\"{0} not a sealed class, it is parent of {1}\", LuaMisc.GetTypeName(t), bt.name);\n        }\n\n        if (t.IsInterface)\n        {\n            Debugger.LogWarning(\"{0} has a base type {1} is Interface, use SetBaseType to jump it\", bt.name, t.FullName);\n            bt.baseType = t.BaseType;\n        }\n        else if (dropType.IndexOf(t) >= 0)\n        {\n            Debugger.LogWarning(\"{0} has a base type {1} is a drop type\", bt.name, t.FullName);\n            bt.baseType = t.BaseType;\n        }\n        else if (!beDropBaseType || baseType.IndexOf(t) < 0)\n        {\n            int index = allTypes.FindIndex((iter) => { return iter.type == t; });\n\n            if (index < 0)\n            {\n#if JUMP_NODEFINED_ABSTRACT\n                if (t.IsAbstract && !t.IsSealed)\n                {\n                    Debugger.LogWarning(\"not defined bindtype for {0}, it is abstract class, jump it, child class is {1}\", LuaMisc.GetTypeName(t), bt.name);\n                    bt.baseType = t.BaseType;\n                }\n                else\n                {\n                    Debugger.LogWarning(\"not defined bindtype for {0}, autogen it, child class is {1}\", LuaMisc.GetTypeName(t), bt.name);\n                    bt = new BindType(t);\n                    allTypes.Add(bt);\n                }\n#else\n                Debugger.LogWarning(\"not defined bindtype for {0}, autogen it, child class is {1}\", LuaMisc.GetTypeName(t), bt.name);                        \n                bt = new BindType(t);\n                allTypes.Add(bt);\n#endif\n            }\n            else\n            {\n                return;\n            }\n        }\n        else\n        {\n            return;\n        }\n\n        AutoAddBaseType(bt, beDropBaseType);\n    }\n\n    static BindType[] GenBindTypes(BindType[] list, bool beDropBaseType = true)\n    {\n        allTypes = new List<BindType>(list);\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            for (int j = i + 1; j < list.Length; j++)\n            {\n                if (list[i].type == list[j].type)\n                    throw new NotSupportedException(\"Repeat BindType:\" + list[i].type);\n            }\n\n            if (dropType.IndexOf(list[i].type) >= 0)\n            {\n                Debug.LogWarning(list[i].type.FullName + \" in dropType table, not need to export\");\n                allTypes.Remove(list[i]);\n                continue;\n            }\n            else if (beDropBaseType && baseType.IndexOf(list[i].type) >= 0)\n            {\n                Debug.LogWarning(list[i].type.FullName + \" is Base Type, not need to export\");\n                allTypes.Remove(list[i]);\n                continue;\n            }\n            else if (list[i].type.IsEnum)\n            {\n                continue;\n            }\n\n            AutoAddBaseType(list[i], beDropBaseType);\n        }\n\n        return allTypes.ToArray();\n    }\n\n    [MenuItem(\"Lua/Gen Lua Wrap Files\", false, 1)]\n    public static void GenerateClassWraps()\n    {\n        if (!beAutoGen && EditorApplication.isCompiling)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"请等待编辑器完成编译再执行此功能\", \"确定\");\n            return;\n        }\n\n        if (!File.Exists(CustomSettings.saveDir))\n        {\n            Directory.CreateDirectory(CustomSettings.saveDir);\n        }\n\n        allTypes.Clear();\n        BindType[] typeList = CustomSettings.customTypeList;\n\n        BindType[] list = GenBindTypes(typeList);\n        ToLuaExport.allTypes.AddRange(baseType);\n\n        for (int i = 0; i < list.Length; i++)\n        {            \n            ToLuaExport.allTypes.Add(list[i].type);\n        }\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            ToLuaExport.Clear();\n            ToLuaExport.className = list[i].name;\n            ToLuaExport.type = list[i].type;\n            ToLuaExport.isStaticClass = list[i].IsStatic;            \n            ToLuaExport.baseType = list[i].baseType;\n            ToLuaExport.wrapClassName = list[i].wrapName;\n            ToLuaExport.libClassName = list[i].libName;\n            ToLuaExport.extendList = list[i].extendList;\n            ToLuaExport.Generate(CustomSettings.saveDir);\n        }\n\n        Debug.Log(\"Generate lua binding files over\");\n        ToLuaExport.allTypes.Clear();\n        allTypes.Clear();        \n        AssetDatabase.Refresh();\n    }\n\n    static HashSet<Type> GetCustomTypeDelegates()\n    {\n        BindType[] list = CustomSettings.customTypeList;\n        HashSet<Type> set = new HashSet<Type>();\n        BindingFlags binding = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.Instance;\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            Type type = list[i].type;\n            FieldInfo[] fields = type.GetFields(BindingFlags.GetField | BindingFlags.SetField | binding);\n            PropertyInfo[] props = type.GetProperties(BindingFlags.GetProperty | BindingFlags.SetProperty | binding);\n            MethodInfo[] methods = null;\n\n            if (type.IsInterface)\n            {\n                methods = type.GetMethods();\n            }\n            else\n            {\n                methods = type.GetMethods(BindingFlags.Instance | binding);\n            }\n\n            for (int j = 0; j < fields.Length; j++)\n            {\n                Type t = fields[j].FieldType;\n\n                if (ToLuaExport.IsDelegateType(t))\n                {\n                    set.Add(t);\n                }\n            }\n\n            for (int j = 0; j < props.Length; j++)\n            {\n                Type t = props[j].PropertyType;\n\n                if (ToLuaExport.IsDelegateType(t))\n                {\n                    set.Add(t);\n                }\n            }\n\n            for (int j = 0; j < methods.Length; j++)\n            {\n                MethodInfo m = methods[j];\n\n                if (m.IsGenericMethod)\n                {\n                    continue;\n                }\n\n                ParameterInfo[] pifs = m.GetParameters();\n\n                for (int k = 0; k < pifs.Length; k++)\n                {\n                    Type t = pifs[k].ParameterType;\n                    if (t.IsByRef) t = t.GetElementType();\n\n                    if (ToLuaExport.IsDelegateType(t))\n                    {\n                        set.Add(t);\n                    }\n                }\n            }\n\n        }\n\n        return set;\n    }\n\n    [MenuItem(\"Lua/Gen Lua Delegates\", false, 2)]\n    static void GenLuaDelegates()\n    {\n        if (!beAutoGen && EditorApplication.isCompiling)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"请等待编辑器完成编译再执行此功能\", \"确定\");\n            return;\n        }\n\n        ToLuaExport.Clear();\n        List<DelegateType> list = new List<DelegateType>();\n        list.AddRange(CustomSettings.customDelegateList);\n        HashSet<Type> set = GetCustomTypeDelegates();        \n\n        foreach (Type t in set)\n        {\n            if (null == list.Find((p) => { return p.type == t; }))\n            {\n                list.Add(new DelegateType(t));\n            }\n        }\n\n        ToLuaExport.GenDelegates(list.ToArray());\n        set.Clear();\n        ToLuaExport.Clear();\n        AssetDatabase.Refresh();\n        Debug.Log(\"Create lua delegate over\");\n    }    \n\n    static ToLuaTree<string> InitTree()\n    {                        \n        ToLuaTree<string> tree = new ToLuaTree<string>();\n        ToLuaNode<string> root = tree.GetRoot();        \n        BindType[] list = GenBindTypes(CustomSettings.customTypeList);\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            string space = list[i].nameSpace;\n            AddSpaceNameToTree(tree, root, space);\n        }\n\n        DelegateType[] dts = CustomSettings.customDelegateList;\n        string str = null;      \n\n        for (int i = 0; i < dts.Length; i++)\n        {            \n            string space = ToLuaExport.GetNameSpace(dts[i].type, out str);\n            AddSpaceNameToTree(tree, root, space);            \n        }\n\n        return tree;\n    }\n\n    static void AddSpaceNameToTree(ToLuaTree<string> tree, ToLuaNode<string> parent, string space)\n    {\n        if (space == null || space == string.Empty)\n        {\n            return;\n        }\n\n        string[] ns = space.Split(new char[] { '.' });\n\n        for (int j = 0; j < ns.Length; j++)\n        {\n            List<ToLuaNode<string>> nodes = tree.Find((_t) => { return _t == ns[j]; }, j);\n\n            if (nodes.Count == 0)\n            {\n                ToLuaNode<string> node = new ToLuaNode<string>();\n                node.value = ns[j];\n                parent.childs.Add(node);\n                node.parent = parent;\n                node.layer = j;\n                parent = node;\n            }\n            else\n            {\n                bool flag = false;\n                int index = 0;\n\n                for (int i = 0; i < nodes.Count; i++)\n                {\n                    int count = j;\n                    int size = j;\n                    ToLuaNode<string> nodecopy = nodes[i];\n\n                    while (nodecopy.parent != null)\n                    {\n                        nodecopy = nodecopy.parent;\n                        if (nodecopy.value != null && nodecopy.value == ns[--count])\n                        {\n                            size--;\n                        }\n                    }\n\n                    if (size == 0)\n                    {\n                        index = i;\n                        flag = true;\n                        break;\n                    }\n                }\n\n                if (!flag)\n                {\n                    ToLuaNode<string> nnode = new ToLuaNode<string>();\n                    nnode.value = ns[j];\n                    nnode.layer = j;\n                    nnode.parent = parent;\n                    parent.childs.Add(nnode);\n                    parent = nnode;\n                }\n                else\n                {\n                    parent = nodes[index];\n                }\n            }\n        }\n    }\n\n    static string GetSpaceNameFromTree(ToLuaNode<string> node)\n    {\n        string name = node.value;\n\n        while (node.parent != null && node.parent.value != null)\n        {\n            node = node.parent;\n            name = node.value + \".\" + name;\n        }\n\n        return name;\n    }\n\n    static string RemoveTemplateSign(string str)\n    {\n        str = str.Replace('<', '_');\n\n        int index = str.IndexOf('>');\n\n        while (index > 0)\n        {\n            str = str.Remove(index, 1);\n            index = str.IndexOf('>');\n        }\n\n        return str;\n    }\n     \n    [MenuItem(\"Lua/Gen LuaBinder File\", false, 4)]\n    static void GenLuaBinder()\n    {\n        if (!beAutoGen && EditorApplication.isCompiling)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"请等待编辑器完成编译再执行此功能\", \"确定\");\n            return;\n        }\n\n        allTypes.Clear();\n        ToLuaTree<string> tree = InitTree();        \n        StringBuilder sb = new StringBuilder();\n        List<DelegateType> dtList = new List<DelegateType>();\n\n        List<DelegateType> list = new List<DelegateType>();\n        list.AddRange(CustomSettings.customDelegateList);\n        HashSet<Type> set = GetCustomTypeDelegates();\n\n        List<BindType> backupList = new List<BindType>();\n        backupList.AddRange(allTypes);\n        ToLuaNode<string> root = tree.GetRoot();\n        string libname = null;\n\n        foreach (Type t in set)\n        {\n            if (null == list.Find((p) => { return p.type == t; }))\n            {\n                DelegateType dt = new DelegateType(t);                                \n                AddSpaceNameToTree(tree, root, ToLuaExport.GetNameSpace(t, out libname));\n                list.Add(dt);\n            }\n        }\n\n        sb.AppendLineEx(\"//this source code was auto-generated by tolua#, do not modify it\");\n        sb.AppendLineEx(\"using System;\");\n        sb.AppendLineEx(\"using UnityEngine;\");\n        sb.AppendLineEx(\"using LuaInterface;\");\n        sb.AppendLineEx();\n        sb.AppendLineEx(\"public static class LuaBinder\");\n        sb.AppendLineEx(\"{\");\n        sb.AppendLineEx(\"\\tpublic static void Bind(LuaState L)\");\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendLineEx(\"\\t\\tfloat t = Time.realtimeSinceStartup;\");\n        sb.AppendLineEx(\"\\t\\tL.BeginModule(null);\");\n\n        GenRegisterInfo(null, sb, list, dtList);\n\n        Action<ToLuaNode<string>> begin = (node) =>\n        {\n            if (node.value == null)\n            {\n                return;\n            }\n\n            sb.AppendFormat(\"\\t\\tL.BeginModule(\\\"{0}\\\");\\r\\n\", node.value);\n            string space = GetSpaceNameFromTree(node);\n\n            GenRegisterInfo(space, sb, list, dtList);\n        };\n\n        Action<ToLuaNode<string>> end = (node) =>\n        {\n            if (node.value != null)\n            {\n                sb.AppendLineEx(\"\\t\\tL.EndModule();\");\n            }\n        };\n\n        tree.DepthFirstTraversal(begin, end, tree.GetRoot());        \n        sb.AppendLineEx(\"\\t\\tL.EndModule();\");\n        \n        if (CustomSettings.dynamicList.Count > 0)\n        {\n            sb.AppendLineEx(\"\\t\\tL.BeginPreLoad();\");            \n\n            for (int i = 0; i < CustomSettings.dynamicList.Count; i++)\n            {\n                Type t1 = CustomSettings.dynamicList[i];\n                BindType bt = backupList.Find((p) => { return p.type == t1; });\n                if (bt != null) sb.AppendFormat(\"\\t\\tL.AddPreLoad(\\\"{0}\\\", LuaOpen_{1}, typeof({0}));\\r\\n\", bt.name, bt.wrapName);\n            }\n\n            sb.AppendLineEx(\"\\t\\tL.EndPreLoad();\");\n        }\n\n        sb.AppendLineEx(\"\\t\\tDebugger.Log(\\\"Register lua type cost time: {0}\\\", Time.realtimeSinceStartup - t);\");\n        sb.AppendLineEx(\"\\t}\");\n\n        for (int i = 0; i < dtList.Count; i++)\n        {\n            ToLuaExport.GenEventFunction(dtList[i].type, sb);\n        }\n\n        if (CustomSettings.dynamicList.Count > 0)\n        {\n            \n            for (int i = 0; i < CustomSettings.dynamicList.Count; i++)\n            {\n                Type t = CustomSettings.dynamicList[i];\n                BindType bt = backupList.Find((p) => { return p.type == t; });\n                if (bt != null) GenPreLoadFunction(bt, sb);\n            }            \n        }\n\n        sb.AppendLineEx(\"}\\r\\n\");\n        allTypes.Clear();\n        string file = CustomSettings.saveDir + \"LuaBinder.cs\";\n\n        using (StreamWriter textWriter = new StreamWriter(file, false, Encoding.UTF8))\n        {\n            textWriter.Write(sb.ToString());\n            textWriter.Flush();\n            textWriter.Close();\n        }\n\n        AssetDatabase.Refresh();\n        Debugger.Log(\"Generate LuaBinder over !\");\n    }\n\n    static void GenRegisterInfo(string nameSpace, StringBuilder sb, List<DelegateType> delegateList, List<DelegateType> wrappedDelegatesCache)\n    {\n        for (int i = 0; i < allTypes.Count; i++)\n        {\n            Type dt = CustomSettings.dynamicList.Find((p) => { return allTypes[i].type == p; });\n\n            if (dt == null && allTypes[i].nameSpace == nameSpace)\n            {\n                string str = \"\\t\\t\" + allTypes[i].wrapName + \"Wrap.Register(L);\\r\\n\";\n                sb.Append(str);\n                allTypes.RemoveAt(i--);\n            }\n        }\n\n        string funcName = null;\n\n        for (int i = 0; i < delegateList.Count; i++)\n        {\n            DelegateType dt = delegateList[i];\n            Type type = dt.type;\n            string typeSpace = ToLuaExport.GetNameSpace(type, out funcName);\n\n            if (typeSpace == nameSpace)\n            {\n                funcName = ToLuaExport.ConvertToLibSign(funcName);\n                string abr = dt.abr;\n                abr = abr == null ? funcName : abr;\n                sb.AppendFormat(\"\\t\\tL.RegFunction(\\\"{0}\\\", {1});\\r\\n\", abr, dt.name);\n                wrappedDelegatesCache.Add(dt);\n            }\n        }\n    }\n\n    static void GenPreLoadFunction(BindType bt, StringBuilder sb)\n    {\n        string funcName = \"LuaOpen_\" + bt.wrapName;\n\n        sb.AppendLineEx(\"\\r\\n\\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\");\n        sb.AppendFormat(\"\\tstatic int {0}(IntPtr L)\\r\\n\", funcName);\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendLineEx(\"\\t\\ttry\");\n        sb.AppendLineEx(\"\\t\\t{\");        \n        sb.AppendLineEx(\"\\t\\t\\tLuaState state = LuaState.Get(L);\");\n        sb.AppendFormat(\"\\t\\t\\tstate.BeginPreModule(\\\"{0}\\\");\\r\\n\", bt.nameSpace);\n        sb.AppendFormat(\"\\t\\t\\t{0}Wrap.Register(state);\\r\\n\", bt.wrapName);\n        sb.AppendFormat(\"\\t\\t\\tint reference = state.GetMetaReference(typeof({0}));\\r\\n\", bt.name);\n        sb.AppendLineEx(\"\\t\\t\\tstate.EndPreModule(L, reference);\");                \n        sb.AppendLineEx(\"\\t\\t\\treturn 1;\");\n        sb.AppendLineEx(\"\\t\\t}\");\n        sb.AppendLineEx(\"\\t\\tcatch(Exception e)\");\n        sb.AppendLineEx(\"\\t\\t{\");\n        sb.AppendLineEx(\"\\t\\t\\treturn LuaDLL.toluaL_exception(L, e);\");\n        sb.AppendLineEx(\"\\t\\t}\");\n        sb.AppendLineEx(\"\\t}\");\n    }\n\n    static string GetOS()\n    {\n        return LuaConst.osDir;\n    }\n\n    static string CreateStreamDir(string dir)\n    {\n        dir = Application.streamingAssetsPath + \"/\" + dir;\n\n        if (!File.Exists(dir))\n        {\n            Directory.CreateDirectory(dir);\n        }\n\n        return dir;\n    }\n\n    static void BuildLuaBundle(string subDir, string sourceDir)\n    {\n        string[] files = Directory.GetFiles(sourceDir + subDir, \"*.bytes\");\n        string bundleName = subDir == null ? \"lua.unity3d\" : \"lua\" + subDir.Replace('/', '_') + \".unity3d\";\n        bundleName = bundleName.ToLower();\n\n#if UNITY_4_6 || UNITY_4_7\n        List<Object> list = new List<Object>();\n\n        for (int i = 0; i < files.Length; i++)\n        {\n            Object obj = AssetDatabase.LoadMainAssetAtPath(files[i]);\n            list.Add(obj);\n        }\n\n        BuildAssetBundleOptions options = BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets | BuildAssetBundleOptions.DeterministicAssetBundle;\n\n        if (files.Length > 0)\n        {\n            string output = string.Format(\"{0}/{1}/\" + bundleName, Application.streamingAssetsPath, GetOS());\n            File.Delete(output);\n            BuildPipeline.BuildAssetBundle(null, list.ToArray(), output, options, EditorUserBuildSettings.activeBuildTarget);            \n        }\n#else\n        for (int i = 0; i < files.Length; i++)\n        {\n            AssetImporter importer = AssetImporter.GetAtPath(files[i]);\n\n            if (importer)\n            {\n                importer.assetBundleName = bundleName;\n                importer.assetBundleVariant = null;\n            }\n        }\n#endif\n    }\n\n    static void ClearAllLuaFiles()\n    {\n        string osPath = Application.streamingAssetsPath + \"/\" + GetOS();\n\n        if (Directory.Exists(osPath))\n        {\n            string[] files = Directory.GetFiles(osPath, \"Lua*.unity3d\");\n\n            for (int i = 0; i < files.Length; i++)\n            {\n                File.Delete(files[i]);\n            }\n        }\n\n        string path = osPath + \"/Lua\";\n\n        if (Directory.Exists(path))\n        {\n            Directory.Delete(path, true);\n        }\n\n        path = Application.streamingAssetsPath + \"/Lua\";\n\n        if (Directory.Exists(path))\n        {\n            Directory.Delete(path, true);\n        }\n\n        path = Application.dataPath + \"/temp\";\n\n        if (Directory.Exists(path))\n        {\n            Directory.Delete(path, true);\n        }\n\n        path = Application.dataPath + \"/Resources/Lua\";\n\n        if (Directory.Exists(path))\n        {\n            Directory.Delete(path, true);\n        }\n\n        path = Application.persistentDataPath + \"/\" + GetOS() + \"/Lua\";\n\n        if (Directory.Exists(path))\n        {\n            Directory.Delete(path, true);\n        }\n    }\n\n    [MenuItem(\"Lua/Gen LuaWrap + Binder\", false, 4)]\n    static void GenLuaWrapBinder()\n    {\n        if (EditorApplication.isCompiling)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"请等待编辑器完成编译再执行此功能\", \"确定\");\n            return;\n        }\n\n        beAutoGen = true;        \n        AssetDatabase.Refresh();\n        GenerateClassWraps();\n        GenLuaBinder();\n        beAutoGen = false;   \n    }\n\n    [MenuItem(\"Lua/Generate All\", false, 5)]\n    static void GenLuaAll()\n    {\n        if (EditorApplication.isCompiling)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"请等待编辑器完成编译再执行此功能\", \"确定\");\n            return;\n        }\n\n        beAutoGen = true;\n        GenLuaDelegates();\n        AssetDatabase.Refresh();\n        GenerateClassWraps();\n        GenLuaBinder();\n        beAutoGen = false;\n    }\n\n    [MenuItem(\"Lua/Clear wrap files\", false, 6)]\n    static void ClearLuaWraps()\n    {\n        string[] files = Directory.GetFiles(CustomSettings.saveDir, \"*.cs\", SearchOption.TopDirectoryOnly);\n\n        for (int i = 0; i < files.Length; i++)\n        {\n            File.Delete(files[i]);\n        }\n\n        ToLuaExport.Clear();\n        List<DelegateType> list = new List<DelegateType>();\n        ToLuaExport.GenDelegates(list.ToArray());\n        ToLuaExport.Clear();\n\n        StringBuilder sb = new StringBuilder();\n        sb.AppendLineEx(\"using System;\");\n        sb.AppendLineEx(\"using LuaInterface;\");\n        sb.AppendLineEx();\n        sb.AppendLineEx(\"public static class LuaBinder\");\n        sb.AppendLineEx(\"{\");\n        sb.AppendLineEx(\"\\tpublic static void Bind(LuaState L)\");\n        sb.AppendLineEx(\"\\t{\");\n        sb.AppendLineEx(\"\\t\\tthrow new LuaException(\\\"Please generate LuaBinder files first!\\\");\");\n        sb.AppendLineEx(\"\\t}\");\n        sb.AppendLineEx(\"}\");\n\n        string file = CustomSettings.saveDir + \"LuaBinder.cs\";\n\n        using (StreamWriter textWriter = new StreamWriter(file, false, Encoding.UTF8))\n        {\n            textWriter.Write(sb.ToString());\n            textWriter.Flush();\n            textWriter.Close();\n        }\n\n        AssetDatabase.Refresh();\n    }\n\n    static void CopyLuaBytesFiles(string sourceDir, string destDir, bool appendext = true, string searchPattern = \"*.lua\", SearchOption option = SearchOption.AllDirectories)\n    {\n        if (!Directory.Exists(sourceDir))\n        {\n            return;\n        }\n\n        string[] files = Directory.GetFiles(sourceDir, searchPattern, option);\n        int len = sourceDir.Length;\n\n        if (sourceDir[len - 1] == '/' || sourceDir[len - 1] == '\\\\')\n        {\n            --len;\n        }         \n\n        for (int i = 0; i < files.Length; i++)\n        {\n            string str = files[i].Remove(0, len);\n            string dest = destDir + \"/\" + str;\n            if (appendext) dest += \".bytes\";\n            string dir = Path.GetDirectoryName(dest);\n            Directory.CreateDirectory(dir);\n            File.Copy(files[i], dest, true);\n        }\n    }\n\n\n    [MenuItem(\"Lua/Copy Lua  files to Resources\", false, 51)]\n    public static void CopyLuaFilesToRes()\n    {\n        ClearAllLuaFiles();\n        string destDir = Application.dataPath + \"/Resources\" + \"/Lua\";\n        CopyLuaBytesFiles(LuaConst.luaDir, destDir);\n        CopyLuaBytesFiles(LuaConst.toluaDir, destDir);\n        AssetDatabase.Refresh();\n        Debug.Log(\"Copy lua files over\");\n    }\n\n    [MenuItem(\"Lua/Copy Lua  files to Persistent\", false, 52)]\n    public static void CopyLuaFilesToPersistent()\n    {\n        ClearAllLuaFiles();\n        string destDir = Application.persistentDataPath + \"/\" + GetOS() + \"/Lua\";\n        CopyLuaBytesFiles(LuaConst.luaDir, destDir, false);\n        CopyLuaBytesFiles(LuaConst.toluaDir, destDir, false);\n        AssetDatabase.Refresh();\n        Debug.Log(\"Copy lua files over\");\n    }\n\n    static void GetAllDirs(string dir, List<string> list)\n    {\n        string[] dirs = Directory.GetDirectories(dir);\n        list.AddRange(dirs);\n\n        for (int i = 0; i < dirs.Length; i++)\n        {\n            GetAllDirs(dirs[i], list);\n        }\n    }\n\n    static void CopyDirectory(string source, string dest, string searchPattern = \"*.lua\", SearchOption option = SearchOption.AllDirectories)\n    {                \n        string[] files = Directory.GetFiles(source, searchPattern, option);\n\n        for (int i = 0; i < files.Length; i++)\n        {\n            string str = files[i].Remove(0, source.Length);\n            string path = dest + \"/\" + str;\n            string dir = Path.GetDirectoryName(path);\n            Directory.CreateDirectory(dir);\n            File.Copy(files[i], path, true);\n        }        \n    }\n\n    static void CopyBuildBat(string path, string tempDir)\n    {\n\t\tif (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)\n\t\t{\n\t\t\tFile.Copy(path + \"/Luajit64/Build.bat\", tempDir + \"/Build.bat\", true);\t\t\t\n\t\t}\n\t\telse if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows)\n        {\n            if (IntPtr.Size == 4)\n            {\n                File.Copy(path + \"/Luajit/Build.bat\", tempDir + \"/Build.bat\", true);\n            }\n            else if (IntPtr.Size == 8)\n            {\n                File.Copy(path + \"/Luajit64/Build.bat\", tempDir + \"/Build.bat\", true);\n            }\n        }\n#if UNITY_5_3_OR_NEWER        \n        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)\n#else\n        else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iPhone)\n#endif        \n        {\n            //Debug.Log(\"iOS默认用64位，32位自行考虑\");\n            File.Copy(path + \"/Luajit64/Build.bat\", tempDir + \"/Build.bat\", true);\n        }\n        else\n        {\n            File.Copy(path + \"/Luajit/Build.bat\", tempDir + \"/Build.bat\", true);\n        }\n\n    }\n\n    [MenuItem(\"Lua/Build Lua files to Resources (PC)\", false, 53)]\n    public static void BuildLuaToResources()\n    {\n        ClearAllLuaFiles();\n        string tempDir = CreateStreamDir(\"Lua\");\n        string destDir = Application.dataPath + \"/Resources\" + \"/Lua\";        \n\n        string path = Application.dataPath.Replace('\\\\', '/');\n        path = path.Substring(0, path.LastIndexOf('/'));\n        CopyBuildBat(path, tempDir);\n        CopyLuaBytesFiles(LuaConst.luaDir, tempDir, false);\n        Process proc = Process.Start(tempDir + \"/Build.bat\");\n        proc.WaitForExit();\n        CopyLuaBytesFiles(tempDir + \"/Out/\", destDir, false, \"*.lua.bytes\");\n        CopyLuaBytesFiles(LuaConst.toluaDir, destDir);\n        \n        Directory.Delete(tempDir, true);        \n        AssetDatabase.Refresh();\n    }\n\n    [MenuItem(\"Lua/Build Lua files to Persistent (PC)\", false, 54)]\n    public static void BuildLuaToPersistent()\n    {\n        ClearAllLuaFiles();\n        string tempDir = CreateStreamDir(\"Lua\");        \n        string destDir = Application.persistentDataPath + \"/\" + GetOS() + \"/Lua/\";\n\n        string path = Application.dataPath.Replace('\\\\', '/');\n        path = path.Substring(0, path.LastIndexOf('/'));        \n        CopyBuildBat(path, tempDir);\n        CopyLuaBytesFiles(LuaConst.luaDir, tempDir, false);\n        Process proc = Process.Start(tempDir + \"/Build.bat\");\n        proc.WaitForExit();        \n        CopyLuaBytesFiles(LuaConst.toluaDir, destDir, false);\n\n        path = tempDir + \"/Out/\";\n        string[] files = Directory.GetFiles(path, \"*.lua.bytes\");\n        int len = path.Length;\n\n        for (int i = 0; i < files.Length; i++)\n        {\n            path = files[i].Remove(0, len);\n            path = path.Substring(0, path.Length - 6);\n            path = destDir + path;\n\n            File.Copy(files[i], path, true);\n        }\n\n        Directory.Delete(tempDir, true);\n        AssetDatabase.Refresh();\n    }\n\n    [MenuItem(\"Lua/Build bundle files not jit\", false, 55)]\n    public static void BuildNotJitBundles()\n    {\n        ClearAllLuaFiles();\n        CreateStreamDir(GetOS());\n\n#if UNITY_4_6 || UNITY_4_7\n        string tempDir = CreateStreamDir(\"Lua\");\n#else\n        string tempDir = Application.dataPath + \"/temp/Lua\";\n\n        if (!File.Exists(tempDir))\n        {\n            Directory.CreateDirectory(tempDir);\n        }        \n#endif\n        CopyLuaBytesFiles(LuaConst.luaDir, tempDir);\n        CopyLuaBytesFiles(LuaConst.toluaDir, tempDir);\n\n        AssetDatabase.Refresh();\n        List<string> dirs = new List<string>();\n        GetAllDirs(tempDir, dirs);\n\n#if UNITY_5 || UNITY_5_3_OR_NEWER\n\t\tfor (int i = 0; i < dirs.Count; i++)\n        {\n            string str = dirs[i].Remove(0, tempDir.Length);\n            BuildLuaBundle(str.Replace('\\\\', '/'), \"Assets/temp/Lua\");\n        }\n\n        BuildLuaBundle(null, \"Assets/temp/Lua\");\n\n        AssetDatabase.SaveAssets();        \n        string output = string.Format(\"{0}/{1}\", Application.streamingAssetsPath, GetOS());        \n        BuildPipeline.BuildAssetBundles(output, BuildAssetBundleOptions.DeterministicAssetBundle, EditorUserBuildSettings.activeBuildTarget);\n\n        //Directory.Delete(Application.dataPath + \"/temp/\", true);\n#else\n        for (int i = 0; i < dirs.Count; i++)\n        {\n            string str = dirs[i].Remove(0, tempDir.Length);\n            BuildLuaBundle(str.Replace('\\\\', '/'), \"Assets/StreamingAssets/Lua\");\n        }\n\n        BuildLuaBundle(null, \"Assets/StreamingAssets/Lua\");\n        Directory.Delete(Application.streamingAssetsPath + \"/Lua/\", true);\n#endif\n        AssetDatabase.Refresh();\n    }\n\n    [MenuItem(\"Lua/Build Luajit bundle files   (PC)\", false, 56)]\n    public static void BuildLuaBundles()\n    {\n        ClearAllLuaFiles();                \n        CreateStreamDir(GetOS());\n\n#if UNITY_4_6 || UNITY_4_7\n        string tempDir = CreateStreamDir(\"Lua\");\n#else\n        string tempDir = Application.dataPath + \"/temp/Lua\";\n\n        if (!File.Exists(tempDir))\n        {\n            Directory.CreateDirectory(tempDir);\n        }\n#endif\n\n        string path = Application.dataPath.Replace('\\\\', '/');\n        path = path.Substring(0, path.LastIndexOf('/'));        \n        CopyBuildBat(path, tempDir);\n        CopyLuaBytesFiles(LuaConst.luaDir, tempDir, false);\n        Process proc = Process.Start(tempDir + \"/Build.bat\");\n        proc.WaitForExit();\n        CopyLuaBytesFiles(LuaConst.toluaDir, tempDir + \"/Out\");\n\n        AssetDatabase.Refresh();\n\n        string sourceDir = tempDir + \"/Out\";\n        List<string> dirs = new List<string>();        \n        GetAllDirs(sourceDir, dirs);\n\n#if UNITY_5 || UNITY_5_3_OR_NEWER\n\t\tfor (int i = 0; i < dirs.Count; i++)\n        {\n            string str = dirs[i].Remove(0, sourceDir.Length);\n            BuildLuaBundle(str.Replace('\\\\', '/'), \"Assets/temp/Lua/Out\");\n        }\n\n        BuildLuaBundle(null, \"Assets/temp/Lua/Out\");\n\n        AssetDatabase.Refresh();\n        string output = string.Format(\"{0}/{1}\", Application.streamingAssetsPath, GetOS());\n        BuildPipeline.BuildAssetBundles(output, BuildAssetBundleOptions.DeterministicAssetBundle, EditorUserBuildSettings.activeBuildTarget);\n        Directory.Delete(Application.dataPath + \"/temp/\", true);\n#else\n        for (int i = 0; i < dirs.Count; i++)\n        {\n            string str = dirs[i].Remove(0, sourceDir.Length);\n            BuildLuaBundle(str.Replace('\\\\', '/'), \"Assets/StreamingAssets/Lua/Out\");\n        }\n\n        BuildLuaBundle(null, \"Assets/StreamingAssets/Lua/Out/\");\n        Directory.Delete(tempDir, true);\n#endif\n        AssetDatabase.Refresh();\n    }\n\n    [MenuItem(\"Lua/Clear all Lua files\", false, 57)]\n    public static void ClearLuaFiles()\n    {\n        ClearAllLuaFiles();\n    }\n\n\n    [MenuItem(\"Lua/Gen BaseType Wrap\", false, 101)]\n    static void GenBaseTypeLuaWrap()\n    {\n        if (!beAutoGen && EditorApplication.isCompiling)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"请等待编辑器完成编译再执行此功能\", \"确定\");\n            return;\n        }\n\n        string dir = CustomSettings.toluaBaseType;\n\n        if (!File.Exists(dir))\n        {\n            Directory.CreateDirectory(dir);\n        }\n\n        allTypes.Clear();\n        ToLuaExport.allTypes.AddRange(baseType);\n        List<BindType> btList = new List<BindType>();\n        \n        for (int i = 0; i < baseType.Count; i++)\n        {\n            btList.Add(new BindType(baseType[i]));\n        }\n\n        GenBindTypes(btList.ToArray(), false);\n        BindType[] list = allTypes.ToArray();\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            ToLuaExport.Clear();\n            ToLuaExport.className = list[i].name;\n            ToLuaExport.type = list[i].type;\n            ToLuaExport.isStaticClass = list[i].IsStatic;\n            ToLuaExport.baseType = list[i].baseType;\n            ToLuaExport.wrapClassName = list[i].wrapName;\n            ToLuaExport.libClassName = list[i].libName;\n            ToLuaExport.Generate(dir);\n        }\n        \n        Debug.Log(\"Generate base type files over\");\n        allTypes.Clear();\n        AssetDatabase.Refresh();\n    }\n\n    static void CreateDefaultWrapFile(string path, string name)\n    {\n        StringBuilder sb = new StringBuilder();\n        path = path + name + \".cs\";\n        sb.AppendLineEx(\"using System;\");\n        sb.AppendLineEx(\"using LuaInterface;\");\n        sb.AppendLineEx();\n        sb.AppendLineEx(\"public static class \" + name);\n        sb.AppendLineEx(\"{\");\n        sb.AppendLineEx(\"\\tpublic static void Register(LuaState L)\");\n        sb.AppendLineEx(\"\\t{\");        \n        sb.AppendLineEx(\"\\t\\tthrow new LuaException(\\\"Please click menu Lua/Gen BaseType Wrap first!\\\");\");\n        sb.AppendLineEx(\"\\t}\");\n        sb.AppendLineEx(\"}\");\n\n        using (StreamWriter textWriter = new StreamWriter(path, false, Encoding.UTF8))\n        {\n            textWriter.Write(sb.ToString());\n            textWriter.Flush();\n            textWriter.Close();\n        }\n    }\n    \n    [MenuItem(\"Lua/Clear BaseType Wrap\", false, 102)]\n    static void ClearBaseTypeLuaWrap()\n    {\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"System_ObjectWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"System_DelegateWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"System_StringWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"System_EnumWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"System_TypeWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"System_Collections_IEnumeratorWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"UnityEngine_ObjectWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"LuaInterface_EventObjectWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"LuaInterface_LuaMethodWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"LuaInterface_LuaPropertyWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"LuaInterface_LuaFieldWrap\");\n        CreateDefaultWrapFile(CustomSettings.toluaBaseType, \"LuaInterface_LuaConstructorWrap\");        \n\n        Debug.Log(\"Clear base type wrap files over\");\n        AssetDatabase.Refresh();\n    }\n\n    [MenuItem(\"Lua/Enable Lua Injection &e\", false, 102)]\n    static void EnableLuaInjection()\n    {\n        bool EnableSymbols = false;\n        if (UpdateMonoCecil(ref EnableSymbols) != -1)\n        {\n            BuildTargetGroup curBuildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;\n            string existSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(curBuildTargetGroup);\n            if (!existSymbols.Contains(\"ENABLE_LUA_INJECTION\"))\n            {\n                PlayerSettings.SetScriptingDefineSymbolsForGroup(curBuildTargetGroup, existSymbols + \";ENABLE_LUA_INJECTION\");\n            }\n\n            AssetDatabase.Refresh();\n        }\n    }\n\n#if ENABLE_LUA_INJECTION\n    [MenuItem(\"Lua/Injection Remove &r\", false, 5)]\n#endif\n    static void RemoveInjection()\n    {\n        if (Application.isPlaying)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"游戏运行过程中无法操作\", \"确定\");\n            return;\n        }\n\n        BuildTargetGroup curBuildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;\n        string existSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(curBuildTargetGroup);\n        PlayerSettings.SetScriptingDefineSymbolsForGroup(curBuildTargetGroup, existSymbols.Replace(\"ENABLE_LUA_INJECTION\", \"\"));\n        Debug.Log(\"Lua Injection Removed!\");\n    }\n\n    public static int UpdateMonoCecil(ref bool EnableSymbols)\n    {\n        string appFileName = Environment.GetCommandLineArgs()[0];\n        string appPath = Path.GetDirectoryName(appFileName);\n        string directory = appPath + \"/Data/Managed/\";\n        if (UnityEngine.Application.platform == UnityEngine.RuntimePlatform.OSXEditor)\n        {\n            directory = appPath.Substring(0, appPath.IndexOf(\"MacOS\")) + \"Managed/\";\n        }\n        string suitedMonoCecilPath = directory +\n#if UNITY_2017_1_OR_NEWER\n            \"Unity.Cecil.dll\";\n#else\n            \"Mono.Cecil.dll\";\n#endif\n        string suitedMonoCecilMdbPath = directory +\n#if UNITY_2017_1_OR_NEWER\n            \"Unity.Cecil.Mdb.dll\";\n#else\n            \"Mono.Cecil.Mdb.dll\";\n#endif\n        string suitedMonoCecilPdbPath = directory +\n#if UNITY_2017_1_OR_NEWER\n            \"Unity.Cecil.Pdb.dll\";\n#else\n            \"Mono.Cecil.Pdb.dll\";\n#endif\n        string suitedMonoCecilToolPath = directory + \"Unity.CecilTools.dll\";\n\n        if (!File.Exists(suitedMonoCecilPath)\n#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_3_OR_NEWER\n            && !File.Exists(suitedMonoCecilMdbPath)\n            && !File.Exists(suitedMonoCecilPdbPath)\n#endif\n        )\n        {\n            EnableSymbols = false;\n            Debug.Log(\"Haven't found Mono.Cecil.dll!Symbols Will Be Disabled\");\n            return -1;\n        }\n\n        bool bInjectionToolUpdated = false;\n        string injectionToolPath = CustomSettings.injectionFilesPath + \"Editor/\";\n        string existMonoCecilPath = injectionToolPath + Path.GetFileName(suitedMonoCecilPath);\n        string existMonoCecilPdbPath = injectionToolPath + Path.GetFileName(suitedMonoCecilPdbPath);\n        string existMonoCecilMdbPath = injectionToolPath + Path.GetFileName(suitedMonoCecilMdbPath);\n        string existMonoCecilToolPath = injectionToolPath + Path.GetFileName(suitedMonoCecilToolPath);\n\n        try\n        {\n            bInjectionToolUpdated = TryUpdate(suitedMonoCecilPath, existMonoCecilPath) ? true : bInjectionToolUpdated;\n#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_3_OR_NEWER\n            bInjectionToolUpdated = TryUpdate(suitedMonoCecilPdbPath, existMonoCecilPdbPath) ? true : bInjectionToolUpdated;\n            bInjectionToolUpdated = TryUpdate(suitedMonoCecilMdbPath, existMonoCecilMdbPath) ? true : bInjectionToolUpdated;\n#endif\n            TryUpdate(suitedMonoCecilToolPath, existMonoCecilToolPath);\n        }\n        catch (Exception e)\n        {\n            Debug.LogError(e.ToString());\n            return -1;\n        }\n        EnableSymbols = true;\n\n        return bInjectionToolUpdated ? 1 : 0;\n    }\n\n    static bool TryUpdate(string srcPath, string destPath)\n    {\n        if (GetFileContentMD5(srcPath) != GetFileContentMD5(destPath))\n        {\n            File.Copy(srcPath, destPath, true);\n            return true;\n        }\n\n        return false;\n    }\n\n    static string GetFileContentMD5(string file)\n    {\n        if (!File.Exists(file))\n        {\n            return string.Empty;\n        }\n\n        FileStream fs = new FileStream(file, FileMode.Open);\n        System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();\n        byte[] retVal = md5.ComputeHash(fs);\n        fs.Close();\n\n        StringBuilder sb = StringBuilderCache.Acquire();\n        for (int i = 0; i < retVal.Length; i++)\n        {\n            sb.Append(retVal[i].ToString(\"x2\"));\n        }\n        return StringBuilderCache.GetStringAndRelease(sb);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/ToLuaMenu.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 97fb7996cd1338442af03841f30cddaf\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor/ToLuaTree.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing System.Collections.Generic;\nusing System;\n\npublic class ToLuaNode<T>\n{\n    public List<ToLuaNode<T>> childs = new List<ToLuaNode<T>>();\n    public ToLuaNode<T> parent = null;\n    public T value;\n    //添加命名空间节点所在位置，解决A.B.C/A.C存在相同名称却在不同命名空间所造成的Wrap问题\n    public int layer;\n}\n\npublic class ToLuaTree<T> \n{       \n    public ToLuaNode<T> _root = null;\n    private List<ToLuaNode<T>> _list = null;\n\n    public ToLuaTree()\n    {\n        _root = new ToLuaNode<T>();\n        _list = new List<ToLuaNode<T>>();\n    }\n\n    //加入pos跟root里的pos比较，只有位置相同才是统一命名空间节点\n    void FindParent(List<ToLuaNode<T>> list, List<ToLuaNode<T>> root, Predicate<T> match, int layer)\n    {\n        if (list == null || root == null)\n        {\n            return;\n        }\n\n        for (int i = 0; i < root.Count; i++)\n        {\n            // 加入layer跟root里的pos比较，只有位置相同才是统一命名空间节点\n            if (match(root[i].value) && root[i].layer == layer)\n            {\n                list.Add(root[i]);\n            }\n\n            FindParent(list, root[i].childs, match, layer);\n        }\n    }\n\n    /*public void BreadthFirstTraversal(Action<ToLuaNode<T>> action)\n    {\n        List<ToLuaNode<T>> root = _root.childs;        \n        Queue<ToLuaNode<T>> queue = new Queue<ToLuaNode<T>>();\n\n        for (int i = 0; i < root.Count; i++)\n        {\n            queue.Enqueue(root[i]);\n        }\n\n        while (queue.Count > 0)\n        {\n            ToLuaNode<T> node = queue.Dequeue();\n            action(node);\n\n            if (node.childs != null)\n            {\n                for (int i = 0; i < node.childs.Count; i++)\n                {\n                    queue.Enqueue(node.childs[i]);\n                }\n            }\n        }\n    }*/\n\n    public void DepthFirstTraversal(Action<ToLuaNode<T>> begin, Action<ToLuaNode<T>> end, ToLuaNode<T> node)\n    {\n        begin(node);\n\n        for (int i = 0; i < node.childs.Count; i++)\n        {            \n            DepthFirstTraversal(begin, end, node.childs[i]);\n        }\n\n        end(node);\n    }\n\n    //只有位置相同才是统一命名空间节点\n    public List<ToLuaNode<T>> Find(Predicate<T> match, int layer)\n    {\n        _list.Clear();\n        FindParent(_list, _root.childs, match, layer);\n        return _list;\n    }\n\n    public ToLuaNode<T> GetRoot()\n    {\n        return _root;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Editor/ToLuaTree.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 99b4e579c20c91f4d84ce5aa9add4672\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 3d9fa950d6c449e42893b939877b4ec7\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/01_HelloWorld/HelloWorld.cs",
    "content": "﻿using UnityEngine;\nusing LuaInterface;\nusing System;\n\npublic class HelloWorld : MonoBehaviour\n{\n    void Awake()\n    {\n        LuaState lua = new LuaState();\n        lua.Start();\n        string hello =\n            @\"                \n                print('hello tolua#')                                  \n            \";\n        \n        lua.DoString(hello, \"HelloWorld.cs\");\n        lua.CheckTop();\n        lua.Dispose();\n        lua = null;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/01_HelloWorld/HelloWorld.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1db6056d0e0ccb049ae392139c512608\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/01_HelloWorld/HelloWorld.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 7ce3f2dc80a0205428a5372f74800258\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/01_HelloWorld.meta",
    "content": "fileFormatVersion: 2\nguid: 79324a58d1dd94843a6e15fb4d77da66\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System;\nusing System.IO;\n\n//展示searchpath 使用，require 与 dofile 区别\npublic class ScriptsFromFile : MonoBehaviour \n{\n    LuaState lua = null;\n    private string strLog = \"\";    \n\n\tvoid Start () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\t\t\n        Application.logMessageReceived += Log;\n#else\n        Application.RegisterLogCallback(Log);\n#endif         \n        lua = new LuaState();                \n        lua.Start();        \n        //如果移动了ToLua目录，自己手动修复吧，只是例子就不做配置了\n        string fullPath = Application.dataPath + \"\\\\ToLua/Examples/02_ScriptsFromFile\";\n        lua.AddSearchPath(fullPath);        \n    }\n\n    void Log(string msg, string stackTrace, LogType type)\n    {\n        strLog += msg;\n        strLog += \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(100, Screen.height / 2 - 100, 600, 400), strLog);\n\n        if (GUI.Button(new Rect(50, 50, 120, 45), \"DoFile\"))\n        {\n            strLog = \"\";\n            lua.DoFile(\"ScriptsFromFile.lua\");                        \n        }\n        else if (GUI.Button(new Rect(50, 150, 120, 45), \"Require\"))\n        {\n            strLog = \"\";            \n            lua.Require(\"ScriptsFromFile\");            \n        }\n\n        lua.Collect();\n        lua.CheckTop();\n    }\n\n    void OnApplicationQuit()\n    {\n        lua.Dispose();\n        lua = null;\n#if UNITY_5 || UNITY_2017 || UNITY_2018\t\n        Application.logMessageReceived -= Log;\n#else\n        Application.RegisterLogCallback(null);\n#endif \n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 17346dbce1e39bd4b8cb9cdf6b9249e7\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.lua",
    "content": "print(\"This is a script from a utf8 file\")\nprint(\"tolua: 你好! こんにちは! 안녕하세요!\")\n"
  },
  {
    "path": "Assets/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.lua.meta",
    "content": "fileFormatVersion: 2\nguid: fbc95a40dca6ccf448ff2a7f1905e751\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/02_ScriptsFromFile/ScriptsFromFile.unity.meta",
    "content": "fileFormatVersion: 2\nguid: e011b54a109dd1c43b5ed71ca3590a32\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/02_ScriptsFromFile.meta",
    "content": "fileFormatVersion: 2\nguid: 71ca7fe863de8dd4d8a6057d043df5e4\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System;\n\npublic class CallLuaFunction : MonoBehaviour \n{\n    private string script =\n        @\"  function luaFunc(num)                        \n                return num + 1\n            end\n\n            test = {}\n            test.luaFunc = luaFunc\n        \";\n\n    LuaFunction luaFunc = null;\n    LuaState lua = null;\n    string tips = null;\n\t\n\tvoid Start () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        lua = new LuaState();\n        lua.Start();\n        DelegateFactory.Init();        \n        lua.DoString(script);\n\n        //Get the function object\n        luaFunc = lua.GetFunction(\"test.luaFunc\");\n\n        if (luaFunc != null)\n        {\n            int num = luaFunc.Invoke<int, int>(123456);\n            Debugger.Log(\"generic call return: {0}\", num);\n\n            num = CallFunc();\n            Debugger.Log(\"expansion call return: {0}\", num);\n\n            Func<int, int> Func = luaFunc.ToDelegate<Func<int, int>>();\n            num = Func(123456);\n            Debugger.Log(\"Delegate call return: {0}\", num);\n            \n            num = lua.Invoke<int, int>(\"test.luaFunc\", 123456, true);\n            Debugger.Log(\"luastate call return: {0}\", num);\n        }\n\n        lua.CheckTop();\n\t}\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n#if !TEST_GC\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 150, 400, 300), tips);\n    }\n#endif\n\n    void OnDestroy()\n    {\n        if (luaFunc != null)\n        {\n            luaFunc.Dispose();\n            luaFunc = null;\n        }\n\n        lua.Dispose();\n        lua = null;\n\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    int CallFunc()\n    {        \n        luaFunc.BeginPCall();                \n        luaFunc.Push(123456);\n        luaFunc.PCall();        \n        int num = (int)luaFunc.CheckNumber();\n        luaFunc.EndPCall();\n        return num;                \n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 11338f45069e3e041b7c42b60897ce0a\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/03_CallLuaFunction/CallLuaFunction.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 9b95d9c7995843244812901527540c78\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/03_CallLuaFunction.meta",
    "content": "fileFormatVersion: 2\nguid: 0b90da095ffcaa34891335989ba05ddf\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections.Generic;\nusing LuaInterface;\n\npublic class AccessingLuaVariables : MonoBehaviour \n{\n    private string script =\n        @\"\n            print('Objs2Spawn is: '..Objs2Spawn)\n            var2read = 42\n            varTable = {1,2,3,4,5}\n            varTable.default = 1\n            varTable.map = {}\n            varTable.map.name = 'map'\n            \n            meta = {name = 'meta'}\n            setmetatable(varTable, meta)\n            \n            function TestFunc(strs)\n                print('get func by variable')\n            end\n        \";\n\n\tvoid Start () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        LuaState lua = new LuaState();\n        lua.Start();\n        lua[\"Objs2Spawn\"] = 5;\n        lua.DoString(script);\n\n        //通过LuaState访问\n        Debugger.Log(\"Read var from lua: {0}\", lua[\"var2read\"]);\n        Debugger.Log(\"Read table var from lua: {0}\", lua[\"varTable.default\"]);  //LuaState 拆串式table\n\n        LuaFunction func = lua[\"TestFunc\"] as LuaFunction;\n        func.Call();\n        func.Dispose();\n\n        //cache成LuaTable进行访问\n        LuaTable table = lua.GetTable(\"varTable\");\n        Debugger.Log(\"Read varTable from lua, default: {0} name: {1}\", table[\"default\"], table[\"map.name\"]);\n        table[\"map.name\"] = \"new\";  //table 字符串只能是key\n        Debugger.Log(\"Modify varTable name: {0}\", table[\"map.name\"]);\n\n        table.AddTable(\"newmap\");\n        LuaTable table1 = (LuaTable)table[\"newmap\"];\n        table1[\"name\"] = \"table1\";\n        Debugger.Log(\"varTable.newmap name: {0}\", table1[\"name\"]);\n        table1.Dispose();\n\n        table1 = table.GetMetaTable();\n\n        if (table1 != null)\n        {\n            Debugger.Log(\"varTable metatable name: {0}\", table1[\"name\"]);\n        }\n\n        object[] list = table.ToArray();\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            Debugger.Log(\"varTable[{0}], is {1}\", i, list[i]);\n        }\n\n        table.Dispose();                        \n        lua.CheckTop();\n        lua.Dispose();\n\t}\n\n    private void OnApplicationQuit()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    string tips = null;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3121aadbc8cdbeb488fdc0cfd1032ead\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/04_AccessingLuaVariables/AccessingLuaVariables.unity.meta",
    "content": "fileFormatVersion: 2\nguid: b440f9ea3ca78884cbc8bd834a84ee54\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/04_AccessingLuaVariables.meta",
    "content": "fileFormatVersion: 2\nguid: 1b3a357bb0337ee438db20f82382e246\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/05_LuaCoroutine/LuaCoroutine.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 811fd4e3aec57234ea72e1ed44701a9c\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/05_LuaCoroutine/TestCoroutine.cs",
    "content": "﻿using UnityEngine;\nusing System;\nusing System.Collections;\nusing LuaInterface;\n\n//例子5和6展示的两套协同系统勿交叉使用，此为推荐方案\npublic class TestCoroutine : MonoBehaviour \n{\n    public TextAsset luaFile = null;\n    private LuaState lua = null;\n    private LuaLooper looper = null;\n\n\tvoid Awake () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif        \n        new LuaResLoader();\n        lua  = new LuaState();\n        lua.Start();\n        LuaBinder.Bind(lua);\n        DelegateFactory.Init();         \n        looper = gameObject.AddComponent<LuaLooper>();\n        looper.luaState = lua;\n\n        lua.DoString(luaFile.text, \"TestLuaCoroutine.lua\");\n        LuaFunction f = lua.GetFunction(\"TestCortinue\");\n        f.Call();\n        f.Dispose();\n        f = null;        \n    }\n\n    void OnApplicationQuit()\n    {\n        looper.Destroy();\n        lua.Dispose();\n        lua = null;\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    string tips = null;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips);\n\n        if (GUI.Button(new Rect(50, 50, 120, 45), \"Start Counter\"))\n        {\n            tips = null;\n            LuaFunction func = lua.GetFunction(\"StartDelay\");\n            func.Call();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(50, 150, 120, 45), \"Stop Counter\"))\n        {\n            LuaFunction func = lua.GetFunction(\"StopDelay\");\n            func.Call();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(50, 250, 120, 45), \"GC\"))\n        {\n            lua.DoString(\"collectgarbage('collect')\", \"TestCoroutine.cs\");\n            Resources.UnloadUnusedAssets();\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/05_LuaCoroutine/TestCoroutine.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3fdb28fb1b0a1eb4391deef05b03405d\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/05_LuaCoroutine.meta",
    "content": "fileFormatVersion: 2\nguid: 4aab46dd051561242b5f1dd79f189a42\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/06_LuaCoroutine2/Coroutine.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 4db2739d8c3e5af4ca5647e7ded00f68\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/06_LuaCoroutine2/TestCoroutine2.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\n\n//两套协同勿交叉使用，类unity原生，大量使用效率低\npublic class TestCoroutine2 : LuaClient \n{\n    string script =\n    @\"\n        function CoExample()            \n            WaitForSeconds(1)\n            print('WaitForSeconds end time: '.. UnityEngine.Time.time)            \n            WaitForFixedUpdate()\n            print('WaitForFixedUpdate end frameCount: '..UnityEngine.Time.frameCount)\n            WaitForEndOfFrame()\n            print('WaitForEndOfFrame end frameCount: '..UnityEngine.Time.frameCount)\n            Yield(null)\n            print('yield null end frameCount: '..UnityEngine.Time.frameCount)\n            Yield(0)\n            print('yield(0) end frameCime: '..UnityEngine.Time.frameCount)\n            local www = UnityEngine.WWW('http://www.baidu.com')\n            Yield(www)\n            print('yield(www) end time: '.. UnityEngine.Time.time)\n            local s = tolua.tolstring(www.bytes)\n            print(s:sub(1, 128))\n            print('coroutine over')\n        end\n\n        function TestCo()            \n            StartCoroutine(CoExample)                                   \n        end\n\n        local coDelay = nil\n\n        function Delay()\n\t        local c = 1\n\n\t        while true do\n\t\t        WaitForSeconds(1) \n\t\t        print('Count: '..c)\n\t\t        c = c + 1\n\t        end\n        end\n\n        function StartDelay()\n\t        coDelay = StartCoroutine(Delay)            \n        end\n\n        function StopDelay()\n\t        StopCoroutine(coDelay)\n            coDelay = nil\n        end\n    \";\n\n    protected override LuaFileUtils InitLoader()\n    {\n        return new LuaResLoader();\n    }\n\n    protected override void OnLoadFinished()\n    {\n        base.OnLoadFinished();\n\n        luaState.DoString(script, \"TestCoroutine2.cs\");\n        LuaFunction func = luaState.GetFunction(\"TestCo\");\n        func.Call();\n        func.Dispose();\n        func = null;\n    }\n\n    //屏蔽，例子不需要运行\n    protected override void CallMain() { }\n\n    bool beStart = false;\n    string tips = null;\n\n    void Start()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    new void OnApplicationQuit()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n        base.OnApplicationQuit();\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips);\n\n        if (GUI.Button(new Rect(50, 50, 120, 45), \"Start Counter\"))\n        {\n            if (!beStart)\n            {\n                beStart = true;\n                tips = \"\";\n                LuaFunction func = luaState.GetFunction(\"StartDelay\");\n                func.Call();\n                func.Dispose();\n            }\n        }\n        else if (GUI.Button(new Rect(50, 150, 120, 45), \"Stop Counter\"))\n        {\n            if (beStart)\n            {\n                beStart = false;\n                LuaFunction func = luaState.GetFunction(\"StopDelay\");\n                func.Call();\n                func.Dispose();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/06_LuaCoroutine2/TestCoroutine2.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 252cf94b5db18424a94f00ddbd580ee0\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/06_LuaCoroutine2.meta",
    "content": "fileFormatVersion: 2\nguid: 2bf03102ccd94cb45afe01e02bf19184\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/07_LuaThread/TestLuaThread.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\n\npublic class TestLuaThread : MonoBehaviour \n{\n    string script =\n        @\"\n            function fib(n)\n                local a, b = 0, 1\n                while n > 0 do\n                    a, b = b, a + b\n                    n = n - 1\n                end\n\n                return a\n            end\n\n            function CoFunc(len)\n                print('Coroutine started')                \n                local i = 0\n                for i = 0, len, 1 do                    \n                    local flag = coroutine.yield(fib(i))\t                    \n                    if not flag then\n                        break\n                    end                                      \n                end\n                print('Coroutine ended')\n            end\n\n            function Test()                \n                local co = coroutine.create(CoFunc)                                \n                return co\n            end            \n        \";\n\n    LuaState state = null;\n    LuaThread thread = null;\n    string tips = null;\n\n    void Start () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        state = new LuaState();\n        state.Start();\n        state.LogGC = true;\n        state.DoString(script);\n\n        LuaFunction func = state.GetFunction(\"Test\");\n        func.BeginPCall();\n        func.PCall();\n        thread = func.CheckLuaThread();\n        thread.name = \"LuaThread\";\n        func.EndPCall();\n        func.Dispose();\n        func = null;\n\n        thread.Resume(10);\n\t}\n\n    void OnApplicationQuit()\n    {\n        if (thread != null)\n        {\n            thread.Dispose();\n            thread = null;\n        }\n\n        state.Dispose();\n        state = null;\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void Update()\n    {\n        state.CheckTop();\n        state.Collect();\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips);\n\n        if (GUI.Button(new Rect(10, 50, 120, 40), \"Resume Thead\"))\n        {\n            int ret = -1;\n\n            if (thread != null && thread.Resume(true, out ret) == (int)LuaThreadStatus.LUA_YIELD)\n            {                \n                Debugger.Log(\"lua yield: \" + ret);\n            }\n        }\n        else if (GUI.Button(new Rect(10, 150, 120, 40), \"Close Thread\"))\n        {\n            if (thread != null)\n            {                \n                thread.Dispose();                \n                thread = null;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/07_LuaThread/TestLuaThread.cs.meta",
    "content": "fileFormatVersion: 2\nguid: cd0d38a2cd6c8794ebb1150cc3678db6\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/07_LuaThread/TestThread.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 4bc55bdc0d2bff34a9abc55c4eeebdc0\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/07_LuaThread.meta",
    "content": "fileFormatVersion: 2\nguid: 34683a8c5207cb3438b3b06aa2ef38c8\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/08_AccessingArray/AccessingArray.cs",
    "content": "﻿using UnityEngine;\nusing LuaInterface;\n\npublic class AccessingArray : MonoBehaviour\n{\n    private string script =\n        @\"\n            function TestArray(array)\n                local len = array.Length\n                \n                for i = 0, len - 1 do\n                    print('Array: '..tostring(array[i]))\n                end\n\n                local iter = array:GetEnumerator()\n\n                while iter:MoveNext() do\n                    print('iter: '..iter.Current)\n                end\n\n                local t = array:ToTable()                \n                \n                for i = 1, #t do\n                    print('table: '.. tostring(t[i]))\n                end\n\n                local pos = array:BinarySearch(3)\n                print('array BinarySearch: pos: '..pos..' value: '..array[pos])\n\n                pos = array:IndexOf(4)\n                print('array indexof bbb pos is: '..pos)\n                \n                return 1, '123', true\n            end            \n        \";\n\n    LuaState lua = null;\n    LuaFunction func = null;\n    string tips = null;\n\n#pragma warning disable 0618\n    void Start()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        lua = new LuaState();\n        lua.Start();\n        lua.DoString(script, \"AccessingArray.cs\");\n        tips = \"\";\n\n        int[] array = { 1, 2, 3, 4, 5 };\n        func = lua.GetFunction(\"TestArray\");\n\n        func.BeginPCall();\n        func.Push(array);\n        func.PCall();\n        double arg1 = func.CheckNumber();\n        string arg2 = func.CheckString();\n        bool arg3 = func.CheckBoolean();\n        Debugger.Log(\"return is {0} {1} {2}\", arg1, arg2, arg3);\n        func.EndPCall();\n\n        //调用通用函数需要转换一下类型，避免可变参数拆成多个参数传递\n        object[] objs = func.LazyCall((object)array);\n\n        if (objs != null)\n        {\n            Debugger.Log(\"return is {0} {1} {2}\", objs[0], objs[1], objs[2]);\n        }\n\n        lua.CheckTop();\n    }\n\n#pragma warning restore 0618\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n\n    void OnApplicationQuit()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n        func.Dispose();\n        lua.Dispose();\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/08_AccessingArray/AccessingArray.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 82a287200877e9344a7e6b2d58dfe019\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/08_AccessingArray/AccessingArray.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 3f3cdbddf148392458f85eed2085860c\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/08_AccessingArray.meta",
    "content": "fileFormatVersion: 2\nguid: d74fee3fd9c8cb64e8d8083fb944a9c3\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccountWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_Collections_Generic_Dictionary_int_TestAccountWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Collections.Generic.Dictionary<int,TestAccount>), typeof(System.Object), \"AccountMap\");\n\t\tL.RegFunction(\".geti\", get_Item);\n\t\tL.RegFunction(\"get_Item\", get_Item);\n\t\tL.RegFunction(\".seti\", set_Item);\n\t\tL.RegFunction(\"set_Item\", set_Item);\n\t\tL.RegFunction(\"Add\", Add);\n\t\tL.RegFunction(\"Clear\", Clear);\n\t\tL.RegFunction(\"ContainsKey\", ContainsKey);\n\t\tL.RegFunction(\"ContainsValue\", ContainsValue);\n\t\tL.RegFunction(\"GetObjectData\", GetObjectData);\n\t\tL.RegFunction(\"OnDeserialization\", OnDeserialization);\n\t\tL.RegFunction(\"Remove\", Remove);\n\t\tL.RegFunction(\"TryGetValue\", TryGetValue);\n\t\tL.RegFunction(\"GetEnumerator\", GetEnumerator);\n\t\tL.RegFunction(\"New\", _CreateSystem_Collections_Generic_Dictionary_int_TestAccount);\n\t\tL.RegVar(\"this\", _this, null);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"Count\", get_Count, null);\n\t\tL.RegVar(\"Comparer\", get_Comparer, null);\n\t\tL.RegVar(\"Keys\", get_Keys, null);\n\t\tL.RegVar(\"Values\", get_Values, null);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateSystem_Collections_Generic_Dictionary_int_TestAccount(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 0)\n\t\t\t{\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = new System.Collections.Generic.Dictionary<int,TestAccount>();\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1 && TypeChecker.CheckTypes<int>(L, 1))\n\t\t\t{\n\t\t\t\tint arg0 = (int)LuaDLL.lua_tonumber(L, 1);\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = new System.Collections.Generic.Dictionary<int,TestAccount>(arg0);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1 && TypeChecker.CheckTypes<System.Collections.Generic.IDictionary<int,TestAccount>>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Collections.Generic.IDictionary<int,TestAccount> arg0 = (System.Collections.Generic.IDictionary<int,TestAccount>)ToLua.ToObject(L, 1);\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = new System.Collections.Generic.Dictionary<int,TestAccount>(arg0);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1 && TypeChecker.CheckTypes<System.Collections.Generic.IEqualityComparer<int>>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Collections.Generic.IEqualityComparer<int> arg0 = (System.Collections.Generic.IEqualityComparer<int>)ToLua.ToObject(L, 1);\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = new System.Collections.Generic.Dictionary<int,TestAccount>(arg0);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<int, System.Collections.Generic.IEqualityComparer<int>>(L, 1))\n\t\t\t{\n\t\t\t\tint arg0 = (int)LuaDLL.lua_tonumber(L, 1);\n\t\t\t\tSystem.Collections.Generic.IEqualityComparer<int> arg1 = (System.Collections.Generic.IEqualityComparer<int>)ToLua.ToObject(L, 2);\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = new System.Collections.Generic.Dictionary<int,TestAccount>(arg0, arg1);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<System.Collections.Generic.IDictionary<int,TestAccount>, System.Collections.Generic.IEqualityComparer<int>>(L, 1))\n\t\t\t{\n\t\t\t\tSystem.Collections.Generic.IDictionary<int,TestAccount> arg0 = (System.Collections.Generic.IDictionary<int,TestAccount>)ToLua.ToObject(L, 1);\n\t\t\t\tSystem.Collections.Generic.IEqualityComparer<int> arg1 = (System.Collections.Generic.IEqualityComparer<int>)ToLua.ToObject(L, 2);\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = new System.Collections.Generic.Dictionary<int,TestAccount>(arg0, arg1);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: System.Collections.Generic.Dictionary<int,TestAccount>.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _get_this(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tTestAccount o = obj[arg0];\n\t\t\tToLua.PushSealed(L, o);\n\t\t\treturn 1;\n\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _set_this(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tTestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 3, typeof(TestAccount));\n\t\t\tobj[arg0] = arg1;\n\t\t\treturn 0;\n\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _this(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tLuaDLL.lua_pushvalue(L, 1);\n\t\t\tLuaDLL.tolua_bindthis(L, _get_this, _set_this);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Item(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tTestAccount o = obj[arg0];\n\t\t\tToLua.PushSealed(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_Item(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tTestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 3, typeof(TestAccount));\n\t\t\tobj[arg0] = arg1;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Add(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tTestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 3, typeof(TestAccount));\n\t\t\tobj.Add(arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Clear(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tobj.Clear();\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ContainsKey(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tbool o = obj.ContainsKey(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ContainsValue(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tTestAccount arg0 = (TestAccount)ToLua.CheckObject(L, 2, typeof(TestAccount));\n\t\t\tbool o = obj.ContainsValue(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetObjectData(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tSystem.Runtime.Serialization.SerializationInfo arg0 = (System.Runtime.Serialization.SerializationInfo)ToLua.CheckObject(L, 2, typeof(System.Runtime.Serialization.SerializationInfo));\n\t\t\tSystem.Runtime.Serialization.StreamingContext arg1 = StackTraits<System.Runtime.Serialization.StreamingContext>.Check(L, 3);\n\t\t\tobj.GetObjectData(arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int OnDeserialization(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\tobj.OnDeserialization(arg0);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Remove(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tbool o = obj.Remove(arg0);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TryGetValue(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tTestAccount arg1 = null;\n\t\t\tbool o = obj.TryGetValue(arg0, out arg1);\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\tToLua.PushSealed(L, arg1);\n\t\t\treturn 2;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumerator(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\tSystem.Collections.IEnumerator o = obj.GetEnumerator();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Count(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)o;\n\t\t\tint ret = obj.Count;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Count on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Comparer(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)o;\n\t\t\tSystem.Collections.Generic.IEqualityComparer<int> ret = obj.Comparer;\n\t\t\tToLua.PushObject(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Comparer on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Keys(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)o;\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection ret = obj.Keys;\n\t\t\tToLua.PushSealed(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Keys on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Values(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> obj = (System.Collections.Generic.Dictionary<int,TestAccount>)o;\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection ret = obj.Values;\n\t\t\tToLua.PushSealed(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Values on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccountWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 7eaa1793aebc03847bbeff73e29e711a\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection), typeof(System.Object), \"KeyCollection\");\n\t\tL.RegFunction(\"CopyTo\", CopyTo);\n\t\tL.RegFunction(\"GetEnumerator\", GetEnumerator);\n\t\tL.RegFunction(\"New\", _CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"Count\", get_Count, null);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> arg0 = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection obj = new System.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection(arg0);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: System.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CopyTo(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection obj = (System.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection));\n\t\t\tint[] arg0 = ToLua.CheckNumberArray<int>(L, 2);\n\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\tobj.CopyTo(arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumerator(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection obj = (System.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection));\n\t\t\tSystem.Collections.IEnumerator o = obj.GetEnumerator();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Count(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection obj = (System.Collections.Generic.Dictionary<int,TestAccount>.KeyCollection)o;\n\t\t\tint ret = obj.Count;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Count on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ae6d6c27412c9fa4e815ef0f87e01cc2\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection), typeof(System.Object), \"ValueCollection\");\n\t\tL.RegFunction(\"CopyTo\", CopyTo);\n\t\tL.RegFunction(\"GetEnumerator\", GetEnumerator);\n\t\tL.RegFunction(\"New\", _CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"Count\", get_Count, null);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount> arg0 = (System.Collections.Generic.Dictionary<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>));\n\t\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection obj = new System.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection(arg0);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: System.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int CopyTo(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 3);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection obj = (System.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection));\n\t\t\tTestAccount[] arg0 = ToLua.CheckObjectArray<TestAccount>(L, 2);\n\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\tobj.CopyTo(arg0, arg1);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int GetEnumerator(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection obj = (System.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection));\n\t\t\tSystem.Collections.IEnumerator o = obj.GetEnumerator();\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Count(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection obj = (System.Collections.Generic.Dictionary<int,TestAccount>.ValueCollection)o;\n\t\t\tint ret = obj.Count;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Count on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: c353ebccdf1714241a37253dd58c9309\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/System_Collections_Generic_KeyValuePair_int_TestAccountWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class System_Collections_Generic_KeyValuePair_int_TestAccountWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(System.Collections.Generic.KeyValuePair<int,TestAccount>), null, \"KeyValuePair_int_TestAccount\");\n\t\tL.RegFunction(\"ToString\", ToString);\n\t\tL.RegFunction(\"New\", _CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"Key\", get_Key, null);\n\t\tL.RegVar(\"Value\", get_Value, null);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 1);\n\t\t\t\tTestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 2, typeof(TestAccount));\n\t\t\t\tSystem.Collections.Generic.KeyValuePair<int,TestAccount> obj = new System.Collections.Generic.KeyValuePair<int,TestAccount>(arg0, arg1);\n\t\t\t\tToLua.PushValue(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 0)\n\t\t\t{\n\t\t\t\tSystem.Collections.Generic.KeyValuePair<int,TestAccount> obj = new System.Collections.Generic.KeyValuePair<int,TestAccount>();\n\t\t\t\tToLua.PushValue(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: System.Collections.Generic.KeyValuePair<int,TestAccount>.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int ToString(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tSystem.Collections.Generic.KeyValuePair<int,TestAccount> obj = (System.Collections.Generic.KeyValuePair<int,TestAccount>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.KeyValuePair<int,TestAccount>));\n\t\t\tstring o = obj.ToString();\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Key(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.Generic.KeyValuePair<int,TestAccount> obj = (System.Collections.Generic.KeyValuePair<int,TestAccount>)o;\n\t\t\tint ret = obj.Key;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Key on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Value(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tSystem.Collections.Generic.KeyValuePair<int,TestAccount> obj = (System.Collections.Generic.KeyValuePair<int,TestAccount>)o;\n\t\t\tTestAccount ret = obj.Value;\n\t\t\tToLua.PushSealed(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Value on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/System_Collections_Generic_KeyValuePair_int_TestAccountWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e6f1375290fa13745bc07de7193ecc3e\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/TestAccountWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class TestAccountWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(TestAccount), typeof(System.Object));\n\t\tL.RegFunction(\"New\", _CreateTestAccount);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"id\", get_id, set_id);\n\t\tL.RegVar(\"name\", get_name, set_name);\n\t\tL.RegVar(\"sex\", get_sex, set_sex);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateTestAccount(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 3)\n\t\t\t{\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tTestAccount obj = new TestAccount(arg0, arg1, arg2);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: TestAccount.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_id(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestAccount obj = (TestAccount)o;\n\t\t\tint ret = obj.id;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index id on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_name(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestAccount obj = (TestAccount)o;\n\t\t\tstring ret = obj.name;\n\t\t\tLuaDLL.lua_pushstring(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index name on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_sex(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestAccount obj = (TestAccount)o;\n\t\t\tint ret = obj.sex;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index sex on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_id(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestAccount obj = (TestAccount)o;\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tobj.id = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index id on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_name(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestAccount obj = (TestAccount)o;\n\t\t\tstring arg0 = ToLua.CheckString(L, 2);\n\t\t\tobj.name = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index name on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_sex(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestAccount obj = (TestAccount)o;\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tobj.sex = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index sex on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/TestAccountWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b763e457bd5365e46bf64d146d0d5a3b\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/UseDictionary.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections.Generic;\nusing LuaInterface;\n\npublic sealed class TestAccount\n{\n    public int id;\n    public string name;\n    public int sex;\n\n    public TestAccount(int id, string name, int sex)\n    {\n        this.id = id;\n        this.name = name;\n        this.sex = sex;\n    }\n}\n\npublic class UseDictionary : MonoBehaviour \n{\n    Dictionary<int, TestAccount> map = new Dictionary<int, TestAccount>();\n\n    string script =\n        @\"              \n            function TestDict(map)                        \n                local iter = map:GetEnumerator() \n                \n                while iter:MoveNext() do\n                    local v = iter.Current.Value\n                    print('id: '..v.id ..' name: '..v.name..' sex: '..v.sex)                                \n                end\n\n                local flag, account = map:TryGetValue(1, nil)\n\n                if flag then\n                    print('TryGetValue result ok: '..account.name)\n                end\n\n                local keys = map.Keys\n                iter = keys:GetEnumerator()\n                print('------------print dictionary keys---------------')\n                while iter:MoveNext() do\n                    print(iter.Current)\n                end\n                print('----------------------over----------------------')\n\n                local values = map.Values\n                iter = values:GetEnumerator()\n                print('------------print dictionary values---------------')\n                while iter:MoveNext() do\n                    print(iter.Current.name)\n                end\n                print('----------------------over----------------------')                \n\n                print('kick '..map[2].name)\n                map:Remove(2)\n                iter = map:GetEnumerator() \n\n                while iter:MoveNext() do\n                    local v = iter.Current.Value\n                    print('id: '..v.id ..' name: '..v.name..' sex: '..v.sex)                                \n                end\n            end                        \n        \";\n\n\tvoid Awake () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        map.Add(1, new TestAccount(1, \"水水\", 0));\n        map.Add(2, new TestAccount(2, \"王伟\", 1));\n        map.Add(3, new TestAccount(3, \"王芳\", 0));\n\n        LuaState luaState = new LuaState();\n        luaState.Start();\n        BindMap(luaState);\n\n        luaState.DoString(script, \"UseDictionary.cs\");\n        LuaFunction func = luaState.GetFunction(\"TestDict\");\n        func.BeginPCall();\n        func.Push(map);\n        func.PCall();\n        func.EndPCall();\n\n        func.Dispose();\n        func = null;\n        luaState.CheckTop();\n        luaState.Dispose();\n        luaState = null;\n    }\n\n    void OnApplicationQuit()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif        \n    }\n\n    string tips = \"\";\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips);\n    }\n\n    //示例方式，方便删除，正常导出无需手写下面代码\n    void BindMap(LuaState L)\n    {\n        L.BeginModule(null);\n        TestAccountWrap.Register(L);\n        L.BeginModule(\"System\");\n        L.BeginModule(\"Collections\");\n        L.BeginModule(\"Generic\");\n        System_Collections_Generic_Dictionary_int_TestAccountWrap.Register(L);\n        System_Collections_Generic_KeyValuePair_int_TestAccountWrap.Register(L);\n        L.BeginModule(\"Dictionary\");\n        System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap.Register(L);\n        System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap.Register(L);\n        L.EndModule();\n        L.EndModule();\n        L.EndModule();\n        L.EndModule();\n        L.EndModule();\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/UseDictionary.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 23454681bd34d36498eafe3bb988240d\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary/UseDictionary.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 5dc40f31458a9544aa74bcdad6d15d06\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/09_Dictionary.meta",
    "content": "fileFormatVersion: 2\nguid: d308146ac25b5a74d99ced6f74495105\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/10_Enum/AccessingEnum.cs",
    "content": "﻿using UnityEngine;\nusing System;\nusing LuaInterface;\n\npublic class AccessingEnum : MonoBehaviour \n{\n    string script =\n        @\"\n            space = nil\n\n            function TestEnum(e)        \n                print('Enum is:'..tostring(e))        \n\n                if space:ToInt() == 0 then\n                    print('enum ToInt() is ok')                \n                end\n\n                if not space:Equals(0) then\n                    print('enum compare int is ok')                \n                end\n\n                if space == e then\n                    print('enum compare enum is ok')\n                end\n\n                local s = UnityEngine.Space.IntToEnum(0)\n\n                if space == s then\n                    print('IntToEnum change type is ok')\n                end\n            end\n\n            function ChangeLightType(light, type)\n                print('change light type to '..tostring(type))\n                light.type = type\n            end\n        \";\n\n    LuaState state = null;\n\n    void Start () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        state = new LuaState();\n        state.Start();\n        LuaBinder.Bind(state);\n\n        state.DoString(script);\n        state[\"space\"] = Space.World;\n\n        LuaFunction func = state.GetFunction(\"TestEnum\");\n        func.BeginPCall();\n        func.Push(Space.World);\n        func.PCall();\n        func.EndPCall();\n        func.Dispose();        \n        func = null;\n\t}\n    void OnApplicationQuit()\n    {\n        state.CheckTop();\n        state.Dispose();\n        state = null;\n\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif        \n    }\n\n    string tips = \"\";\n    int count = 1;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips);\n\n        if (GUI.Button(new Rect(0, 60, 120, 50), \"ChangeType\"))\n        {\n            GameObject go = GameObject.Find(\"/Light\");\n            Light light = go.GetComponent<Light>();\n            LuaFunction func = state.GetFunction(\"ChangeLightType\");\n            func.BeginPCall();\n            func.Push(light);\n            LightType type = (LightType)(count++ % 4);\n            func.Push(type);\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/10_Enum/AccessingEnum.cs.meta",
    "content": "fileFormatVersion: 2\nguid: acd101a7d0a84e64198674b06dba633d\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/10_Enum/AccessingEnum.unity.meta",
    "content": "fileFormatVersion: 2\nguid: a217aecbea099fd4cbb21c9795f57884\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/10_Enum.meta",
    "content": "fileFormatVersion: 2\nguid: fbe9c6c5abd052b488c851260cc2cb92\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/11_Delegate/TestDelegate.cs",
    "content": "﻿using UnityEngine;\nusing System;\nusing System.Collections.Generic;\nusing LuaInterface;\n\n\npublic class TestDelegate: MonoBehaviour\n{\n    private string script =\n    @\"                              \n            function DoClick1(go)                \n                print('click1 gameObject is '..go.name)                    \n            end\n\n            function DoClick2(go)                \n                print('click2 gameObject is '..go.name)                              \n            end                       \n\n            function AddClick1(listener)       \n                if listener.onClick then\n                    listener.onClick = listener.onClick + DoClick1                                                    \n                else\n                    listener.onClick = DoClick1                      \n                end                \n            end\n\n            function AddClick2(listener)\n                if listener.onClick then\n                    listener.onClick = listener.onClick + DoClick2                      \n                else\n                    listener.onClick = DoClick2\n                end                \n            end\n\n            function SetClick1(listener)\n                if listener.onClick then\n                    listener.onClick:Destroy()\n                end\n\n                listener.onClick = DoClick1         \n            end\n\n            function RemoveClick1(listener)\n                if listener.onClick then\n                    listener.onClick = listener.onClick - DoClick1      \n                else\n                    print('empty delegate')\n                end\n            end\n\n            function RemoveClick2(listener)\n                if listener.onClick then\n                    listener.onClick = listener.onClick - DoClick2    \n                else\n                    print('empty delegate')                                \n                end\n            end\n\n            --测试重载问题\n            function TestOverride(listener)\n                listener:SetOnFinished(TestEventListener.OnClick(DoClick1))\n                listener:SetOnFinished(TestEventListener.VoidDelegate(DoClick2))\n            end\n\n            function TestEvent()\n                print('this is a event')\n            end\n\n            function AddEvent(listener)\n                listener.onClickEvent = listener.onClickEvent + TestEvent\n            end\n\n            function RemoveEvent(listener)\n                listener.onClickEvent = listener.onClickEvent - TestEvent\n            end\n\n            local t = {name = 'byself'}\n\n            function t:TestSelffunc()\n                print('callback with self: '..self.name)\n            end       \n\n            function AddSelfClick(listener)\n                if listener.onClick then\n                    listener.onClick = listener.onClick + TestEventListener.OnClick(t.TestSelffunc, t)\n                else\n                    listener.onClick = TestEventListener.OnClick(t.TestSelffunc, t)\n                end   \n            end     \n\n            function RemoveSelfClick(listener)\n                if listener.onClick then\n                    listener.onClick = listener.onClick - TestEventListener.OnClick(t.TestSelffunc, t)\n                else\n                    print('empty delegate')\n                end   \n            end\n    \";\n\n    LuaState state = null;\n    TestEventListener listener = null;\n\n    LuaFunction SetClick1 = null;\n    LuaFunction AddClick1 = null;\n    LuaFunction AddClick2 = null;\n    LuaFunction RemoveClick1 = null;\n    LuaFunction RemoveClick2 = null;\n    LuaFunction TestOverride = null;\n    LuaFunction RemoveEvent = null;\n    LuaFunction AddEvent = null;\n    LuaFunction AddSelfClick = null;\n    LuaFunction RemoveSelfClick = null;\n   \n    //需要删除的转LuaFunction为委托，不需要删除的直接加或者等于即可\n    void Awake()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        state = new LuaState();\n        state.Start();\n        LuaBinder.Bind(state);\n        Bind(state);\n\n        state.LogGC = true;\n        state.DoString(script);\n        GameObject go = new GameObject(\"TestGo\");\n        listener = (TestEventListener)go.AddComponent(typeof(TestEventListener));\n\n        SetClick1 = state.GetFunction(\"SetClick1\");\n        AddClick1 = state.GetFunction(\"AddClick1\");\n        AddClick2 = state.GetFunction(\"AddClick2\");\n        RemoveClick1 = state.GetFunction(\"RemoveClick1\");\n        RemoveClick2 = state.GetFunction(\"RemoveClick2\");\n        TestOverride = state.GetFunction(\"TestOverride\");\n        AddEvent = state.GetFunction(\"AddEvent\");\n        RemoveEvent = state.GetFunction(\"RemoveEvent\");\n\n        AddSelfClick = state.GetFunction(\"AddSelfClick\");\n        RemoveSelfClick = state.GetFunction(\"RemoveSelfClick\");\n    }\n\n    void Bind(LuaState L)\n    {\n        L.BeginModule(null);\n        TestEventListenerWrap.Register(state);\n        L.EndModule();\n\n        DelegateFactory.dict.Add(typeof(TestEventListener.OnClick), TestEventListener_OnClick);\n        DelegateFactory.dict.Add(typeof(TestEventListener.VoidDelegate), TestEventListener_VoidDelegate);\n\n        DelegateTraits<TestEventListener.OnClick>.Init(TestEventListener_OnClick);\n        DelegateTraits<TestEventListener.VoidDelegate>.Init(TestEventListener_VoidDelegate);\n    }\n\n    void CallLuaFunction(LuaFunction func)\n    {\n        tips = \"\";\n        func.BeginPCall();\n        func.Push(listener);\n        func.PCall();\n        func.EndPCall();                \n    }\n\n    //自动生成代码后拷贝过来\n    class TestEventListener_OnClick_Event : LuaDelegate\n    {\n        public TestEventListener_OnClick_Event(LuaFunction func) : base(func) { }\n\n        public void Call(UnityEngine.GameObject param0)\n        {\n            func.BeginPCall();\n            func.Push(param0);\n            func.PCall();\n            func.EndPCall();\n        }\n    }\n\n    public static TestEventListener.OnClick TestEventListener_OnClick(LuaFunction func, LuaTable self, bool flag)\n    {\n        if (func == null)\n        {\n            TestEventListener.OnClick fn = delegate { };\n            return fn;\n        }\n\n        TestEventListener_OnClick_Event target = new TestEventListener_OnClick_Event(func);\n        TestEventListener.OnClick d = target.Call;\n        target.method = d.Method;\n        return d;\n    }\n\n    class TestEventListener_VoidDelegate_Event : LuaDelegate\n    {\n        public TestEventListener_VoidDelegate_Event(LuaFunction func) : base(func) { }\n\n        public void Call(UnityEngine.GameObject param0)\n        {\n            func.BeginPCall();\n            func.Push(param0);\n            func.PCall();\n            func.EndPCall();\n        }\n    }\n\n    public static TestEventListener.VoidDelegate TestEventListener_VoidDelegate(LuaFunction func, LuaTable self, bool flag)\n    {\n        if (func == null)\n        {\n            TestEventListener.VoidDelegate fn = delegate { };\n            return fn;\n        }\n\n        TestEventListener_VoidDelegate_Event target = new TestEventListener_VoidDelegate_Event(func);\n        TestEventListener.VoidDelegate d = target.Call;\n        target.method = d.Method;\n        return d;\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 200, 600, 400), tips);\n\n        if (GUI.Button(new Rect(10, 10, 120, 40), \" = OnClick1\"))\n        {\n            CallLuaFunction(SetClick1);\n        }\n        else if (GUI.Button(new Rect(10, 60, 120, 40), \" + Click1\"))\n        {\n            CallLuaFunction(AddClick1);\n        }\n        else if (GUI.Button(new Rect(10, 110, 120, 40), \" + Click2\"))\n        {\n            CallLuaFunction(AddClick2);\n        }\n        else if (GUI.Button(new Rect(10, 160, 120, 40), \" - Click1\"))\n        {\n            CallLuaFunction(RemoveClick1);\n        }\n        else if (GUI.Button(new Rect(10, 210, 120, 40), \" - Click2\"))\n        {\n            CallLuaFunction(RemoveClick2);\n        }\n        else if (GUI.Button(new Rect(10, 260, 120, 40), \"+ Click1 in C#\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"DoClick1\");\n            TestEventListener.OnClick onClick = (TestEventListener.OnClick)DelegateTraits<TestEventListener.OnClick>.Create(func);\n            listener.onClick += onClick;\n        }        \n        else if (GUI.Button(new Rect(10, 310, 120, 40), \" - Click1 in C#\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"DoClick1\");\n            listener.onClick = (TestEventListener.OnClick)DelegateFactory.RemoveDelegate(listener.onClick, func);\n            func.Dispose();\n            func = null;\n        }\n        else if (GUI.Button(new Rect(10, 360, 120, 40), \"OnClick\"))\n        {\n            if (listener.onClick != null)\n            {\n                listener.onClick(gameObject);\n            }\n            else\n            {\n                Debug.Log(\"empty delegate!!\");\n            }\n        }\n        else if (GUI.Button(new Rect(10, 410, 120, 40), \"Override\"))\n        {\n            CallLuaFunction(TestOverride);\n        }\n        else if (GUI.Button(new Rect(10, 460, 120, 40), \"Force GC\"))\n        {\n            //自动gc log: collect lua reference name , id xxx in thread \n            state.LuaGC(LuaGCOptions.LUA_GCCOLLECT, 0);\n            GC.Collect();\n        }\n        else if (GUI.Button(new Rect(10, 510, 120, 40), \"event +\"))\n        {\n            CallLuaFunction(AddEvent);\n        }\n        else if (GUI.Button(new Rect(10, 560, 120, 40), \"event -\"))\n        {\n            CallLuaFunction(RemoveEvent);\n        }\n        else if (GUI.Button(new Rect(10, 610, 120, 40), \"event call\"))\n        {\n            listener.OnClickEvent(gameObject);\n        }\n        else if (GUI.Button(new Rect(200, 10, 120, 40), \"+self call\"))\n        {\n            CallLuaFunction(AddSelfClick);\n        }\n        else if (GUI.Button(new Rect(200, 60, 120, 40), \"-self call\"))\n        {\n            CallLuaFunction(RemoveSelfClick);\n        }\n    }\n\n    void Update()\n    {\n        state.Collect();\n        state.CheckTop();        \n    }\n\n    void SafeRelease(ref LuaFunction luaRef)\n    {\n        if (luaRef != null)\n        {\n            luaRef.Dispose();\n            luaRef = null;\n        }\n    }\n\n    string tips = \"\";    \n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnApplicationQuit()\n    {\n        SafeRelease(ref AddClick1);\n        SafeRelease(ref AddClick2);\n        SafeRelease(ref RemoveClick1);\n        SafeRelease(ref RemoveClick2);\n        SafeRelease(ref SetClick1);\n        SafeRelease(ref TestOverride);\n        state.Dispose();\n        state = null;\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif    \n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/11_Delegate/TestDelegate.cs.meta",
    "content": "fileFormatVersion: 2\nguid: aebc047d4185a4942b0220c97c91154e\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/11_Delegate/TestEventListener.cs",
    "content": "﻿using UnityEngine;\nusing System;\nusing System.Collections;\nusing LuaInterface;\n\npublic sealed class TestEventListener : MonoBehaviour\n{\n    public delegate void VoidDelegate(GameObject go);\n    public delegate void OnClick(GameObject go);    \n    public OnClick onClick = delegate { };\n\n    public event OnClick onClickEvent = delegate { };\n\n    public Func<bool> TestFunc = null;\n\n    public void SetOnFinished(OnClick click)\n    {\n        Debugger.Log(\"SetOnFinished OnClick\");\n    }\n    \n    public void SetOnFinished(VoidDelegate click)\n    {\n        Debugger.Log(\"SetOnFinished VoidDelegate\");\n    }\n\n    [NoToLuaAttribute]\n    public void OnClickEvent(GameObject go)\n    {\n        onClickEvent(go);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/11_Delegate/TestEventListener.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b909bbc52f2fc814ab97a3b1038ec9ee\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/11_Delegate/TestEventListenerWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class TestEventListenerWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(TestEventListener), typeof(UnityEngine.MonoBehaviour));\n\t\tL.RegFunction(\"SetOnFinished\", SetOnFinished);\n\t\tL.RegFunction(\"__eq\", op_Equality);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"onClick\", get_onClick, set_onClick);\n\t\tL.RegVar(\"TestFunc\", get_TestFunc, set_TestFunc);\n\t\tL.RegVar(\"onClickEvent\", get_onClickEvent, set_onClickEvent);\n\t\tL.RegFunction(\"OnClick\", TestEventListener_OnClick);\n\t\tL.RegFunction(\"VoidDelegate\", TestEventListener_VoidDelegate);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int SetOnFinished(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2 && TypeChecker.CheckTypes<TestEventListener.VoidDelegate>(L, 2))\n\t\t\t{\n\t\t\t\tTestEventListener obj = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener));\n\t\t\t\tTestEventListener.VoidDelegate arg0 = (TestEventListener.VoidDelegate)ToLua.ToObject(L, 2);\n\t\t\t\tobj.SetOnFinished(arg0);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<TestEventListener.OnClick>(L, 2))\n\t\t\t{\n\t\t\t\tTestEventListener obj = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener));\n\t\t\t\tTestEventListener.OnClick arg0 = (TestEventListener.OnClick)ToLua.ToObject(L, 2);\n\t\t\t\tobj.SetOnFinished(arg0);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: TestEventListener.SetOnFinished\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int op_Equality(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tUnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1);\n\t\t\tUnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2);\n\t\t\tbool o = arg0 == arg1;\n\t\t\tLuaDLL.lua_pushboolean(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_onClick(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestEventListener obj = (TestEventListener)o;\n\t\t\tTestEventListener.OnClick ret = obj.onClick;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index onClick on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_TestFunc(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestEventListener obj = (TestEventListener)o;\n\t\t\tSystem.Func<bool> ret = obj.TestFunc;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index TestFunc on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_onClickEvent(IntPtr L)\n\t{\n\t\tToLua.Push(L, new EventObject(typeof(TestEventListener.OnClick)));\n\t\treturn 1;\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_onClick(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestEventListener obj = (TestEventListener)o;\n\t\t\tTestEventListener.OnClick arg0 = (TestEventListener.OnClick)ToLua.CheckDelegate<TestEventListener.OnClick>(L, 2);\n\t\t\tobj.onClick = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index onClick on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_TestFunc(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestEventListener obj = (TestEventListener)o;\n\t\t\tSystem.Func<bool> arg0 = (System.Func<bool>)ToLua.CheckDelegate<System.Func<bool>>(L, 2);\n\t\t\tobj.TestFunc = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index TestFunc on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_onClickEvent(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tTestEventListener obj = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener));\n\t\t\tEventObject arg0 = null;\n\n\t\t\tif (LuaDLL.lua_isuserdata(L, 2) != 0)\n\t\t\t{\n\t\t\t\targ0 = (EventObject)ToLua.ToObject(L, 2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"The event 'TestEventListener.onClickEvent' can only appear on the left hand side of += or -= when used outside of the type 'TestEventListener'\");\n\t\t\t}\n\n\t\t\tif (arg0.op == EventOp.Add)\n\t\t\t{\n                TestEventListener.OnClick ev = (TestEventListener.OnClick)arg0.func;\n                obj.onClickEvent += ev;\n\t\t\t}\n\t\t\telse if (arg0.op == EventOp.Sub)\n\t\t\t{\n                TestEventListener.OnClick ev = (TestEventListener.OnClick)arg0.func;\n                obj.onClickEvent -= ev;\n            }\n\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestEventListener_OnClick(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tLuaFunction func = ToLua.CheckLuaFunction(L, 1);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tDelegate arg1 = DelegateTraits<TestEventListener.OnClick>.Create(func);\n\t\t\t\tToLua.Push(L, arg1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tLuaTable self = ToLua.CheckLuaTable(L, 2);\n\t\t\t\tDelegate arg1 = DelegateTraits<TestEventListener.OnClick>.Create(func, self);\n\t\t\t\tToLua.Push(L, arg1);\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestEventListener_VoidDelegate(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tLuaFunction func = ToLua.CheckLuaFunction(L, 1);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tDelegate arg1 = DelegateTraits<TestEventListener.VoidDelegate>.Create(func);\n\t\t\t\tToLua.Push(L, arg1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tLuaTable self = ToLua.CheckLuaTable(L, 2);\n\t\t\t\tDelegate arg1 = DelegateTraits<TestEventListener.VoidDelegate>.Create(func, self);\n\t\t\t\tToLua.Push(L, arg1);\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/11_Delegate/TestEventListenerWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 1e84ecc8101f77e45bab712de82fed53\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/11_Delegate/UseDelegate.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 0c371c24024790e4fafc6efd6656ffa8\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/11_Delegate.meta",
    "content": "fileFormatVersion: 2\nguid: bafe37b805a5b274aaee648a0b64bcb2\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/12_GameObject/TestGameObject.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\n\npublic class TestGameObject: MonoBehaviour\n{\n    private string script =\n        @\"                                                \n            local Color = UnityEngine.Color\n            local GameObject = UnityEngine.GameObject\n            local ParticleSystem = UnityEngine.ParticleSystem \n\n            function OnComplete()\n                print('OnComplete CallBack')\n            end                       \n            \n            local go = GameObject('go')\n            go:AddComponent(typeof(ParticleSystem))\n            local node = go.transform\n            node.position = Vector3.one                  \n            print('gameObject is: '..tostring(go))                 \n            --go.transform:DOPath({Vector3.zero, Vector3.one * 10}, 1, DG.Tweening.PathType.Linear, DG.Tweening.PathMode.Full3D, 10, nil)\n            --go.transform:DORotate(Vector3(0,0,360), 2, DG.Tweening.RotateMode.FastBeyond360):OnComplete(OnComplete)            \n            GameObject.Destroy(go, 2)                  \n            go.name = '123'\n            --print('delay destroy gameobject is: '..go.name)                                           \n        \";\n\n    LuaState lua = null;\n\n    void Start()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        lua = new LuaState();\n        lua.LogGC = true;\n        lua.Start();\n        LuaBinder.Bind(lua);\n        lua.DoString(script, \"TestGameObject.cs\");\n    }\n\n    void Update()\n    {\n        lua.CheckTop();\n        lua.Collect();        \n    }\n\n    string tips = \"\";\n        \n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnApplicationQuit()\n    {        \n        lua.Dispose();\n        lua = null;\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif    \n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/12_GameObject/TestGameObject.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4a206b7d4dbb78541b0e1be49fa5d338\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/12_GameObject/TestGameObject.unity.meta",
    "content": "fileFormatVersion: 2\nguid: bd44e2bbf67026a4eb7a12cc132f5515\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/12_GameObject.meta",
    "content": "fileFormatVersion: 2\nguid: c05e0dc08239c724bba79944e7ccbcaa\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/13_CustomLoader/CustomLoader.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 64a15f71c3e8ada48bbf2dec47d8eb0d\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/13_CustomLoader/TestCustomLoader.cs",
    "content": "﻿using UnityEngine;\nusing System.IO;\nusing LuaInterface;\n\n//use menu Lua->Copy lua files to Resources. 之后才能发布到手机\npublic class TestCustomLoader : LuaClient \n{\n    string tips = \"Test custom loader\";\n\n    protected override LuaFileUtils InitLoader()\n    {\n        return new LuaResLoader();\n    }\n\n    protected override void CallMain()\n    {\n        LuaFunction func = luaState.GetFunction(\"Test\");\n        func.Call();\n        func.Dispose();\n    }\n\n    protected override void StartMain()\n    {\n        luaState.DoFile(\"TestLoader.lua\");\n        CallMain();\n    }\n\n    new void Awake()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += Logger;\n#else\n        Application.RegisterLogCallback(Logger);\n#endif    \n        base.Awake();\n    }\n\n    new void OnApplicationQuit()\n    {\n        base.OnApplicationQuit();\n\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= Logger;\n#else\n        Application.RegisterLogCallback(null);\n#endif    \n    }\n\n    void Logger(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 200, 400, 400), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/13_CustomLoader/TestCustomLoader.cs.meta",
    "content": "fileFormatVersion: 2\nguid: bc2267b374446b24faf55d67673d8e63\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/13_CustomLoader.meta",
    "content": "fileFormatVersion: 2\nguid: 9fc9a6d7d2170ce43bfdcb7197628a9d\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/14_Out/TestOut.unity.meta",
    "content": "fileFormatVersion: 2\nguid: c1cff06827ae69d45ba691b5714e066d\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/14_Out/TestOutArg.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System;\n\npublic class TestOutArg : MonoBehaviour \n{            \n    string script =\n        @\"                                \n            local box = UnityEngine.BoxCollider\n                                                                            \n            function TestPick(ray)                                                                  \n                local _layer = 2 ^ LayerMask.NameToLayer('Default')                \n                local time = os.clock()                                                  \n                local flag, hit = UnityEngine.Physics.Raycast(ray, nil, 5000, _layer)                                              \n                --local flag, hit = UnityEngine.Physics.Raycast(ray, RaycastHit.out, 5000, _layer)                                \n                                \n                if flag then\n                    print('pick from lua, point: '..tostring(hit.point))                                        \n                end\n            end\n        \";\n\n    LuaState state = null;\n    LuaFunction func = null;\n    string tips = string.Empty;\n\n    void Start () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        state = new LuaState();\n        LuaBinder.Bind(state);\n        state.Start();\n        state.DoString(script, \"TestOutArg.cs\");\n        func = state.GetFunction(\"TestPick\");        \n\t}\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnApplicationQuit()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif        \n    }\n\n    private void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n\n    void Update()\n    {\n        if (Input.GetMouseButtonDown(0))\n        {\n            Camera camera = Camera.main;\n            Ray ray = camera.ScreenPointToRay(Input.mousePosition);                  \n            RaycastHit hit;\n            bool flag = Physics.Raycast(ray, out hit, 5000, 1 << LayerMask.NameToLayer(\"Default\"));            \n\n            if (flag)\n            {\n                Debugger.Log(\"pick from c#, point: [{0}, {1}, {2}]\", hit.point.x, hit.point.y, hit.point.z);\n            }\n\n            func.BeginPCall();\n            func.Push(ray);\n            func.PCall();\n            func.EndPCall();\n        }\n\n        state.CheckTop();\n        state.Collect();\n    }\n\n    void OnDestroy()\n    {\n        func.Dispose();\n        func = null;\n\n        state.Dispose();\n        state = null;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/14_Out/TestOutArg.cs.meta",
    "content": "fileFormatVersion: 2\nguid: cb859a8f0bf518243b6fc7c57eeef886\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/14_Out.meta",
    "content": "fileFormatVersion: 2\nguid: b9762f66a6f78d843b27a77925f63e3f\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/ProtoBuffer.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 1a4304ba0253d9241b8bf736a8607df6\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/TestProtoBuffer.cs",
    "content": "﻿//#define USE_PROTOBUF_NET\nusing UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System;\nusing System.IO;\n\n#if USE_PROTOBUF_NET\nusing ProtoBuf;\n\n[ProtoContract]\nclass Header\n{\n    [ProtoMember(1, IsRequired = true)]\n    public int cmd { get; set; }\n\n    [ProtoMember(2, IsRequired = true)]\n    public int seq { get; set; }\n}\n\n[ProtoContract]\nclass Person\n{\n    [ProtoMember(1, IsRequired = true)]\n    public Header header { get; set; }\n    [ProtoMember(2, IsRequired = true)]\n    public long id { get; set; }\n\n    [ProtoMember(3, IsRequired = true)]\n    public string name { get; set; }\n\n    [ProtoMember(4, IsRequired = false)]\n    public int age { get; set; }\n\n    [ProtoMember(5, IsRequired = false)]\n    public string email { get; set; }\n\n    [ProtoMember(6, IsRequired = true)]\n    public int[] array;\n}\n\n#endif\n\npublic class TestProtoBuffer : LuaClient\n{\n    private string script = @\"      \n        local common_pb = require 'Protol.common_pb'\n        local person_pb = require 'Protol.person_pb'\n       \n        function Decoder()  \n            local msg = person_pb.Person()\n            msg:ParseFromString(TestProtol.data)\n            --tostring 不会打印默认值\n            print('person_pb decoder: '..tostring(msg)..'age: '..msg.age..'\\nemail: '..msg.email)\n        end\n\n        function Encoder()                     \n            local msg = person_pb.Person()                                 \n            msg.header.cmd = 10010                                 \n            msg.header.seq = 1\n            msg.id = '1223372036854775807'            \n            msg.name = 'foo'              \n            --数组添加                              \n            msg.array:append(1)                              \n            msg.array:append(2)            \n            --extensions 添加\n            local phone = msg.Extensions[person_pb.Phone.phones]:add()\n            phone.num = '13788888888'      \n            phone.type = person_pb.Phone.MOBILE      \n            local pb_data = msg:SerializeToString()                   \n            TestProtol.data = pb_data\n        end\n        \";\n\n    private string tips = \"\";\n\n    //实际应用如Socket.Send(LuaStringBuffer buffer)函数发送协议, 在lua中调用Socket.Send(pb_data)\n    //读取协议 Socket.PeekMsgPacket() {return MsgPacket}; lua 中，取协议字节流 MsgPack.data 为 LuaStringBuffer类型\n    //msg = Socket.PeekMsgPacket() \n    //pb_data = msg.data    \n    new void Awake()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif  \n        base.Awake();\n    }\n\n    protected override LuaFileUtils InitLoader()\n    {\n        return new LuaResLoader();\n    }\n\n    protected override void Bind()\n    {\n        base.Bind();\n\n        luaState.BeginModule(null);\n        TestProtolWrap.Register(luaState);\n        luaState.EndModule();\n    }\n\n    //屏蔽，例子不需要运行\n    protected override void CallMain() { }\n\n    protected override void OnLoadFinished()\n    {\n        base.OnLoadFinished();\n        luaState.DoString(script, \"TestProtoBuffer.cs\");\n\n#if !USE_PROTOBUF_NET\n        LuaFunction func = luaState.GetFunction(\"Encoder\");\n        func.Call();\n        func.Dispose();\n\n        func = luaState.GetFunction(\"Decoder\");\n        func.Call();\n        func.Dispose();\n        func = null;\n#else\n        Person data = new Person();\n        data.id = 1223372036854775807;\n        data.name = \"foo\";\n        data.header = new Header();\n        data.header.cmd = 10086;\n        data.header.seq = 1;\n        data.array = new int[2];\n        data.array[0] = 1;\n        data.array[1] = 2;\n        MemoryStream stream = new MemoryStream();\n        Serializer.Serialize<Person>(stream, data);\n        TestProtol.data = stream.ToArray();\n\n        LuaFunction func = luaState.GetFunction(\"Decoder\");\n        func.Call();\n        func.Dispose();\n        func = null;\n\n        func = luaState.GetFunction(\"Encoder\");\n        func.Call();\n        func.Dispose();\n        func = null;\n\n        stream = new MemoryStream(TestProtol.data);\n        data = Serializer.Deserialize<Person>(stream);\n        Debugger.Log(\"Decoder from lua int64 is: {0}, cmd: {1}\", data.id, data.header.cmd);\n#endif\n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips = tips + msg + \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 200, 500, 500), tips);\n    }\n\n    new void OnApplicationQuit()\n    {\n        base.Destroy();\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/TestProtoBuffer.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 07805e704145c3b47b7c511a16d66d99\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/TestProtol.cs",
    "content": "﻿using System;\nusing LuaInterface;\n\npublic static class TestProtol\n{\n    [LuaByteBufferAttribute]\n    public static byte[] data; \n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/TestProtol.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 486ec4f4b6496a94c85974a2e0c1bd78\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/TestProtolWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class TestProtolWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginStaticLibs(\"TestProtol\");\n\t\tL.RegVar(\"data\", get_data, set_data);\n\t\tL.EndStaticLibs();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_data(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tLuaDLL.tolua_pushlstring(L, TestProtol.data, TestProtol.data.Length);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_data(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tbyte[] arg0 = ToLua.CheckByteBuffer(L, 2);\n\t\t\tTestProtol.data = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/TestProtolWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 25408b0022185f34c9744c405ad5da65\ntimeCreated: 1515038394\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/common.proto",
    "content": "\nmessage Header \n{\n  required int64 cmd = 1;\n  required int32 seq = 2;\n}"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/common.proto.meta",
    "content": "fileFormatVersion: 2\nguid: 760d09f03acd6ed4e94516e3b7439c54\ntimeCreated: 1498133645\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/person.proto",
    "content": "import \"common.proto\";\n\nmessage Person \n{  \n  required Header header = 1;\n  required int64 id = 2;\n  required string name = 3;  \n  optional int32 age = 4 [default = 18];\n  optional string email = 5 [default = \"topameng@qq.com\"];\n  repeated int32 array = 6;  \n\n  extensions 10 to max;\n}\n\nmessage Phone \n{\n    extend Person { repeated Phone phones = 10;}\n\n    enum PHONE_TYPE\n    {\n        MOBILE = 1;\n        HOME = 2;\n    }\n    optional string num = 1;\n    optional PHONE_TYPE type = 2;\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer/person.proto.meta",
    "content": "fileFormatVersion: 2\nguid: f84fe6c5b2078174bb56bed15abd687b\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/15_ProtoBuffer.meta",
    "content": "fileFormatVersion: 2\nguid: cac1317b8ab1d3a438e2fa736a69d7fe\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/16_Int64/TestInt64.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing System;\nusing LuaInterface;\nusing System.Collections.Generic;\n\n\npublic class TestInt64 : MonoBehaviour\n{\n    private string tips = \"\";\n\n    string script =\n        @\"            \n            function TestInt64(x)                \n                x = 789 + x\n                assert(tostring(x) == '9223372036854775807')\t\t                                       \n                local low, high = int64.tonum2(x)                \n                print('x value is: '..tostring(x)..' low is: '.. low .. ' high is: '..high.. ' type is: '.. tolua.typename(x))           \n                local y = int64.new(1,2)                \n                local z = int64.new(1,2)\n                \n                if y == z then\n                    print('int64 equals is ok, value: '..int64.tostring(y))\n                end\n\n                x = int64.new(123)                   \n            \n                if int64.equals(x, 123) then\n                    print('int64 equals to number ok')\n                else\n                    print('int64 equals to number failed')\n                end\n\n                x = int64.new('78962871035984074')\n                print('int64 is: '..tostring(x))\n\n                local str = tostring(int64.new(3605690779, 30459971))                \n                local n2 = int64.new(str)\n                local l, h = int64.tonum2(n2)                        \n                print(str..':'..tostring(n2)..' low:'..l..' high:'..h)                  \n\n                print('----------------------------uint64-----------------------------')\n                x = uint64.new('18446744073709551615')                                \n                print('uint64 max is: '..tostring(x))\n                l, h = uint64.tonum2(x)      \n                str = tostring(uint64.new(l, h))\n                print(str..':'..tostring(x)..' low:'..l..' high:'..h)     \n\n                return y\n            end\n        \";\n\n\n    void Start()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\t\t\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif        \n        new LuaResLoader();\n        LuaState lua = new LuaState();\n        lua.Start();\n        lua.DoString(script, \"TestInt64.cs\");                \n\n        LuaFunction func = lua.GetFunction(\"TestInt64\");\n        func.BeginPCall();\n        func.Push(9223372036854775807 - 789);\n        func.PCall();\n        long n64 = func.CheckLong();        \n        Debugger.Log(\"int64 return from lua is: {0}\", n64);\n        func.EndPCall();\n        func.Dispose();\n        func = null;\n\n        lua.CheckTop();\n        lua.Dispose();\n        lua = null;              \n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnDestroy()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/16_Int64/TestInt64.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d2eb3e2c0caea144e8cbbb8de6ed33f8\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/16_Int64/TestInt64.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 9f5fdf9606a2d854590fcbd3926005e4\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/16_Int64.meta",
    "content": "fileFormatVersion: 2\nguid: 56454d123fe4d2a47a2a1bf5e9a7399b\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/17_Inherit/Inherit.unity.meta",
    "content": "fileFormatVersion: 2\nguid: a3cf1516f0a320b49a263c1fed026319\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/17_Inherit/TestInherit.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\n\npublic class TestInherit : MonoBehaviour \n{\n    private string script =\n    @\"  LuaTransform = \n        {                          \n        }                                                   \n\n        function LuaTransform.Extend(u)         \n            local t = {}                        \n            local _position = u.position      \n            tolua.setpeer(u, t)     \n\n            t.__index = t\n            local get = tolua.initget(t)\n            local set = tolua.initset(t)   \n\n            local _base = u.base            \n\n            --重写同名属性获取        \n            get.position = function(self)                              \n                return _position                \n            end            \n\n            --重写同名属性设置\n            set.position = function(self, v)                 \t                                            \n                if _position ~= v then         \n                    _position = v                    \n                    _base.position = v                                                                      \t            \n                end\n            end\n\n            --重写同名函数\n            function t:Translate(...)            \n\t            print('child Translate')\n\t            _base:Translate(...)                   \n            end    \n                           \n            return u\n        end\n        \n        \n        --既保证支持继承函数，又支持go.transform == transform 这样的比较\n        function Test(node)        \n            local v = Vector3.one           \n            local transform = LuaTransform.Extend(node)                                                         \n\n            local t = os.clock()            \n            for i = 1, 200000 do\n                transform.position = transform.position\n            end\n            print('LuaTransform get set cost', os.clock() - t)\n\n            transform:Translate(1,1,1)                                                                     \n                        \n            local child = transform:Find('child')\n            print('child is: ', tostring(child))\n            \n            if child.parent == transform then            \n                print('LuaTransform compare to userdata transform is ok')\n            end\n\n            transform.xyz = 123\n            transform.xyz = 456\n            print('extern field xyz is: '.. transform.xyz)\n        end\n        \";\n\n    LuaState lua = null;\n\n\tvoid Start () \n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif   \n        new LuaResLoader();\n        lua = new LuaState();        \n        lua.Start();\n        LuaBinder.Bind(lua);\n        lua.DoString(script, \"TestInherit.cs\");\n\n        float time = Time.realtimeSinceStartup;\n\n        for (int i = 0; i < 200000; i++)\n        {\n            Vector3 v = transform.position;            \n            transform.position = v;\n        }\n\n        time = Time.realtimeSinceStartup - time;\n        Debugger.Log(\"c# Transform get set cost time: \" + time);        \n        lua.Call(\"Test\", transform, true);        \n        lua.Dispose();\n        lua = null;        \n\t}\n\n    string tips;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnDestroy()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/17_Inherit/TestInherit.cs.meta",
    "content": "fileFormatVersion: 2\nguid: a9cb964bd30f70946ab3ba186316e134\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/17_Inherit.meta",
    "content": "fileFormatVersion: 2\nguid: 49da3d0eb205def459dc639d92b7cc77\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/18_Bundle/TesetAssetBundle.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 207ce505e47eb8542963d4972b45b05d\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/18_Bundle/TestABLoader.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing LuaInterface;\nusing System;\n\n//click Lua/Build lua bundle\npublic class TestABLoader : MonoBehaviour \n{\n    int bundleCount = int.MaxValue;\n    string tips = null;\n\n    IEnumerator CoLoadBundle(string name, string path)\n    {\n        using (WWW www = new WWW(path))\n        {\n            if (www == null)\n            {\n                Debugger.LogError(name + \" bundle not exists\");\n                yield break;\n            }\n\n            yield return www;\n\n            if (www.error != null)\n            {\n                Debugger.LogError(string.Format(\"Read {0} failed: {1}\", path, www.error));\n                yield break;\n            }\n\n            --bundleCount;\n            LuaFileUtils.Instance.AddSearchBundle(name, www.assetBundle);\n            www.Dispose();\n        }                     \n    }\n\n    IEnumerator LoadFinished()\n    {\n        while (bundleCount > 0)\n        {\n            yield return null;\n        }\n\n        OnBundleLoad();\n    }\n\n    public IEnumerator LoadBundles()\n    {\n        string streamingPath = Application.streamingAssetsPath.Replace('\\\\', '/');\n\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n#if UNITY_ANDROID && !UNITY_EDITOR\n        string main = streamingPath + \"/\" + LuaConst.osDir + \"/\" + LuaConst.osDir;\n#else\n        string main = \"file:///\" + streamingPath + \"/\" + LuaConst.osDir + \"/\" + LuaConst.osDir;\n#endif\n        WWW www = new WWW(main);\n        yield return www;\n\n        AssetBundleManifest manifest = (AssetBundleManifest)www.assetBundle.LoadAsset(\"AssetBundleManifest\");\n        List<string> list = new List<string>(manifest.GetAllAssetBundles());        \n#else\n        //此处应该配表获取\n        List<string> list = new List<string>() { \"lua.unity3d\", \"lua_cjson.unity3d\", \"lua_system.unity3d\", \"lua_unityengine.unity3d\", \"lua_protobuf.unity3d\", \"lua_misc.unity3d\", \"lua_socket.unity3d\", \"lua_system_reflection.unity3d\" };\n#endif\n        bundleCount = list.Count;\n\n        for (int i = 0; i < list.Count; i++)\n        {\n            string str = list[i];\n\n#if UNITY_ANDROID && !UNITY_EDITOR\n            string path = streamingPath + \"/\" + LuaConst.osDir + \"/\" + str;\n#else\n            string path = \"file:///\" + streamingPath + \"/\" + LuaConst.osDir + \"/\" + str;\n#endif\n            string name = Path.GetFileNameWithoutExtension(str);\n            StartCoroutine(CoLoadBundle(name, path));            \n        }\n\n        yield return StartCoroutine(LoadFinished());\n    }\n\n    void Awake()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        LuaFileUtils file = new LuaFileUtils();\n        file.beZip = true;\n#if UNITY_ANDROID && UNITY_EDITOR\n        if (IntPtr.Size == 8)\n        {\n            throw new Exception(\"can't run this in unity5.x process for 64 bits, switch to pc platform, or run it in android mobile\");\n        }\n#endif\n        StartCoroutine(LoadBundles());\n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 150, 400, 300), tips);\n    }\n\n    void OnApplicationQuit()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    void OnBundleLoad()\n    {                \n        LuaState state = new LuaState();\n        state.Start();\n        state.DoString(\"print('hello tolua#:'..tostring(Vector3.zero))\");\n        state.DoFile(\"Main.lua\");\n        LuaFunction func = state.GetFunction(\"Main\");\n        func.Call();\n        func.Dispose();\n        state.Dispose();\n        state = null;\n\t}\t\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/18_Bundle/TestABLoader.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d357c949a4510b146a6e82777d131d20\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/18_Bundle.meta",
    "content": "fileFormatVersion: 2\nguid: 07aecff784dcab84393e4fad04c7b35d\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/19_cjson/TestCJson.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\n\npublic class TestCJson : LuaClient\n{\n    string script = @\"\n    local json = require 'cjson'\n\n    function Test(str)\n\t    local data = json.decode(str)\n        print(data.glossary.title)\n\t    s = json.encode(data)\n\t    print(s)\n    end\n\";\n    protected override LuaFileUtils InitLoader()\n    {\n        return new LuaResLoader();\n    }\n    \n    protected override void OpenLibs()\n    {\n        base.OpenLibs();\n        OpenCJson();                   \n    }\n\n    protected override void OnLoadFinished()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif  \n        base.OnLoadFinished();\n\n        TextAsset text = (TextAsset)Resources.Load(\"jsonexample\", typeof(TextAsset));\n        string str = text.ToString();\n        luaState.DoString(script);\n        LuaFunction func = luaState.GetFunction(\"Test\");\n        func.BeginPCall();\n        func.Push(str);\n        func.PCall();\n        func.EndPCall();\n        func.Dispose();                        \n    }\n\n    //屏蔽，例子不需要运行\n    protected override void CallMain() { }\n\n    string tips;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    new void OnApplicationQuit()\n    {\n        base.OnApplicationQuit();\n\n#if UNITY_5 || UNITY_2017 || UNITY_2018\t\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/19_cjson/TestCJson.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b3dab0c9b55ca0f44a0d3b8a50edf396\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/19_cjson/testcjson.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 0dbc965b474b6824db5cb79d380403e4\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/19_cjson.meta",
    "content": "fileFormatVersion: 2\nguid: 3c1a9e6cb95cdea4cbc97a336446abe8\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/20_utf8/TestUTF8.cs",
    "content": "﻿using UnityEngine;\nusing LuaInterface;\n\npublic class TestUTF8 : LuaClient\n{\n    string script =\n@\"\n    local utf8 = utf8\n\n    function Test()        \n\t    local l1 = utf8.len('你好')\n        local l2 = utf8.len('こんにちは')\n        print('chinese string len is: '..l1..' japanese sting len: '..l2)     \n\n        local s = '遍历字符串'                                        \n\n        for i in utf8.byte_indices(s) do            \n            local next = utf8.next(s, i)                   \n            print(s:sub(i, next and next -1))\n        end   \n\n        local s1 = '天下风云出我辈'        \n        print('风云 count is: '..utf8.count(s1, '风云'))\n        s1 = s1:gsub('风云', '風雲')\n\n        local function replace(s, i, j, repl_char)            \n\t        if s:sub(i, j) == '辈' then\n\t\t        return repl_char            \n\t        end\n        end\n\n        print(utf8.replace(s1, replace, '輩'))\n    end\n\";\n\n    protected override LuaFileUtils InitLoader()\n    {\n        return new LuaResLoader();\n    }\n\n    //屏蔽，例子不需要运行\n    protected override void CallMain() { }\n\n    protected override void OnLoadFinished()\n    {\n#if UNITY_4_6 || UNITY_4_7\n        Application.RegisterLogCallback(ShowTips);        \n#else\n        Application.logMessageReceived += ShowTips;\n#endif\n        base.OnLoadFinished();\n        luaState.DoString(script, \"TestUTF8.cs\");\n        LuaFunction func = luaState.GetFunction(\"Test\");\n        func.Call();\n        func.Dispose();\n        func = null;\n    }\n\n    string tips;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    new void OnApplicationQuit()\n    {\n        base.OnApplicationQuit();\n\n#if UNITY_4_6 || UNITY_4_7\n        Application.RegisterLogCallback(null);        \n#else\n        Application.logMessageReceived -= ShowTips;\n#endif\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/20_utf8/TestUTF8.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0c58b879bbb37ee4891c46ef87989f91\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/20_utf8/utf8.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 74b6932cd0642734eb36e554528a9825\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/20_utf8.meta",
    "content": "fileFormatVersion: 2\nguid: 48896cd2daf4f4542ba776681732210a\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/21_String/TestString.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System;\nusing System.Reflection;\nusing System.Text;\n\npublic class TestString : LuaClient\n{\n    string script =\n@\"           \n    function Test()\n        local str = System.String.New('男儿当自强')\n        local index = str:IndexOfAny('儿自')\n        print('and index is: '..index)\n        local buffer = str:ToCharArray()\n        print('str type is: '..type(str)..' buffer[0] is ' .. buffer[0])\n        local luastr = tolua.tolstring(buffer)\n        print('lua string is: '..luastr..' type is: '..type(luastr))\n        luastr = tolua.tolstring(str)\n        print('lua string is: '..luastr)                    \n    end\n\";\n\n    protected override LuaFileUtils InitLoader()\n    {\n        return new LuaResLoader();\n    }\n\n    //屏蔽，例子不需要运行\n    protected override void CallMain() { }\n\n    protected override void OnLoadFinished()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif  \n        base.OnLoadFinished();\n        luaState.DoString(script);\n        LuaFunction func = luaState.GetFunction(\"Test\");\n        func.Call();\n        func.Dispose();\n        func = null;\n    }\n\n    string tips;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    new void OnApplicationQuit()\n    {\n        base.OnApplicationQuit();\n\n#if UNITY_5 || UNITY_2017 || UNITY_2018\t\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/21_String/TestString.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 73dc7ee420beffa4b9db2334045dabba\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/21_String/TestString.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 8e6bca3bb283b3247a8692ac6e03d4ff\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/21_String.meta",
    "content": "fileFormatVersion: 2\nguid: d7bfd51b922b87a4ba399b7f73540493\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/22_Reflection/TestReflection.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections.Generic;\nusing LuaInterface;\nusing System;\nusing System.Reflection;\n\n\npublic class TestReflection : LuaClient\n{\n    string script =\n@\"    \n    require 'tolua.reflection'          \n    tolua.loadassembly('Assembly-CSharp')        \n    local BindingFlags = require 'System.Reflection.BindingFlags'\n\n    function DoClick()\n        print('do click')        \n    end \n\n    function Test()  \n        local t = typeof('TestExport')        \n        local func = tolua.getmethod(t, 'TestReflection')           \n        func:Call()        \n        func:Destroy()\n        func = nil\n        \n        local objs = {Vector3.one, Vector3.zero}\n        local array = tolua.toarray(objs, typeof(Vector3))\n        local obj = tolua.createinstance(t, array)\n        --local constructor = tolua.getconstructor(t, typeof(Vector3):MakeArrayType())\n        --local obj = constructor:Call(array)        \n        --constructor:Destroy()\n\n        func = tolua.getmethod(t, 'Test', typeof('System.Int32'):MakeByRefType())        \n        local r, o = func:Call(obj, 123)\n        print(r..':'..o)\n        func:Destroy()\n\n        local property = tolua.getproperty(t, 'Number')\n        local num = property:Get(obj, null)\n        print('object Number: '..num)\n        property:Set(obj, 456, null)\n        num = property:Get(obj, null)\n        property:Destroy()\n        print('object Number: '..num)\n\n        local field = tolua.getfield(t, 'field')\n        num = field:Get(obj)\n        print('object field: '.. num)\n        field:Set(obj, 2048)\n        num = field:Get(obj)\n        field:Destroy()\n        print('object field: '.. num)       \n        \n        field = tolua.getfield(t, 'OnClick')\n        local onClick = field:Get(obj)        \n        onClick = onClick + DoClick        \n        field:Set(obj, onClick)        \n        local click = field:Get(obj)\n        click:DynamicInvoke()\n        field:Destroy()\n        click:Destroy()\n    end  \n\";\n\n    string tips = null;\n\n    protected override LuaFileUtils InitLoader()\n    {\n#if UNITY_4_6 || UNITY_4_7\n        Application.RegisterLogCallback(ShowTips);        \n#else\n        Application.logMessageReceived += ShowTips;\n#endif\n        return new LuaResLoader();\n    }\n\n    //屏蔽，例子不需要运行\n    protected override void CallMain() { }\n\n    void TestAction()\n    {\n        Debugger.Log(\"Test Action\");\n    }\n\n    protected override void OnLoadFinished()\n    {        \n        base.OnLoadFinished();\n\n        /*Type t = typeof(TestExport);\n        MethodInfo md = t.GetMethod(\"TestReflection\");\n        md.Invoke(null, null);\n\n        Vector3[] array = new Vector3[] { Vector3.zero, Vector3.one };\n        object obj = Activator.CreateInstance(t, array);\n        md = t.GetMethod(\"Test\", new Type[] { typeof(int).MakeByRefType() });\n        object o = 123;\n        object[] args = new object[] { o };\n        object ret = md.Invoke(obj, args);\n        Debugger.Log(ret + \" : \" + args[0]);\n\n        PropertyInfo p = t.GetProperty(\"Number\");\n        int num = (int)p.GetValue(obj, null);\n        Debugger.Log(\"object Number: {0}\", num);\n        p.SetValue(obj, 456, null);\n        num = (int)p.GetValue(obj, null);\n        Debugger.Log(\"object Number: {0}\", num);\n\n        FieldInfo f = t.GetField(\"field\");\n        num = (int)f.GetValue(obj);\n        Debugger.Log(\"object field: {0}\", num);\n        f.SetValue(obj, 2048);\n        num = (int)f.GetValue(obj);\n        Debugger.Log(\"object field: {0}\", num);*/\n\n        luaState.CheckTop();\n        luaState.DoString(script, \"TestReflection.cs\");\n        LuaFunction func = luaState.GetFunction(\"Test\");\n        func.Call();\n        func.Dispose();\n        func = null;\n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    new void OnApplicationQuit()\n    {\n#if UNITY_4_6 || UNITY_4_7\n        Application.RegisterLogCallback(ShowTips);        \n#else\n        Application.logMessageReceived += ShowTips;\n#endif\n        Destroy();\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 150, 500, 300), tips);       \n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/22_Reflection/TestReflection.cs.meta",
    "content": "fileFormatVersion: 2\nguid: fab693360b2865f4a9121b9959993d29\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/22_Reflection/TestReflection.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 0c297fdd08a27a54a96505801547f7b2\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/22_Reflection.meta",
    "content": "fileFormatVersion: 2\nguid: 1160a89e211090a4ea787fb5145cc984\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/23_List/UseList.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System.Collections.Generic;\nusing System;\n\n//需要导出委托类型如下：\n//System.Predicate<int>\n//System.Action<int>\n//System.Comparison<int>\npublic class UseList : LuaClient\n{\n    private string script =\n        @\"\n            function Exist2(v)\n                return v == 2\n            end\n\n            function IsEven(v)\n                return v % 2 == 0\n            end\n\n            function NotExist(v)\n                return false\n            end\n\n            function Compare(a, b)\n                if a > b then \n                    return 1\n                elseif a == b then\n                    return 0\n                else\n                    return -1\n                end\n            end\n\n            function Test(list, list1)        \n                list:Add(123)\n                print('Add result: list[0] is '..list[0])\n                list:AddRange(list1)\n                print(string.format('AddRange result: list[1] is %d, list[2] is %d', list[1], list[2]))\n\n                local const = list:AsReadOnly()\n                print('AsReadOnley:'..const[0])    \n\n                index = const:IndexOf(123)\n                \n                if index == 0 then\n                    print('const IndexOf is ok')\n                end\n\n                local pos = list:BinarySearch(1)\n                print('BinarySearch 1 result is: '..pos)\n\n                if list:Contains(123) then\n                    print('list Contain 123')\n                else\n                    error('list Contains result fail')\n                end\n\n                if list:Exists(Exist2) then\n                    print('list exists 2')\n                else\n                    error('list exists result fail')\n                end                    \n                \n                if list:Find(Exist2) then\n                    print('list Find is ok')\n                else\n                    print('list Find error')\n                end\n\n                local fa = list:FindAll(IsEven)\n\n                if fa.Count == 2 then\n                    print('FindAll is ok')\n                end\n\n                --注意推导后的委托声明必须注册, 这里是System.Predicate<int>\n                local index = list:FindIndex(System.Predicate_int(Exist2))\n\n                if index == 2 then\n                    print('FindIndex is ok')\n                end\n\n                index = list:FindLastIndex(System.Predicate_int(Exist2))\n\n                if index == 2 then\n                    print('FindLastIndex is ok')\n                end                \n                \n                index = list:IndexOf(123)\n                \n                if index == 0 then\n                    print('IndexOf is ok')\n                end\n\n                index = list:LastIndexOf(123)\n                \n                if index == 0 then\n                    print('LastIndexOf is ok')\n                end\n\n                list:Remove(123)\n\n                if list[0] ~= 123 then\n                    print('Remove is ok')\n                end\n\n                list:Insert(0, 123)\n\n                if list[0] == 123 then\n                    print('Insert is ok')\n                end\n\n                list:RemoveAt(0)\n\n                if list[0] ~= 123 then\n                    print('RemoveAt is ok')\n                end\n\n                list:Insert(0, 123)\n                list:ForEach(function(v) print('foreach: '..v) end)\n                local count = list.Count      \n\n                list:Sort(System.Comparison_int(Compare))\n                print('--------------sort list over----------------------')\n                                \n                for i = 0, count - 1 do\n                    print('for:'..list[i])\n                end\n\n                list:Clear()\n                print('list Clear not count is '..list.Count)\n            end\n        \";\n\n\n    protected override LuaFileUtils InitLoader()\n    {\n        return new LuaResLoader();\n    }\n\n    //屏蔽，例子不需要运行\n    protected override void CallMain() { }\n\n    protected override void OnLoadFinished()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif          \n        base.OnLoadFinished();\n        luaState.DoString(script, \"UseList.cs\");\n        List<int> list1 = new List<int>();\n        list1.Add(1);\n        list1.Add(2);\n        list1.Add(4);\n\n        LuaFunction func = luaState.GetFunction(\"Test\");\n        func.BeginPCall();\n        func.Push(new List<int>());\n        func.Push(list1);\n        func.PCall();\n        func.EndPCall();\n        func.Dispose();\n        func = null;        \n    }\n\n    string tips;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    new void OnApplicationQuit()\n    {\n        base.OnApplicationQuit();\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 300, 600, 600), tips);\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/23_List/UseList.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 8a4f97c41d925314c853a72d43fb5166\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/23_List/UseList.unity.meta",
    "content": "fileFormatVersion: 2\nguid: a4f35714ff91744489f71618b0ae9fd8\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/23_List.meta",
    "content": "fileFormatVersion: 2\nguid: 665099d7241e1a54fb217e3b172e21a7\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/24_Struct/PassStruct.cs",
    "content": "﻿using UnityEngine;\nusing LuaInterface;\nusing System;\nusing Debugger = LuaInterface.Debugger;\n\nnamespace LuaInterface\n{\n    public partial struct LuaValueType\n    {\n        public const int Rect = 13;\n    }\n}\n\npublic class PassStruct : LuaClient \n{\n    private string script =\n        @\"\n            Rect = {}\n                       \n            function Rect.New(x,y,w,h)\n                local rt = {x = x, y = y, w = w, h = h}\n                setmetatable(rt, Rect)                \n                return rt\n            end\n\n            function Rect:Get()                       \n                return self.x, self.y, self.w, self.h\n            end\n          \n            Rect.__tostring = function(self)\n                return '(x:'..self.x..', y:'..self.y..', width:'..self.w..', height:'..self.h..')'\n            end\n\n            function PrintRect(rt)\n                print(tostring(rt))\n                return rt\n            end\n\n            setmetatable(Rect, Rect)\n            AddValueType(Rect, 13)\n        \";\n\n    void PushRect(IntPtr L, Rect rt)\n    {\n        LuaDLL.lua_getref(L, NewRect.GetReference());\n        LuaDLL.lua_pushnumber(L, rt.xMin);\n        LuaDLL.lua_pushnumber(L, rt.yMin);\n        LuaDLL.lua_pushnumber(L, rt.width);\n        LuaDLL.lua_pushnumber(L, rt.height);\n        LuaDLL.lua_call(L, 4, 1);\n    }\n\n    Rect ToRectValue(IntPtr L, int pos)\n    {\n        pos = LuaDLL.abs_index(L, pos);\n        LuaDLL.lua_getref(L, GetRect.GetReference());\n        LuaDLL.lua_pushvalue(L, pos);\n        LuaDLL.lua_call(L, 1, 4);\n        float x = (float)LuaDLL.lua_tonumber(L, -4);\n        float y = (float)LuaDLL.lua_tonumber(L, -3);\n        float w = (float)LuaDLL.lua_tonumber(L, -2);\n        float h = (float)LuaDLL.lua_tonumber(L, -1);\n        LuaDLL.lua_pop(L, 4);\n\n        return new Rect(x, y, w, h);\n    }\n\n    Rect CheckRectValue(IntPtr L, int pos)\n    {\n        int type = LuaDLL.tolua_getvaluetype(L, pos);\n\n        if (type != LuaValueType.Rect)\n        {\n            luaState.LuaTypeError(pos, \"Rect\", LuaValueTypeName.Get(type));\n            return new Rect();\n        }\n\n        return ToRectValue(L, pos);\n    }\n\n    bool CheckRectType(IntPtr L, int pos)\n    {\n        return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Rect;        \n    }\n\n    bool CheckNullRectType(IntPtr L, int pos)\n    {\n        LuaTypes luaType = LuaDLL.lua_type(L, pos);\n\n        switch (luaType)\n        {\n            case LuaTypes.LUA_TNIL:\n                return true;\n            case LuaTypes.LUA_TTABLE:\n                return LuaDLL.tolua_getvaluetype(L, pos) == LuaValueType.Rect;\n            default:\n                return false;\n        }\n    }\n\n    object ToRectTable(IntPtr L, int pos)\n    {\n        return ToRectValue(L, pos);\n    }\n\n    string tips = null;\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    new void OnApplicationQuit()\n    {\n        base.OnApplicationQuit();\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif                  \n    }\n\n    new void Awake()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        base.Awake();\n    }\n\n    protected override void OnLoadFinished()\n    {\n        base.OnLoadFinished();\n        luaState.DoString(script, \"PassStruct.cs\");\n\n        NewRect = luaState.GetFunction(\"Rect.New\");\n        GetRect = luaState.GetFunction(\"Rect.Get\");\n        StackTraits<Rect>.Init(PushRect, CheckRectValue, ToRectValue);           //支持压入lua以及从lua栈读取\n        TypeTraits<Rect>.Init(CheckRectType);                                    //支持重载函数TypeCheck.CheckTypes\n        TypeTraits<Nullable<Rect>>.Init(CheckNullRectType);                      //支持重载函数TypeCheck.CheckTypes\n        LuaValueTypeName.names[LuaValueType.Rect] = \"Rect\";                      //CheckType失败提示的名字\n        TypeChecker.LuaValueTypeMap[LuaValueType.Rect] = typeof(Rect);           //用于支持类型匹配检查操作\n        ToLua.ToVarMap[LuaValueType.Rect] = ToRectTable;                         //Rect作为object读取\n        ToLua.VarPushMap[typeof(Rect)] = (L, o) => { PushRect(L, (Rect)o); };    //Rect作为object压入\n\n        //测试例子\n        LuaFunction func = luaState.GetFunction(\"PrintRect\");\n        func.BeginPCall();\n        func.PushValue(new Rect(10, 20, 120, 50));\n        func.PCall();\n        Rect rt = func.CheckValue<Rect>();\n        func.EndPCall();\n        Debugger.Log(rt);\n        Debugger.Log(Vector3.one.ToString());\n    }\n\n    LuaFunction NewRect = null;\n    LuaFunction GetRect = null;    \n\n    protected override LuaFileUtils InitLoader()\n    {\n        return new LuaResLoader();\n    }\n\n    private void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 220, Screen.height / 2 - 200, 400, 400), tips);        \n    }\n\n    //屏蔽，例子不需要运行\n    protected override void CallMain() { }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/24_Struct/PassStruct.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 51af02ba87a948543b788453b5bb790c\ntimeCreated: 1495007962\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/24_Struct/Struct.unity.meta",
    "content": "fileFormatVersion: 2\nguid: bab0d380ec96e4846bcd28c1d626d89f\ntimeCreated: 1495007901\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/24_Struct.meta",
    "content": "fileFormatVersion: 2\nguid: a817b98d5c7d23e4c9c6afb6ac646cbe\nfolderAsset: yes\ntimeCreated: 1495007845\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Performance/Performance.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 0693d19658479a642a7faaa61feb2c09\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Performance/TestPerformance.cs",
    "content": "﻿using System;\nusing UnityEngine;\nusing System.Collections.Generic;\nusing LuaInterface;\nusing System.Collections;\nusing System.Runtime.InteropServices;\n\npublic class TestPerformance : MonoBehaviour \n{\n    LuaState state = null;        \n    private string tips = \"\";\n\n    private void Start()\n    {\n#if UNITY_4_6 || UNITY_4_7\n        Application.RegisterLogCallback(ShowTips);        \n#else\n        Application.logMessageReceived += ShowTips;\n#endif\n        new LuaResLoader();\n        state = new LuaState();\n        state.Start();\n        LuaBinder.Bind(state);\n        state.DoFile(\"TestPerf.lua\");                              \n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n    }\n\n    void OnApplicationQuit()\n    {\n#if UNITY_4_6 || UNITY_4_7\n        Application.RegisterLogCallback(null);        \n#else\n        Application.logMessageReceived -= ShowTips;\n#endif\n        state.Dispose();\n        state = null;\n    }\n\n    void OnGUI()\n    {        \n        GUI.Label(new Rect(Screen.width / 2 - 220, Screen.height / 2 - 200, 400, 400), tips);\n\n        if (GUI.Button(new Rect(50, 50, 120, 45), \"Test1\"))\n        {\n            float time = Time.realtimeSinceStartup;            \n\n            for (int i = 0; i < 200000; i++)\n            {\n                Vector3 v = transform.position;\n                transform.position = v + Vector3.one;\n            }\n\n            time = Time.realtimeSinceStartup - time;\n            tips = \"\";\n            Debugger.Log(\"c# Transform getset cost time: \" + time);            \n            transform.position = Vector3.zero;\n\n            LuaFunction func = state.GetFunction(\"Test1\");\n            func.BeginPCall();\n            func.Push(transform);\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n            func = null;            \n        }\n        else if (GUI.Button(new Rect(50, 150, 120, 45), \"Test2\"))\n        {\n            float time = Time.realtimeSinceStartup;\n\n            for (int i = 0; i < 200000; i++)\n            {\n                transform.Rotate(Vector3.up, 1);\n            }\n\n            time = Time.realtimeSinceStartup - time;\n            tips = \"\";\n            Debugger.Log(\"c# Transform.Rotate cost time: \" + time);\n\n            LuaFunction func = state.GetFunction(\"Test2\");\n            func.BeginPCall();\n            func.Push(transform);\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n            func = null;    \n        }\n        else if (GUI.Button(new Rect(50, 250, 120, 45), \"Test3\"))\n        {\n            float time = Time.realtimeSinceStartup;            \n\n            for (int i = 0; i < 2000000; i++)\n            {\n                new Vector3(i, i, i);\n            }\n\n            time = Time.realtimeSinceStartup - time;\n            tips = \"\";\n            Debugger.Log(\"c# new Vector3 cost time: \" + time);            \n\n            LuaFunction func = state.GetFunction(\"Test3\");\n            func.Call();\n            func.Dispose();\n            func = null;  \n        }\n        else if (GUI.Button(new Rect(50, 350, 120, 45), \"Test4\"))\n        {\n            float time = Time.realtimeSinceStartup;\n\n            for (int i = 0; i < 20000; i++)\n            {\n                new GameObject();\n            }\n\n            time = Time.realtimeSinceStartup - time;\n            tips = \"\";\n            Debugger.Log(\"c# new GameObject cost time: \" + time);\n\n            //光gc了\n            LuaFunction func = state.GetFunction(\"Test4\");\n            func.Call();\n            func.Dispose();\n            func = null;\n        }\n        else if (GUI.Button(new Rect(50, 450, 120, 45), \"Test5\"))\n        {            \n            int[] array = new int[1024];\n\n            for (int i = 0; i < 1024; i++)\n            {\n                array[i] = i;\n            }\n\n            float time = Time.realtimeSinceStartup;\n            int total = 0;\n\n            for (int j = 0; j < 100000; j++)\n            {\n                for (int i = 0; i < 1024; i++)\n                {\n                    total += array[i];\n                }\n            }\n\n            time = Time.realtimeSinceStartup - time;\n            tips = \"\";\n            Debugger.Log(\"Array cost time: \" + time);\n\n            List<int> list = new List<int>(array);\n            time = Time.realtimeSinceStartup;\n            total = 0;\n\n            for (int j = 0; j < 100000; j++)\n            {\n                for (int i = 0; i < 1024; i++)\n                {\n                    total += list[i];\n                }\n            }\n\n            time = Time.realtimeSinceStartup - time;\n            tips = \"\";\n            Debugger.Log(\"Array cost time: \" + time);\n\n            LuaFunction func = state.GetFunction(\"TestTable\");\n            func.Call();\n            func.Dispose();\n            func = null;            \n        }\n        else if (GUI.Button(new Rect(50, 550, 120, 40), \"Test7\"))\n        {            \n            float time = Time.realtimeSinceStartup;\n            Vector3 v1 = Vector3.zero;\n\n            for (int i = 0; i < 200000; i++)\n            {\n                Vector3 v = new Vector3(i,i,i);\n                v = Vector3.Normalize(v);\n                v1 = v + v1;\n            }\n\n            time = Time.realtimeSinceStartup - time;            \n            tips = \"\";\n            Debugger.Log(\"Vector3 New Normalize cost: \" + time);\n            LuaFunction func = state.GetFunction(\"Test7\");\n            func.Call();\n            func.Dispose();\n            func = null;  \n        }\n        else if (GUI.Button(new Rect(250, 50, 120, 40), \"Test8\"))\n        {\n            float time = Time.realtimeSinceStartup;\n\n            for (int i = 0; i < 200000; i++)\n            {\n\t\t        Quaternion q1 = Quaternion.Euler(i, i, i);\n                Quaternion q2 = Quaternion.Euler(i * 2, i * 2, i * 2);\n                Quaternion.Slerp(q1, q2, 0.5f);\n            }\n\n            time = Time.realtimeSinceStartup - time;\n            tips = \"\";\n            Debugger.Log(\"Quaternion Euler Slerp cost: \" + time);\n\n            LuaFunction func = state.GetFunction(\"Test8\");\n            func.Call();\n            func.Dispose();\n            func = null;\n        }\n        else if (GUI.Button(new Rect(250, 150, 120, 40), \"Test9\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"Test9\");\n            func.Call();\n            func.Dispose();\n            func = null;\n        }\n        else if (GUI.Button(new Rect(250, 250, 120, 40), \"Quit\"))\n        {\n            Application.Quit();\n        }\n\n        if (state != null)\n        {\n            state.CheckTop();\n            state.Collect();\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/Performance/TestPerformance.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e3be970387cfeea42a1944adffc6fffc\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Performance.meta",
    "content": "fileFormatVersion: 2\nguid: f240c18ff8d4eb44390f8d949e2f6fbd\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/README.md",
    "content": "## 例子1\n展示了最小的tolua#环境，以及执行一段lua代码操作代码如下：\n``` csharp\n        LuaState lua = new LuaState();\n        lua.Start();\n        string hello =\n            @\"                \n                print('hello tolua#')                                  \n            \";\n        \n        lua.DoString(hello, \"HelloWorld.cs\");\n        lua.CheckTop();\n        lua.Dispose();\n        lua = null;\n``` \nLuaState封装了对lua 主要数据结构 lua_State 指针的各种堆栈操作。<br>\n一般对于客户端，推荐只创建一个LuaState对象。如果要使用多State需要在Unity中设置全局宏 MULTI_STATE<br>\n* LuaState.Start 需要在tolua代码加载到内存后调用。如果使用assetbunblde加载lua文件，调用Start()之前assetbundle必须加载好<br>\n* LuaState.DoString 执行一段lua代码,除了例子,比较少用这种方式加载代码,无法避免代码重复加载覆盖等,需调用者自己保证。第二个参数用于调试信息,或者error消息(用于提示出错代码所在文件名称)<br>\n* LuaState.CheckTop 检查是否堆栈是否平衡，一般放于update中，c#中任何使用lua堆栈操作，都需要调用者自己平衡堆栈（参考LuaFunction以及LuaTable代码）, 当CheckTop出现警告时其实早已经离开了堆栈操作范围，这是需自行review代码。<br>\n* LuaState.Dispose 释放LuaState 以及其资源。<br>\n> **注意:** 此例子无法发布到手机\n\n## 例子2\n展示了dofile跟require的区别, 代码如下:\n``` csharp\n    LuaState lua = null;\n\n    void Start () \n    {      \n        lua = new LuaState();                \n        lua.Start();        \n        //如果移动了ToLua目录，需要自己手动，这里只是例子就不做配置了\n        string fullPath = Application.dataPath + \"/ToLua/Examples/02_ScriptsFromFile\";\n        lua.AddSearchPath(fullPath);        \n    }\n\n    void OnGUI()\n    {\n        if (GUI.Button(new Rect(50, 50, 120, 45), \"DoFile\"))\n        {\n            lua.DoFile(\"ScriptsFromFile.lua\");                        \n        }\n        else if (GUI.Button(new Rect(50, 150, 120, 45), \"Require\"))\n        {            \n            lua.Require(\"ScriptsFromFile\");            \n        }\n\n        lua.Collect();\n        lua.CheckTop();\n    }\n\n    void OnApplicationQuit()\n    {\n        lua.Dispose();\n        lua = null;\n    }\n``` \ntolua#DoFile函数,跟lua保持一致行为,能多次执行一个文件。tolua#加入了新的Require函数,无论c#和lua谁先require一个lua文件, 都能保证加载唯一性<br>\n* LuaState.AddSearchPath 增加搜索目录, 这样DoFile跟Require函数可以只用文件名,无需写全路径<br>\n* LuaState.DoFile 加载一个lua文件, 注意dofile需要扩展名, 可反复执行, 后面的变量会覆盖之前的DoFile加载的变量<br>\n* LuaState.Require 同lua require(modname)操作, 加载指定模块并且把结果写入到package.loaded中,如果modname存在, 则直接返回package.loaded[modname]<br>\n* LuaState.Collect 垃圾回收, 对于被自动gc的LuaFunction, LuaTable, 以及委托减掉的LuaFunction, 延迟删除的Object之类。等等需要延迟处理的回收, 都在这里自动执行<br>\n\n> **注意:** 虽然有文件加载,但此例子无法发布到手机, 如果ToLua目录不在/Assets目录下, 需要修改代码中的目录位置<br>\n\n## 例子3 LuaFunction\n展示了如何调用lua的函数, 主要代码如下:\n``` csharp\n    private string script =\n        @\"  function luaFunc(num)                        \n                return num + 1\n            end\n\n            test = {}\n            test.luaFunc = luaFunc\n        \";\n\n    LuaFunction luaFunc = null;\n    LuaState lua = null;\n\t\n    void Start () \n    {\n        new LuaResLoader();\n        lua = new LuaState();\n        lua.Start();\n        DelegateFactory.Init();\n        lua.DoString(script);\n\n        //Get the function object\n        luaFunc = lua.GetFunction(\"test.luaFunc\");\n\n        if (func != null)\n        {\n            int num = luaFunc.Invoke<int, int>(123456);\n            Debugger.Log(\"generic call return: {0}\", num);\n\n            num = CallFunc();\n            Debugger.Log(\"expansion call return: {0}\", num);\n\n            Func<int, int> Func = luaFunc.ToDelegate<Func<int, int>>();\n            num = Func(123456);\n            Debugger.Log(\"Delegate call return: {0}\", num);\n            \n            num = lua.Invoke<int, int>(\"test.luaFunc\", 123456, true);\n            Debugger.Log(\"luastate call return: {0}\", num);\n        }\n                \n        lua.CheckTop();\n\t}\n\n    void OnDestroy()\n    {\n        if (luaFunc != null)\n        {\n            luaFunc.Dispose();\n            luaFunc = null;\n        }\n\n        lua.Dispose();\n        lua = null;\n    }\n\n    int CallFunc()\n    {        \n        luaFunc.BeginPCall();                \n        luaFunc.Push(123456);\n        luaFunc.PCall();        \n        int num = (int)luaFunc.CheckNumber();                    \n        luaFunc.EndPCall();\n        return num;                \n    }\n``` \ntolua# 简化了lua函数的操作，通过LuaFunction封装(并缓存)一个lua函数，并提供各种操作, 建议频繁调用函数使用无GC方式。<br>\n* LuaState.GetLuaFunction 获取并缓存一个lua函数, 此函数支持串式操作, 如\"test.luaFunc\"代表test表中的luaFunc函数。<br>\n* LuaState.Invoke 临时调用一个lua function并返回一个值，这个操作并不缓存lua function，适合频率非常低的函数调用。<br>\n* LuaFunction.Call() 不需要返回值的函数调用操作<br>\n* LuaFunction.Invoke() 有一个返回值的函数调用操作 <br>\n* LuaFunction.BeginPCall() 开始函数调用 <br>\n* LuaFunction.Push() 压入函数调用需要的参数，通过众多的重载函数来解决参数转换gc问题 <br>\n* LuaFunction.PCall() 调用lua函数 <br>\n* LuaFunction.CheckNumber() 提取函数返回值, 并检查返回值为lua number类型 <br>\n* LuaFunction.EndPCall() 结束lua函数调用, 清楚函数调用造成的堆栈变化 <br>\n* LuaFunction.Dispose() 释放LuaFunction, 递减引用计数，如果引用计数为0, 则从_R表删除该函数 <br>\n\n> **注意:** 无论Call还是PCall只相当于lua中的函数'.'调用。<br>\n请注意':'这种语法糖 self:call(...) == self.call(self, ...） <br>\nc# 中需要按后面方式调用, 即必须主动传入第一个参数self <br>\n\n## 例子4\n展示了如何访问lua中变量，table的操作\n``` csharp\n    private string script =\n        @\"\n            print('Objs2Spawn is: '..Objs2Spawn)\n            var2read = 42\n            varTable = {1,2,3,4,5}\n            varTable.default = 1\n            varTable.map = {}\n            varTable.map.name = 'map'\n            \n            meta = {name = 'meta'}\n            setmetatable(varTable, meta)\n            \n            function TestFunc(strs)\n                print('get func by variable')\n            end\n        \";\n\n    void Start () \n    {\n        new LuaResLoader();\n        LuaState lua = new LuaState();\n        lua.Start();\n        lua[\"Objs2Spawn\"] = 5;\n        lua.DoString(script);\n\n        //通过LuaState访问\n        Debugger.Log(\"Read var from lua: {0}\", lua[\"var2read\"]);\n        Debugger.Log(\"Read table var from lua: {0}\", lua[\"varTable.default\"]);  //LuaState 拆串式table\n\n        LuaFunction func = lua[\"TestFunc\"] as LuaFunction;\n        func.Call();\n        func.Dispose();\n\n        //cache成LuaTable进行访问\n        LuaTable table = lua.GetTable(\"varTable\");\n        Debugger.Log(\"Read varTable from lua, default: {0} name: {1}\", table[\"default\"], table[\"map.name\"]);\n        table[\"map.name\"] = \"new\";  //table 字符串只能是key\n        Debugger.Log(\"Modify varTable name: {0}\", table[\"map.name\"]);\n\n        table.AddTable(\"newmap\");\n        LuaTable table1 = (LuaTable)table[\"newmap\"];\n        table1[\"name\"] = \"table1\";\n        Debugger.Log(\"varTable.newmap name: {0}\", table1[\"name\"]);\n        table1.Dispose();\n\n        table1 = table.GetMetaTable();\n\n        if (table1 != null)\n        {\n            Debugger.Log(\"varTable metatable name: {0}\", table1[\"name\"]);\n        }\n\n        object[] list = table.ToArray();\n\n        for (int i = 0; i < list.Length; i++)\n        {\n            Debugger.Log(\"varTable[{0}], is {1}\", i, list[i]);\n        }\n\n        table.Dispose();                        \n        lua.CheckTop();\n        lua.Dispose();\n    }\n``` \n* luaState[\"Objs2Spawn\"] LuaState通过重载this操作符，访问lua _G表中的变量Objs2Spawn <br>\n* LuaState.GetTable 从lua中获取一个lua table, 可以串式访问比如lua.GetTable(\"varTable.map.name\") 等于 varTable->map->name<br>\n* LuaTable 支持this操作符，但此this不支持串式访问。比如table[\"map.name\"] \"map.name\" 只是一个key，不是table->map->name <br>\n* LuaTable.GetMetaTable() 可以获取当前table的metatable <br>\n* LuaTable.ToArray() 获取数组表中的所有对象存入到object[]表中 <br>\n* LuaTable.AddTable(name) 在当前的table表中添加一个名字为name的表 <br>\n* LuaTable.GetTable(key) 获取t[key]值到c#, 类似于 lua_gettable <br>\n* LuaTable.SetTable(key, value) 等价于t[k] = v的操作, 类似于lua_settable <br>\n* LuaTable.RawGet(key) 获取t[key]值到c#, 类似于 lua_rawget <br>\n* LuaTable.RawSet(key, value) 等价于t[k] = v的操作, 类似于lua_rawset <br>\n\n## 例子5 协同一\n展示了如何使用lua协同, lua 代码如下：\n``` lua\n        function fib(n)\n            local a, b = 0, 1\n            while n > 0 do\n                a, b = b, a + b\n                n = n - 1\n            end\n\n            return a\n        end\n\n        function CoFunc()\n            print('Coroutine started')    \n            for i = 1, 10, 1 do\n                print(fib(i))                    \n                coroutine.wait(0.1)                     \n            end \n            print(\"current frameCount: \"..Time.frameCount)\n            coroutine.step()\n            print(\"yield frameCount: \"..Time.frameCount)\n\n            local www = UnityEngine.WWW(\"http://www.baidu.com\")\n            coroutine.www(www)\n            local s = tolua.tolstring(www.bytes)\n            print(s:sub(1, 128))\n            print('Coroutine ended')\n        end\n\n        function TestCortinue() \n            coroutine.start(CoFunc)\n        end\n\n        local coDelay = nil\n\n        function Delay()\n            local c = 1\n\n            while true do\n                coroutine.wait(1) \n                print(\"Count: \"..c)\n                c = c + 1\n            end\n        end\n\n        function StartDelay()\n            coDelay = coroutine.start(Delay)\n        end\n\n        function StopDelay()\n            coroutine.stop(coDelay)\n        end\n```\nc#代码如下:\n``` csharp\n        new LuaResLoader();\n        lua  = new LuaState();\n        lua.Start();\n        LuaBinder.Bind(lua);\n        DelegateFactory.Init();         \n        looper = gameObject.AddComponent<LuaLooper>();\n        looper.luaState = lua;\n\n        lua.DoString(luaFile.text, \"TestLuaCoroutine.lua\");\n        LuaFunction f = lua.GetFunction(\"TestCortinue\");\n        f.Call();\n        f.Dispose();\n        f = null;  \n```         \n* 必须启动LuaLooper驱动协同，这里将一个lua的半双工协同装换为类似unity的全双工协同 <br>\n* fib函数负责计算一个斐那波契n  <br>\n* coroutine.start 启动一个lua协同  <br>\n* coroutine.wait 协同中等待一段时间，单位:秒  <br>\n* coroutine.step 协同中等待一帧.  <br>\n* coroutine.www 等待一个WWW完成. <br>\n* tolua.tolstring 转换byte数组为lua字符串缓冲 <br>\n* coroutine.stop 停止一个正在lua将要执行的协同 <br>"
  },
  {
    "path": "Assets/ToLua/Examples/README.md.meta",
    "content": "fileFormatVersion: 2\nguid: 9efe91d34eaff5a4ab3530e47ea50385\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/Protol/common_pb.lua.bytes",
    "content": "--Generated By protoc-gen-lua Do not Edit\nlocal protobuf = require \"protobuf.protobuf\"\nmodule('Protol.common_pb')\n\nHEADER = protobuf.Descriptor();\nHEADER_CMD_FIELD = protobuf.FieldDescriptor();\nHEADER_SEQ_FIELD = protobuf.FieldDescriptor();\n\nHEADER_CMD_FIELD.name = \"cmd\"\nHEADER_CMD_FIELD.full_name = \".Header.cmd\"\nHEADER_CMD_FIELD.number = 1\nHEADER_CMD_FIELD.index = 0\nHEADER_CMD_FIELD.label = 2\nHEADER_CMD_FIELD.has_default_value = false\nHEADER_CMD_FIELD.default_value = 0\nHEADER_CMD_FIELD.type = 5\nHEADER_CMD_FIELD.cpp_type = 1\n\nHEADER_SEQ_FIELD.name = \"seq\"\nHEADER_SEQ_FIELD.full_name = \".Header.seq\"\nHEADER_SEQ_FIELD.number = 2\nHEADER_SEQ_FIELD.index = 1\nHEADER_SEQ_FIELD.label = 2\nHEADER_SEQ_FIELD.has_default_value = false\nHEADER_SEQ_FIELD.default_value = 0\nHEADER_SEQ_FIELD.type = 5\nHEADER_SEQ_FIELD.cpp_type = 1\n\nHEADER.name = \"Header\"\nHEADER.full_name = \".Header\"\nHEADER.nested_types = {}\nHEADER.enum_types = {}\nHEADER.fields = {HEADER_CMD_FIELD, HEADER_SEQ_FIELD}\nHEADER.is_extendable = false\nHEADER.extensions = {}\n\nHeader = protobuf.Message(HEADER)\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/Protol/common_pb.lua.bytes.meta",
    "content": "fileFormatVersion: 2\nguid: dae780f9dbb4a634bbc8605c0cd7bd13\ntimeCreated: 1498123941\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/Protol/person_pb.lua.bytes",
    "content": "--Generated By protoc-gen-lua Do not Edit\nlocal protobuf = require \"protobuf.protobuf\"\nlocal common_pb = require(\"Protol.common_pb\")\nmodule('Protol.person_pb')\n\nPERSON = protobuf.Descriptor();\nPERSON_HEADER_FIELD = protobuf.FieldDescriptor();\nPERSON_ID_FIELD = protobuf.FieldDescriptor();\nPERSON_NAME_FIELD = protobuf.FieldDescriptor();\nPERSON_AGE_FIELD = protobuf.FieldDescriptor();\nPERSON_EMAIL_FIELD = protobuf.FieldDescriptor();\nPERSON_ARRAY_FIELD = protobuf.FieldDescriptor();\nPHONE = protobuf.Descriptor();\nPHONE_PHONE_TYPE = protobuf.EnumDescriptor();\nPHONE_PHONE_TYPE_MOBILE_ENUM = protobuf.EnumValueDescriptor();\nPHONE_PHONE_TYPE_HOME_ENUM = protobuf.EnumValueDescriptor();\nPHONE_NUM_FIELD = protobuf.FieldDescriptor();\nPHONE_TYPE_FIELD = protobuf.FieldDescriptor();\nPHONE_PHONES_FIELD = protobuf.FieldDescriptor();\n\nPERSON_HEADER_FIELD.name = \"header\"\nPERSON_HEADER_FIELD.full_name = \".Person.header\"\nPERSON_HEADER_FIELD.number = 1\nPERSON_HEADER_FIELD.index = 0\nPERSON_HEADER_FIELD.label = 2\nPERSON_HEADER_FIELD.has_default_value = false\nPERSON_HEADER_FIELD.default_value = nil\nPERSON_HEADER_FIELD.message_type = common_pb.HEADER\nPERSON_HEADER_FIELD.type = 11\nPERSON_HEADER_FIELD.cpp_type = 10\n\nPERSON_ID_FIELD.name = \"id\"\nPERSON_ID_FIELD.full_name = \".Person.id\"\nPERSON_ID_FIELD.number = 2\nPERSON_ID_FIELD.index = 1\nPERSON_ID_FIELD.label = 2\nPERSON_ID_FIELD.has_default_value = false\nPERSON_ID_FIELD.default_value = 0\nPERSON_ID_FIELD.type = 3\nPERSON_ID_FIELD.cpp_type = 2\n\nPERSON_NAME_FIELD.name = \"name\"\nPERSON_NAME_FIELD.full_name = \".Person.name\"\nPERSON_NAME_FIELD.number = 3\nPERSON_NAME_FIELD.index = 2\nPERSON_NAME_FIELD.label = 2\nPERSON_NAME_FIELD.has_default_value = false\nPERSON_NAME_FIELD.default_value = \"\"\nPERSON_NAME_FIELD.type = 9\nPERSON_NAME_FIELD.cpp_type = 9\n\nPERSON_AGE_FIELD.name = \"age\"\nPERSON_AGE_FIELD.full_name = \".Person.age\"\nPERSON_AGE_FIELD.number = 4\nPERSON_AGE_FIELD.index = 3\nPERSON_AGE_FIELD.label = 1\nPERSON_AGE_FIELD.has_default_value = true\nPERSON_AGE_FIELD.default_value = 18\nPERSON_AGE_FIELD.type = 5\nPERSON_AGE_FIELD.cpp_type = 1\n\nPERSON_EMAIL_FIELD.name = \"email\"\nPERSON_EMAIL_FIELD.full_name = \".Person.email\"\nPERSON_EMAIL_FIELD.number = 5\nPERSON_EMAIL_FIELD.index = 4\nPERSON_EMAIL_FIELD.label = 1\nPERSON_EMAIL_FIELD.has_default_value = true\nPERSON_EMAIL_FIELD.default_value = \"topameng@qq.com\"\nPERSON_EMAIL_FIELD.type = 9\nPERSON_EMAIL_FIELD.cpp_type = 9\n\nPERSON_ARRAY_FIELD.name = \"array\"\nPERSON_ARRAY_FIELD.full_name = \".Person.array\"\nPERSON_ARRAY_FIELD.number = 6\nPERSON_ARRAY_FIELD.index = 5\nPERSON_ARRAY_FIELD.label = 3\nPERSON_ARRAY_FIELD.has_default_value = false\nPERSON_ARRAY_FIELD.default_value = {}\nPERSON_ARRAY_FIELD.type = 5\nPERSON_ARRAY_FIELD.cpp_type = 1\n\nPERSON.name = \"Person\"\nPERSON.full_name = \".Person\"\nPERSON.nested_types = {}\nPERSON.enum_types = {}\nPERSON.fields = {PERSON_HEADER_FIELD, PERSON_ID_FIELD, PERSON_NAME_FIELD, PERSON_AGE_FIELD, PERSON_EMAIL_FIELD, PERSON_ARRAY_FIELD}\nPERSON.is_extendable = true\nPERSON.extensions = {}\nPHONE_PHONE_TYPE_MOBILE_ENUM.name = \"MOBILE\"\nPHONE_PHONE_TYPE_MOBILE_ENUM.index = 0\nPHONE_PHONE_TYPE_MOBILE_ENUM.number = 1\nPHONE_PHONE_TYPE_HOME_ENUM.name = \"HOME\"\nPHONE_PHONE_TYPE_HOME_ENUM.index = 1\nPHONE_PHONE_TYPE_HOME_ENUM.number = 2\nPHONE_PHONE_TYPE.name = \"PHONE_TYPE\"\nPHONE_PHONE_TYPE.full_name = \".Phone.PHONE_TYPE\"\nPHONE_PHONE_TYPE.values = {PHONE_PHONE_TYPE_MOBILE_ENUM,PHONE_PHONE_TYPE_HOME_ENUM}\nPHONE_NUM_FIELD.name = \"num\"\nPHONE_NUM_FIELD.full_name = \".Phone.num\"\nPHONE_NUM_FIELD.number = 1\nPHONE_NUM_FIELD.index = 0\nPHONE_NUM_FIELD.label = 1\nPHONE_NUM_FIELD.has_default_value = false\nPHONE_NUM_FIELD.default_value = \"\"\nPHONE_NUM_FIELD.type = 9\nPHONE_NUM_FIELD.cpp_type = 9\n\nPHONE_TYPE_FIELD.name = \"type\"\nPHONE_TYPE_FIELD.full_name = \".Phone.type\"\nPHONE_TYPE_FIELD.number = 2\nPHONE_TYPE_FIELD.index = 1\nPHONE_TYPE_FIELD.label = 1\nPHONE_TYPE_FIELD.has_default_value = false\nPHONE_TYPE_FIELD.default_value = nil\nPHONE_TYPE_FIELD.enum_type = PHONE_PHONE_TYPE\nPHONE_TYPE_FIELD.type = 14\nPHONE_TYPE_FIELD.cpp_type = 8\n\nPHONE_PHONES_FIELD.name = \"phones\"\nPHONE_PHONES_FIELD.full_name = \".Phone.phones\"\nPHONE_PHONES_FIELD.number = 10\nPHONE_PHONES_FIELD.index = 0\nPHONE_PHONES_FIELD.label = 3\nPHONE_PHONES_FIELD.has_default_value = false\nPHONE_PHONES_FIELD.default_value = {}\nPHONE_PHONES_FIELD.message_type = PHONE\nPHONE_PHONES_FIELD.type = 11\nPHONE_PHONES_FIELD.cpp_type = 10\n\nPHONE.name = \"Phone\"\nPHONE.full_name = \".Phone\"\nPHONE.nested_types = {}\nPHONE.enum_types = {PHONE_PHONE_TYPE}\nPHONE.fields = {PHONE_NUM_FIELD, PHONE_TYPE_FIELD}\nPHONE.is_extendable = false\nPHONE.extensions = {PHONE_PHONES_FIELD}\n\nPerson = protobuf.Message(PERSON)\nPhone = protobuf.Message(PHONE)\n\nPerson.RegisterExtension(PHONE_PHONES_FIELD)\n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/Protol/person_pb.lua.bytes.meta",
    "content": "fileFormatVersion: 2\nguid: 9a5684e0e56583c43b809876b457c953\ntimeCreated: 1498113766\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/Protol.meta",
    "content": "fileFormatVersion: 2\nguid: 0882b1dfb9d5f9e408ec017206a4946a\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/TestErrorStack.lua.bytes",
    "content": "function Show()\n    error('this is error')                \nend\n\nfunction ShowStack(go)\n    TestStack.Test1(go)                        \nend      \n\nfunction Instantiate(obj)\n    local go = UnityEngine.Object.Instantiate(obj)\n\tprint(go.name)\nend\n\nfunction TestRay(ray)                \n    return Vector3.zero\nend\n\nfunction PushLuaError()\n    TestStack.PushLuaError()      \t\nend\n\nfunction Test3()\n    TestStack.Test3()          \nend\n\nfunction Test4()\n    TestStack.Test4()          \nend\n\nfunction Test5()\n    TestStack.Test5()          \nend\n\nfunction SendMsgError(go)\n\tgo:SendMessage(\"OnSendMsg\");\nend\n\nfunction resume(co, ...)\n    local r, msg = nil\n    local func = function(...)\n         r, msg = coroutine.resume(co, ...)\n        \n        if not r then\n            print('xxxxxxxxxxxxxxxxxxxxxx')\n            error(msg)\n        end\n    end\n\n    pcall(func, ...)\n    return r, msg\nend\n\nfunction Test6()\n    print('--------------------------')                \n    --TestStack.Test6()                \n    local co = coroutine.create(function()  coroutine.yield() print('hahahahaha')  TestStack.Test6(go) end)                                                                                        \n    coroutine.resume(co)                \n    local r, msg = coroutine.resume(co)                \n    print('go error')\n    print(msg)\n    print('--------------------------')            \nend     \n\nfunction Test8()\n\tTestArgError('123') \nend\n\n_event =\n{\n\tname = 'event'\n}\n\n_event.__index = function(t, k)\n\treturn rawget(_event, k)\nend\n\nsetmetatable(_event, _event)\n\nfunction _event:Add(func, obj)\n\tprint('xxxxxxxxxxxxxxxxxxxxxxxxxx')\nend\n\n_event.__call = function()\n\nend\n\ntestev = {}            \nsetmetatable(testev, _event)\n\nfunction TestCo(...)\n\tlocal name = TestTableInCo(...)\n\tprint(\"table.name is: \"..name)\nend\n\nfunction TestCoTable()\n\tlocal co = coroutine.create(TestCo)\n\tlocal r, msg = coroutine.resume(co, testev)\n\n\tif not r then\n\t\tprint(\"TestCoTable: \"..msg)\n\tend    \nend"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/TestErrorStack.lua.bytes.meta",
    "content": "fileFormatVersion: 2\nguid: a540e20118516b1449b2bb6293d1030a\nTextScriptImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/TestLoader.lua.bytes",
    "content": "print(\"This is a script from a utf8 file\")\nprint(\"tolua: 你好! こんにちは! 안녕하세요!\")\n\nfunction Test()\n\tprint(\"this is lua file load by Resource.Load\")\nend"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/TestLoader.lua.bytes.meta",
    "content": "fileFormatVersion: 2\nguid: d249a195df84a8e448b95867fdc844df\nTextScriptImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/TestLuaCoroutine.lua.bytes",
    "content": "function fib(n)\n    local a, b = 0, 1\n    while n > 0 do\n        a, b = b, a + b\n        n = n - 1\n    end\n\n    return a\nend\n\nfunction CoFunc()\n    print('Coroutine started')    \n    for i = 0, 10, 1 do\n        print(fib(i))                    \n        coroutine.wait(0.1)\t\t\t\t\t\t\n    end\t\n\tprint(\"current frameCount: \"..Time.frameCount)\n\tcoroutine.step()\n\tprint(\"yield frameCount: \"..Time.frameCount)\n\n\tlocal www = UnityEngine.WWW(\"http://www.baidu.com\")\n\tcoroutine.www(www)\n\tlocal s = tolua.tolstring(www.bytes)\n\tprint(s:sub(1, 128))\n    print('Coroutine ended')\nend\n\nfunction TestCortinue()\t\n    coroutine.start(CoFunc)\nend\n\nlocal coDelay = nil\n\nfunction Delay()\n\tlocal c = 1\n\n\twhile true do\n\t\tcoroutine.wait(1) \n\t\tprint(\"Count: \"..c)\n\t\tc = c + 1\n\tend\nend\n\nfunction StartDelay()\n\tcoDelay = coroutine.start(Delay)\nend\n\nfunction StopDelay()\n\tcoroutine.stop(coDelay)\nend\n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/TestLuaCoroutine.lua.bytes.meta",
    "content": "fileFormatVersion: 2\nguid: 3e90f8f033d17114297577d8cde2677e\nTextScriptImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/TestPerf.lua.bytes",
    "content": "local Vector3 = Vector3\nlocal Quaternion = Quaternion\nlocal Normalize = Vector3.Normalize\n--local verbo = require(\"jit.v\")\n--verbo.start()\n\nfunction Test1(transform)\t\n\tlocal one = Vector3.one\n\tlocal t = os.clock()\n\t\n\tfor i = 1,200000 do\n\t\ttransform.position = transform.position\n\tend\n\t\n\tt = os.clock() - t\n\tprint(\"Transform.position lua cost time: \", t)\t\nend\n\nfunction Test2(transform)\t\t\n\tlocal up = Vector3.up\n\tlocal t = os.clock()\n\n\tfor i = 1,200000 do\n\t\ttransform:Rotate(up, 1)\t\n\tend\n\t\n\tt = os.clock() - t\n\tprint(\"Transform.Rotate lua cost time: \", t)\t\nend\n\nfunction Test3()\t\t\n\tlocal t = os.clock()\n\tlocal New = Vector3.New\n\t\n\tfor i = 1, 200000 do\n\t\tlocal v = New(i, i, i)\t\t\n\tend\n\t\t\n\tt = os.clock() - t\n\tprint(\"Vector3.New lua cost time: \", t)\t\nend\n\n--会存在大量gc操作\nfunction Test4()\t\n\tlocal GameObject = UnityEngine.GameObject\n\tlocal t = os.clock()\t\n\tlocal go = GameObject.New()\n\tlocal node = go.transform\n\n\tfor i = 1,100000 do\t\t\t\t\n\t\t--GameObject.New()\n\t\tgo = node.gameObject\n\tend\n\t\n\tt = os.clock() - t\n\tprint(\"GameObject.New lua cost time: \", t)\t\nend\n\nfunction Test5()\t\t\n\tlocal t = os.clock()\n\tlocal GameObject = UnityEngine.GameObject\n\tlocal SkinnedMeshRenderer = UnityEngine.SkinnedMeshRenderer\n\tlocal tp = typeof(SkinnedMeshRenderer)\n\n\tfor i = 1,20000 do\t\t\t\t\n\t\tlocal go = GameObject.New()\n\t\tgo:AddComponent(tp)\n    \tlocal c = go:GetComponent(tp)\n    \tc.castShadows=false\n    \tc.receiveShadows=false\n\tend\n\t\t\n\tprint(\"Test5 lua cost time: \", os.clock() - t)\t\nend\n\nfunction Test6()\t\n\tlocal t = os.clock()\n\t\n\tfor i = 1,200000 do\t\t\n\t\tlocal t = Input.GetTouch(0)\t\t\n\t\tlocal p = Input.mousePosition\n\t\t--Physics.RayCast\n\tend\n\t\t\n\tprint(\"lua cost time: \", os.clock() - t)\t\nend\n\nfunction Test7()\t\t\n\tlocal Vector3 = Vector3\t\n\tlocal t = os.clock()\n\t\t\n\tfor i = 1, 200000 do\n\t\tlocal v = Vector3.New(i,i,i)\n\t\tVector3.Normalize(v)\n\tend\n\t\t\n\tprint(\"lua Vector3 New Normalize cost time: \", os.clock() - t)\t\nend\n\nfunction Test8()\t\t\n\tlocal Quaternion = Quaternion\n\tlocal t = os.clock()\n\t\n\tfor i=1,200000 do\n\t\tlocal q1 = Quaternion.Euler(i, i, i)\t\t\n\t\tlocal q2 = Quaternion.Euler(i * 2, i * 2, i * 2)\n\t\tQuaternion.Slerp(Quaternion.identity, q1, 0.5)\t\t\n\tend\n\t\t\n\tprint(\"Quaternion Euler Slerp const: \", os.clock() - t)\t\t\nend\n\nfunction Test9()\t\n\tlocal total = 0\n\tlocal t = os.clock()\n\n\tfor i = 0, 1000000 do\n\t\ttotal = total + i - (i/2) * (i + 3) / (i + 5)\n\tend\n\n\tprint(\"math cal cost: \", os.clock() - t)\t\t\nend\n\nfunction TestTable()\t\n\tlocal array = {}\n\n\tfor i = 1, 1024 do\n\t\tarray[i] = i\n\tend\n\n\tlocal total = 0\n\tlocal t = os.clock()\n\t\t\n\tfor j = 1, 100000 do\n\t\tfor i = 1, 1024 do\n\t\t\ttotal = total + array[i]\n\t\tend\t\t\t\n\tend\n\t\t\n\tprint(\"Array cost time: \", os.clock() - t)\t\nend\n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/TestPerf.lua.bytes.meta",
    "content": "fileFormatVersion: 2\nguid: 07657567fb0a4fe439b7e52f48d787e1\nTextScriptImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/ToLuaInjectionTestInjector.lua.bytes",
    "content": "local ToLuaInjectionTestInjector = {}\n\n--ToLuaInjectionTestInjector[\".ctor\"] = function()\n\t--请注意ToLuaInjection.cs中的injectIgnoring字段已经默认过滤掉了Constructor，如果要测试构造函数的注入，请去掉InjectFilter.IgnoreConstructor这个过滤项\n\t-- Only After Does Matter\n\t--return function(self)\n\t--\tprint(\"Lua Inject Constructor\")\n\t--end, LuaInterface.InjectType.After\n\t-------------------------------------------------------\n\t--return function(self)\n\t--\tprint(\"Lua Inject Constructor\")\n\t--end, LuaInterface.InjectType.Before\n\t-------------------------------------------------------\n--end\n\n--ToLuaInjectionTestInjector[\".ctor_bool\"] = function()\n\t--请注意ToLuaInjection.cs中的injectIgnoring字段已经默认过滤掉了Constructor，如果要测试构造函数的注入，请去掉InjectFilter.IgnoreConstructor这个过滤项\n\t-- Only After Does Matter\n\t--return function(self, state)\n\t--\tprint(\"Lua Inject Constructor_bool \" .. tostring(state))\n\t--end, LuaInterface.InjectType.After\n--end\n\nToLuaInjectionTestInjector.set_PropertyTest = function()\n\treturn function (self, value)\n\t\tprint(\"Lua Inject Property set :\" .. value)\n\tend, LuaInterface.InjectType.After\n\t-------------------------------------------------------\n\t--return function (self, value)\n\t--\tprint(\"Lua Inject Property set :\")\n\t--\treturn {3}\n\t--end, LuaInterface.InjectType.Replace\n\t-------------------------------------------------------\nend\n\nToLuaInjectionTestInjector.get_PropertyTest = function()\n\treturn function (self)\n\t\tprint(\"Lua Inject Property get :\")\n\tend, LuaInterface.InjectType.After\n\t-------------------------------------------------------\n\t--return function (self)\n\t--\tprint(\"Lua Inject Property get :\")\n\t--end, LuaInterface.InjectType.Before\n\t-------------------------------------------------------\n\t--return function (self)\n\t--\tprint(\"Lua Inject Property get :\")\n\t--\treturn 2\n\t--end, LuaInterface.InjectType.Replace\n\t-------------------------------------------------------\nend\n\nToLuaInjectionTestInjector.TestRef = function()\n\t--return function (self, count)\n\t--\tprint(\"Lua Inject TestRef \")\n\t--\tcount = 10\n\t--\treturn { count , 3}\n\t--end, LuaInterface.InjectType.After\n\t-------------------------------------------------------\n\t--return function (self, count)\n\t--\tprint(\"Lua Inject TestRef \")\n\t--\tcount = 10\n\t--\treturn { count , 3}\n\t--end, LuaInterface.InjectType.ReplaceWithPreInvokeBase\n\t-------------------------------------------------------\n\treturn function (self, count)\n\t\tprint(\"Lua Inject TestRef \")\n\t\tcount = 10\n\t\treturn { count , 3}\n\tend, LuaInterface.InjectType.ReplaceWithPostInvokeBase\n\t-------------------------------------------------------\n\t--return function (self, count)\n\t--\tprint(\"Lua Inject TestRef \")\n\t--\tcount = 10\n\t--\treturn { count , 3}\n\t--end, LuaInterface.InjectType.Replace\n\t-------------------------------------------------------\n\t--return function (self, count)\n\t--\tprint(\"Lua Inject TestRef \")\n\t--\tcount = 10\n\t--\treturn { count , 3}\n\t--end, LuaInterface.InjectType.Before\n\t-------------------------------------------------------\nend\n\nToLuaInjectionTestInjector[\"TestOverload-int-bool\"] = function()\n\treturn function (self, count, state)\n\t\tprint(\"Lua Inject TestOverload-int-bool \" .. tostring(state))\n\tend, LuaInterface.InjectType.After\nend\n\nToLuaInjectionTestInjector[\"TestOverload-int-bool&\"] = function()\n\t--return function (self, param1, param2)\n\t--\tprint(\"Lua Inject TestOverload-int-bool& \")\n\t--\treturn {false}\n\t--end, LuaInterface.InjectType.After\n\t-------------------------------------------------------\n\t--return function (self, param1, param2)\n\t--\tprint(\"Lua Inject TestOverload-int-bool& \")\n\t--\treturn {false}\n\t--end, LuaInterface.InjectType.Before\n\t-------------------------------------------------------\n\treturn function (self, param1, param2)\n\t\tprint(\"Lua Inject TestOverload-int-bool& \")\n\t\treturn {false}\n\tend, LuaInterface.InjectType.Replace\n\t-------------------------------------------------------\nend\n\nToLuaInjectionTestInjector[\"TestOverload-bool-int\"] = function()\n\treturn function (self, param1, param2)\n\t\tprint(\"Lua Inject TestOverload-bool-int \" .. param2)\n\tend, LuaInterface.InjectType.After\nend\n\nToLuaInjectionTestInjector.TestCoroutine = function()\n\treturn function (self, delay, coroutineState)\n\t\tprint(\"Lua Inject TestCoroutine \" .. coroutineState)\n\tend, LuaInterface.InjectType.After\n\t-------------------------------------------------------\n\t--return function (self, delay)\n\t--\treturn WrapLuaCoroutine(function()\n\t--\t\tprint(\"Lua Inject TestCoroutine Pulse\" .. delay)\n\t--\t\treturn false\n\t--\tend)\n\t--end, LuaInterface.InjectType.Replace\n\t-------------------------------------------------------\n\t--return function (self, delay)\n\t--\tlocal state = true\n\t--\tlocal cor\n\t--\tlocal function StartLuaCoroutine()\n\t--\t\tif cor == nil then\n\t--\t\t\tcor = coroutine.start(function()\n\t--\t\t\t\tprint(\"Lua Coroutine Before\")\n\t--\t\t\t\tcoroutine.wait(delay)\n\t--\t\t\t\tstate = false\n\t--\t\t\t\tprint(\"Lua Coroutine After\")\n\t--\t\t\tend)\n\t--\t\tend\n\t--\tend\n\t--\n\t--\treturn WrapLuaCoroutine(function()\n\t--\t\tStartLuaCoroutine()\n\t--\t\treturn state\n\t--\tend)\n\t--end, LuaInterface.InjectType.Replace\n\t-------------------------------------------------------\nend\n\n--InjectByName(\"ToLuaInjectionTest\", ToLuaInjectionTestInjector)\nInjectByModule(ToLuaInjectionTest, ToLuaInjectionTestInjector)"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua/ToLuaInjectionTestInjector.lua.bytes.meta",
    "content": "fileFormatVersion: 2\nguid: 4d4ade31977a9ce4f92428e0889cee1d\ntimeCreated: 1536241531\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/Lua.meta",
    "content": "fileFormatVersion: 2\nguid: d26bf1a8a6d42954eb332fd9957140d1\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/jsonexample.json",
    "content": "{\n    \"glossary\": {\n        \"title\": \"example glossary\",\n                \"GlossDiv\": {\n            \"title\": \"S\",\n                        \"GlossList\": {\n                \"GlossEntry\": {\n                    \"ID\": \"SGML\",\n                                        \"SortAs\": \"SGML\",\n                                        \"GlossTerm\": \"Standard Generalized Mark up Language\",\n                                        \"Acronym\": \"SGML\",\n                                        \"Abbrev\": \"ISO 8879:1986\",\n                                        \"GlossDef\": {\n                        \"para\": \"A meta-markup language, used to create markup languages such as DocBook.\",\n                                                \"GlossSeeAlso\": [\"GML\", \"XML\"]\n                    },\n                                        \"GlossSee\": \"markup\"\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources/jsonexample.json.meta",
    "content": "fileFormatVersion: 2\nguid: 7d7edaf98b78bd84297bb888bf41ed02\nTextScriptImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/Resources.meta",
    "content": "fileFormatVersion: 2\nguid: cd85633be4068ee4b8d8f4744a4a9386\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestInstantiate.cs",
    "content": "﻿using UnityEngine;\nusing System;\nusing LuaInterface;\n\npublic class TestInstantiate : MonoBehaviour \n{\n    void Awake()\n    {\n        LuaState state = LuaState.Get(IntPtr.Zero);\n\n        try\n        {\n            LuaFunction func = state.GetFunction(\"Show\");\n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n            func = null;\n        }\n        catch (Exception e)\n        {            \n            state.ThrowLuaException(e);\n        }\n    }\n\n    void Start()\n    {\n        Debugger.Log(\"start\");\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestInstantiate.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b3f31488b17b6394f8cc6e000f1001ab\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestInstantiate.prefab.meta",
    "content": "fileFormatVersion: 2\nguid: ec8a2f7e4eaf1c64e8393014e602047c\nNativeFormatImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestInstantiate2.cs",
    "content": "﻿using UnityEngine;\nusing System;\nusing LuaInterface;\n\npublic class TestInstantiate2 : MonoBehaviour \n{\n    void Awake()\n    {\n        try\n        {\n            throw new Exception(\"Instantiate exception 2\");\n        }\n        catch (Exception e)\n        {\n            LuaState state = LuaState.Get(IntPtr.Zero);\n            state.ThrowLuaException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestInstantiate2.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 901668bc322ed714d9c7c74febc9bd8b\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestInstantiate2.prefab.meta",
    "content": "fileFormatVersion: 2\nguid: 0e472cc047eb20841bbb7c64dfeb0d78\nNativeFormatImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestLuaStack.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System;\nusing System.Runtime.InteropServices;\n\n//检测合理报错\npublic class TestLuaStack : MonoBehaviour\n{\n    public GameObject go = null;\n    public GameObject go2 = null;\n    public static LuaFunction show = null;\n    public static LuaFunction testRay = null;\n    public static LuaFunction showStack = null;\n    public static LuaFunction test4 = null;\n\n    private static GameObject testGo = null;\n    private string tips = \"\";\n    public static TestLuaStack Instance = null;    \n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Test1(IntPtr L)\n    {\n        try\n        {                                                    \n            show.BeginPCall();\n            show.PCall();\n            show.EndPCall();\n        }\n        catch (Exception e)\n        {            \n            return LuaDLL.toluaL_exception(L, e);\n        }\n\n        return 0;\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int PushLuaError(IntPtr L)\n    {\n        try\n        {\n            testRay.BeginPCall();\n            testRay.Push(Instance);\n            testRay.PCall();\n            testRay.EndPCall();\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\n        return 0;\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Test3(IntPtr L)\n    {\n        try\n        {\n            testRay.BeginPCall();\n            testRay.PCall();\n            testRay.CheckRay();\n            testRay.EndPCall();\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\n        return 0;\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Test4(IntPtr L)\n    {\n        try\n        {\n            show.BeginPCall();\n            show.PCall();\n            show.EndPCall();\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\n        return 0;\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Test5(IntPtr L)\n    {\n        try\n        {\n            test4.BeginPCall();            \n            test4.PCall();\n            bool ret = test4.CheckBoolean();\n            ret = !ret;\n            test4.EndPCall();\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n\n        return 0;\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int Test6(IntPtr L)\n    {        \n        try\n        {\n            throw new LuaException(\"this a lua exception\");\n        }\n        catch (Exception e)\n        {            \n            return LuaDLL.toluaL_exception(L, e);            \n        }       \n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int TestOutOfBound(IntPtr L)\n    {\n        try\n        {\n            Transform transform = testGo.transform;\n            Transform node = transform.GetChild(20);\n            ToLua.Push(L, node);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }        \n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int TestArgError(IntPtr L)\n    {                \n        try\n        {\n            LuaDLL.luaL_typerror(L, 1, \"number\");\n        }\n        catch (Exception e)\n        {            \n            return LuaDLL.toluaL_exception(L, e);\n        }\n\n        return 0;\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int TestTableInCo(IntPtr L)\n    {\n        try\n        {\n            LuaTable table = ToLua.CheckLuaTable(L, 1);\n            string str = (string)table[\"name\"];\n            ToLua.Push(L, str);            \n            return 1;\n        }\n        catch (Exception e)\n        {            \n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int TestCycle(IntPtr L)\n    {\n        try\n        {\n            LuaState state = LuaState.Get(L);\n            LuaFunction func = state.GetFunction(\"TestCycle\");\n            int c = (int)LuaDLL.luaL_checknumber(L, 1);\n\n            if (c <= 2)\n            {\n                LuaDLL.lua_pushnumber(L, 1);\n            }\n            else\n            {\n                func.BeginPCall();\n                func.Push(c - 1);\n                func.PCall();\n                int n1 = (int)func.CheckNumber();\n                func.EndPCall();\n\n                func.BeginPCall();\n                func.Push(c - 2);\n                func.PCall();\n                int n2 = (int)func.CheckNumber();\n                func.EndPCall();\n\n                LuaDLL.lua_pushnumber(L, n1 + n2);\n            }\n            \n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int TestNull(IntPtr L)\n    {\n        try\n        {\n            GameObject go = (GameObject)ToLua.CheckObject(L, 1, typeof(GameObject));\n            ToLua.Push(L, go.name);\n            return 1;\n        }\n        catch (Exception e)\n        {            \n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int TestAddComponent(IntPtr L)\n    {\n        try\n        {\n            GameObject go = (GameObject)ToLua.CheckObject(L, 1, typeof(GameObject));\n            go.AddComponent<TestInstantiate2>();\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    static void TestMul1()\n    {\n        throw new Exception(\"multi stack error\");\n    }\n\n    static void TestMul0()\n    {\n        TestMul1();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int TestMulStack(IntPtr L)\n    {\n        try\n        {\n            TestMul0();\n            return 0;\n        }\n        catch (Exception e)\n        {\n            //Debugger.Log(\"xxxx\" + e.StackTrace);\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    void OnSendMsg()\n    {\n        try\n        {\n            LuaFunction func = state.GetFunction(\"TestStack.Test6\");\n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n        }\n        catch(Exception e)\n        {\n            state.ThrowLuaException(e);\n        }\n    }\n    \n\n    LuaState state = null;\n    public TextAsset text = null;\n\n    static Action TestDelegate = delegate { };\n\n    void Awake()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\t\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        Instance = this;\n        new LuaResLoader();\n        testGo = gameObject;                \n        state = new LuaState();\n        state.Start();\n        LuaBinder.Bind(state);        \n\n        state.BeginModule(null);\n        state.RegFunction(\"TestArgError\", TestArgError);\n        state.RegFunction(\"TestTableInCo\", TestTableInCo);\n        state.RegFunction(\"TestCycle\", TestCycle);\n        state.RegFunction(\"TestNull\", TestNull);\n        state.RegFunction(\"TestAddComponent\", TestAddComponent);\n        state.RegFunction(\"TestOutOfBound\", TestOutOfBound);\n        state.RegFunction(\"TestMulStack\", TestMulStack);            \n        state.BeginStaticLibs(\"TestStack\");\n        state.RegFunction(\"Test1\", Test1);\n        state.RegFunction(\"PushLuaError\", PushLuaError);\n        state.RegFunction(\"Test3\", Test3);\n        state.RegFunction(\"Test4\", Test4);\n        state.RegFunction(\"Test5\", Test5);\n        state.RegFunction(\"Test6\", Test6);            \n        state.EndStaticLibs();\n        state.EndModule();\n\n        //state.DoFile(\"TestErrorStack.lua\");\n        state.Require(\"TestErrorStack\");\n        show = state.GetFunction(\"Show\");\n        testRay = state.GetFunction(\"TestRay\");\n\n        showStack = state.GetFunction(\"ShowStack\");\n        test4 = state.GetFunction(\"Test4\");\n\n        TestDelegate += TestD1;\n        TestDelegate += TestD2;\n    }\n\n    void Update()\n    {\n        state.CheckTop();\n    }\n\n    void OnApplicationQuit()\n    {\n#if UNITY_5 || UNITY_2017 || UNITY_2018\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n        state.Dispose();\n        state = null;\n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n\n        if (type == LogType.Error || type == LogType.Exception)\n        {\n            tips += stackTrace;\n        }\n    }\n\n    void TestD1()\n    {\n        Debugger.Log(\"delegate 1\");\n        TestDelegate -= TestD2;\n    }\n\n    void TestD2()\n    {\n        Debugger.Log(\"delegate 2\");\n    }\n\n    void OnGUI()\n    {\n        GUI.Label(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 150, 800, 400), tips);\n\n        if (GUI.Button(new Rect(10, 10, 120, 40), \"Error1\"))\n        {\n            tips = \"\";\n            showStack.BeginPCall();\n            showStack.Push(go);\n            showStack.PCall();\n            showStack.EndPCall();\n            showStack.Dispose();\n            showStack = null;\n        }\n        else if (GUI.Button(new Rect(10, 60, 120, 40), \"Instantiate Error\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"Instantiate\");\n            func.BeginPCall();\n            func.Push(go);\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 110, 120, 40), \"Check Error\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"TestRay\");\n            func.BeginPCall();\n            func.PCall();\n            func.CheckRay();        //返回值出错\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 160, 120, 40), \"Push Error\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"TestRay\");\n            func.BeginPCall();\n            func.Push(Instance);\n            func.PCall();            \n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 210, 120, 40), \"LuaPushError\"))\n        {\n            //需要改lua文件让其出错\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"PushLuaError\");\n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 260, 120, 40), \"Check Error\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"Test5\");\n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 310, 120, 40), \"Test Resume\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"Test6\");\n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 360, 120, 40), \"out of bound\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"TestOutOfBound\");\n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 410, 120, 40), \"TestArgError\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"Test8\");\n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 460, 120, 40), \"TestFuncDispose\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"Test8\");\n            func.Dispose();\n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 510, 120, 40), \"SendMessage\"))\n        {\n            tips = \"\";\n            gameObject.SendMessage(\"OnSendMsg\");\n        }\n        else if (GUI.Button(new Rect(10, 560, 120, 40), \"SendMessageInLua\"))\n        {\n            LuaFunction func = state.GetFunction(\"SendMsgError\");\n            func.BeginPCall();\n            func.Push(gameObject);\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(10, 610, 120, 40), \"AddComponent\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"TestAddComponent\");            \n            func.BeginPCall();\n            func.Push(gameObject);\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();            \n        }\n        else if (GUI.Button(new Rect(210, 10, 120, 40), \"TableGetSet\"))\n        {\n            tips = \"\";\n            LuaTable table = state.GetTable(\"testev\");\n            int top = state.LuaGetTop();\n\n            try\n            {\n                state.Push(table);\n                state.LuaGetField(-1, \"Add\");\n                LuaFunction func = state.CheckLuaFunction(-1);                \n\n                if (func != null)\n                {\n                    func.Call();\n                    func.Dispose();\n                }\n\n                state.LuaPop(1);\n                state.Push(123456);\n                state.LuaSetField(-2, \"value\");\n                state.LuaGetField(-1, \"value\");\n                int n = (int)state.LuaCheckNumber(-1);\n                Debugger.Log(\"value is: \" + n);\n\n                state.LuaPop(1);\n\n                state.Push(\"Add\");\n                state.LuaGetTable(-2);\n\n                func = state.CheckLuaFunction(-1);\n\n                if (func != null)\n                {\n                    func.Call();\n                    func.Dispose();\n                }\n\n                state.LuaPop(1);\n\n                state.Push(\"look\");\n                state.Push(456789);                \n                state.LuaSetTable(-3);                \n                                \n                state.LuaGetField(-1, \"look\");\n                n = (int)state.LuaCheckNumber(-1);\n                Debugger.Log(\"look: \" + n);\n            }\n            catch (Exception e)\n            {\n                state.LuaSetTop(top);\n                throw e;\n            }\n                        \n            state.LuaSetTop(top);\n        }\n        else if (GUI.Button(new Rect(210, 60, 120, 40), \"TestTableInCo\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"TestCoTable\");            \n            func.BeginPCall();\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(210, 110, 120, 40), \"Instantiate2 Error\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"Instantiate\");\n            func.BeginPCall();\n            func.Push(go2);\n            func.PCall();\n            func.EndPCall();\n            func.Dispose();\n        }\n        else if (GUI.Button(new Rect(210, 160, 120, 40), \"Instantiate3 Error\"))\n        {\n            tips = \"\";\n            UnityEngine.Object.Instantiate(go2);\n        }\n        else if (GUI.Button(new Rect(210, 210, 120, 40), \"TestCycle\"))\n        {\n            tips = \"\";\n            int n = 20;\n            LuaFunction func = state.GetFunction(\"TestCycle\");\n            func.BeginPCall();\n            func.Push(n);            \n            func.PCall();\n            int c = (int)func.CheckNumber();\n            func.EndPCall();\n\n            Debugger.Log(\"Fib({0}) is {1}\", n, c);\n        }\n        else if (GUI.Button(new Rect(210, 260, 120, 40), \"TestNull\"))\n        {\n            tips = \"\";\n            Action action = ()=>\n            {\n                LuaFunction func = state.GetFunction(\"TestNull\");\n                func.BeginPCall();\n                func.PushObject(null);\n                func.PCall();\n                func.EndPCall();\n            };\n\n            StartCoroutine(TestCo(action));\n        }\n        else if (GUI.Button(new Rect(210, 310, 120, 40), \"TestMulti\"))\n        {\n            tips = \"\";\n            LuaFunction func = state.GetFunction(\"TestMulStack\");\n            func.BeginPCall();\n            func.PushObject(null);\n            func.PCall();\n            func.EndPCall();\n        }\n    }\n\n    IEnumerator TestCo(Action action)\n    {\n        yield return new WaitForSeconds(0.1f);\n        action();\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestLuaStack.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b40a6eeee975862489a712e1a3d79ed1\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack/TestLuaStack.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 706020e5c3f37944995bfe00955fdd39\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestErrorStack.meta",
    "content": "fileFormatVersion: 2\nguid: 00b15eee8aab8d64e844fc53ee7395de\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/BaseTestWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing System.Runtime.InteropServices;\nusing LuaInterface;\n\npublic class BaseTestWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(BaseTest), typeof(System.Object));\n\t\tL.RegFunction(\"TestRef\", TestRef);\n\t\tL.RegFunction(\"New\", _CreateBaseTest);\n\t\tL.RegVar(\"PropertyTest\", get_PropertyTest, set_PropertyTest);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateBaseTest(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 0)\n\t\t\t{\n\t\t\t\tBaseTest obj = new BaseTest();\n\t\t\t\tToLua.PushObject(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: BaseTest.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestRef(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tBaseTest obj = (BaseTest)ToLua.CheckObject<BaseTest>(L, 1);\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint o = obj.TestRef(ref arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\tLuaDLL.lua_pushinteger(L, arg0);\n\t\t\treturn 2;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_PropertyTest(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tBaseTest obj = (BaseTest)o;\n\t\t\tint ret = obj.PropertyTest;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index PropertyTest on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_PropertyTest(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tBaseTest obj = (BaseTest)o;\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tobj.PropertyTest = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index PropertyTest on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/BaseTestWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 823570c1e66fe6e45b87a838ec075e76\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/TestInjection.cs",
    "content": "﻿using UnityEngine;\nusing LuaInterface;\nusing System.Collections;\n\n[LuaInterface.NoToLua]\npublic class TestInjection : MonoBehaviour\n{\n    string tips = \"\";\n    bool m_isMouseDown;\n    int m_fontSize = 28;\n    int m_logFontSize = 0;\n    float scaleThreshold;\n    LuaState luaState = null;\n    Color m_normalColor;\n    GUIStyle m_fontStyle;\n    GUIStyle m_windowStyle;\n    Rect m_windowRect;\n    Vector2 m_scrollViewPos;\n    Vector2 m_distance;\n\n    // Use this for initialization\n    void Start()\n    {\n        InitGUI();\n#if UNITY_5 || UNITY_2017_1_OR_NEWER\n        Application.logMessageReceived += ShowTips;\n#else\n        Application.RegisterLogCallback(ShowTips);\n#endif\n        new LuaResLoader();\n        luaState = new LuaState();\n        luaState.Start();\n        LuaBinder.Bind(luaState);\n        //For InjectByModule\n        //////////////////////////////////////////////////////\n        luaState.BeginModule(null);\n        BaseTestWrap.Register(luaState);\n        ToLuaInjectionTestWrap.Register(luaState);\n        luaState.EndModule();\n        //////////////////////////////////////////////////////\n\n#if ENABLE_LUA_INJECTION\n#if UNITY_EDITOR\n        if (UnityEditor.EditorPrefs.GetInt(Application.dataPath + \"InjectStatus\") == 1)\n        {\n#else\n        if (true)\n        {\n#endif\n            ///此处Require是示例专用，暖更新的lua代码都要放到LuaInjectionBus.lua中统一require\n            luaState.Require(\"ToLuaInjectionTestInjector\");\n            int counter = 0;\n            bool state = true;\n            ToLuaInjectionTest test = new ToLuaInjectionTest(true);\n            test = new ToLuaInjectionTest();\n            StartCoroutine(test.TestCoroutine(0.3f));\n\n            test.TestOverload(1, state);\n            test.TestOverload(1, ref state);\n            Debug.Log(\"TestOverload ref result:\" + state);\n            test.TestOverload(state, 1);\n            int refResult = test.TestRef(ref counter);\n            Debug.Log(string.Format(\"TestRef return result:{0}; ref result:{1}\", refResult, counter));\n\n            Debug.Log(\"Property Get Test:\" + test.PropertyTest);\n            test.PropertyTest = 2;\n            Debug.Log(\"Property Set Test:\" + test.PropertyTest);\n\n            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();\n            sw.Start();\n            for (int i = 0; i < 10000000; ++i)\n            {\n                test.NoInject(true, 1);\n            }\n            sw.Stop();\n            long noInjectMethodCostTime = sw.ElapsedMilliseconds;\n            sw.Reset();\n            sw.Start();\n            for (int i = 0; i < 10000000; ++i)\n            {\n                test.Inject(true, 1);\n            }\n            sw.Stop();\n            Debug.Log(\"time cost ratio:\" + (double)sw.ElapsedMilliseconds / noInjectMethodCostTime);\n        }\n        else\n#endif\n        {\n            Debug.LogError(\"查看是否开启了宏ENABLE_LUA_INJECTION并执行了菜单命令——\\\"Lua=>Inject All\\\"\");\n        }\n    }\n\n    void InitGUI()\n    {\n        m_windowRect.x = 0;\n        m_windowRect.y = 0;\n        m_windowRect.width = Screen.width;\n        m_windowRect.height = Screen.height;\n\n        m_logFontSize = (int)(m_fontSize * Screen.width * Screen.height / (1280 * 720));\n        m_normalColor = Color.white;\n        m_fontStyle = new GUIStyle();\n        m_fontStyle.normal.textColor = m_normalColor;\n        m_fontStyle.fontSize = m_logFontSize;\n\n        //设置窗口颜色\n        m_windowStyle = new GUIStyle();\n        Texture2D windowTexture = new Texture2D(1, 1);\n        windowTexture.SetPixel(0, 0, Color.black);\n        windowTexture.Apply();\n        m_windowStyle.normal.background = windowTexture;\n\n        scaleThreshold = Screen.width / 1100.0f;\n    }\n\n    void OnApplicationQuit()\n    {\n#if UNITY_5 || UNITY_2017_1_OR_NEWER\n        Application.logMessageReceived -= ShowTips;\n#else\n        Application.RegisterLogCallback(null);\n#endif\n        luaState.Dispose();\n        luaState = null;\n    }\n\n    Vector2 MousePoisition { get { return new Vector2(-Input.mousePosition.x, Input.mousePosition.y); } }\n    //鼠标拖拽控制\n    private void MouseDragView(ref Vector2 viewPos)\n    {\n        if (Input.GetMouseButtonDown(0))\n        {\n            m_distance = viewPos - MousePoisition;\n            m_isMouseDown = true;\n        }\n        else if (Input.GetMouseButtonUp(0))\n        {\n            m_isMouseDown = false;\n        }\n\n        if (m_isMouseDown)\n        {\n            viewPos = MousePoisition + m_distance;\n        }\n    }\n\n    /// <summary>\n    /// 非常简陋的一个log窗口，不要用到项目中，仅用来示例\n    /// </summary>\n    /// <param name=\"id\"></param>\n    void LogWindow(int id)\n    {\n        GUILayout.BeginHorizontal();\n        if (GUILayout.Button(\"+\", GUILayout.MinHeight(50 * scaleThreshold)))\n        {\n            m_logFontSize = Mathf.Min(64, ++m_logFontSize);\n            m_fontStyle.fontSize = m_logFontSize;\n        }\n        if (GUILayout.Button(\"-\", GUILayout.MinHeight(50 * scaleThreshold)))\n        {\n            m_logFontSize = Mathf.Max(1, --m_logFontSize);\n            m_fontStyle.fontSize = m_logFontSize;\n        }\n        GUILayout.EndHorizontal();\n\n        m_scrollViewPos = GUILayout.BeginScrollView(m_scrollViewPos, false, false);\n\n        MouseDragView(ref m_scrollViewPos);\n\n        GUILayout.Label(tips, m_fontStyle);\n        GUILayout.Space(2);\n        GUILayout.EndScrollView();\n\n        GUILayout.BeginHorizontal();\n        GUILayout.Label(string.Format(\"Font Size ({0})\", m_logFontSize));\n        GUILayout.EndHorizontal();\n    }\n\n    void OnGUI()\n    {\n        m_windowRect = GUI.Window(0, m_windowRect, LogWindow, \"Log Window\", m_windowStyle);\n    }\n\n    void ShowTips(string msg, string stackTrace, LogType type)\n    {\n        tips += msg;\n        tips += \"\\r\\n\";\n\n        if (type == LogType.Error || type == LogType.Exception)\n        {\n            tips += stackTrace;\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/TestInjection.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f95133dba6f6a1a40936257b1a8b3dae\ntimeCreated: 1515035194\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/TestInjection.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 05dc1e98babb44f47ad2a28a88b76380\ntimeCreated: 1515035207\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/ToLuaInjectionTest.cs",
    "content": "﻿using System.Collections;\nusing UnityEngine;\n\npublic class BaseTest\n{\n    private int propertyTest;\n\n    public virtual int TestRef(ref int count)\n    {\n        Debug.Log(\"CS:Base TestRef\");\n        ++count;\n\n        return 1;\n    }\n\n    public virtual int PropertyTest\n    {\n        get\n        {\n            Debug.Log(\"CS: Base PropertyTestGet\");\n            return propertyTest;\n        }\n        set\n        {\n            Debug.Log(\"CS: Base PropertyTestSet\");\n            propertyTest = value;\n        }\n    }\n}\n\npublic class ToLuaInjectionTest : BaseTest\n{\n    private int propertyTest;\n\n    public ToLuaInjectionTest()\n    {\n        Debug.Log(\"CS:Constructor Test\");\n    }\n\n    public ToLuaInjectionTest(bool state)\n    {\n        Debug.Log(\"CS:Constructor Test \" + state);\n    }\n\n    public override int PropertyTest\n    {\n        get\n        {\n            Debug.Log(\"CS:PropertyTestGet\");\n            return propertyTest;\n        }\n        set\n        {\n            Debug.Log(\"CS:PropertyTestSet\");\n            propertyTest = value;\n        }\n    }\n\n    public override int TestRef(ref int count)\n    {\n        Debug.Log(\"CS:Override TestRef\");\n        ++count;\n\n        return 2;\n    }\n\n    public void TestOverload(int param1, bool param2)\n    {\n        Debug.Log(\"CS:TestOverload\");\n    }\n\n    public void TestOverload(int param1, ref bool param2)\n    {\n        Debug.Log(\"CS:TestOverload\");\n        param2 = !param2;\n    }\n\n    public void TestOverload(bool param1, int param2)\n    {\n        Debug.Log(\"CS:TestOverload\");\n    }\n\n#pragma warning disable 0219\n    [LuaInterface.NoToLua]\n    public void NoInject(bool param1, int param2)\n    {\n        int a = 0;\n        int b = ++a;        \n    }\n\n    public void Inject(bool param1, int param2)\n    {\n        int a = 0;\n        int b = ++a;\n    }\n#pragma warning restore 0219\n\n    public IEnumerator TestCoroutine(float delay)\n    {\n        Debug.Log(\"CS:TestCoroutine Run\");\n        yield return new WaitForSeconds(delay);\n        Debug.Log(\"CS:TestCoroutine End\");\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/ToLuaInjectionTest.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 80e29c43f1cea9d4988c36fd2f6c26c1\ntimeCreated: 1514883665\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/ToLuaInjectionTestWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing System.Runtime.InteropServices;\nusing LuaInterface;\n\npublic class ToLuaInjectionTestWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(ToLuaInjectionTest), typeof(BaseTest));\n\t\tL.RegFunction(\"TestRef\", TestRef);\n\t\tL.RegFunction(\"TestOverload\", TestOverload);\n\t\tL.RegFunction(\"TestCoroutine\", TestCoroutine);\n\t\tL.RegFunction(\"New\", _CreateToLuaInjectionTest);\n        L.RegVar(\"PropertyTest\", get_PropertyTest, set_PropertyTest);\n        L.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateToLuaInjectionTest(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 0)\n\t\t\t{\n\t\t\t\tToLuaInjectionTest obj = new ToLuaInjectionTest();\n\t\t\t\tToLua.PushObject(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1)\n\t\t\t{\n\t\t\t\tbool arg0 = LuaDLL.luaL_checkboolean(L, 1);\n\t\t\t\tToLuaInjectionTest obj = new ToLuaInjectionTest(arg0);\n\t\t\t\tToLua.PushObject(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: ToLuaInjectionTest.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestRef(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject<ToLuaInjectionTest>(L, 1);\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint o = obj.TestRef(ref arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\tLuaDLL.lua_pushinteger(L, arg0);\n\t\t\treturn 2;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestOverload(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 3 && TypeChecker.CheckTypes<bool, int>(L, 2))\n\t\t\t{\n\t\t\t\tToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject<ToLuaInjectionTest>(L, 1);\n\t\t\t\tbool arg0 = LuaDLL.lua_toboolean(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tobj.TestOverload(arg0, arg1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<int, bool>(L, 2))\n\t\t\t{\n\t\t\t\tToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject<ToLuaInjectionTest>(L, 1);\n\t\t\t\tint arg0 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tbool arg1 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tobj.TestOverload(arg0, ref arg1);\n\t\t\t\tLuaDLL.lua_pushboolean(L, arg1);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<int, bool>(L, 2))\n\t\t\t{\n\t\t\t\tToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject<ToLuaInjectionTest>(L, 1);\n\t\t\t\tint arg0 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tbool arg1 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tobj.TestOverload(arg0, arg1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: ToLuaInjectionTest.TestOverload\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestCoroutine(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tToLuaInjectionTest obj = (ToLuaInjectionTest)ToLua.CheckObject<ToLuaInjectionTest>(L, 1);\n\t\t\tfloat arg0 = (float)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tSystem.Collections.IEnumerator o = obj.TestCoroutine(arg0);\n\t\t\tToLua.Push(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_PropertyTest(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tToLuaInjectionTest obj = (ToLuaInjectionTest)o;\n\t\t\tint ret = obj.PropertyTest;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index PropertyTest on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_PropertyTest(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tToLuaInjectionTest obj = (ToLuaInjectionTest)o;\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tobj.PropertyTest = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index PropertyTest on a nil value\");\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection/ToLuaInjectionTestWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 14459b5f9debe5f47b5a300b6f1acfe8\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestInjection.meta",
    "content": "fileFormatVersion: 2\nguid: 38c5ccf43aa1bef4ab5def4faf0a5aba\nfolderAsset: yes\ntimeCreated: 1515035158\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestOverload/TestExportWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class TestExportWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginClass(typeof(TestExport), typeof(System.Object));\n\t\tL.RegFunction(\".geti\", get_Item);\n\t\tL.RegFunction(\"get_Item\", get_Item);\n\t\tL.RegFunction(\".seti\", set_Item);\n\t\tL.RegFunction(\"set_Item\", set_Item);\n\t\tL.RegFunction(\"TestByteBuffer\", TestByteBuffer);\n\t\tL.RegFunction(\"Test\", Test);\n\t\tL.RegFunction(\"TestChar\", TestChar);\n\t\tL.RegFunction(\"Test33\", Test33);\n\t\tL.RegFunction(\"TestGeneric\", TestGeneric);\n\t\tL.RegFunction(\"TestEnum\", TestEnum);\n\t\tL.RegFunction(\"TestCheckParamNumber\", TestCheckParamNumber);\n\t\tL.RegFunction(\"TestCheckParamString\", TestCheckParamString);\n\t\tL.RegFunction(\"TestReflection\", TestReflection);\n\t\tL.RegFunction(\"TestRefGameObject\", TestRefGameObject);\n\t\tL.RegFunction(\"DoClick\", DoClick);\n\t\tL.RegFunction(\"TestNullable\", TestNullable);\n\t\tL.RegFunction(\"New\", _CreateTestExport);\n\t\tL.RegVar(\"this\", _this, null);\n\t\tL.RegFunction(\"__tostring\", ToLua.op_ToString);\n\t\tL.RegVar(\"field\", get_field, set_field);\n\t\tL.RegVar(\"OnClick\", get_OnClick, set_OnClick);\n\t\tL.RegVar(\"OnRefEvent\", get_OnRefEvent, set_OnRefEvent);\n\t\tL.RegVar(\"buffer\", get_buffer, set_buffer);\n\t\tL.RegVar(\"Number\", get_Number, set_Number);\n\t\tL.RegFunction(\"TestBuffer\", TestExport_TestBuffer);\n\t\tL.RegFunction(\"TestRefEvent\", TestExport_TestRefEvent);\n\t\tL.EndClass();\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _CreateTestExport(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 0)\n\t\t\t{\n\t\t\t\tTestExport obj = new TestExport();\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1 && TypeChecker.CheckTypes<UnityEngine.Vector3>(L, 1))\n\t\t\t{\n\t\t\t\tUnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1);\n\t\t\t\tTestExport obj = new TestExport(arg0);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1 && TypeChecker.CheckTypes<UnityEngine.Vector3[]>(L, 1))\n\t\t\t{\n\t\t\t\tUnityEngine.Vector3[] arg0 = ToLua.ToStructArray<UnityEngine.Vector3>(L, 1);\n\t\t\t\tTestExport obj = new TestExport(arg0);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tUnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1);\n\t\t\t\tstring arg1 = ToLua.CheckString(L, 2);\n\t\t\t\tTestExport obj = new TestExport(arg0, arg1);\n\t\t\t\tToLua.PushSealed(L, obj);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to ctor method: TestExport.New\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _get_this(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 2)\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint o = obj[arg0];\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\t\tchar arg0 = (char)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint o = obj[arg0, arg1];\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to operator method: TestExport.this\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _set_this(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 3)\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tobj[arg0] = arg1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\t\tchar arg0 = (char)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tobj[arg0, arg1] = arg2;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to operator method: TestExport.this\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int _this(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tLuaDLL.lua_pushvalue(L, 1);\n\t\t\tLuaDLL.tolua_bindthis(L, _get_this, _set_this);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Item(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1 && TypeChecker.CheckTypes<string>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tint o = TestExport.get_Item(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 1 && TypeChecker.CheckTypes<double>(L, 1))\n\t\t\t{\n\t\t\t\tdouble arg0 = (double)LuaDLL.lua_tonumber(L, 1);\n\t\t\t\tint o = TestExport.get_Item(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2)\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint o = obj[arg0];\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<int, int, int>(L, 1))\n\t\t\t{\n\t\t\t\tint arg0 = (int)LuaDLL.lua_tonumber(L, 1);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = TestExport.get_Item(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<TestExport, char, int>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tchar arg0 = (char)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = obj[arg0, arg1];\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: TestExport.get_Item\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_Item(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tdouble arg0 = (double)LuaDLL.luaL_checknumber(L, 1);\n\t\t\t\tint o = TestExport.set_Item(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3)\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tobj[arg0] = arg1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (count == 4)\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\t\tchar arg0 = (char)LuaDLL.luaL_checknumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.luaL_checknumber(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.luaL_checknumber(L, 4);\n\t\t\t\tobj[arg0, arg1] = arg2;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: TestExport.set_Item\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestByteBuffer(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tTestExport.TestBuffer arg0 = (TestExport.TestBuffer)ToLua.CheckDelegate<TestExport.TestBuffer>(L, 2);\n\t\t\tobj.TestByteBuffer(arg0);\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Test(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\n\t\t\tif (count == 1 && TypeChecker.CheckTypes<TestExport>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tint o = obj.Test();\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<TestExport, LuaInterface.LuaOut<int>>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tint arg0;\n\t\t\t\tint o = obj.Test(out arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\tLuaDLL.lua_pushinteger(L, arg0);\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<TestExport, double>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tdouble arg0 = (double)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<TestExport, string>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tstring arg0 = ToLua.ToString(L, 2);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<string, string>(L, 1))\n\t\t\t{\n\t\t\t\tstring arg0 = ToLua.ToString(L, 1);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 2);\n\t\t\t\tint o = TestExport.Test(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<TestExport, TestExport.Space>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tTestExport.Space arg0 = (TestExport.Space)ToLua.ToObject(L, 2);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<TestExport, bool>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tbool arg0 = LuaDLL.lua_toboolean(L, 2);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<TestExport, int[,]>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tint[,] arg0 = (int[,])ToLua.ToObject(L, 2);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 2 && TypeChecker.CheckTypes<TestExport, object>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<TestExport, string[], bool>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tstring[] arg0 = ToLua.ToStringArray(L, 2);\n\t\t\t\tbool arg1 = LuaDLL.lua_toboolean(L, 3);\n\t\t\t\tint o = obj.Test(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<TestExport, int, int>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tint arg0 = (int)LuaDLL.lua_tonumber(L, 2);\n\t\t\t\tint arg1 = (int)LuaDLL.lua_tonumber(L, 3);\n\t\t\t\tint o = obj.Test(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 3 && TypeChecker.CheckTypes<TestExport, object, string>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 3);\n\t\t\t\tint o = obj.Test(arg0, arg1);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (count == 4 && TypeChecker.CheckTypes<TestExport, object, string, int>(L, 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tobject arg0 = ToLua.ToVarObject(L, 2);\n\t\t\t\tstring arg1 = ToLua.ToString(L, 3);\n\t\t\t\tint arg2 = (int)LuaDLL.lua_tonumber(L, 4);\n\t\t\t\tint o = obj.Test(arg0, arg1, arg2);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<TestExport>(L, 1) && TypeChecker.CheckParamsType<int>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tint[] arg0 = ToLua.ToParamsNumber<int>(L, 2, count - 1);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<TestExport>(L, 1) && TypeChecker.CheckParamsType<string>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tstring[] arg0 = ToLua.ToParamsString(L, 2, count - 1);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse if (TypeChecker.CheckTypes<TestExport>(L, 1) && TypeChecker.CheckParamsType<object>(L, 2, count - 1))\n\t\t\t{\n\t\t\t\tTestExport obj = (TestExport)ToLua.ToObject(L, 1);\n\t\t\t\tobject[] arg0 = ToLua.ToParamsObject(L, 2, count - 1);\n\t\t\t\tint o = obj.Test(arg0);\n\t\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn LuaDLL.luaL_throw(L, \"invalid arguments to method: TestExport.Test\");\n\t\t\t}\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestChar(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tchar arg0 = (char)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tint o = obj.Test(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int Test33(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tSystem.Action<int> arg0 = (System.Action<int>)ToLua.CheckDelegate<System.Action<int>>(L, 2);\n\t\t\tint o = obj.Test33(ref arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\tToLua.Push(L, arg0);\n\t\t\treturn 2;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestGeneric(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tUnityEngine.Component arg0 = (UnityEngine.Component)ToLua.CheckObject<UnityEngine.Component>(L, 2);\n\t\t\tint o = obj.TestGeneric(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestEnum(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tTestExport.Space arg0 = (TestExport.Space)ToLua.CheckObject(L, 2, typeof(TestExport.Space));\n\t\t\tint o = obj.TestEnum(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestCheckParamNumber(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tint[] arg0 = ToLua.CheckParamsNumber<int>(L, 2, count - 1);\n\t\t\tint o = obj.TestCheckParamNumber(arg0);\n\t\t\tLuaDLL.lua_pushinteger(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestCheckParamString(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tstring[] arg0 = ToLua.CheckParamsString(L, 2, count - 1);\n\t\t\tstring o = obj.TestCheckParamString(arg0);\n\t\t\tLuaDLL.lua_pushstring(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestReflection(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 0);\n\t\t\tTestExport.TestReflection();\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestRefGameObject(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tUnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));\n\t\t\tTestExport.TestRefGameObject(ref arg0);\n\t\t\tToLua.PushSealed(L, arg0);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int DoClick(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 1);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tobj.DoClick();\n\t\t\treturn 0;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestNullable(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tToLua.CheckArgsCount(L, 2);\n\t\t\tTestExport obj = (TestExport)ToLua.CheckObject(L, 1, typeof(TestExport));\n\t\t\tSystem.Nullable<UnityEngine.Vector3> arg0 = ToLua.CheckNullable<UnityEngine.Vector3>(L, 2);\n\t\t\tSystem.Nullable<UnityEngine.Vector3> o = obj.TestNullable(arg0);\n\t\t\tToLua.PusNullable(L, o);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_field(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tint ret = obj.field;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index field on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_OnClick(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tSystem.Action ret = obj.OnClick;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index OnClick on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_OnRefEvent(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tTestExport.TestRefEvent ret = obj.OnRefEvent;\n\t\t\tToLua.Push(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index OnRefEvent on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_buffer(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tbyte[] ret = obj.buffer;\n\t\t\tLuaDLL.tolua_pushlstring(L, ret, ret.Length);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index buffer on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_Number(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tint ret = obj.Number;\n\t\t\tLuaDLL.lua_pushinteger(L, ret);\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Number on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_field(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tobj.field = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index field on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_OnClick(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tSystem.Action arg0 = (System.Action)ToLua.CheckDelegate<System.Action>(L, 2);\n\t\t\tobj.OnClick = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index OnClick on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_OnRefEvent(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tTestExport.TestRefEvent arg0 = (TestExport.TestRefEvent)ToLua.CheckDelegate<TestExport.TestRefEvent>(L, 2);\n\t\t\tobj.OnRefEvent = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index OnRefEvent on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_buffer(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tbyte[] arg0 = ToLua.CheckByteBuffer(L, 2);\n\t\t\tobj.buffer = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index buffer on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int set_Number(IntPtr L)\n\t{\n\t\tobject o = null;\n\n\t\ttry\n\t\t{\n\t\t\to = ToLua.ToObject(L, 1);\n\t\t\tTestExport obj = (TestExport)o;\n\t\t\tint arg0 = (int)LuaDLL.luaL_checknumber(L, 2);\n\t\t\tobj.Number = arg0;\n\t\t\treturn 0;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e, o, \"attempt to index Number on a nil value\");\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestExport_TestBuffer(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tLuaFunction func = ToLua.CheckLuaFunction(L, 1);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tDelegate arg1 = DelegateTraits<TestExport.TestBuffer>.Create(func);\n\t\t\t\tToLua.Push(L, arg1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tLuaTable self = ToLua.CheckLuaTable(L, 2);\n\t\t\t\tDelegate arg1 = DelegateTraits<TestExport.TestBuffer>.Create(func, self);\n\t\t\t\tToLua.Push(L, arg1);\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int TestExport_TestRefEvent(IntPtr L)\n\t{\n\t\ttry\n\t\t{\n\t\t\tint count = LuaDLL.lua_gettop(L);\n\t\t\tLuaFunction func = ToLua.CheckLuaFunction(L, 1);\n\n\t\t\tif (count == 1)\n\t\t\t{\n\t\t\t\tDelegate arg1 = DelegateTraits<TestExport.TestRefEvent>.Create(func);\n\t\t\t\tToLua.Push(L, arg1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tLuaTable self = ToLua.CheckLuaTable(L, 2);\n\t\t\t\tDelegate arg1 = DelegateTraits<TestExport.TestRefEvent>.Create(func, self);\n\t\t\t\tToLua.Push(L, arg1);\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\treturn LuaDLL.toluaL_exception(L, e);\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestOverload/TestExportWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 93a993f96184f9043b307249752cde32\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestOverload/TestExport_SpaceWrap.cs",
    "content": "﻿//this source code was auto-generated by tolua#, do not modify it\nusing System;\nusing LuaInterface;\n\npublic class TestExport_SpaceWrap\n{\n\tpublic static void Register(LuaState L)\n\t{\n\t\tL.BeginEnum(typeof(TestExport.Space));\n\t\tL.RegVar(\"World\", get_World, null);\n\t\tL.RegFunction(\"IntToEnum\", IntToEnum);\n\t\tL.EndEnum();\n\t\tTypeTraits<TestExport.Space>.Check = CheckType;\n\t\tStackTraits<TestExport.Space>.Push = Push;\n\t}\n\n\tstatic void Push(IntPtr L, TestExport.Space arg)\n\t{\n\t\tToLua.Push(L, arg);\n\t}\n\n\tstatic bool CheckType(IntPtr L, int pos)\n\t{\n\t\treturn TypeChecker.CheckEnumType(typeof(TestExport.Space), L, pos);\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int get_World(IntPtr L)\n\t{\n\t\tToLua.Push(L, TestExport.Space.World);\n\t\treturn 1;\n\t}\n\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tstatic int IntToEnum(IntPtr L)\n\t{\n\t\tint arg0 = (int)LuaDLL.lua_tonumber(L, 1);\n\t\tTestExport.Space o = (TestExport.Space)arg0;\n\t\tToLua.Push(L, o);\n\t\treturn 1;\n\t}\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestOverload/TestExport_SpaceWrap.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3e8176bbf31cef9418a3a1aa76f1f018\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestOverload/TestOverload.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections;\nusing LuaInterface;\nusing System;\nusing System.Reflection;\n\npublic class TestEnum\n{\n    public TestEnum()\n    {\n\n    }\n\n    public void Test(UnityEngine.Space e)\n    {\n\n    }\n}\n\npublic sealed class TestExport\n{\n    [LuaByteBufferAttribute]\n    public delegate void TestBuffer(byte[] buffer);       \n\n    public enum Space\n    {\n        World = 1\n    }\n\n    public int field = 1024;\n\n    public System.Action OnClick = delegate { };\n\n    public delegate void TestRefEvent(ref GameObject go);\n\n    public TestRefEvent OnRefEvent;\n\n    //public int Item { get; set; }\n    private int number = 123;\n    public int Number\n    {\n        get\n        {            \n            return number;\n        }\n\n        set\n        {            \n            number = value;            \n        }\n    }\n\n    public int this[int pos]\n    {\n        get { return pos; }\n        set { Debugger.Log(value); }\n    }\n\n    public int this[char index, int pos]\n    {\n        get { return 0; }\n        set { Debugger.Log(value); }\n    }\n\n    [LuaByteBufferAttribute]\n    public byte[] buffer;\n\n    public static int get_Item(string pos) { return 0; }\n    public static int get_Item(double pos) { return 0; }\n    public static int get_Item(int i, int j, int k) { return 0; }\n\n    public static int set_Item(double pos) { return 0; }\n\n    public void TestByteBuffer(TestBuffer tb)\n    {\n\n    }\n\n    public int Test(object o, string str)\n    {\n        Debugger.Log(\"call Test(object o, string str)\");\n        return 1;\n    }\n\n    public int Test(object o, string str, int n)\n    {\n        Debugger.Log(\"call Test(object o, string str, int n)\");\n        return 111;\n    }\n\n    [LuaRenameAttribute(Name = \"TestChar\")]\n    public int Test(char c)\n    {\n        Debugger.Log(\"call Test(char c)\");\n        return 2;\n    }\n\n    public int Test()\n    {\n        return -1;\n    }\n\n    public int Test(bool b)\n    {\n        Debugger.Log(\"call Test(bool b)\");\n        return 15;\n    }\n\n    public int Test(int[,] objs)\n    {\n        Debugger.Log(\"call Test(int[,] objs)\");\n        return 16;\n    }\n\n    public int Test(int i)\n    {\n        Debugger.Log(\"call Test(int i)\");\n        return 3;\n    }\n\n    //有这个函数要扔掉上面两个精度不匹配的，因为lua是double\n    public int Test(double d)\n    {\n        Debugger.Log(\"call Test(double d)\");\n        return 4;\n    }\n\n    public int Test(out int i)\n    {\n        i = 1024;\n        Debugger.Log(\"call Test(ref int i)\");\n        return 3;\n    }\n\n\n    public int Test(int i, int j)\n    {\n        Debugger.Log(\"call Test(int i, int j)\");\n        return 5;\n    }\n\n\n    public int Test(string str)\n    {\n        Debugger.Log(\"call Test(string str)\");\n        return 6;\n    }\n\n    public static int Test(string str1, string str2)\n    {\n        Debugger.Log(\"call static Test(string str1, string str2)\");\n        return 7;\n    }\n\n    public int Test(object o)\n    {\n        Debugger.Log(\"call Test(object o)\");\n        return 8;\n    }\n\n    public int Test(params int[] objs)\n    {\n        Debugger.Log(\"call Test(params int[] objs)\");\n        return 12;\n    }\n\n    public int Test(params string[] objs)\n    {\n        Debugger.Log(\"call Test(params int[] objs)\");\n        return 13;\n    }\n\n    public int Test(string[] objs, bool flag)\n    {\n        Debugger.Log(\"call Test(string[] objs, bool flag)\");\n        return 20;\n    }\n\n    public int Test(params object[] objs)\n    {\n        Debugger.Log(\"call Test(params object[] objs)\");\n        return 9;\n    }\n\n    public int Test(Space e)\n    {\n        Debugger.Log(\"call Test(Space e)\");\n        return 10;\n    }\n\n    public int Test33(ref System.Action<int> action)\n    {\n        Debugger.Log(\"ref System.Action action\");\n        return 14;\n    }\n\n    public int TestGeneric<T> (T t) where T : Component\n    {\n        Debugger.Log(\"TestGeneric(T t) Call\");\n        return 11;\n    }\n\n    public int TestEnum(Space e)\n    {\n        Debugger.Log(\"call TestEnum(Space e)\");\n        return 10;\n    }\n\n    public int TestCheckParamNumber(params int[] ns)\n    {\n        Debugger.Log(\"call TestCheckParamNumber(params int[] ns)\");\n        int n = 0;\n\n        for (int i = 0; i < ns.Length; i++)\n        {\n            n += ns[i];\n        }\n\n        return n;\n    }\n\n    public string TestCheckParamString(params string[] ss)\n    {\n        Debugger.Log(\"call TestCheckParamNumber(params string[] ss)\");\n        string str = null;\n\n        for (int i = 0; i < ss.Length; i++)\n        {\n            str += ss[i];\n        }\n\n        return str;\n    }\n\n    public static void TestReflection()\n    {\n        Debugger.Log(\"call TestReflection()\");        \n    }\n\n    public static void TestRefGameObject(ref GameObject go)\n    {\n\n    }\n\n    public void DoClick()\n    {\n        OnClick();\n    }\n\n    public TestExport()\n    {\n        Debugger.Log(\"call TestExport()\");\n    }\n\n    public TestExport(Vector3[] v)\n    {\n        Debugger.Log(\"call TestExport(params Vector3[] v)\");\n    }\n\n    public TestExport(Vector3 v, string str)\n    {\n        Debugger.Log(\"call TestExport(Vector3 v, string str)\");\n    }\n\n    public TestExport(Vector3 v)\n    {\n        Debugger.Log(\"call TestExport(Vector3 v)\");\n    }\n\n    public Nullable<Vector3> TestNullable(Nullable<Vector3> v)\n    {\n        Debugger.Log(\"call TestNullable(Nullable<Vector3> v)\");\n        return v;\n    }\n}\n\npublic class TestOverload : MonoBehaviour\n{\n    private string script =\n@\"                  \n        require 'TestExport'                                        \n        local out = require 'tolua.out'\n        local GameObject = UnityEngine.GameObject                                \n\n        function Test(to)            \n            assert(to:Test(1) == 4)            \n            local flag, num = to:Test(out.int)\n            assert(flag == 3 and num == 1024, 'Test(out)')\n            assert(to:Test('hello') == 6, 'Test(string)')\n            assert(to:Test(System.Object.New()) == 8)            \n            assert(to:Test(true) == 15)\n            assert(to:Test(123, 456) == 5)            \n            assert(to:Test('123', '456') == 1)\n            assert(to:Test(System.Object.New(), '456') == 1)\n            assert(to:Test('123', 456) == 9)\n            assert(to:Test('123', System.Object.New()) == 9)\n            assert(to:Test(1,2,3) == 12)            \n            assert(to:Test('hello') == 6)\n            assert(TestExport.Test('hello', 'world') == 7)\n            assert(to:TestGeneric(GameObject().transform) == 11)\n            assert(to:TestCheckParamNumber(1,2,3) == 6)\n            assert(to:TestCheckParamString('1', '2', '3') == '123')\n            assert(to:Test(TestExport.Space.World) == 10)        \n            print(to.this:get(123))\n            to.this:set(1, 456)          \n            local v = to:TestNullable(Vector3.New(1,2,3)) \n            print(v.z)\n        end\n    \";\n    \n    void Awake ()\n    {\n        LuaState state = new LuaState();\n        state.Start();\n        LuaBinder.Bind(state);\n        Bind(state);        \n        state.DoString(script, \"TestOverload.cs\");\n\n        TestExport to = new TestExport();\n        LuaFunction func = state.GetFunction(\"Test\");\n        func.Call(to);          \n        state.Dispose();                     \n    }\n\n    void Bind(LuaState state)\n    {\n        state.BeginModule(null);\n        TestExportWrap.Register(state);\n        state.BeginModule(\"TestExport\");\n        TestExport_SpaceWrap.Register(state);\n        state.EndModule();\n        state.EndModule();\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Examples/TestOverload/TestOverload.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ccb167912a52c2f4e9f88a1bc02d5083\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestOverload/TestOverload.unity.meta",
    "content": "fileFormatVersion: 2\nguid: 45830782541ee7a49b44eb5a02d7ecef\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Examples/TestOverload.meta",
    "content": "fileFormatVersion: 2\nguid: c47782a99562c02499fb1602381bfe8d\nfolderAsset: yes\ntimeCreated: 1486461631\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Examples.meta",
    "content": "fileFormatVersion: 2\nguid: 940a49ebae9b91b4fb0682c92d968933\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/CustomCecilRocks/MethodBodyRocks.cs",
    "content": "#if ENABLE_LUA_INJECTION\n//\n// Author:\n//   Jb Evain (jbevain@gmail.com)\n//\n// Copyright (c) 2008 - 2015 Jb Evain\n// Copyright (c) 2008 - 2011 Novell, Inc.\n//\n// Licensed under the MIT/X11 license.\n//\nusing System;\nusing Mono.Cecil;\nusing Mono.Cecil.Cil;\n\nnamespace CustomCecilRocks {\n\n\tpublic\n\tstatic class MethodBodyRocks {\n\n\t\tpublic static void SimplifyMacros (this MethodBody self)\n\t\t{\n\t\t\tif (self == null)\n\t\t\t\tthrow new ArgumentNullException (\"self\");\n\n\t\t\tforeach (var instruction in self.Instructions) {\n\t\t\t\tif (instruction.OpCode.OpCodeType != OpCodeType.Macro)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tswitch (instruction.OpCode.Code) {\n\t\t\t\tcase Code.Ldarg_0:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (0));\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldarg_1:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (1));\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldarg_2:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (2));\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldarg_3:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (3));\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldloc_0:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldloc, self.Variables [0]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldloc_1:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldloc, self.Variables [1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldloc_2:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldloc, self.Variables [2]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldloc_3:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldloc, self.Variables [3]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Stloc_0:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Stloc, self.Variables [0]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Stloc_1:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Stloc, self.Variables [1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Stloc_2:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Stloc, self.Variables [2]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Stloc_3:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Stloc, self.Variables [3]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldarg_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Ldarg;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldarga_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Ldarga;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Starg_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Starg;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldloc_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Ldloc;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldloca_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Ldloca;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Stloc_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Stloc;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_M1:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, -1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_0:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 0);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_1:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_2:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_3:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 3);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_4:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 4);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_5:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 5);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_6:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 6);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_7:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 7);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_8:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, 8);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4_S:\n\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, (int) (sbyte) instruction.Operand);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Br_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Br;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Brfalse_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Brfalse;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Brtrue_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Brtrue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Beq_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Beq;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Bge_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Bge;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Bgt_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Bgt;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ble_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Ble;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Blt_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Blt;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Bne_Un_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Bne_Un;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Bge_Un_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Bge_Un;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Bgt_Un_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Bgt_Un;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ble_Un_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Ble_Un;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Blt_Un_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Blt_Un;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Leave_S:\n\t\t\t\t\tinstruction.OpCode = OpCodes.Leave;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tstatic void ExpandMacro (Instruction instruction, OpCode opcode, object operand)\n\t\t{\n\t\t\tinstruction.OpCode = opcode;\n\t\t\tinstruction.Operand = operand;\n\t\t}\n\n\t\tstatic void MakeMacro (Instruction instruction, OpCode opcode)\n\t\t{\n\t\t\tinstruction.OpCode = opcode;\n\t\t\tinstruction.Operand = null;\n\t\t}\n\n\t\tpublic static void Optimize (this MethodBody self)\n\t\t{\n\t\t\tif (self == null)\n\t\t\t\tthrow new ArgumentNullException (\"self\");\n\n\t\t\tOptimizeLongs (self);\n\t\t\tOptimizeMacros (self);\n\t\t}\n\n\t\tstatic void OptimizeLongs (this MethodBody self)\n\t\t{\n\t\t\tfor (var i = 0; i < self.Instructions.Count; i++) {\n\t\t\t\tvar instruction = self.Instructions [i];\n\t\t\t\tif (instruction.OpCode.Code != Code.Ldc_I8)\n\t\t\t\t\tcontinue;\n\t\t\t\tvar l = (long) instruction.Operand;\n\t\t\t\tif (l >= int.MaxValue || l <= int.MinValue)\n\t\t\t\t\tcontinue;\n\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4, (int) l);\n\t\t\t\tself.Instructions.Insert (++i, Instruction.Create (OpCodes.Conv_I8));\n\t\t\t}\n\t\t}\n\n\t\tpublic static void OptimizeMacros (this MethodBody self)\n\t\t{\n\t\t\tif (self == null)\n\t\t\t\tthrow new ArgumentNullException (\"self\");\n\n\t\t\tvar method = self.Method;\n\n\t\t\tforeach (var instruction in self.Instructions) {\n\t\t\t\tint index;\n\t\t\t\tswitch (instruction.OpCode.Code) {\n\t\t\t\tcase Code.Ldarg:\n\t\t\t\t\tindex = ((ParameterDefinition) instruction.Operand).Index;\n\t\t\t\t\tif (index == -1 && instruction.Operand == self.ThisParameter)\n\t\t\t\t\t\tindex = 0;\n\t\t\t\t\telse if (method.HasThis)\n\t\t\t\t\t\tindex++;\n\n\t\t\t\t\tswitch (index) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldarg_0);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldarg_1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldarg_2);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldarg_3);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif (index < 256)\n\t\t\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldarg_S, instruction.Operand);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldloc:\n\t\t\t\t\tindex = ((VariableDefinition) instruction.Operand).Index;\n\t\t\t\t\tswitch (index) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldloc_0);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldloc_1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldloc_2);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldloc_3);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif (index < 256)\n\t\t\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldloc_S, instruction.Operand);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Stloc:\n\t\t\t\t\tindex = ((VariableDefinition) instruction.Operand).Index;\n\t\t\t\t\tswitch (index) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Stloc_0);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Stloc_1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Stloc_2);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Stloc_3);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif (index < 256)\n\t\t\t\t\t\t\tExpandMacro (instruction, OpCodes.Stloc_S, instruction.Operand);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldarga:\n\t\t\t\t\tindex = ((ParameterDefinition) instruction.Operand).Index;\n\t\t\t\t\tif (index == -1 && instruction.Operand == self.ThisParameter)\n\t\t\t\t\t\tindex = 0;\n\t\t\t\t\telse if (method.HasThis)\n\t\t\t\t\t\tindex++;\n\t\t\t\t\tif (index < 256)\n\t\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldarga_S, instruction.Operand);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldloca:\n\t\t\t\t\tif (((VariableDefinition) instruction.Operand).Index < 256)\n\t\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldloca_S, instruction.Operand);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Code.Ldc_I4:\n\t\t\t\t\tint i = (int) instruction.Operand;\n\t\t\t\t\tswitch (i) {\n\t\t\t\t\tcase -1:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_M1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_0);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_2);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_3);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_4);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_5);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 6:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_6);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 7:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_7);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 8:\n\t\t\t\t\t\tMakeMacro (instruction, OpCodes.Ldc_I4_8);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif (i >= -128 && i < 128)\n\t\t\t\t\t\t\tExpandMacro (instruction, OpCodes.Ldc_I4_S, (sbyte) i);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tOptimizeBranches (self);\n\t\t}\n\n\t\tstatic void OptimizeBranches (MethodBody body)\n\t\t{\n\t\t\tComputeOffsets (body);\n\n\t\t\tforeach (var instruction in body.Instructions) {\n\t\t\t\tif (instruction.OpCode.OperandType != OperandType.InlineBrTarget)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif (OptimizeBranch (instruction))\n\t\t\t\t\tComputeOffsets (body);\n\t\t\t}\n\t\t}\n\n\t\tstatic bool OptimizeBranch (Instruction instruction)\n\t\t{\n\t\t\tvar offset = ((Instruction) instruction.Operand).Offset - (instruction.Offset + instruction.OpCode.Size + 4);\n\t\t\tif (!(offset >= -128 && offset <= 127))\n\t\t\t\treturn false;\n\n\t\t\tswitch (instruction.OpCode.Code) {\n\t\t\tcase Code.Br:\n\t\t\t\tinstruction.OpCode = OpCodes.Br_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Brfalse:\n\t\t\t\tinstruction.OpCode = OpCodes.Brfalse_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Brtrue:\n\t\t\t\tinstruction.OpCode = OpCodes.Brtrue_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Beq:\n\t\t\t\tinstruction.OpCode = OpCodes.Beq_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Bge:\n\t\t\t\tinstruction.OpCode = OpCodes.Bge_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Bgt:\n\t\t\t\tinstruction.OpCode = OpCodes.Bgt_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Ble:\n\t\t\t\tinstruction.OpCode = OpCodes.Ble_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Blt:\n\t\t\t\tinstruction.OpCode = OpCodes.Blt_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Bne_Un:\n\t\t\t\tinstruction.OpCode = OpCodes.Bne_Un_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Bge_Un:\n\t\t\t\tinstruction.OpCode = OpCodes.Bge_Un_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Bgt_Un:\n\t\t\t\tinstruction.OpCode = OpCodes.Bgt_Un_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Ble_Un:\n\t\t\t\tinstruction.OpCode = OpCodes.Ble_Un_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Blt_Un:\n\t\t\t\tinstruction.OpCode = OpCodes.Blt_Un_S;\n\t\t\t\tbreak;\n\t\t\tcase Code.Leave:\n\t\t\t\tinstruction.OpCode = OpCodes.Leave_S;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tstatic void ComputeOffsets (MethodBody body)\n\t\t{\n\t\t\tvar offset = 0;\n\t\t\tforeach (var instruction in body.Instructions) {\n\t\t\t\tinstruction.Offset = offset;\n\t\t\t\toffset += instruction.GetSize ();\n\t\t\t}\n\t\t}\n\n\t\tpublic static ParameterDefinition GetParameter (this MethodBody self, int index)\n\t\t{\n\t\t\tvar method = self.Method;\n\n\t\t\tif (method.HasThis) {\n\t\t\t\tif (index == 0)\n\t\t\t\t\treturn self.ThisParameter;\n\n\t\t\t\tindex--;\n\t\t\t}\n\n\t\t\tvar parameters = method.Parameters;\n\n\t\t\tif (index < 0 || index >= parameters.Count)\n\t\t\t\treturn null;\n\n\t\t\treturn parameters [index];\n\t\t}\n\t}\n}\n#endif"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/CustomCecilRocks/MethodBodyRocks.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 86b293140e547b342a6037d11e939fce\nMonoImporter:\n  externalObjects: {}\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/CustomCecilRocks.meta",
    "content": "fileFormatVersion: 2\nguid: 5c0193e665c01f54eb307adc123ddb74\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/ToLuaInjection.cs",
    "content": "#if ENABLE_LUA_INJECTION\nusing System;\nusing System.IO;\nusing System.Xml;\nusing System.Text;\nusing System.Linq;\nusing UnityEngine;\nusing UnityEditor;\nusing Mono.Cecil;\nusing Mono.Cecil.Cil;\nusing Unity.CecilTools;\nusing Unity.CecilTools.Extensions;\nusing CustomCecilRocks; \nusing System.Reflection;\nusing LuaInterface;\nusing UnityEditor.Callbacks;\nusing System.Collections.Generic;\nusing MethodBody = Mono.Cecil.Cil.MethodBody;\n\nclass InjectedMethodInfo\n{\n    public string methodFullSignature;\n    public string methodOverloadSignature;\n    public string methodPublishedName;\n    public string methodName;\n    public int methodIndex;\n}\n\n[InitializeOnLoad]\npublic static class ToLuaInjection\n{\n    static int offset = 0;\n    static int methodCounter = 0;\n    static bool EnableSymbols = true;\n    static Instruction cursor;\n    static VariableDefinition flagDef;\n    static VariableDefinition funcDef;\n    static TypeReference intTypeRef;\n    static TypeReference injectFlagTypeRef;\n    static TypeReference noToLuaAttrTypeRef;\n    static TypeDefinition injectStationTypeDef;\n    static TypeDefinition luaFunctionTypeDef;\n    static TypeDefinition luaTableTypeDef;\n    static MethodReference injectFlagGetter;\n    static MethodReference injectedFuncGetter;\n    static HashSet<string> dropTypeGroup = new HashSet<string>();\n    static HashSet<string> injectableTypeGroup = new HashSet<string>();\n    static Dictionary<MethodDefinition, VariableDefinition> resultTableGroup = new Dictionary<MethodDefinition, VariableDefinition>();\n    static SortedDictionary<string, List<InjectedMethodInfo>> bridgeInfo = new SortedDictionary<string, List<InjectedMethodInfo>>();\n    static OpCode[] ldargs = new OpCode[] { OpCodes.Ldarg_0, OpCodes.Ldarg_1, OpCodes.Ldarg_2, OpCodes.Ldarg_3 };\n    static OpCode[] ldcI4s = new OpCode[] { OpCodes.Ldc_I4_1, OpCodes.Ldc_I4_2, OpCodes.Ldc_I4_4, OpCodes.Ldc_I4_8 };\n    const string assemblyPath = \"./Library/ScriptAssemblies/Assembly-CSharp.dll\";\n    const InjectType injectType = InjectType.After | InjectType.Before | InjectType.Replace | InjectType.ReplaceWithPreInvokeBase | InjectType.ReplaceWithPostInvokeBase;\n    const InjectFilter injectIgnoring = InjectFilter.IgnoreGeneric | InjectFilter.IgnoreConstructor;// | InjectFilter.IgnoreNoToLuaAttr | InjectFilter.IgnoreProperty;\n    static HashSet<string> dropGenericNameGroup = new HashSet<string>\n    {\n    };\n    static HashSet<string> dropNamespaceGroup = new HashSet<string>\n    {\n        \"LuaInterface\",\n    };\n    static HashSet<string> forceInjectTypeGroup = new HashSet<string>\n    {\n    };\n\n    static ToLuaInjection()\n    {\n        LoadAndCheckAssembly(true);\n        InjectAll();\n    }\n\n    static void InjectAll()\n    {\n        var injectionStatus = EditorPrefs.GetInt(Application.dataPath + \"WaitForInjection\", 0);\n        if (Application.isPlaying || EditorApplication.isCompiling || injectionStatus == 0)\n        {\n            return;\n        }\n\n        bool bInjectInterupted = !LoadBlackList() || ToLuaMenu.UpdateMonoCecil(ref EnableSymbols) != 0 || !LoadBridgeEditorInfo();\n        if (!bInjectInterupted)\n        {\n            CacheInjectableTypeGroup();\n            Inject();\n\n            AssetDatabase.Refresh();\n        }\n    }\n\n    [PostProcessBuildAttribute()]\n    static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)\n    {\n        var injectionStatus = EditorPrefs.GetInt(Application.dataPath + \"WaitForInjection\", 0);\n        if (injectionStatus == 0)\n        {\n            Debug.LogError(\"Inject Failed!!!\");\n        }\n        EditorPrefs.SetInt(Application.dataPath + \"WaitForInjection\", 0);\n    }\n\n    [PostProcessScene]\n    static void OnPostProcessScene()\n    {\n        if (BuildPipeline.isBuildingPlayer)\n        {\n            EditorPrefs.SetInt(Application.dataPath + \"WaitForInjection\", 1);\n        }\n\n        InjectAll();\n    }\n\n    [DidReloadScripts]\n    static void OnDidReloadScripts()\n    {\n        if (!BuildPipeline.isBuildingPlayer)\n        {\n            EditorPrefs.SetInt(Application.dataPath + \"WaitForInjection\", 0);\n        }\n    }\n\t\n    [MenuItem(\"Lua/Inject All &i\", false, 5)]\n    static void InjectByMenu()\n    {\n        if (Application.isPlaying)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"游戏运行过程中无法操作\", \"确定\");\n            return;\n        }\n\n        EditorPrefs.SetInt(Application.dataPath + \"WaitForInjection\", 1);\n        if (EditorApplication.isCompiling)\n        {\n            EditorUtility.DisplayDialog(\"警告\", \"请等待编辑器编译完成\", \"确定\");\n            return;\n        }\n\n        InjectAll();\n    }\n\n    static AssemblyDefinition LoadAndCheckAssembly(bool bPulse)\n    {\n        var assemblyReader = new ReaderParameters\n        {\n            ReadSymbols = EnableSymbols,\n            AssemblyResolver = GetAssemblyResolver()\n        };\n        AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(assemblyPath, assemblyReader);\n\n        var alreadyInjected = assembly.CustomAttributes.Any((attr) =>\n        {\n            return attr.AttributeType.FullName == \"LuaInterface.UseDefinedAttribute\";\n        });\n        EditorPrefs.SetInt(Application.dataPath + \"InjectStatus\", alreadyInjected ? 1 : 0);\n\n        if (bPulse)\n        {\n            Clean(assembly);\n        }\n\n        return assembly;\n    }\n\n    static void Inject()\n    {\n        AssemblyDefinition assembly = null;\n        try\n        {\n            assembly = LoadAndCheckAssembly(false);\n            if (InjectPrepare(assembly))\n            {\n                foreach (var module in assembly.Modules)\n                {\n                    int cursor = 0;\n                    int typesCount = module.Types.Count;\n                    foreach (var type in module.Types)\n                    {\n                        ++cursor;\n                        EditorUtility.DisplayProgressBar(\"Injecting:\" + module.FullyQualifiedName, type.FullName, (float)cursor / typesCount);\n                        if (!InjectProcess(assembly, type))\n                        {\n                            EditorUtility.ClearProgressBar();\n                            return;\n                        }\n                    }\n                }\n                EditorUtility.ClearProgressBar();\n\n                UpdateInjectionCacheSize();\n                ExportInjectionBridgeInfo();\n                WriteInjectedAssembly(assembly, assemblyPath);\n                resultTableGroup.Clear();\n                EditorApplication.Beep();\n                Debug.Log(\"Lua Injection Finished!\");\n                EditorPrefs.SetInt(Application.dataPath + \"InjectStatus\", 1);\n            }\n        }\n        catch (Exception e)\n        {\n            Debug.LogError(e.ToString());\n        }\n        finally\n        {\n            if (assembly != null)\n            {\n                Clean(assembly);\n            }\n        }\n    }\n\n    static bool InjectPrepare(AssemblyDefinition assembly)\n    {\n        bool alreadyInjected = EditorPrefs.GetInt(Application.dataPath + \"InjectStatus\") == 1;\n        if (alreadyInjected)\n        {\n            Debug.Log(\"Already Injected!\");\n            return false;\n        }\n        resultTableGroup.Clear();\n        var injectAttrType = assembly.MainModule.Types.Single(type => type.FullName == \"LuaInterface.UseDefinedAttribute\");\n        var attrCtorInfo = injectAttrType.Methods.Single(method => method.IsConstructor);\n        assembly.CustomAttributes.Add(new CustomAttribute(attrCtorInfo));\n\n        intTypeRef = assembly.MainModule.TypeSystem.Int32;\n        injectFlagTypeRef = assembly.MainModule.TypeSystem.Byte;\n        noToLuaAttrTypeRef = assembly.MainModule.Types.Single(type => type.FullName == \"LuaInterface.NoToLuaAttribute\");\n        injectStationTypeDef = assembly.MainModule.Types.Single(type => type.FullName == \"LuaInterface.LuaInjectionStation\");\n        luaFunctionTypeDef = assembly.MainModule.Types.Single(method => method.FullName == \"LuaInterface.LuaFunction\");\n        luaTableTypeDef = assembly.MainModule.Types.Single(method => method.FullName == \"LuaInterface.LuaTable\");\n        injectFlagGetter = injectStationTypeDef.Methods.Single(method => method.Name == \"GetInjectFlag\");\n        injectedFuncGetter = injectStationTypeDef.Methods.Single(method => method.Name == \"GetInjectionFunction\");\n\n        return true;\n    }\n\n    static BaseAssemblyResolver GetAssemblyResolver()\n    {\n        DefaultAssemblyResolver resolver = new DefaultAssemblyResolver();\n\n        AppDomain.CurrentDomain\n                .GetAssemblies()\n                .Select(assem => Path.GetDirectoryName(assem.ManifestModule.FullyQualifiedName))\n                .Distinct()\n                .Foreach(dir => resolver.AddSearchDirectory(dir));\n\n        return resolver;\n    }\n\n    static bool InjectProcess(AssemblyDefinition assembly, TypeDefinition type)\n    {\n        if (!DoesTypeInjectable(type))\n        {\n            return true;\n        }\n\n        foreach (var nestedType in type.NestedTypes)\n        {\n            if (!InjectProcess(assembly, nestedType))\n            {\n                return false;\n            }\n        }\n\n        foreach (var target in type.Methods)\n        {\n            if (target.IsGenericMethodDefinition())\n            {\n                continue;\n            }\n            if (!DoesMethodInjectable(target))\n            {\n                continue;\n            }\n            int methodIndex = AppendMethod(target);\n            if (methodIndex == -1)\n            {\n                return false;\n            }\n\n            if (target.IsEnumerator())\n            {\n                InjectCoroutine(assembly, target, methodIndex);\n            }\n            else\n            {\n                InjectMethod(assembly, target, methodIndex);\n            }\n        }\n\n        return true;\n    }\n\n    static void FillBegin(MethodDefinition target, int methodIndex)\n    {\n        MethodBody targetBody = target.Body;\n        ILProcessor il = targetBody.GetILProcessor();\n        targetBody.InitLocals = true;\n        flagDef = new VariableDefinition(injectFlagTypeRef);\n        funcDef = new VariableDefinition(luaFunctionTypeDef);\n        targetBody.Variables.Add(flagDef);\n        targetBody.Variables.Add(funcDef);\n\n        Instruction startInsertPos = targetBody.Instructions[0];\n        il.InsertBefore(startInsertPos, il.Create(OpCodes.Ldc_I4, methodIndex));\n        il.InsertBefore(startInsertPos, il.Create(OpCodes.Call, injectFlagGetter));\n        il.InsertBefore(startInsertPos, il.Create(OpCodes.Stloc, flagDef));\n        il.InsertBefore(startInsertPos, il.Create(OpCodes.Ldloc, flagDef));\n        il.InsertBefore(startInsertPos, il.Create(OpCodes.Brfalse, startInsertPos));\n        il.InsertBefore(startInsertPos, il.Create(OpCodes.Ldc_I4, methodIndex));\n        il.InsertBefore(startInsertPos, il.Create(OpCodes.Call, injectedFuncGetter));\n        il.InsertBefore(startInsertPos, il.Create(OpCodes.Stloc, funcDef));\n        offset = targetBody.Instructions.IndexOf(startInsertPos);\n    }\n\n#region GenericMethod\n    static void InjectGenericMethod(AssemblyDefinition assembly, MethodDefinition target, int methodIndex)\n    {\n    }\n#endregion GenericMethod\n\n#region Coroutine\n    static void InjectCoroutine(AssemblyDefinition assembly, MethodDefinition target, int methodIndex)\n    {\n        InjectType runtimeInjectType = GetMethodRuntimeInjectType(target);\n        if (runtimeInjectType == InjectType.None)\n        {\n            return;\n        }\n\n        target.Body.SimplifyMacros();\n        FillBegin(target, methodIndex);\n        FillReplaceCoroutine(target, runtimeInjectType & InjectType.Replace);\n        FillCoroutineMonitor(target, runtimeInjectType & (~InjectType.Replace), methodIndex);\n        target.Body.OptimizeMacros();\n    }\n\n    static void FillReplaceCoroutine(MethodDefinition target, InjectType runtimeInjectType)\n    {\n        if (runtimeInjectType == InjectType.None)\n        {\n            return;\n        }\n\n        MethodBody targetBody = target.Body;\n        ILProcessor il = targetBody.GetILProcessor();\n        cursor = GetMethodNextInsertPosition(target, null, false);\n\n        if (cursor != null)\n        {\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, flagDef));\n            il.InsertBefore(cursor, il.Create(ldcI4s[(int)InjectType.Replace / 2]));\n            il.InsertBefore(cursor, il.Create(OpCodes.Bne_Un, cursor));\n\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, funcDef));\n            FillArgs(target, cursor, null);\n            il.InsertBefore(cursor, il.Create(OpCodes.Call, GetLuaMethodInvoker(target, false, false)));\n            il.InsertBefore(cursor, il.Create(OpCodes.Ret));\n        }\n    }\n\n    static void FillCoroutineMonitor(MethodDefinition target, InjectType runtimeInjectType, int methodIndex)\n    {\n        if (runtimeInjectType == InjectType.None)\n        {\n            return;\n        }\n\n        MethodBody targetBody = target.Body;\n        FieldDefinition hostField = null;\n        var coroutineEntity = targetBody.Variables[0].VariableType.Resolve();\n        if (!target.DeclaringType.NestedTypes.Any(type => coroutineEntity == type))\n        {\n            return;\n        }\n\n        cursor = GetMethodNextInsertPosition(target, cursor, true);\n        CopyCoroutineCreatorReference(target, coroutineEntity, ref hostField);\n        var coroutineCarrier = coroutineEntity.Methods.Single(method => method.Name == \"MoveNext\");\n        CopyCreatorArgsToCarrier(target, coroutineCarrier);\n        FillBegin(coroutineCarrier, methodIndex);\n        var fillInjectInfoFunc = GetCoroutineInjectInfoFiller(target, hostField);\n        FillInjectMethod(coroutineCarrier, fillInjectInfoFunc, runtimeInjectType & InjectType.After);\n        FillInjectMethod(coroutineCarrier, fillInjectInfoFunc, runtimeInjectType & InjectType.Before);\n    }\n\n    static Action<MethodDefinition, InjectType> GetCoroutineInjectInfoFiller(MethodDefinition coroutineCreator, FieldDefinition hostRef)\n    {\n        return (coroutineCarrier, runtimeInjectType) =>\n        {\n            MethodBody targetBody = coroutineCarrier.Body;\n            ILProcessor il = targetBody.GetILProcessor();\n\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, funcDef));\n            if (coroutineCreator.HasThis)\n            {\n                il.InsertBefore(cursor, il.Create(OpCodes.Ldarg_0));\n                il.InsertBefore(cursor, il.Create(OpCodes.Ldfld, hostRef));\n            }\n            CopyCarrierFieldsToArg(coroutineCreator, coroutineCarrier);\n            FillCoroutineState(coroutineCarrier);\n\n            il.InsertBefore(cursor, il.Create(OpCodes.Call, GetLuaMethodInvoker(coroutineCreator, true, true)));\n        };\n    }\n\n    static void CopyCoroutineCreatorReference(MethodDefinition coroutineCreator, TypeDefinition coroutineCarrier, ref FieldDefinition hostField)\n    {\n        if (coroutineCreator.HasThis)\n        {\n            ILProcessor il = coroutineCreator.Body.GetILProcessor();\n\n            hostField = new FieldDefinition(\"__iHost\", Mono.Cecil.FieldAttributes.Public, coroutineCreator.DeclaringType);\n            coroutineCarrier.Fields.Add(hostField);\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldloc_0));\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldarg_0));\n            il.InsertBefore(cursor, il.Create(OpCodes.Stfld, hostField));\n        }\n    }\n\n    static void CopyCreatorArgsToCarrier(MethodDefinition coroutineCreator, MethodDefinition coroutineCarrier)\n    {\n        ILProcessor il = coroutineCreator.Body.GetILProcessor();\n        var carrierFields = coroutineCarrier.DeclaringType.Fields;\n\n        coroutineCreator\n            .Parameters\n            .Foreach(param =>\n            {\n                var name = \"<$>\" + param.Name;\n                if (!carrierFields.Any(field => field.Name == name))\n                {\n                    var hostArg = new FieldDefinition(name, Mono.Cecil.FieldAttributes.Public, param.ParameterType);\n                    carrierFields.Add(hostArg);\n                    il.InsertBefore(cursor, il.Create(OpCodes.Ldloc_0));\n                    il.InsertBefore(cursor, il.Create(OpCodes.Ldarg, param));\n                    il.InsertBefore(cursor, il.Create(OpCodes.Stfld, hostArg));\n                }\n            });\n    }\n\n    static void CopyCarrierFieldsToArg(MethodDefinition coroutineCreator, MethodDefinition coroutineCarrier)\n    {\n        ILProcessor il = coroutineCarrier.Body.GetILProcessor();\n        var carrierFields = coroutineCarrier.DeclaringType.Fields;\n\n        coroutineCreator\n            .Parameters\n            .Select(param => \"<$>\" + param.Name)\n            .Foreach(name =>\n            {\n                var arg = carrierFields.Single(field => field.Name == name);\n                il.InsertBefore(cursor, il.Create(OpCodes.Ldarg_0));\n                il.InsertBefore(cursor, il.Create(OpCodes.Ldfld, arg));\n            });\n    }\n\n    static void FillCoroutineState(MethodDefinition coroutineCarrier)\n    {\n        MethodBody targetBody = coroutineCarrier.Body;\n        ILProcessor il = targetBody.GetILProcessor();\n\n        il.InsertBefore(cursor, il.Create(OpCodes.Ldarg_0));\n        var stateField = coroutineCarrier.DeclaringType.Fields.Single(field => field.Name == \"$PC\");\n        il.InsertBefore(cursor, il.Create(OpCodes.Ldfld, stateField));\n    }\n\n#endregion Coroutine\n\n#region NormalMethod\n    static void InjectMethod(AssemblyDefinition assembly, MethodDefinition target, int methodIndex)\n    {\n        target.Body.SimplifyMacros();\n        FillBegin(target, methodIndex);\n        InjectType runtimeInjectType = GetMethodRuntimeInjectType(target);\n        FillInjectMethod(target, FillInjectInfo, runtimeInjectType & InjectType.After);\n        FillInjectMethod(target, FillInjectInfo, runtimeInjectType & (~InjectType.After));\n        target.Body.OptimizeMacros();\n    }\n\n    static void FillInjectMethod(MethodDefinition target, Action<MethodDefinition, InjectType> fillInjectInfo, InjectType runtimeInjectType)\n    {\n        if (runtimeInjectType == InjectType.None)\n        {\n            return;\n        }\n\n        MethodBody targetBody = target.Body;\n        ILProcessor il = targetBody.GetILProcessor();\n        cursor = GetMethodNextInsertPosition(target, null, runtimeInjectType.HasFlag(InjectType.After));\n\n        while (cursor != null)\n        {\n            bool bAfterInject = runtimeInjectType == InjectType.After;\n            Instruction startPos = il.Create(OpCodes.Ldloc, flagDef);\n            if (bAfterInject)\n            {\n                /// Replace instruction with references reserved\n                Instruction endPos = il.Create(OpCodes.Ret);\n                int replaceIndex = targetBody.Instructions.IndexOf(cursor);\n                cursor.OpCode = startPos.OpCode;\n                cursor.Operand = startPos.Operand;\n                il.InsertAfter(targetBody.Instructions[replaceIndex], endPos);\n                cursor = targetBody.Instructions[replaceIndex + 1];\n            }\n            else il.InsertBefore(cursor, startPos);\n            il.InsertBefore(cursor, il.Create(ldcI4s[(int)InjectType.After / 2]));\n            il.InsertBefore(cursor, il.Create(bAfterInject ? OpCodes.Bne_Un : OpCodes.Ble_Un, cursor));\n\n            fillInjectInfo(target, runtimeInjectType);\n            cursor = GetMethodNextInsertPosition(target, cursor, runtimeInjectType.HasFlag(InjectType.After));\n        }\n    }\n\n    static void FillInjectInfo(MethodDefinition target, InjectType runtimeInjectType)\n    {\n        FillBaseCall(target, runtimeInjectType, true);\n        FillLuaMethodCall(target, runtimeInjectType == InjectType.After);\n        FillBaseCall(target, runtimeInjectType, false);\n        FillJumpInfo(target, runtimeInjectType == InjectType.After);\n    }\n\n    static void FillBaseCall(MethodDefinition target, InjectType runtimeInjectType, bool preCall)\n    {\n        MethodBody targetBody = target.Body;\n        ILProcessor il = targetBody.GetILProcessor();\n        InjectType curBaseInjectType = preCall ? InjectType.ReplaceWithPreInvokeBase : InjectType.ReplaceWithPostInvokeBase;\n\n        if (runtimeInjectType.HasFlag(curBaseInjectType))\n        {\n            Instruction end = il.Create(OpCodes.Nop);\n            il.InsertBefore(cursor, end);\n            il.InsertBefore(end, il.Create(OpCodes.Ldloc, flagDef));\n            il.InsertBefore(end, il.Create(OpCodes.Ldc_I4, (int)curBaseInjectType));\n            il.InsertBefore(end, il.Create(OpCodes.Bne_Un, end));\n\n            FillArgs(target, end, PostProcessBaseMethodArg);\n            il.InsertBefore(end, il.Create(OpCodes.Call, target.GetBaseMethodInstance()));\n            if (!target.ReturnVoid())\n            {\n                il.InsertBefore(end, il.Create(OpCodes.Pop));\n            }\n        }\n    }\n\n    static void FillLuaMethodCall(MethodDefinition target, bool bConfirmPopReturnValue)\n    {\n        ILProcessor il = target.Body.GetILProcessor();\n        Instruction start = il.Create(OpCodes.Ldloc, funcDef);\n\n        if (cursor.Previous.OpCode == OpCodes.Nop)\n        {\n            cursor.Previous.OpCode = start.OpCode;\n            cursor.Previous.Operand = start.Operand;\n        }\n        else\n        {\n            il.InsertBefore(cursor, start);\n        }\n\n        FillArgs(target, cursor, ParseArgumentReference);\n        il.InsertBefore(cursor, il.Create(OpCodes.Call, GetLuaMethodInvoker(target, bConfirmPopReturnValue, false)));\n\n        CacheResultTable(target, bConfirmPopReturnValue);\n        UpdatePassedByReferenceParams(target, bConfirmPopReturnValue);\n    }\n\n    static void CacheResultTable(MethodDefinition target, bool bConfirmPopReturnValue)\n    {\n        ILProcessor il = target.Body.GetILProcessor();\n        if (target.GotPassedByReferenceParam())\n        {\n            il.InsertBefore(cursor, il.Create(OpCodes.Stloc, GetResultTable(target)));\n        }\n    }\n\n    static VariableDefinition GetResultTable(MethodDefinition target)\n    {\n        VariableDefinition luaTable = null;\n        resultTableGroup.TryGetValue(target, out luaTable);\n        if (luaTable == null)\n        {\n            luaTable = new VariableDefinition(luaTableTypeDef);\n            target.Body.Variables.Add(luaTable);\n            resultTableGroup.Add(target, luaTable);\n        }\n\n        return luaTable;\n    }\n\n    static void UpdatePassedByReferenceParams(MethodDefinition target, bool bConfirmPopReturnValue)\n    {\n        if (!target.GotPassedByReferenceParam())\n        {\n            return;\n        }\n\n        int updateCount = 0;\n        ILProcessor il = target.Body.GetILProcessor();\n        VariableDefinition luaTable = GetResultTable(target);\n        var rawGetGenericMethod = luaTableTypeDef.Methods.Single(method => method.Name == \"RawGetIndex\");\n\n        foreach (var param in target.Parameters)\n        {\n            if (!param.ParameterType.IsByReference)\n            {\n                continue;\n            }\n\n            var paramType = ElementType.For(param.ParameterType);\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldarg, param));\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, luaTable));\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldc_I4, ++updateCount));\n            il.InsertBefore(cursor, il.Create(OpCodes.Call, rawGetGenericMethod.MakeGenericMethod(paramType)));\n            if (paramType.IsValueType)\n            {\n                il.InsertBefore(cursor, il.Create(OpCodes.Stobj, paramType));\n            }\n            else\n            {\n                il.InsertBefore(cursor, il.Create(OpCodes.Stind_Ref));\n            }\n        }\n\n        if (!bConfirmPopReturnValue && !target.ReturnVoid())\n        {\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldloc, luaTable));\n            il.InsertBefore(cursor, il.Create(OpCodes.Ldc_I4, ++updateCount));\n            il.InsertBefore(cursor, il.Create(OpCodes.Call, rawGetGenericMethod.MakeGenericMethod(target.ReturnType)));\n        }\n    }\n\n    static void FillJumpInfo(MethodDefinition target, bool bConfirmPopReturnValue)\n    {\n        MethodBody targetBody = target.Body;\n        ILProcessor il = targetBody.GetILProcessor();\n\n        if (!bConfirmPopReturnValue)\n        {\n            Instruction retIns = il.Create(OpCodes.Ret);\n            if (!injectType.HasFlag(InjectType.Before))\n            {\n                if (cursor.Previous.OpCode == OpCodes.Nop)\n                {\n                    cursor.Previous.OpCode = retIns.OpCode;\n                    cursor.Previous.Operand = retIns.Operand;\n                    retIns = cursor.Previous;\n                }\n                else\n                {\n                    il.InsertBefore(cursor, retIns);\n                }\n            }\n            else\n            {\n                Instruction start = il.Create(OpCodes.Ldloc, flagDef);\n                if (cursor.Previous.OpCode == OpCodes.Nop)\n                {\n                    cursor.Previous.OpCode = start.OpCode;\n                    cursor.Previous.Operand = start.Operand;\n                    il.InsertAfter(cursor.Previous, retIns);\n                }\n                else\n                {\n                    il.InsertBefore(cursor, retIns);\n                    il.InsertBefore(retIns, start);\n                }\n\n                Instruction popIns = il.Create(OpCodes.Pop);\n                bool bGotReturnValue = !target.ReturnVoid();\n                if (bGotReturnValue)\n                {\n                    il.InsertBefore(cursor, popIns);\n                }\n                il.InsertBefore(retIns, il.Create(ldcI4s[(int)InjectType.Before / 2]));\n                il.InsertBefore(retIns, il.Create(OpCodes.Ble_Un, bGotReturnValue ? popIns : cursor));\n            }\n        }\n        else if (cursor.Previous.OpCode == OpCodes.Nop)\n        {\n            targetBody.Instructions.Remove(cursor.Previous);\n        }\n    }\n#endregion NormalMethod\n\n    static void FillArgs(MethodDefinition target, Instruction endPoint, Action<MethodDefinition, Instruction, int> parseReferenceProcess)\n    {\n        MethodBody targetBody = target.Body;\n        ILProcessor il = targetBody.GetILProcessor();\n        int paramCount = target.Parameters.Count + (target.HasThis ? 1 : 0);\n\n        for (int i = 0; i < paramCount; ++i)\n        {\n            if (i < ldargs.Length)\n            {\n                il.InsertBefore(endPoint, il.Create(ldargs[i]));\n            }\n            else if (i <= byte.MaxValue)\n            {\n                il.InsertBefore(endPoint, il.Create(OpCodes.Ldarg_S, (byte)i));\n            }\n            else\n            {\n                il.InsertBefore(endPoint, il.Create(OpCodes.Ldarg, (short)i));\n            }\n\n            if (parseReferenceProcess != null)\n            {\n                parseReferenceProcess(target, endPoint, i);\n            }\n        }\n    }\n\n    static void PostProcessBaseMethodArg(MethodDefinition target, Instruction endPoint, int paramIndex)\n    {\n        var declaringType = target.DeclaringType;\n        ILProcessor il = target.Body.GetILProcessor();\n        if (paramIndex == 0 && declaringType.IsValueType)\n        {\n            il.InsertBefore(endPoint, il.Create(OpCodes.Ldobj, declaringType));\n            il.InsertBefore(endPoint, il.Create(OpCodes.Box, declaringType));\n        }\n    }\n\n    static void ParseArgumentReference(MethodDefinition target, Instruction endPoint, int paramIndex)\n    {\n        ParameterDefinition param = null;\n        ILProcessor il = target.Body.GetILProcessor();\n\n        if (target.HasThis)\n        {\n            if (paramIndex > 0)\n            {\n                param = target.Parameters[paramIndex - 1];\n            }\n            else if (target.DeclaringType.IsValueType)\n            {\n                il.InsertBefore(endPoint, il.Create(OpCodes.Ldobj, target.DeclaringType));\n            }\n        }\n        else if (!target.HasThis)\n        {\n            param = target.Parameters[paramIndex];\n        }\n\n        if (param != null && param.ParameterType.IsByReference)\n        {\n            TypeReference paramType = ElementType.For(param.ParameterType);\n            if (paramType.IsValueType)\n            {\n                il.InsertBefore(endPoint, il.Create(OpCodes.Ldobj, paramType));\n            }\n            else\n            {\n                il.InsertBefore(endPoint, il.Create(OpCodes.Ldind_Ref));\n            }\n        }\n    }\n\n    static Instruction GetMethodNextInsertPosition(MethodDefinition target, Instruction curPoint, bool bInsertBeforeRet)\n    {\n        MethodBody targetBody = target.Body;\n        if (target.IsConstructor || bInsertBeforeRet)\n        {\n            if (curPoint != null)\n            {\n                return targetBody.Instructions\n                    .SkipWhile(ins => ins != curPoint)\n                    .FirstOrDefault(ins => ins != curPoint && ins.OpCode == OpCodes.Ret);\n            }\n            else\n            {\n                return targetBody.Instructions\n                    .FirstOrDefault(ins => ins.OpCode == OpCodes.Ret);\n            }\n        }\n        else\n        {\n            if (curPoint != null) return null;\n            else return targetBody.Instructions[offset];\n        }\n    }\n\n    static InjectType GetMethodRuntimeInjectType(MethodDefinition target)\n    {\n        InjectType type = injectType;\n\n        //bool bOverrideParantMethodFlag = target.IsVirtual && target.IsReuseSlot;\n        var parantMethod = target.GetBaseMethodInstance();\n        if (target.IsConstructor)\n        {\n            type &= ~InjectType.Before;\n            type &= ~InjectType.Replace;\n            type &= ~InjectType.ReplaceWithPostInvokeBase;\n            type &= ~InjectType.ReplaceWithPreInvokeBase;\n        }\n        else if (parantMethod == null || target.IsEnumerator())\n        {\n            type &= ~InjectType.ReplaceWithPostInvokeBase;\n            type &= ~InjectType.ReplaceWithPreInvokeBase;\n        }\n        else if (!target.HasBody)\n        {\n            type &= ~InjectType.After;\n            type &= ~InjectType.Before;\n        }\n\n        return type;\n    }\n\n    static MethodReference GetLuaMethodInvoker(MethodDefinition prototypeMethod, bool bIgnoreReturnValue, bool bAppendCoroutineState)\n    {\n        MethodReference injectMethod = null;\n\n        GetLuaInvoker(prototypeMethod, bIgnoreReturnValue, bAppendCoroutineState, ref injectMethod);\n        FillLuaInvokerGenericArguments(prototypeMethod, bIgnoreReturnValue, bAppendCoroutineState, ref injectMethod);\n\n        return injectMethod;\n    }\n\n    static void GetLuaInvoker(MethodDefinition prototypeMethod, bool bIgnoreReturnValue, bool bAppendCoroutineState, ref MethodReference invoker)\n    {\n        bool bRequireResult = prototypeMethod.GotPassedByReferenceParam()\n            || (!bIgnoreReturnValue && !prototypeMethod.ReturnVoid());\n        string methodName = bRequireResult ? \"Invoke\" : \"Call\";\n        int paramCount = prototypeMethod.Parameters.Count;\n        int paramExtraCount = prototypeMethod.HasThis ? 1 : 0;\n        paramExtraCount = bAppendCoroutineState ? paramExtraCount + 1 : paramExtraCount;\n        paramCount += paramExtraCount;\n        invoker = luaFunctionTypeDef.Methods.FirstOrDefault(method =>\n        {\n            return method.Name == methodName && method.Parameters.Count == paramCount && bRequireResult == !method.ReturnVoid();\n        });\n\n        if (invoker == null)\n        {\n            Debug.Log(prototypeMethod.FullName + \" Got too many parameters!!!Skipped!!!\");\n        }\n    }\n\n    static void FillLuaInvokerGenericArguments(MethodDefinition prototypeMethod, bool bIgnoreReturnValue, bool bAppendCoroutineState, ref MethodReference invoker)\n    {\n        if (invoker.HasGenericParameters)\n        {\n            GenericInstanceMethod genericInjectMethod = new GenericInstanceMethod(invoker.CloneMethod());\n\n            if (prototypeMethod.HasThis)\n            {\n                genericInjectMethod.GenericArguments.Add(prototypeMethod.DeclaringType);\n            }\n            foreach (ParameterDefinition parameter in prototypeMethod.Parameters)\n            {\n                var paramType = parameter.ParameterType.IsByReference ? ElementType.For(parameter.ParameterType) : parameter.ParameterType;\n                genericInjectMethod.GenericArguments.Add(paramType);\n            }\n            if (bAppendCoroutineState)\n            {\n                genericInjectMethod.GenericArguments.Add(intTypeRef);\n            }\n            if (prototypeMethod.GotPassedByReferenceParam())\n            {\n                genericInjectMethod.GenericArguments.Add(luaTableTypeDef);\n            }\n            else if (!bIgnoreReturnValue && !prototypeMethod.ReturnVoid())\n            {\n                genericInjectMethod.GenericArguments.Add(prototypeMethod.ReturnType);\n            }\n\n            invoker = genericInjectMethod;\n        }\n    }\n\n    static void UpdateInjectionCacheSize()\n    {\n        var staticConstructor = injectStationTypeDef.Methods.Single((method) =>\n        {\n            return method.Name == \".cctor\";\n        });\n\n        var il = staticConstructor.Body.GetILProcessor();\n        Instruction loadStaticFieldIns = null;\n        loadStaticFieldIns = staticConstructor\n            .Body\n            .Instructions\n            .FirstOrDefault(ins =>\n            {\n                return ins.OpCode == OpCodes.Ldsfld\n                       && (ins.Operand as FieldReference).Name == \"cacheSize\";\n            });\n\n        var loadCacheSizeIns = il.Create(OpCodes.Ldc_I4, methodCounter + 1);\n        il.InsertBefore(loadStaticFieldIns, loadCacheSizeIns);\n        il.InsertBefore(loadStaticFieldIns, il.Create(OpCodes.Stsfld, (loadStaticFieldIns.Operand as FieldReference)));\n    }\n\n    static void WriteInjectedAssembly(AssemblyDefinition assembly, string assemblyPath)\n    {\n        var writerParameters = new WriterParameters { WriteSymbols = EnableSymbols };\n        assembly.Write(assemblyPath, writerParameters);\n    }\n\n    static void ExportInjectionBridgeInfo()\n    {\n        ExportInjectionPublishInfo(bridgeInfo);\n        ExportInjectionEditorInfo(bridgeInfo);\n    }\n\n    static void ExportInjectionPublishInfo(SortedDictionary<string, List<InjectedMethodInfo>> data)\n    {\n        var temp = data.ToDictionary(\n            typeInfo => typeInfo.Key,\n            typeinfo =>\n            {\n                return typeinfo.Value\n                            .OrderBy(methodInfo => methodInfo.methodPublishedName)\n                            .ToDictionary(\n                                methodInfo => methodInfo.methodPublishedName,\n                                methodInfo => methodInfo.methodIndex\n                            );\n            }\n        );\n\n        StringBuilder sb = StringBuilderCache.Acquire();\n        sb.Append(\"return \");\n        ToLuaText.TransferDic(temp, sb);\n        sb.Remove(sb.Length - 1, 1);\n        File.WriteAllText(CustomSettings.baseLuaDir + \"System/Injection/InjectionBridgeInfo.lua\", StringBuilderCache.GetStringAndRelease(sb));\n    }\n\n    static int AppendMethod(MethodDefinition method)\n    {\n        string methodSignature = GetMethodSignature(method);\n        string methodFullSignature = method.FullName;\n        InjectedMethodInfo newInfo = new InjectedMethodInfo();\n        string typeName = ToLuaInjectionHelper.GetTypeName(method.DeclaringType, true);\n        List<InjectedMethodInfo> typeMethodIndexGroup = null;\n        bridgeInfo.TryGetValue(typeName, out typeMethodIndexGroup);\n\n        if (typeMethodIndexGroup == null)\n        {\n            typeMethodIndexGroup = new List<InjectedMethodInfo>();\n            newInfo.methodPublishedName = method.Name;\n            bridgeInfo.Add(typeName, typeMethodIndexGroup);\n        }\n        else\n        {\n            InjectedMethodInfo existInfo = typeMethodIndexGroup.Find(info => info.methodOverloadSignature == methodSignature);\n\n            if (existInfo == null)\n            {\n                existInfo = typeMethodIndexGroup.Find(info => info.methodName == method.Name);\n                if (existInfo != null)\n                {\n                    newInfo.methodPublishedName = methodSignature;\n                    existInfo.methodPublishedName = existInfo.methodOverloadSignature;\n                }\n                else\n                {\n                    newInfo.methodPublishedName = method.Name;\n                }\n            }\n            else\n            {\n                if (existInfo.methodFullSignature != methodFullSignature)\n                {\n                    Debug.LogError(typeName + \".\" + existInfo.methodPublishedName + \" 签名跟历史签名不一致，无法增量，Injection中断，请修改函数签名、或者直接删掉InjectionBridgeEditorInfo.xml（该操作会导致无法兼容线上版的包体，需要强制换包）！\");\n                    EditorPrefs.SetInt(Application.dataPath + \"WaitForInjection\", 0);\n                    return -1;\n                }\n                return existInfo.methodIndex;\n            }\n        }\n\n        newInfo.methodName = method.Name;\n        newInfo.methodOverloadSignature = methodSignature;\n        newInfo.methodFullSignature = methodFullSignature;\n        newInfo.methodIndex = ++methodCounter;\n        typeMethodIndexGroup.Add(newInfo);\n\n        return methodCounter;\n    }\n\n    static string GetMethodSignature(MethodDefinition method)\n    {\n        StringBuilder paramsTypeNameBuilder = StringBuilderCache.Acquire();\n        paramsTypeNameBuilder.Append(method.Name);\n\n        foreach (var param in method.Parameters)\n        {\n            paramsTypeNameBuilder\n                .Append(\"-\")\n                .Append(ToLuaInjectionHelper.GetTypeName(param.ParameterType));\n        }\n\n        return StringBuilderCache.GetStringAndRelease(paramsTypeNameBuilder);\n    }\n\n    static void ExportInjectionEditorInfo(SortedDictionary<string, List<InjectedMethodInfo>> data)\n    {\n        string incrementalFilePath = CustomSettings.injectionFilesPath + \"InjectionBridgeEditorInfo.xml\";\n        if (File.Exists(incrementalFilePath))\n        {\n            File.Delete(incrementalFilePath);\n        }\n\n        var doc = new XmlDocument();\n        var fileInforRoot = doc.CreateElement(\"Root\");\n        doc.AppendChild(fileInforRoot);\n\n        foreach (var type in data)\n        {\n            XmlElement typeNode = doc.CreateElement(\"Type\");\n            typeNode.SetAttribute(\"Name\", type.Key);\n\n            var sortedMethodsGroup = type.Value.OrderBy(info => info.methodPublishedName);\n            foreach (var method in sortedMethodsGroup)\n            {\n                XmlElement typeMethodNode = doc.CreateElement(\"Method\");\n                typeMethodNode.SetAttribute(\"Name\", method.methodName);\n                typeMethodNode.SetAttribute(\"PublishedName\", method.methodPublishedName);\n                typeMethodNode.SetAttribute(\"Signature\", method.methodOverloadSignature);\n                typeMethodNode.SetAttribute(\"FullSignature\", method.methodFullSignature);\n                typeMethodNode.SetAttribute(\"Index\", method.methodIndex.ToString());\n                typeNode.AppendChild(typeMethodNode);\n            }\n\n            fileInforRoot.AppendChild(typeNode);\n        }\n\n        doc.Save(incrementalFilePath);\n    }\n\n    static bool LoadBridgeEditorInfo()\n    {\n        bridgeInfo.Clear();\n        methodCounter = 0;\n        string incrementalFilePath = CustomSettings.injectionFilesPath + \"InjectionBridgeEditorInfo.xml\";\n        if (!File.Exists(incrementalFilePath))\n        {\n            return true;\n        }\n\n        var doc = new XmlDocument();\n        doc.Load(incrementalFilePath);\n        var fileInfoRoot = doc.FindChildByName(\"Root\");\n        if (fileInfoRoot == null)\n        {\n            return true;\n        }\n\n        foreach (XmlNode typeChild in fileInfoRoot.ChildNodes)\n        {\n            List<InjectedMethodInfo> typeMethodInfo = new List<InjectedMethodInfo>();\n            string typeName = typeChild.FindAttributeByName(\"Name\").Value;\n\n            foreach (XmlNode methodChild in typeChild.ChildNodes)\n            {\n                InjectedMethodInfo info = new InjectedMethodInfo();\n                info.methodName = methodChild.FindAttributeByName(\"Name\").Value;\n                info.methodPublishedName = methodChild.FindAttributeByName(\"PublishedName\").Value;\n                info.methodOverloadSignature = methodChild.FindAttributeByName(\"Signature\").Value;\n                info.methodFullSignature = methodChild.FindAttributeByName(\"FullSignature\").Value;\n                info.methodIndex = int.Parse(methodChild.FindAttributeByName(\"Index\").Value);\n                typeMethodInfo.Add(info);\n                methodCounter = Math.Max(methodCounter, info.methodIndex);\n            }\n\n            bridgeInfo.Add(typeName, typeMethodInfo);\n        }\n\n        return true;\n    }\n\n    static void Clean(AssemblyDefinition assembly)\n    {\n        if (assembly.MainModule.SymbolReader != null)\n        {\n            assembly.MainModule.SymbolReader.Dispose();\n        }\n    }\n\n    static void CacheInjectableTypeGroup()\n    {\n        injectableTypeGroup.Clear();\n\n        Assembly assebly = Assembly.Load(\"Assembly-CSharp\");\n        foreach (Type t in assebly.GetTypes())\n        {\n            if (DoesTypeInjectable(t))\n            {\n                injectableTypeGroup.Add(t.FullName);\n            }\n        }\n    }\n\n    static bool DoesTypeInjectable(Type type)\n    {\n        if (dropTypeGroup.Contains(type.FullName) || (type.DeclaringType != null && dropTypeGroup.Contains(type.DeclaringType.FullName)))\n        {\n            return false;\n        }\n\n        if (type.IsGenericType)\n        {\n            Type genericTypeDefinition = type.GetGenericTypeDefinition();\n            if (dropGenericNameGroup.Contains(genericTypeDefinition.FullName))\n            {\n                return false;\n            }\n        }\n\n        if (typeof(System.Delegate).IsAssignableFrom(type))\n        {\n            return false;\n        }\n\n        if (type.FullName.Contains(\"<\") || type.IsInterface)\n        {\n            return false;\n        }\n\n        if (!injectIgnoring.HasFlag(InjectFilter.IgnoreNoToLuaAttr))\n        {\n            foreach (var attr in type.GetCustomAttributes(true))\n            {\n                Type attrT = attr.GetType();\n                if (attrT == typeof(LuaInterface.NoToLuaAttribute))\n                {\n                    return false;\n                }\n            }\n        }\n\n        return true;\n    }\n\n    static bool DoesTypeInjectable(TypeDefinition type)\n    {\n        if (dropNamespaceGroup.Contains(type.SafeNamespace()))\n        {\n            return false;\n        }\n\n        if (!injectableTypeGroup.Contains(type.FullName.Replace(\"/\", \"+\")))\n        {\n            return false;\n        }\n\n        if (injectIgnoring.HasFlag(InjectFilter.IgnoreConstructor) && type.Methods.Count == 1)\n        {\n            return false;\n        }\n\n        if (!injectIgnoring.HasFlag(InjectFilter.IgnoreNoToLuaAttr))\n        {\n            if (type.CustomAttributes.Any((attr) => attr.AttributeType == noToLuaAttrTypeRef))\n            {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    static bool DoesMethodInjectable(MethodDefinition method)\n    {\n        if (method.IsSpecialName)\n        {\n            if (method.Name == \".cctor\")\n            {\n                return false;\n            }\n\n            bool bIgnoreConstructor = injectIgnoring.HasFlag(InjectFilter.IgnoreConstructor)\n                                    || method.DeclaringType.IsAssignableTo(\"UnityEngine.MonoBehaviour\")\n                                    || method.DeclaringType.IsAssignableTo(\"UnityEngine.ScriptableObject\");\n            if (method.IsConstructor)\n            {\n                if (bIgnoreConstructor)\n                {\n                    return false;\n                }\n            }\n            else\n            {\n                ///Skip add_、remove_、op_、Finalize\n                if (!method.IsGetter && !method.IsSetter)\n                {\n                    return false;\n                }\n            }\n        }\n\n        if (method.Name.Contains(\"<\") || method.IsUnmanaged || method.IsAbstract || method.IsPInvokeImpl || !method.HasBody)\n        {\n            return false;\n        }\n\n        /// Skip Unsafe\n        if (method.Body.Variables.Any(var => var.VariableType.IsPointer) || method.Parameters.Any(param => param.ParameterType.IsPinned))\n        {\n            return false;\n        }\n\n        /// Hmm... Sometimes method.IsSpecialName Got False\n        if (method.Name == \"Finalize\")\n        {\n            return false;\n        }\n\n        if ((method.IsGetter || method.IsSetter) && injectIgnoring.HasFlag(InjectFilter.IgnoreProperty))\n        {\n            return false;\n        }\n\n        if (!injectIgnoring.HasFlag(InjectFilter.IgnoreNoToLuaAttr))\n        {\n            if (method.CustomAttributes.Any((attr) => attr.AttributeType == noToLuaAttrTypeRef))\n            {\n                return false;\n            }\n        }\n\n        if (method.ReturnType.IsAssignableTo(\"System.Collections.IEnumerable\"))\n        {\n            return false;\n        }\n\n        MethodReference luaInjector = null;\n        GetLuaInvoker(method, true, false, ref luaInjector);\n        if (luaInjector == null)\n        {\n            return false;\n        }\n\n        return true;\n    }\n\n    static bool LoadBlackList()\n    {\n        if (File.Exists(InjectionBlackListGenerator.blackListFilePath))\n        {\n            dropTypeGroup.UnionWith(File.ReadAllLines(InjectionBlackListGenerator.blackListFilePath));\n            dropTypeGroup.ExceptWith(forceInjectTypeGroup);\n        }\n        else\n        {\n            if (EditorUtility.DisplayDialog(\"警告\", \"由于Injection会额外增加代码量，故可以先设置一些Injection跳过的代码目录(比如NGUI插件代码目录)，减少生成的代码量\", \"设置黑名单\", \"全量生成\"))\n            {\n                InjectionBlackListGenerator.Open();\n                InjectionBlackListGenerator.onBlackListGenerated += InjectAll;\n                return false;\n            }\n        }\n\n        return true;\n    }\n}\n\npublic static class SystemXMLExtension\n{\n    public static XmlNode FindChildByName(this XmlNode root, string childName)\n    {\n        var child = root.FirstChild;\n        while (child != null)\n        {\n            if (child.Name.Equals(childName))\n            {\n                return child;\n            }\n            else\n            {\n                child = child.NextSibling;\n            }\n        }\n\n        return null;\n    }\n\n    public static XmlAttribute FindAttributeByName(this XmlNode node, string attributeName)\n    {\n        var attributeCollection = node.Attributes;\n        for (int i = 0; i < attributeCollection.Count; i++)\n        {\n            if (attributeCollection[i].Name.Equals(attributeName))\n            {\n                return attributeCollection[i];\n            }\n        }\n\n        return null;\n    }\n}\n\n#endif"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/ToLuaInjection.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 576ad269863310b4aba201ae8896a3ef\ntimeCreated: 1512461674\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/ToLuaInjectionHelper.cs",
    "content": "﻿#if ENABLE_LUA_INJECTION\nusing System;\nusing System.Collections.Generic;\nusing Mono.Cecil;\nusing Mono.Cecil.Cil;\nusing Unity.CecilTools;\nusing System.Linq;\n\n[Flags]\npublic enum InjectFilter\n{\n    IgnoreConstructor = 1,\n    IgnoreProperty = 1 << 1,\n    IgnoreGeneric = 1 << 2,\n    IgnoreNoToLuaAttr = 1 << 3,\n}\n\npublic static class ToLuaInjectionHelper\n{\n    public static string GetArrayRank(TypeReference t)\n    {\n        ArrayType type = t as ArrayType;\n        int count = type.Rank;\n\n        if (count == 1)\n        {\n            return \"[]\";\n        }\n\n        using (CString.Block())\n        {\n            CString sb = CString.Alloc(64);\n            sb.Append('[');\n\n            for (int i = 1; i < count; i++)\n            {\n                sb.Append(',');\n            }\n\n            sb.Append(']');\n            return sb.ToString();\n        }\n    }\n\n    public static string GetTypeName(TypeReference t, bool bFull = false)\n    {\n        if (t.IsArray)\n        {\n            string str = GetTypeName(ElementType.For(t));\n            str += GetArrayRank(t);\n            return str;\n        }\n        else if (t.IsByReference)\n        {\n            //t = t.GetElementType();\n            return GetTypeName(ElementType.For(t)) + \"&\";\n        }\n        else if (t.IsGenericInstance)\n        {\n            return GetGenericName(t, bFull);\n        }\n        else if (t.MetadataType == MetadataType.Void)\n        {\n            return \"void\";\n        }\n        else\n        {\n            string name = GetPrimitiveTypeStr(t, bFull);\n            return name.Replace('+', '.');\n        }\n    }\n\n    public static string[] GetGenericName(Mono.Collections.Generic.Collection<TypeReference> types, int offset, int count, bool bFull)\n    {\n        string[] results = new string[count];\n\n        for (int i = 0; i < count; i++)\n        {\n            int pos = i + offset;\n\n            if (types[pos].IsGenericInstance)\n            {\n                results[i] = GetGenericName(types[pos], bFull);\n            }\n            else\n            {\n                results[i] = GetTypeName(types[pos]);\n            }\n        }\n\n        return results;\n    }\n\n    public static MethodReference GetBaseMethodInstance(this MethodDefinition target)\n    {\n        MethodDefinition baseMethodDef = null;\n        var baseType = target.DeclaringType.BaseType;\n\n        while (baseType != null)\n        {\n            if (baseType.MetadataToken.TokenType == TokenType.TypeRef)\n            {\n                break;\n            }\n\n            var baseTypeDef = baseType.Resolve();\n            baseMethodDef = MetadataResolver.GetMethod(baseTypeDef.Methods, target);\n            if (baseMethodDef != null && !baseMethodDef.IsAbstract)\n            {\n                if (baseType.IsGenericInstance)\n                {\n                    MethodReference baseMethodRef = baseType.Module.Import(baseMethodDef);\n                    var baseTypeInstance = (GenericInstanceType)baseType;\n                    return baseMethodRef.MakeGenericMethod(baseTypeInstance.GenericArguments.ToArray());\n                }\n                break;\n            }\n            else baseMethodDef = null;\n\n           baseType = baseTypeDef.BaseType;\n        }\n\n        return baseMethodDef;\n    }\n\n    public static bool IsGenericTypeDefinition(this TypeReference type)\n    {\n        if (type.HasGenericParameters)\n        {\n            return true;\n        }\n        else if (type.IsByReference || type.IsArray)\n        {\n            return ElementType.For(type).IsGenericTypeDefinition();\n        }\n        else if (type.IsNested)\n        {\n            var parent = type.DeclaringType;\n            while (parent != null)\n            {\n                if (parent.IsGenericTypeDefinition())\n                {\n                    return true;\n                }\n\n                if (parent.IsNested)\n                {\n                    parent = parent.DeclaringType;\n                }\n                else\n                {\n                    break;\n                }\n            }\n        }\n\n        return type.IsGenericParameter;\n    }\n\n    public static bool IsGenericMethodDefinition(this MethodDefinition md)\n    {\n        if (md.HasGenericParameters\n#if UNITY_5_2 || UNITY_5_3 || UNITY_5_3_OR_NEWER\n            || md.ContainsGenericParameter\n#endif\n            )\n        {\n            return true;\n        }\n\n        if (md.DeclaringType != null && md.DeclaringType.IsGenericTypeDefinition())\n        {\n            return true;\n        }\n\n        if (md.ReturnType.IsGenericTypeDefinition())\n        {\n            return true;\n        }\n\n        foreach (var param in md.Parameters)\n        {\n            if (param.ParameterType.IsGenericTypeDefinition())\n            {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    public static bool GotPassedByReferenceParam(this MethodReference md)\n    {\n        return md.Parameters.Any(param => param.ParameterType.IsByReference);\n    }\n\n    public static TypeReference MakeGenericType(this TypeReference self, params TypeReference[] arguments)\n    {\n        if (self.GenericParameters.Count != arguments.Length)\n        {\n            throw new ArgumentException();\n        }\n\n        var instance = new GenericInstanceType(self);\n        foreach (var argument in arguments)\n        {\n            instance.GenericArguments.Add(argument);\n        }\n\n        return instance;\n    }\n\n    public static MethodReference MakeGenericMethod(this MethodReference self, params TypeReference[] arguments)\n    {\n        if (self.DeclaringType.IsGenericTypeDefinition())\n        {\n            return self.CloneMethod(self.DeclaringType.MakeGenericType(arguments));\n        }\n        else\n        {\n            var genericInstanceMethod = new GenericInstanceMethod(self.CloneMethod());\n\n            foreach (var argument in arguments)\n            {\n                genericInstanceMethod.GenericArguments.Add(argument);\n            }\n\n            return genericInstanceMethod;\n        }\n    }\n\n    public static MethodReference CloneMethod(this MethodReference self, TypeReference declaringType = null)\n    {\n        var reference = new MethodReference(self.Name, self.ReturnType, declaringType ?? self.DeclaringType)\n        {\n            HasThis = self.HasThis,\n            ExplicitThis = self.ExplicitThis,\n            CallingConvention = self.CallingConvention,\n        };\n\n        foreach (ParameterDefinition parameterDef in self.Parameters)\n        {\n            reference.Parameters.Add(new ParameterDefinition(parameterDef.Name, parameterDef.Attributes, parameterDef.ParameterType));\n        }\n\n        foreach (GenericParameter genParamDef in self.GenericParameters)\n        {\n            reference.GenericParameters.Add(new GenericParameter(genParamDef.Name, reference));\n        }\n\n        return reference;\n    }\n\n    public static bool IsEnumerator(this MethodDefinition md)\n    {\n        return md.ReturnType.FullName == \"System.Collections.IEnumerator\";\n    }\n\n    public static bool ReturnVoid(this MethodDefinition target)\n    {\n        return target.ReturnType.FullName == \"System.Void\";\n    }\n\n    public static bool HasFlag(this LuaInterface.InjectType flag, LuaInterface.InjectType destFlag)\n    {\n        return (flag & destFlag) == destFlag;\n    }\n\n    public static bool HasFlag(this LuaInterface.InjectType flag, byte destFlag)\n    {\n        return ((byte)flag & destFlag) == destFlag;\n    }\n\n    public static bool HasFlag(this InjectFilter flag, InjectFilter destFlag)\n    {\n        return (flag & destFlag) == destFlag;\n    }\n\n    public static string GetPrimitiveTypeStr(TypeReference t, bool bFull)\n    {\n        switch (t.MetadataType)\n        {\n            case MetadataType.Single:\n                return \"float\";\n            case MetadataType.String:\n                return \"string\";\n            case MetadataType.Int32:\n                return \"int\";\n            case MetadataType.Double:\n                return \"double\";\n            case MetadataType.Boolean:\n                return \"bool\";\n            case MetadataType.UInt32:\n                return \"uint\";\n            case MetadataType.SByte:\n                return \"sbyte\";\n            case MetadataType.Byte:\n                return \"byte\";\n            case MetadataType.Int16:\n                return \"short\";\n            case MetadataType.UInt16:\n                return \"ushort\";\n            case MetadataType.Char:\n                return \"char\";\n            case MetadataType.Int64:\n                return \"long\";\n            case MetadataType.UInt64:\n                return \"ulong\";\n            case MetadataType.Object:\n                return \"object\";\n            default:\n                return bFull ? t.FullName.Replace(\"/\", \"+\") : t.Name;\n        }\n    }\n\n    static string CombineTypeStr(string space, string name)\n    {\n        if (string.IsNullOrEmpty(space))\n        {\n            return name;\n        }\n        else\n        {\n            return space + \".\" + name;\n        }\n    }\n\n    static string GetGenericName(TypeReference t, bool bFull)\n    {\n        GenericInstanceType type = t as GenericInstanceType;\n        var gArgs = type.GenericArguments;\n\n        string typeName = bFull ? t.FullName.Replace(\"/\", \"+\") : t.Name;\n        int count = gArgs.Count;\n        int pos = typeName.IndexOf(\"[\");\n\n        if (pos > 0)\n        {\n            typeName = typeName.Substring(0, pos);\n        }\n\n        string str = null;\n        string name = null;\n        int offset = 0;\n        pos = typeName.IndexOf(\"+\");\n\n        while (pos > 0)\n        {\n            str = typeName.Substring(0, pos);\n            typeName = typeName.Substring(pos + 1);\n            pos = str.IndexOf('`');\n\n            if (pos > 0)\n            {\n                count = (int)(str[pos + 1] - '0');\n                str = str.Substring(0, pos);\n                str += \"<\" + string.Join(\",\", GetGenericName(gArgs, offset, count, bFull)) + \">\";\n                offset += count;\n            }\n\n            name = CombineTypeStr(name, str);\n            pos = typeName.IndexOf(\"+\");\n        }\n\n        str = typeName;\n\n        if (offset < gArgs.Count)\n        {\n            pos = str.IndexOf('`');\n            count = (int)(str[pos + 1] - '0');\n            str = str.Substring(0, pos);\n            str += \"<\" + string.Join(\",\", GetGenericName(gArgs, offset, count, bFull)) + \">\";\n        }\n\n        return CombineTypeStr(name, str);\n    }\n\n    public static void Foreach<T>(this IEnumerable<T> source, Action<T> callback)\n    {\n        foreach (var val in source)\n        {\n            callback(val);\n        }\n    }\n}\n#endif"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/ToLuaInjectionHelper.cs.meta",
    "content": "fileFormatVersion: 2\nguid: dce8c9cb062a97740b01381922e799a1\ntimeCreated: 1513238253\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/ToLuaText.cs",
    "content": "﻿using System;\nusing System.Text;\nusing System.Reflection;\nusing System.Collections.Generic;\n\npublic interface LuaSerialization\n{\n    bool Serialize(StringBuilder sb, int indent);\n    //void UnSerilize(IntPtr L);\n}\n\npublic static class ToLuaText\n{\n    static Type listTypeDefinition = typeof(List<>);\n    static Type dictionaryTypeDefinition = typeof(Dictionary<,>);\n    static MethodInfo customTransferGenericMethod;\n    static MethodInfo listTransferGenericMethod;\n    static MethodInfo arrayTransferGenericMethod;\n    static MethodInfo dictionaryTransferGenericMethod;\n\n    static ToLuaText()\n    {\n        var classType = typeof(ToLuaText);\n        customTransferGenericMethod = classType.GetMethod(\"TransferCustomData\", BindingFlags.Static | BindingFlags.NonPublic);\n        listTransferGenericMethod = classType.GetMethod(\"TransferList\");\n        arrayTransferGenericMethod = classType.GetMethod(\"TransferArray\");\n        dictionaryTransferGenericMethod = classType.GetMethod(\"TransferDic\");\n    }\n\n    public static bool TransferList<T>(List<T> list, StringBuilder sb, int indent = 0)\n    {\n        return TransferArray<T>(list.ToArray(), sb, indent);\n    }\n\n    public static bool TransferArray<T>(T[] array, StringBuilder sb, int indent = 0)\n    {\n        bool bSerializeSuc = false;\n        int validContentLength = sb.Length;\n\n        NestBegin(sb, indent);\n\n        if (array.Length <= 0)\n        {\n            bSerializeSuc = false;\n            WipeInvalidContent(sb, validContentLength);\n            return bSerializeSuc;\n        }\n\n        foreach (var item in array)\n        {\n            if (SerializeData(sb, indent, item))\n                bSerializeSuc = true;\n        }\n\n        if (!IsCommonData(typeof(T)))\n            sb.Append(\"\\n\");\n        else\n            sb.Remove(sb.Length - 2, 2);///移除最后一个\", \"字符组,为了部分满足强迫症\n\n        if (bSerializeSuc)\n            NestEnd(sb, indent);\n        else\n            WipeInvalidContent(sb, validContentLength);\n\n        return bSerializeSuc;\n    }\n\n    public static bool TransferDic<T, U>(Dictionary<T, U> dic, StringBuilder sb, int indent = 0)\n    {\n        var keyType = typeof(T);\n        bool bSerializeSuc = false;\n        int validContentLength = sb.Length;\n\n        NestBegin(sb, indent);\n\n        if (dic.Count <= 0/* || !IsDataTypeSerializable(keyType)*/)\n        {\n            bSerializeSuc = false;\n            WipeInvalidContent(sb, validContentLength);\n            return bSerializeSuc;\n        }\n\n        string keyDataFormat = keyType == typeof(string) ? \"[\\\"{0}\\\"] = \" : \"[{0}] = \";\n\n        ++indent;\n        foreach (var item in dic)\n        {\n            int tempValidContentLength = sb.Length;\n            sb.Append(\"\\n\");\n            AppendIndent(sb, indent);\n            /// 不管是不是自定义数据，只要tostring能用就行\n            sb.AppendFormat(keyDataFormat, item.Key);\n\n            if (SerializeData(sb, indent, item.Value))\n                bSerializeSuc = true;\n            else\n                WipeInvalidContent(sb, tempValidContentLength);\n        }\n        --indent;\n\n        sb.Append(\"\\n\");\n        if (bSerializeSuc)\n            NestEnd(sb, indent);\n        else\n            WipeInvalidContent(sb, validContentLength);\n\n        return bSerializeSuc;\n    }\n\n    public static MethodInfo MakeGenericArrayTransferMethod(Type type)\n    {\n        return arrayTransferGenericMethod.MakeGenericMethod(new Type[] { type });\n    }\n\n    public static void AppendIndent(StringBuilder sb, int indent)\n    {\n        for (int i = 0; i < indent; ++i)\n            sb.Append(\"\\t\");\n    }\n\n    public static void AppendValue(Type valueType, string value, StringBuilder sb)\n    {\n        string dataFormat = valueType == typeof(string) ? \"\\\"{0}\\\", \" : \"{0}, \";\n        sb.AppendFormat(dataFormat, value.Replace(\"\\n\", @\"\\n\").Replace(\"\\\"\", @\"\\\"\"\"));\n    }\n\n    public static void WipeInvalidContent(StringBuilder sb, int validLength)\n    {\n        sb.Remove(validLength, sb.Length - validLength);\n    }\n\n    static bool TransferCustomData<T>(T data, StringBuilder sb, int indent = 0) where T : LuaSerialization\n    {\n        LuaSerialization serializor = data as LuaSerialization;\n        return serializor.Serialize(sb, indent);\n    }\n\n    static bool SerializeNestData<T>(StringBuilder sb, int indent, T data, MethodInfo transferMethod)\n    {\n        bool bSerializeSuc = false;\n        int validContentLength = sb.Length;\n\n        if (transferMethod != null)\n        {\n            ++indent;\n            sb.Append(\"\\n\");\n            bSerializeSuc = (bool)transferMethod.Invoke(null, new object[] { data, sb, indent });\n            if (!bSerializeSuc)\n                WipeInvalidContent(sb, validContentLength);\n            --indent;\n        }\n\n        return bSerializeSuc;\n    }\n\n    static bool SerializeData<T>(StringBuilder sb, int indent, T Data)\n    {\n        Type dataType = typeof(T);\n        bool bSerializeSuc = false;\n\n        if (dataType.IsPrimitive || dataType == typeof(string))\n        {\n            AppendValue(dataType, Data.ToString(), sb);\n            bSerializeSuc = true;\n        }\n        else\n        {\n            MethodInfo nestEleTranferMethod = GetCollectionTransferMethod(dataType);\n            bSerializeSuc = SerializeNestData(sb, indent, Data, nestEleTranferMethod);\n        }\n\n        return bSerializeSuc;\n    }\n\n    static MethodInfo GetCollectionTransferMethod(Type collectionType)\n    {\n        MethodInfo method = null;\n\n        if (typeof(LuaSerialization).IsAssignableFrom(collectionType))\n            method = customTransferGenericMethod.MakeGenericMethod(collectionType);\n        else if (collectionType.GetGenericTypeDefinition() == dictionaryTypeDefinition)\n            method = dictionaryTransferGenericMethod.MakeGenericMethod(collectionType.GetGenericArguments());\n        else if (collectionType.GetGenericTypeDefinition() == listTypeDefinition)\n            method = listTransferGenericMethod.MakeGenericMethod(collectionType.GetGenericArguments());\n        else if (collectionType.IsArray)\n            method = arrayTransferGenericMethod.MakeGenericMethod(new Type[] { collectionType.GetElementType() });\n\n        return method;\n    }\n\n    static void NestBegin(StringBuilder sb, int indent)\n    {\n        AppendIndent(sb, indent);\n        sb.Append(\"{\");\n    }\n\n    static void NestEnd(StringBuilder sb, int indent)\n    {\n        AppendIndent(sb, indent);\n        sb.Append(\"},\");\n    }\n\n    static bool IsDataTypeSerializable(Type type)\n    {\n        if (type != typeof(int) && type != typeof(string))\n        {\n            Console.ForegroundColor = ConsoleColor.Red;\n            Console.WriteLine(string.Format(\"Can't Serialize Specify Data Type : {0} To Lua\", type));\n            return false;\n        }\n\n        return true;\n    }\n\n    static bool IsCommonData(Type type)\n    {\n        if (type == typeof(string) || type.IsPrimitive)\n            return true;\n\n        return false;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/ToLuaText.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5de9ab9717d9977429063071523fae1a\ntimeCreated: 1513060947\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/ToluaInjectionBlackListPanel.cs",
    "content": "﻿using System;\nusing System.Xml;\nusing System.IO;\nusing System.Linq;\nusing UnityEngine;\nusing UnityEditor;\nusing System.Reflection;\nusing UnityEditorInternal;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\npublic class InjectionBlackListGenerator : EditorWindow\n{\n    public static string blackListFilePath = CustomSettings.injectionFilesPath + \"InjectionBlackList.txt\";\n    public static Action onBlackListGenerated;\n\n    static string pathsInfoSavedPath;\n    static HashSet<string> specifiedDropType = new HashSet<string>\n    {\n    };\n    const string nestRegex = @\"     (?<=\n                                        (?<!/{2,}.*)                #Ignore Comment\n                                    )\n                                    (\n                                        (?<=class\\s+)               #Capture class name\n                                        (\\b(\\w+)\\b)\n                                        |\n                                        (?<=struct\\s+)              #Capture struct name\n                                        (\\b(\\w+)\\b)\n                                        |\n                                        (?<=namespace\\s+)           #Capture namespace name\n                                        ((\\b(\\w+)\\b\\.?){1,})\n                                    )\";/// match class or struct\n    const string namespaceRegex = @\"(?<=\n                                        (?<=\n                                            (?<!/{2,}.*)            #Ignore Comment\n                                        )\n                                        namespace\\s+\n                                    )\";/// match namespace Name\n    List<string> paths;\n    ReorderableList pathUIList;\n    Vector2 scrollPosition = Vector2.zero;\n    HashSet<string> blackList = new HashSet<string>();\n    Dictionary<string, System.Action<HashSet<string>, string>> assetExtentions = new Dictionary<string, System.Action<HashSet<string>, string>>\n    {\n        { \"*.cs\", SearchTypeInCSFile },\n        { \"*.dll\", SearchTypeInAssembly },\n    };\n\n#if ENABLE_LUA_INJECTION\n    [MenuItem(\"Lua/Generate LuaInjection BlackList\")]\n#endif\n    public static void Open()\n    {\n        GetWindow<InjectionBlackListGenerator>(\"LuaInjection\", true);\n    }\n\n    void OnListHeaderGUI(Rect rect)\n    {\n        EditorGUI.LabelField(rect, \"Scripts Path\");\n    }\n\n    void OnListElementGUI(Rect rect, int index, bool isactive, bool isfocused)\n    {\n        const float GAP = 5;\n\n        string info = paths[index];\n        rect.y++;\n\n        Rect r = rect;\n        r.width = 16;\n        r.height = 18;\n        r.xMin = r.xMax + GAP;\n        r.xMax = rect.xMax - 50 - GAP;\n        GUI.enabled = false;\n        info = GUI.TextField(r, info);\n        GUI.enabled = true;\n\n        r.xMin = r.xMax + GAP;\n        r.width = 50;\n        if (GUI.Button(r, \"Select\"))\n        {\n            var path = SelectFolder();\n            if (path != null)\n            {\n                paths[index] = path;\n            }\n        }\n    }\n\n    string SelectFolder()\n    {\n        string dataPath = Application.dataPath;\n        string selectedPath = EditorUtility.OpenFolderPanel(\"Path\", dataPath, \"\");\n        if (!string.IsNullOrEmpty(selectedPath))\n        {\n            return GetRelativePath(selectedPath);\n        }\n        return null;\n    }\n\n    string GetRelativePath(string absolutePath)\n    {\n        if (absolutePath.StartsWith(Application.dataPath))\n        {\n            return \"Assets/\" + absolutePath.Substring(Application.dataPath.Length + 1);\n        }\n        else\n        {\n            ShowNotification(new GUIContent(\"不能在Assets目录之外!\"));\n        }\n        return null;\n    }\n\n    void AddNewPath()\n    {\n        string path = SelectFolder();\n        if (!string.IsNullOrEmpty(path))\n        {\n            paths.Add(path);\n        }\n    }\n\n    void InitFilterListDrawer()\n    {\n        if (pathUIList != null)\n        {\n            return;\n        }\n\n        pathUIList = new ReorderableList(paths, typeof(string));\n        pathUIList.drawElementCallback = OnListElementGUI;\n        pathUIList.drawHeaderCallback = OnListHeaderGUI;\n        pathUIList.draggable = true;\n        pathUIList.elementHeight = 22;\n        pathUIList.onAddCallback = (list) => AddNewPath();\n    }\n\n    void OnGUI()\n    {\n        InitPathsInfo();\n        InitFilterListDrawer();\n\n        bool execGenerate = false;\n        GUILayout.BeginHorizontal(EditorStyles.toolbar);\n        {\n            if (GUILayout.Button(\"Add\", EditorStyles.toolbarButton))\n            {\n                AddNewPath();\n            }\n            if (GUILayout.Button(\"Save\", EditorStyles.toolbarButton))\n            {\n                SavePathsInfo();\n            }\n            GUILayout.FlexibleSpace();\n            if (GUILayout.Button(\"Generate\", EditorStyles.toolbarButton))\n            {\n                execGenerate = true;\n            }\n        }\n        GUILayout.EndHorizontal();\n\n        GUILayout.BeginVertical();\n        {\n            scrollPosition = GUILayout.BeginScrollView(scrollPosition);\n            {\n                pathUIList.DoLayoutList();\n            }\n            GUILayout.EndScrollView();\n        }\n        GUILayout.EndVertical();\n\n        if (execGenerate)\n        {\n            Generate();\n            Close();\n        }\n    }\n\n    void Generate()\n    {\n        if (paths.Count == 0)\n        {\n            EditorUtility.DisplayDialog(\"提示\", \"没有选中任何可跳过的路径\", \"确定\");\n            return;\n        }\n        blackList.Clear();\n\n        foreach (var path in paths)\n        {\n            foreach (var extention in assetExtentions)\n            {\n                var files = from fileName in Directory.GetFiles(path, extention.Key, SearchOption.AllDirectories)\n                            let validFullFileName = fileName.Replace(\"\\\\\", \"/\")\n                            let bEditorScriptFile = validFullFileName.Contains(\"/Editor/\")\n                            //let bToluaGeneratedFile = validFullFileName.Contains(\"/GenerateWrapFiles/\")\n                            where !bEditorScriptFile /*&& !bToluaGeneratedFile*/\n                            select validFullFileName;\n\n                int index = 0;\n                foreach (var fileFullPath in files)\n                {\n                    EditorUtility.DisplayProgressBar(\"Searching\", fileFullPath, (float)index / files.Count());\n                    extention.Value(blackList, fileFullPath);\n                    ++index;\n                }\n                EditorUtility.ClearProgressBar();\n            }\n        }\n\n        blackList.UnionWith(specifiedDropType);\n        SaveBlackList();\n        SavePathsInfo();\n\n        if (onBlackListGenerated != null)\n        {\n            onBlackListGenerated();\n        }\n        onBlackListGenerated = null;\n        Debug.Log(\"BlackList Generated!!!\");\n    }\n\n    static void SearchTypeInCSFile(HashSet<string> typeSet, string fileFullPath)\n    {\n        var fileContent = File.ReadAllText(fileFullPath);\n        if (string.IsNullOrEmpty(fileContent))\n        {\n            return;\n        }\n\n        int nestCount = 0;\n        int lastTypeMatchedIndex = 0;\n        Stack<int> nestIndexStack = new Stack<int>();\n        Stack<string> nestStack = new Stack<string>();\n\n        var matchResult = Regex.Match(fileContent, nestRegex, RegexOptions.IgnorePatternWhitespace);\n        while (matchResult.Success)\n        {\n            string typeName = matchResult.Value;\n            if (string.IsNullOrEmpty(typeName))\n            {\n                matchResult = matchResult.NextMatch();\n                continue;\n            }\n\n            lastTypeMatchedIndex = nestIndexStack.Count > 0 ? nestIndexStack.Peek() : 0;\n            string matchSubString = fileContent.Substring(lastTypeMatchedIndex, matchResult.Index - lastTypeMatchedIndex);\n            var beginBraceMatchResult = Regex.Matches(matchSubString, \"(?<!/{2,}.*){\");\n            var endBraceMatchResult = Regex.Matches(matchSubString, \"(?<!/{2,}.*)}\");\n            int compareTag = beginBraceMatchResult.Count - endBraceMatchResult.Count;\n            bool bNamespaceMatched = Regex.IsMatch(matchSubString, namespaceRegex, RegexOptions.IgnorePatternWhitespace);\n            nestIndexStack.Push(matchResult.Index);\n\n            if (compareTag == 0)\n            {\n                nestStack.Clear();\n                nestCount = 0;\n            }\n            else if (compareTag >= nestCount)\n            {\n                if (compareTag == nestCount)\n                {\n                    nestStack.Pop();\n                }\n                if (compareTag > nestCount)\n                {\n                    nestCount++;\n                }\n                nestIndexStack.Pop();\n            }\n            else if (compareTag < nestCount && compareTag > 0)\n            {\n                int searchedStackCount = nestStack.Count - compareTag;\n                for (int i = 0; i < searchedStackCount; ++i)\n                {\n                    nestStack.Pop();\n                }\n                nestCount = nestStack.Count;\n                if (nestCount > 0)\n                {\n                    nestIndexStack.Pop();\n                }\n            }\n\n            string prefix = \"\";\n            foreach (var name in nestStack)\n            {\n                prefix = name + prefix;\n            }\n            string typeFullName = prefix + typeName;\n            if (!typeSet.Contains(typeFullName) && !bNamespaceMatched)\n            {\n                typeSet.Add(typeFullName);\n            }\n\n            string nestTag = (bNamespaceMatched ? \".\" : \"+\");\n            nestStack.Push(typeName + nestTag);\n            matchResult = matchResult.NextMatch();\n        }\n    }\n\n    static void SearchTypeInAssembly(HashSet<string> typeSet, string assemblyPath)\n    {\n        Assembly assembly = null;\n        try\n        {\n            assembly = Assembly.LoadFile(assemblyPath);\n        }\n        catch { }\n\n        if (assembly == null)\n        {\n            return;\n        }\n\n        try\n        {\n            foreach (Type t in assembly.GetTypes())\n            {\n                bool bNotPrimitiveType = t.IsClass || (t.IsValueType && !t.IsPrimitive && !t.IsEnum);\n                bool bCustomType = bNotPrimitiveType && !t.FullName.Contains(\"<\");\n                if (bCustomType && !typeSet.Contains(t.FullName) && !t.ContainsGenericParameters)\n                {\n                    typeSet.Add(t.FullName);\n                }\n            }\n        }\n        catch (Exception e)\n        {\n            Debug.LogError(e.ToString());\n        }\n    }\n\n    void InitPathsInfo()\n    {\n        if (pathsInfoSavedPath == null)\n        {\n            pathsInfoSavedPath = CustomSettings.injectionFilesPath + \"LuaInjectionSkipPaths.txt\";\n        }\n        if (paths != null)\n        {\n            return;\n        }\n\n        if (File.Exists(pathsInfoSavedPath))\n        {\n            paths = new List<string>(File.ReadAllLines(pathsInfoSavedPath));\n        }\n        else\n        {\n            paths = new List<string>();\n            string toluaPath = GetRelativePath(CustomSettings.injectionFilesPath.Substring(0, CustomSettings.injectionFilesPath.Length - \"Injection/\".Length));\n            paths.Add(toluaPath + \"Core/\");\n            paths.Add(toluaPath + \"Injection/\");\n            paths.Add(toluaPath + \"Misc/\");\n            paths.Add(toluaPath + \"Injection/\");\n            paths.Add(toluaPath + \"Misc/\");\n            paths.Add(Application.dataPath + \"/Plugins/\");\n            paths.Add(CustomSettings.toluaBaseType);\n            paths.Add(GetRelativePath(CustomSettings.saveDir));\n        }\n    }\n\n    void SavePathsInfo()\n    {\n        File.WriteAllLines(pathsInfoSavedPath, paths.ToArray());\n        AssetDatabase.Refresh();\n    }\n\n    void SaveBlackList()\n    {\n        try\n        {\n            if (File.Exists(blackListFilePath))\n            {\n                File.Delete(blackListFilePath);\n            }\n            File.WriteAllLines(blackListFilePath, blackList.ToArray());\n        }\n        catch (Exception e)\n        {\n            Debug.LogError(e.ToString());\n        }\n\n        AssetDatabase.Refresh();\n    }\n}"
  },
  {
    "path": "Assets/ToLua/Injection/Editor/ToluaInjectionBlackListPanel.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 55ebe04f71192174990387365881eac4\ntimeCreated: 1512567263\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 408aa6da49448a544942370044596d77\nfolderAsset: yes\ntimeCreated: 1515031012\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/InjectionBlackList.txt",
    "content": "LuaInterface.MonoPInvokeCallbackAttribute\nLuaInterface.NoToLuaAttribute\nLuaInterface.UseDefinedAttribute\nLuaInterface.OverrideDefinedAttribute\nLuaInterface.LuaByteBufferAttribute\nLuaInterface.LuaRenameAttribute\nLuaInterface.LuaBaseRef\nLuaInterface.LuaBeatEvent\nLuaInterface.LuaIndexes\nLuaInterface.LuaRIDX\nLuaInterface.ToLuaFlags\nLuaInterface.Lua_Debug\nLuaInterface.LuaDLL\nLuaInterface.LuaEvent\nLuaInterface.LuaException\nLuaInterface.LuaFileUtils\nLuaInterface.LuaFunction\nLuaInterface.LuaFunction+FuncData\nLuaInterface.LuaMatchType\nLuaInterface.LuaMethodCache\nLuaInterface.GCRef\nLuaInterface.LuaByteBuffer\nLuaInterface.LuaOut\nLuaInterface.NullObject\nLuaInterface.nil\nLuaInterface.LuaDelegate\nLuaInterface.LuaMisc\nLuaInterface.LuaInteger64\nLuaInterface.TouchBits\nLuaInterface.RaycastBits\nLuaInterface.EventObject\nLuaInterface.LuaStackOp\nLuaInterface.LuaState\nLuaInterface.LuaStatePtr\nLuaInterface.LuaStatic\nLuaInterface.LuaTable\nLuaInterface.LuaArrayTable\nLuaInterface.LuaArrayTable+Enumerator\nLuaInterface.LuaDictTable\nLuaInterface.LuaDictTable+Enumerator\nLuaInterface.LuaDictEntry\nLuaInterface.LuaThread\nLuaInterface.LuaUnityLibs\nLuaInterface.LuaValueType\nLuaInterface.LuaValueTypeName\nLuaInterface.LuaObjectPool\nLuaInterface.LuaObjectPool+PoolNode\nLuaInterface.ObjectTranslator\nLuaInterface.ObjectTranslator+DelayGC\nLuaInterface.ObjectTranslator+CompareObject\nLuaInterface.ToLua\nLuaInterface.TypeChecker\nLuaInterface.TypeTraits\nLuaInterface.DelegateTraits\nLuaInterface.StackTraits\nLuaInterface.LuaInjectionStation\nLuaClient\nLuaCoroutine\nLuaLooper\nLuaProfiler\nLuaResLoader\nCString\nExtensionLibs\nNumberFormatter\nStringPool\nCString+CStringBlock\nNumberFormatter+CustomInfo\nConstStringTable\nLuaInterface.Debugger\nLuaInterface.ExtensionMethods\nLuaInterface.StringBuilderCache\nLuaInterface_EventObjectWrap\nLuaInterface_LuaConstructorWrap\nLuaInterface_LuaFieldWrap\nLuaInterface_LuaMethodWrap\nLuaInterface_LuaOutWrap\nLuaInterface_LuaPropertyWrap\nSystem_ArrayWrap\nSystem_Collections_Generic_DictionaryWrap\nSystem_Collections_Generic_Dictionary_KeyCollectionWrap\nSystem_Collections_Generic_Dictionary_ValueCollectionWrap\nSystem_Collections_Generic_KeyValuePairWrap\nSystem_Collections_Generic_ListWrap\nSystem_Collections_IEnumeratorWrap\nSystem_Collections_ObjectModel_ReadOnlyCollectionWrap\nSystem_DelegateWrap\nSystem_EnumWrap\nSystem_NullObjectWrap\nSystem_ObjectWrap\nSystem_StringWrap\nSystem_TypeWrap\nUnityEngine_CoroutineWrap\nUnityEngine_ObjectWrap\nDelegateFactory\nLuaBinder\nLuaInterface_DebuggerWrap\nUnityEngine_AnimationBlendModeWrap\nUnityEngine_AnimationClipWrap\nUnityEngine_AnimationStateWrap\nUnityEngine_AnimationWrap\nUnityEngine_AnimatorWrap\nUnityEngine_ApplicationWrap\nUnityEngine_AssetBundleWrap\nUnityEngine_AsyncOperationWrap\nUnityEngine_AudioClipWrap\nUnityEngine_AudioSourceWrap\nUnityEngine_BehaviourWrap\nUnityEngine_BlendWeightsWrap\nUnityEngine_BoxColliderWrap\nUnityEngine_CameraClearFlagsWrap\nUnityEngine_CameraWrap\nUnityEngine_CapsuleColliderWrap\nUnityEngine_CharacterControllerWrap\nUnityEngine_ColliderWrap\nUnityEngine_ComponentWrap\nUnityEngine_Experimental_Director_DirectorPlayerWrap\nUnityEngine_GameObjectWrap\nUnityEngine_InputWrap\nUnityEngine_KeyCodeWrap\nUnityEngine_LightTypeWrap\nUnityEngine_LightWrap\nUnityEngine_MaterialWrap\nUnityEngine_MeshColliderWrap\nUnityEngine_MeshRendererWrap\nUnityEngine_MonoBehaviourWrap\nUnityEngine_ParticleSystemWrap\nUnityEngine_PhysicsWrap\nUnityEngine_PlayModeWrap\nUnityEngine_QualitySettingsWrap\nUnityEngine_QueueModeWrap\nUnityEngine_RendererWrap\nUnityEngine_RenderSettingsWrap\nUnityEngine_RenderTextureWrap\nUnityEngine_ResourcesWrap\nUnityEngine_RigidbodyWrap\nUnityEngine_ScreenWrap\nUnityEngine_ShaderWrap\nUnityEngine_SkinnedMeshRendererWrap\nUnityEngine_SleepTimeoutWrap\nUnityEngine_SpaceWrap\nUnityEngine_SphereColliderWrap\nUnityEngine_Texture2DWrap\nUnityEngine_TextureWrap\nUnityEngine_TimeWrap\nUnityEngine_TrackedReferenceWrap\nUnityEngine_TransformWrap\nUnityEngine_WrapModeWrap\nUnityEngine_WWWWrap\n"
  },
  {
    "path": "Assets/ToLua/Injection/InjectionBlackList.txt.meta",
    "content": "fileFormatVersion: 2\nguid: 449a10dea407bc04ea1bbb6f9d42bbd8\ntimeCreated: 1515037624\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/InjectionBridgeEditorInfo.xml",
    "content": "<Root>\n  <Type Name=\"AccessingArray\">\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void AccessingArray::OnApplicationQuit()\" Index=\"54\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void AccessingArray::OnGUI()\" Index=\"53\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void AccessingArray::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"52\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void AccessingArray::Start()\" Index=\"51\" />\n  </Type>\n  <Type Name=\"AccessingEnum\">\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void AccessingEnum::OnApplicationQuit()\" Index=\"104\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void AccessingEnum::OnGUI()\" Index=\"106\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void AccessingEnum::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"105\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void AccessingEnum::Start()\" Index=\"103\" />\n  </Type>\n  <Type Name=\"AccessingLuaVariables\">\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void AccessingLuaVariables::OnApplicationQuit()\" Index=\"32\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void AccessingLuaVariables::OnGUI()\" Index=\"34\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void AccessingLuaVariables::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"33\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void AccessingLuaVariables::Start()\" Index=\"31\" />\n  </Type>\n  <Type Name=\"BaseTest\">\n    <Method Name=\"get_PropertyTest\" PublishedName=\"get_PropertyTest\" Signature=\"get_PropertyTest\" FullSignature=\"System.Int32 BaseTest::get_PropertyTest()\" Index=\"259\" />\n    <Method Name=\"set_PropertyTest\" PublishedName=\"set_PropertyTest\" Signature=\"set_PropertyTest-int\" FullSignature=\"System.Void BaseTest::set_PropertyTest(System.Int32)\" Index=\"260\" />\n    <Method Name=\"TestRef\" PublishedName=\"TestRef\" Signature=\"TestRef-int&amp;\" FullSignature=\"System.Int32 BaseTest::TestRef(System.Int32&amp;)\" Index=\"258\" />\n  </Type>\n  <Type Name=\"BaseTestWrap\">\n    <Method Name=\"_CreateBaseTest\" PublishedName=\"_CreateBaseTest\" Signature=\"_CreateBaseTest-IntPtr\" FullSignature=\"System.Int32 BaseTestWrap::_CreateBaseTest(System.IntPtr)\" Index=\"254\" />\n    <Method Name=\"get_PropertyTest\" PublishedName=\"get_PropertyTest\" Signature=\"get_PropertyTest-IntPtr\" FullSignature=\"System.Int32 BaseTestWrap::get_PropertyTest(System.IntPtr)\" Index=\"256\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void BaseTestWrap::Register(LuaInterface.LuaState)\" Index=\"253\" />\n    <Method Name=\"set_PropertyTest\" PublishedName=\"set_PropertyTest\" Signature=\"set_PropertyTest-IntPtr\" FullSignature=\"System.Int32 BaseTestWrap::set_PropertyTest(System.IntPtr)\" Index=\"257\" />\n    <Method Name=\"TestRef\" PublishedName=\"TestRef\" Signature=\"TestRef-IntPtr\" FullSignature=\"System.Int32 BaseTestWrap::TestRef(System.IntPtr)\" Index=\"255\" />\n  </Type>\n  <Type Name=\"CallLuaFunction\">\n    <Method Name=\"CallFunc\" PublishedName=\"CallFunc\" Signature=\"CallFunc\" FullSignature=\"System.Int32 CallLuaFunction::CallFunc()\" Index=\"30\" />\n    <Method Name=\"OnDestroy\" PublishedName=\"OnDestroy\" Signature=\"OnDestroy\" FullSignature=\"System.Void CallLuaFunction::OnDestroy()\" Index=\"29\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void CallLuaFunction::OnGUI()\" Index=\"28\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void CallLuaFunction::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"27\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void CallLuaFunction::Start()\" Index=\"26\" />\n  </Type>\n  <Type Name=\"HelloWorld\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void HelloWorld::Awake()\" Index=\"21\" />\n  </Type>\n  <Type Name=\"LuaInterface_InjectTypeWrap\">\n    <Method Name=\"CheckType\" PublishedName=\"CheckType\" Signature=\"CheckType-IntPtr-int\" FullSignature=\"System.Boolean LuaInterface_InjectTypeWrap::CheckType(System.IntPtr,System.Int32)\" Index=\"3\" />\n    <Method Name=\"get_After\" PublishedName=\"get_After\" Signature=\"get_After-IntPtr\" FullSignature=\"System.Int32 LuaInterface_InjectTypeWrap::get_After(System.IntPtr)\" Index=\"5\" />\n    <Method Name=\"get_Before\" PublishedName=\"get_Before\" Signature=\"get_Before-IntPtr\" FullSignature=\"System.Int32 LuaInterface_InjectTypeWrap::get_Before(System.IntPtr)\" Index=\"6\" />\n    <Method Name=\"get_None\" PublishedName=\"get_None\" Signature=\"get_None-IntPtr\" FullSignature=\"System.Int32 LuaInterface_InjectTypeWrap::get_None(System.IntPtr)\" Index=\"4\" />\n    <Method Name=\"get_Replace\" PublishedName=\"get_Replace\" Signature=\"get_Replace-IntPtr\" FullSignature=\"System.Int32 LuaInterface_InjectTypeWrap::get_Replace(System.IntPtr)\" Index=\"7\" />\n    <Method Name=\"get_ReplaceWithPostInvokeBase\" PublishedName=\"get_ReplaceWithPostInvokeBase\" Signature=\"get_ReplaceWithPostInvokeBase-IntPtr\" FullSignature=\"System.Int32 LuaInterface_InjectTypeWrap::get_ReplaceWithPostInvokeBase(System.IntPtr)\" Index=\"9\" />\n    <Method Name=\"get_ReplaceWithPreInvokeBase\" PublishedName=\"get_ReplaceWithPreInvokeBase\" Signature=\"get_ReplaceWithPreInvokeBase-IntPtr\" FullSignature=\"System.Int32 LuaInterface_InjectTypeWrap::get_ReplaceWithPreInvokeBase(System.IntPtr)\" Index=\"8\" />\n    <Method Name=\"IntToEnum\" PublishedName=\"IntToEnum\" Signature=\"IntToEnum-IntPtr\" FullSignature=\"System.Int32 LuaInterface_InjectTypeWrap::IntToEnum(System.IntPtr)\" Index=\"10\" />\n    <Method Name=\"Push\" PublishedName=\"Push\" Signature=\"Push-IntPtr-InjectType\" FullSignature=\"System.Void LuaInterface_InjectTypeWrap::Push(System.IntPtr,LuaInterface.InjectType)\" Index=\"2\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void LuaInterface_InjectTypeWrap::Register(LuaInterface.LuaState)\" Index=\"1\" />\n  </Type>\n  <Type Name=\"LuaInterface_LuaInjectionStationWrap\">\n    <Method Name=\"_CreateLuaInterface_LuaInjectionStation\" PublishedName=\"_CreateLuaInterface_LuaInjectionStation\" Signature=\"_CreateLuaInterface_LuaInjectionStation-IntPtr\" FullSignature=\"System.Int32 LuaInterface_LuaInjectionStationWrap::_CreateLuaInterface_LuaInjectionStation(System.IntPtr)\" Index=\"12\" />\n    <Method Name=\"CacheInjectFunction\" PublishedName=\"CacheInjectFunction\" Signature=\"CacheInjectFunction-IntPtr\" FullSignature=\"System.Int32 LuaInterface_LuaInjectionStationWrap::CacheInjectFunction(System.IntPtr)\" Index=\"13\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void LuaInterface_LuaInjectionStationWrap::Register(LuaInterface.LuaState)\" Index=\"11\" />\n  </Type>\n  <Type Name=\"LuaProfilerWrap\">\n    <Method Name=\"BeginSample\" PublishedName=\"BeginSample\" Signature=\"BeginSample-IntPtr\" FullSignature=\"System.Int32 LuaProfilerWrap::BeginSample(System.IntPtr)\" Index=\"17\" />\n    <Method Name=\"Clear\" PublishedName=\"Clear\" Signature=\"Clear-IntPtr\" FullSignature=\"System.Int32 LuaProfilerWrap::Clear(System.IntPtr)\" Index=\"15\" />\n    <Method Name=\"EndSample\" PublishedName=\"EndSample\" Signature=\"EndSample-IntPtr\" FullSignature=\"System.Int32 LuaProfilerWrap::EndSample(System.IntPtr)\" Index=\"18\" />\n    <Method Name=\"get_list\" PublishedName=\"get_list\" Signature=\"get_list-IntPtr\" FullSignature=\"System.Int32 LuaProfilerWrap::get_list(System.IntPtr)\" Index=\"19\" />\n    <Method Name=\"GetID\" PublishedName=\"GetID\" Signature=\"GetID-IntPtr\" FullSignature=\"System.Int32 LuaProfilerWrap::GetID(System.IntPtr)\" Index=\"16\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void LuaProfilerWrap::Register(LuaInterface.LuaState)\" Index=\"14\" />\n    <Method Name=\"set_list\" PublishedName=\"set_list\" Signature=\"set_list-IntPtr\" FullSignature=\"System.Int32 LuaProfilerWrap::set_list(System.IntPtr)\" Index=\"20\" />\n  </Type>\n  <Type Name=\"PassStruct\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void PassStruct::Awake()\" Index=\"217\" />\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void PassStruct::CallMain()\" Index=\"221\" />\n    <Method Name=\"CheckNullRectType\" PublishedName=\"CheckNullRectType\" Signature=\"CheckNullRectType-IntPtr-int\" FullSignature=\"System.Boolean PassStruct::CheckNullRectType(System.IntPtr,System.Int32)\" Index=\"213\" />\n    <Method Name=\"CheckRectType\" PublishedName=\"CheckRectType\" Signature=\"CheckRectType-IntPtr-int\" FullSignature=\"System.Boolean PassStruct::CheckRectType(System.IntPtr,System.Int32)\" Index=\"212\" />\n    <Method Name=\"CheckRectValue\" PublishedName=\"CheckRectValue\" Signature=\"CheckRectValue-IntPtr-int\" FullSignature=\"UnityEngine.Rect PassStruct::CheckRectValue(System.IntPtr,System.Int32)\" Index=\"211\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils PassStruct::InitLoader()\" Index=\"219\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void PassStruct::OnApplicationQuit()\" Index=\"216\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void PassStruct::OnGUI()\" Index=\"220\" />\n    <Method Name=\"OnLoadFinished\" PublishedName=\"OnLoadFinished\" Signature=\"OnLoadFinished\" FullSignature=\"System.Void PassStruct::OnLoadFinished()\" Index=\"218\" />\n    <Method Name=\"PushRect\" PublishedName=\"PushRect\" Signature=\"PushRect-IntPtr-Rect\" FullSignature=\"System.Void PassStruct::PushRect(System.IntPtr,UnityEngine.Rect)\" Index=\"209\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void PassStruct::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"215\" />\n    <Method Name=\"ToRectTable\" PublishedName=\"ToRectTable\" Signature=\"ToRectTable-IntPtr-int\" FullSignature=\"System.Object PassStruct::ToRectTable(System.IntPtr,System.Int32)\" Index=\"214\" />\n    <Method Name=\"ToRectValue\" PublishedName=\"ToRectValue\" Signature=\"ToRectValue-IntPtr-int\" FullSignature=\"UnityEngine.Rect PassStruct::ToRectValue(System.IntPtr,System.Int32)\" Index=\"210\" />\n  </Type>\n  <Type Name=\"ScriptsFromFile\">\n    <Method Name=\"Log\" PublishedName=\"Log\" Signature=\"Log-string-string-LogType\" FullSignature=\"System.Void ScriptsFromFile::Log(System.String,System.String,UnityEngine.LogType)\" Index=\"23\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void ScriptsFromFile::OnApplicationQuit()\" Index=\"25\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void ScriptsFromFile::OnGUI()\" Index=\"24\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void ScriptsFromFile::Start()\" Index=\"22\" />\n  </Type>\n  <Type Name=\"System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap\">\n    <Method Name=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection\" PublishedName=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection\" Signature=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap::_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection(System.IntPtr)\" Index=\"76\" />\n    <Method Name=\"CopyTo\" PublishedName=\"CopyTo\" Signature=\"CopyTo-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap::CopyTo(System.IntPtr)\" Index=\"77\" />\n    <Method Name=\"get_Count\" PublishedName=\"get_Count\" Signature=\"get_Count-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap::get_Count(System.IntPtr)\" Index=\"79\" />\n    <Method Name=\"GetEnumerator\" PublishedName=\"GetEnumerator\" Signature=\"GetEnumerator-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap::GetEnumerator(System.IntPtr)\" Index=\"78\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap::Register(LuaInterface.LuaState)\" Index=\"75\" />\n  </Type>\n  <Type Name=\"System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap\">\n    <Method Name=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection\" PublishedName=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection\" Signature=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap::_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection(System.IntPtr)\" Index=\"81\" />\n    <Method Name=\"CopyTo\" PublishedName=\"CopyTo\" Signature=\"CopyTo-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap::CopyTo(System.IntPtr)\" Index=\"82\" />\n    <Method Name=\"get_Count\" PublishedName=\"get_Count\" Signature=\"get_Count-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap::get_Count(System.IntPtr)\" Index=\"84\" />\n    <Method Name=\"GetEnumerator\" PublishedName=\"GetEnumerator\" Signature=\"GetEnumerator-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap::GetEnumerator(System.IntPtr)\" Index=\"83\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap::Register(LuaInterface.LuaState)\" Index=\"80\" />\n  </Type>\n  <Type Name=\"System_Collections_Generic_Dictionary_int_TestAccountWrap\">\n    <Method Name=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount\" PublishedName=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount\" Signature=\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::_CreateSystem_Collections_Generic_Dictionary_int_TestAccount(System.IntPtr)\" Index=\"56\" />\n    <Method Name=\"_get_this\" PublishedName=\"_get_this\" Signature=\"_get_this-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::_get_this(System.IntPtr)\" Index=\"57\" />\n    <Method Name=\"_set_this\" PublishedName=\"_set_this\" Signature=\"_set_this-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::_set_this(System.IntPtr)\" Index=\"58\" />\n    <Method Name=\"_this\" PublishedName=\"_this\" Signature=\"_this-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::_this(System.IntPtr)\" Index=\"59\" />\n    <Method Name=\"Add\" PublishedName=\"Add\" Signature=\"Add-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::Add(System.IntPtr)\" Index=\"62\" />\n    <Method Name=\"Clear\" PublishedName=\"Clear\" Signature=\"Clear-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::Clear(System.IntPtr)\" Index=\"63\" />\n    <Method Name=\"ContainsKey\" PublishedName=\"ContainsKey\" Signature=\"ContainsKey-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::ContainsKey(System.IntPtr)\" Index=\"64\" />\n    <Method Name=\"ContainsValue\" PublishedName=\"ContainsValue\" Signature=\"ContainsValue-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::ContainsValue(System.IntPtr)\" Index=\"65\" />\n    <Method Name=\"get_Comparer\" PublishedName=\"get_Comparer\" Signature=\"get_Comparer-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::get_Comparer(System.IntPtr)\" Index=\"72\" />\n    <Method Name=\"get_Count\" PublishedName=\"get_Count\" Signature=\"get_Count-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::get_Count(System.IntPtr)\" Index=\"71\" />\n    <Method Name=\"get_Item\" PublishedName=\"get_Item\" Signature=\"get_Item-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::get_Item(System.IntPtr)\" Index=\"60\" />\n    <Method Name=\"get_Keys\" PublishedName=\"get_Keys\" Signature=\"get_Keys-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::get_Keys(System.IntPtr)\" Index=\"73\" />\n    <Method Name=\"get_Values\" PublishedName=\"get_Values\" Signature=\"get_Values-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::get_Values(System.IntPtr)\" Index=\"74\" />\n    <Method Name=\"GetEnumerator\" PublishedName=\"GetEnumerator\" Signature=\"GetEnumerator-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::GetEnumerator(System.IntPtr)\" Index=\"70\" />\n    <Method Name=\"GetObjectData\" PublishedName=\"GetObjectData\" Signature=\"GetObjectData-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::GetObjectData(System.IntPtr)\" Index=\"66\" />\n    <Method Name=\"OnDeserialization\" PublishedName=\"OnDeserialization\" Signature=\"OnDeserialization-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::OnDeserialization(System.IntPtr)\" Index=\"67\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void System_Collections_Generic_Dictionary_int_TestAccountWrap::Register(LuaInterface.LuaState)\" Index=\"55\" />\n    <Method Name=\"Remove\" PublishedName=\"Remove\" Signature=\"Remove-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::Remove(System.IntPtr)\" Index=\"68\" />\n    <Method Name=\"set_Item\" PublishedName=\"set_Item\" Signature=\"set_Item-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::set_Item(System.IntPtr)\" Index=\"61\" />\n    <Method Name=\"TryGetValue\" PublishedName=\"TryGetValue\" Signature=\"TryGetValue-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_Dictionary_int_TestAccountWrap::TryGetValue(System.IntPtr)\" Index=\"69\" />\n  </Type>\n  <Type Name=\"System_Collections_Generic_KeyValuePair_int_TestAccountWrap\">\n    <Method Name=\"_CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount\" PublishedName=\"_CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount\" Signature=\"_CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_KeyValuePair_int_TestAccountWrap::_CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount(System.IntPtr)\" Index=\"86\" />\n    <Method Name=\"get_Key\" PublishedName=\"get_Key\" Signature=\"get_Key-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_KeyValuePair_int_TestAccountWrap::get_Key(System.IntPtr)\" Index=\"88\" />\n    <Method Name=\"get_Value\" PublishedName=\"get_Value\" Signature=\"get_Value-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_KeyValuePair_int_TestAccountWrap::get_Value(System.IntPtr)\" Index=\"89\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void System_Collections_Generic_KeyValuePair_int_TestAccountWrap::Register(LuaInterface.LuaState)\" Index=\"85\" />\n    <Method Name=\"ToString\" PublishedName=\"ToString\" Signature=\"ToString-IntPtr\" FullSignature=\"System.Int32 System_Collections_Generic_KeyValuePair_int_TestAccountWrap::ToString(System.IntPtr)\" Index=\"87\" />\n  </Type>\n  <Type Name=\"TestABLoader\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestABLoader::Awake()\" Index=\"172\" />\n    <Method Name=\"CoLoadBundle\" PublishedName=\"CoLoadBundle\" Signature=\"CoLoadBundle-string-string\" FullSignature=\"System.Collections.IEnumerator TestABLoader::CoLoadBundle(System.String,System.String)\" Index=\"169\" />\n    <Method Name=\"LoadBundles\" PublishedName=\"LoadBundles\" Signature=\"LoadBundles\" FullSignature=\"System.Collections.IEnumerator TestABLoader::LoadBundles()\" Index=\"171\" />\n    <Method Name=\"LoadFinished\" PublishedName=\"LoadFinished\" Signature=\"LoadFinished\" FullSignature=\"System.Collections.IEnumerator TestABLoader::LoadFinished()\" Index=\"170\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestABLoader::OnApplicationQuit()\" Index=\"175\" />\n    <Method Name=\"OnBundleLoad\" PublishedName=\"OnBundleLoad\" Signature=\"OnBundleLoad\" FullSignature=\"System.Void TestABLoader::OnBundleLoad()\" Index=\"176\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestABLoader::OnGUI()\" Index=\"174\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestABLoader::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"173\" />\n  </Type>\n  <Type Name=\"TestAccountWrap\">\n    <Method Name=\"_CreateTestAccount\" PublishedName=\"_CreateTestAccount\" Signature=\"_CreateTestAccount-IntPtr\" FullSignature=\"System.Int32 TestAccountWrap::_CreateTestAccount(System.IntPtr)\" Index=\"91\" />\n    <Method Name=\"get_id\" PublishedName=\"get_id\" Signature=\"get_id-IntPtr\" FullSignature=\"System.Int32 TestAccountWrap::get_id(System.IntPtr)\" Index=\"92\" />\n    <Method Name=\"get_name\" PublishedName=\"get_name\" Signature=\"get_name-IntPtr\" FullSignature=\"System.Int32 TestAccountWrap::get_name(System.IntPtr)\" Index=\"93\" />\n    <Method Name=\"get_sex\" PublishedName=\"get_sex\" Signature=\"get_sex-IntPtr\" FullSignature=\"System.Int32 TestAccountWrap::get_sex(System.IntPtr)\" Index=\"94\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void TestAccountWrap::Register(LuaInterface.LuaState)\" Index=\"90\" />\n    <Method Name=\"set_id\" PublishedName=\"set_id\" Signature=\"set_id-IntPtr\" FullSignature=\"System.Int32 TestAccountWrap::set_id(System.IntPtr)\" Index=\"95\" />\n    <Method Name=\"set_name\" PublishedName=\"set_name\" Signature=\"set_name-IntPtr\" FullSignature=\"System.Int32 TestAccountWrap::set_name(System.IntPtr)\" Index=\"96\" />\n    <Method Name=\"set_sex\" PublishedName=\"set_sex\" Signature=\"set_sex-IntPtr\" FullSignature=\"System.Int32 TestAccountWrap::set_sex(System.IntPtr)\" Index=\"97\" />\n  </Type>\n  <Type Name=\"TestCJson\">\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void TestCJson::CallMain()\" Index=\"180\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils TestCJson::InitLoader()\" Index=\"177\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestCJson::OnApplicationQuit()\" Index=\"182\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestCJson::OnGUI()\" Index=\"183\" />\n    <Method Name=\"OnLoadFinished\" PublishedName=\"OnLoadFinished\" Signature=\"OnLoadFinished\" FullSignature=\"System.Void TestCJson::OnLoadFinished()\" Index=\"179\" />\n    <Method Name=\"OpenLibs\" PublishedName=\"OpenLibs\" Signature=\"OpenLibs\" FullSignature=\"System.Void TestCJson::OpenLibs()\" Index=\"178\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestCJson::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"181\" />\n  </Type>\n  <Type Name=\"TestCoroutine\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestCoroutine::Awake()\" Index=\"35\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestCoroutine::OnApplicationQuit()\" Index=\"36\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestCoroutine::OnGUI()\" Index=\"38\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestCoroutine::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"37\" />\n  </Type>\n  <Type Name=\"TestCoroutine2\">\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void TestCoroutine2::CallMain()\" Index=\"41\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils TestCoroutine2::InitLoader()\" Index=\"39\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestCoroutine2::OnApplicationQuit()\" Index=\"44\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestCoroutine2::OnGUI()\" Index=\"45\" />\n    <Method Name=\"OnLoadFinished\" PublishedName=\"OnLoadFinished\" Signature=\"OnLoadFinished\" FullSignature=\"System.Void TestCoroutine2::OnLoadFinished()\" Index=\"40\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestCoroutine2::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"43\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void TestCoroutine2::Start()\" Index=\"42\" />\n  </Type>\n  <Type Name=\"TestCustomLoader\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestCustomLoader::Awake()\" Index=\"140\" />\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void TestCustomLoader::CallMain()\" Index=\"138\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils TestCustomLoader::InitLoader()\" Index=\"137\" />\n    <Method Name=\"Logger\" PublishedName=\"Logger\" Signature=\"Logger-string-string-LogType\" FullSignature=\"System.Void TestCustomLoader::Logger(System.String,System.String,UnityEngine.LogType)\" Index=\"142\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestCustomLoader::OnApplicationQuit()\" Index=\"141\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestCustomLoader::OnGUI()\" Index=\"143\" />\n    <Method Name=\"StartMain\" PublishedName=\"StartMain\" Signature=\"StartMain\" FullSignature=\"System.Void TestCustomLoader::StartMain()\" Index=\"139\" />\n  </Type>\n  <Type Name=\"TestDelegate\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestDelegate::Awake()\" Index=\"109\" />\n    <Method Name=\"Bind\" PublishedName=\"Bind\" Signature=\"Bind-LuaState\" FullSignature=\"System.Void TestDelegate::Bind(LuaInterface.LuaState)\" Index=\"110\" />\n    <Method Name=\"CallLuaFunction\" PublishedName=\"CallLuaFunction\" Signature=\"CallLuaFunction-LuaFunction\" FullSignature=\"System.Void TestDelegate::CallLuaFunction(LuaInterface.LuaFunction)\" Index=\"111\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestDelegate::OnApplicationQuit()\" Index=\"118\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestDelegate::OnGUI()\" Index=\"114\" />\n    <Method Name=\"SafeRelease\" PublishedName=\"SafeRelease\" Signature=\"SafeRelease-LuaFunction&amp;\" FullSignature=\"System.Void TestDelegate::SafeRelease(LuaInterface.LuaFunction&amp;)\" Index=\"116\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestDelegate::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"117\" />\n    <Method Name=\"TestEventListener_OnClick\" PublishedName=\"TestEventListener_OnClick\" Signature=\"TestEventListener_OnClick-LuaFunction-LuaTable-bool\" FullSignature=\"TestEventListener/OnClick TestDelegate::TestEventListener_OnClick(LuaInterface.LuaFunction,LuaInterface.LuaTable,System.Boolean)\" Index=\"112\" />\n    <Method Name=\"TestEventListener_VoidDelegate\" PublishedName=\"TestEventListener_VoidDelegate\" Signature=\"TestEventListener_VoidDelegate-LuaFunction-LuaTable-bool\" FullSignature=\"TestEventListener/VoidDelegate TestDelegate::TestEventListener_VoidDelegate(LuaInterface.LuaFunction,LuaInterface.LuaTable,System.Boolean)\" Index=\"113\" />\n    <Method Name=\"Update\" PublishedName=\"Update\" Signature=\"Update\" FullSignature=\"System.Void TestDelegate::Update()\" Index=\"115\" />\n  </Type>\n  <Type Name=\"TestDelegate.TestEventListener_OnClick_Event\">\n    <Method Name=\"Call\" PublishedName=\"Call\" Signature=\"Call-GameObject\" FullSignature=\"System.Void TestDelegate/TestEventListener_OnClick_Event::Call(UnityEngine.GameObject)\" Index=\"107\" />\n  </Type>\n  <Type Name=\"TestDelegate.TestEventListener_VoidDelegate_Event\">\n    <Method Name=\"Call\" PublishedName=\"Call\" Signature=\"Call-GameObject\" FullSignature=\"System.Void TestDelegate/TestEventListener_VoidDelegate_Event::Call(UnityEngine.GameObject)\" Index=\"108\" />\n  </Type>\n  <Type Name=\"TestEnum\">\n    <Method Name=\"Test\" PublishedName=\"Test\" Signature=\"Test-Space\" FullSignature=\"System.Void TestEnum::Test(UnityEngine.Space)\" Index=\"312\" />\n  </Type>\n  <Type Name=\"TestEventListener\">\n    <Method Name=\"SetOnFinished\" PublishedName=\"SetOnFinished-OnClick\" Signature=\"SetOnFinished-OnClick\" FullSignature=\"System.Void TestEventListener::SetOnFinished(TestEventListener/OnClick)\" Index=\"119\" />\n    <Method Name=\"SetOnFinished\" PublishedName=\"SetOnFinished-VoidDelegate\" Signature=\"SetOnFinished-VoidDelegate\" FullSignature=\"System.Void TestEventListener::SetOnFinished(TestEventListener/VoidDelegate)\" Index=\"120\" />\n  </Type>\n  <Type Name=\"TestEventListenerWrap\">\n    <Method Name=\"get_onClick\" PublishedName=\"get_onClick\" Signature=\"get_onClick-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::get_onClick(System.IntPtr)\" Index=\"124\" />\n    <Method Name=\"get_onClickEvent\" PublishedName=\"get_onClickEvent\" Signature=\"get_onClickEvent-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::get_onClickEvent(System.IntPtr)\" Index=\"126\" />\n    <Method Name=\"get_TestFunc\" PublishedName=\"get_TestFunc\" Signature=\"get_TestFunc-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::get_TestFunc(System.IntPtr)\" Index=\"125\" />\n    <Method Name=\"op_Equality\" PublishedName=\"op_Equality\" Signature=\"op_Equality-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::op_Equality(System.IntPtr)\" Index=\"123\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void TestEventListenerWrap::Register(LuaInterface.LuaState)\" Index=\"121\" />\n    <Method Name=\"set_onClick\" PublishedName=\"set_onClick\" Signature=\"set_onClick-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::set_onClick(System.IntPtr)\" Index=\"127\" />\n    <Method Name=\"set_onClickEvent\" PublishedName=\"set_onClickEvent\" Signature=\"set_onClickEvent-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::set_onClickEvent(System.IntPtr)\" Index=\"129\" />\n    <Method Name=\"set_TestFunc\" PublishedName=\"set_TestFunc\" Signature=\"set_TestFunc-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::set_TestFunc(System.IntPtr)\" Index=\"128\" />\n    <Method Name=\"SetOnFinished\" PublishedName=\"SetOnFinished\" Signature=\"SetOnFinished-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::SetOnFinished(System.IntPtr)\" Index=\"122\" />\n    <Method Name=\"TestEventListener_OnClick\" PublishedName=\"TestEventListener_OnClick\" Signature=\"TestEventListener_OnClick-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::TestEventListener_OnClick(System.IntPtr)\" Index=\"130\" />\n    <Method Name=\"TestEventListener_VoidDelegate\" PublishedName=\"TestEventListener_VoidDelegate\" Signature=\"TestEventListener_VoidDelegate-IntPtr\" FullSignature=\"System.Int32 TestEventListenerWrap::TestEventListener_VoidDelegate(System.IntPtr)\" Index=\"131\" />\n  </Type>\n  <Type Name=\"TestExport\">\n    <Method Name=\"DoClick\" PublishedName=\"DoClick\" Signature=\"DoClick\" FullSignature=\"System.Void TestExport::DoClick()\" Index=\"348\" />\n    <Method Name=\"get_Item\" PublishedName=\"get_Item-char-int\" Signature=\"get_Item-char-int\" FullSignature=\"System.Int32 TestExport::get_Item(System.Char,System.Int32)\" Index=\"317\" />\n    <Method Name=\"get_Item\" PublishedName=\"get_Item-double\" Signature=\"get_Item-double\" FullSignature=\"System.Int32 TestExport::get_Item(System.Double)\" Index=\"320\" />\n    <Method Name=\"get_Item\" PublishedName=\"get_Item-int\" Signature=\"get_Item-int\" FullSignature=\"System.Int32 TestExport::get_Item(System.Int32)\" Index=\"315\" />\n    <Method Name=\"get_Item\" PublishedName=\"get_Item-int-int-int\" Signature=\"get_Item-int-int-int\" FullSignature=\"System.Int32 TestExport::get_Item(System.Int32,System.Int32,System.Int32)\" Index=\"321\" />\n    <Method Name=\"get_Item\" PublishedName=\"get_Item-string\" Signature=\"get_Item-string\" FullSignature=\"System.Int32 TestExport::get_Item(System.String)\" Index=\"319\" />\n    <Method Name=\"get_Number\" PublishedName=\"get_Number\" Signature=\"get_Number\" FullSignature=\"System.Int32 TestExport::get_Number()\" Index=\"313\" />\n    <Method Name=\"set_Item\" PublishedName=\"set_Item-char-int-int\" Signature=\"set_Item-char-int-int\" FullSignature=\"System.Void TestExport::set_Item(System.Char,System.Int32,System.Int32)\" Index=\"318\" />\n    <Method Name=\"set_Item\" PublishedName=\"set_Item-double\" Signature=\"set_Item-double\" FullSignature=\"System.Int32 TestExport::set_Item(System.Double)\" Index=\"322\" />\n    <Method Name=\"set_Item\" PublishedName=\"set_Item-int-int\" Signature=\"set_Item-int-int\" FullSignature=\"System.Void TestExport::set_Item(System.Int32,System.Int32)\" Index=\"316\" />\n    <Method Name=\"set_Number\" PublishedName=\"set_Number\" Signature=\"set_Number-int\" FullSignature=\"System.Void TestExport::set_Number(System.Int32)\" Index=\"314\" />\n    <Method Name=\"Test\" PublishedName=\"Test\" Signature=\"Test\" FullSignature=\"System.Int32 TestExport::Test()\" Index=\"327\" />\n    <Method Name=\"Test33\" PublishedName=\"Test33\" Signature=\"Test33-Action&lt;int&gt;&amp;\" FullSignature=\"System.Int32 TestExport::Test33(System.Action`1&lt;System.Int32&gt;&amp;)\" Index=\"342\" />\n    <Method Name=\"Test\" PublishedName=\"Test-bool\" Signature=\"Test-bool\" FullSignature=\"System.Int32 TestExport::Test(System.Boolean)\" Index=\"328\" />\n    <Method Name=\"TestByteBuffer\" PublishedName=\"TestByteBuffer\" Signature=\"TestByteBuffer-TestBuffer\" FullSignature=\"System.Void TestExport::TestByteBuffer(TestExport/TestBuffer)\" Index=\"323\" />\n    <Method Name=\"Test\" PublishedName=\"Test-char\" Signature=\"Test-char\" FullSignature=\"System.Int32 TestExport::Test(System.Char)\" Index=\"326\" />\n    <Method Name=\"TestCheckParamNumber\" PublishedName=\"TestCheckParamNumber\" Signature=\"TestCheckParamNumber-int[]\" FullSignature=\"System.Int32 TestExport::TestCheckParamNumber(System.Int32[])\" Index=\"344\" />\n    <Method Name=\"TestCheckParamString\" PublishedName=\"TestCheckParamString\" Signature=\"TestCheckParamString-string[]\" FullSignature=\"System.String TestExport::TestCheckParamString(System.String[])\" Index=\"345\" />\n    <Method Name=\"Test\" PublishedName=\"Test-double\" Signature=\"Test-double\" FullSignature=\"System.Int32 TestExport::Test(System.Double)\" Index=\"331\" />\n    <Method Name=\"TestEnum\" PublishedName=\"TestEnum\" Signature=\"TestEnum-Space\" FullSignature=\"System.Int32 TestExport::TestEnum(TestExport/Space)\" Index=\"343\" />\n    <Method Name=\"Test\" PublishedName=\"Test-int\" Signature=\"Test-int\" FullSignature=\"System.Int32 TestExport::Test(System.Int32)\" Index=\"330\" />\n    <Method Name=\"Test\" PublishedName=\"Test-int&amp;\" Signature=\"Test-int&amp;\" FullSignature=\"System.Int32 TestExport::Test(System.Int32&amp;)\" Index=\"332\" />\n    <Method Name=\"Test\" PublishedName=\"Test-int[,]\" Signature=\"Test-int[,]\" FullSignature=\"System.Int32 TestExport::Test(System.Int32[,])\" Index=\"329\" />\n    <Method Name=\"Test\" PublishedName=\"Test-int[]\" Signature=\"Test-int[]\" FullSignature=\"System.Int32 TestExport::Test(System.Int32[])\" Index=\"337\" />\n    <Method Name=\"Test\" PublishedName=\"Test-int-int\" Signature=\"Test-int-int\" FullSignature=\"System.Int32 TestExport::Test(System.Int32,System.Int32)\" Index=\"333\" />\n    <Method Name=\"TestNullable\" PublishedName=\"TestNullable\" Signature=\"TestNullable-Nullable&lt;Vector3&gt;\" FullSignature=\"System.Nullable`1&lt;UnityEngine.Vector3&gt; TestExport::TestNullable(System.Nullable`1&lt;UnityEngine.Vector3&gt;)\" Index=\"349\" />\n    <Method Name=\"Test\" PublishedName=\"Test-object\" Signature=\"Test-object\" FullSignature=\"System.Int32 TestExport::Test(System.Object)\" Index=\"336\" />\n    <Method Name=\"Test\" PublishedName=\"Test-object[]\" Signature=\"Test-object[]\" FullSignature=\"System.Int32 TestExport::Test(System.Object[])\" Index=\"340\" />\n    <Method Name=\"Test\" PublishedName=\"Test-object-string\" Signature=\"Test-object-string\" FullSignature=\"System.Int32 TestExport::Test(System.Object,System.String)\" Index=\"324\" />\n    <Method Name=\"Test\" PublishedName=\"Test-object-string-int\" Signature=\"Test-object-string-int\" FullSignature=\"System.Int32 TestExport::Test(System.Object,System.String,System.Int32)\" Index=\"325\" />\n    <Method Name=\"TestRefGameObject\" PublishedName=\"TestRefGameObject\" Signature=\"TestRefGameObject-GameObject&amp;\" FullSignature=\"System.Void TestExport::TestRefGameObject(UnityEngine.GameObject&amp;)\" Index=\"347\" />\n    <Method Name=\"TestReflection\" PublishedName=\"TestReflection\" Signature=\"TestReflection\" FullSignature=\"System.Void TestExport::TestReflection()\" Index=\"346\" />\n    <Method Name=\"Test\" PublishedName=\"Test-Space\" Signature=\"Test-Space\" FullSignature=\"System.Int32 TestExport::Test(TestExport/Space)\" Index=\"341\" />\n    <Method Name=\"Test\" PublishedName=\"Test-string\" Signature=\"Test-string\" FullSignature=\"System.Int32 TestExport::Test(System.String)\" Index=\"334\" />\n    <Method Name=\"Test\" PublishedName=\"Test-string[]\" Signature=\"Test-string[]\" FullSignature=\"System.Int32 TestExport::Test(System.String[])\" Index=\"338\" />\n    <Method Name=\"Test\" PublishedName=\"Test-string[]-bool\" Signature=\"Test-string[]-bool\" FullSignature=\"System.Int32 TestExport::Test(System.String[],System.Boolean)\" Index=\"339\" />\n    <Method Name=\"Test\" PublishedName=\"Test-string-string\" Signature=\"Test-string-string\" FullSignature=\"System.Int32 TestExport::Test(System.String,System.String)\" Index=\"335\" />\n  </Type>\n  <Type Name=\"TestExport_SpaceWrap\">\n    <Method Name=\"CheckType\" PublishedName=\"CheckType\" Signature=\"CheckType-IntPtr-int\" FullSignature=\"System.Boolean TestExport_SpaceWrap::CheckType(System.IntPtr,System.Int32)\" Index=\"309\" />\n    <Method Name=\"get_World\" PublishedName=\"get_World\" Signature=\"get_World-IntPtr\" FullSignature=\"System.Int32 TestExport_SpaceWrap::get_World(System.IntPtr)\" Index=\"310\" />\n    <Method Name=\"IntToEnum\" PublishedName=\"IntToEnum\" Signature=\"IntToEnum-IntPtr\" FullSignature=\"System.Int32 TestExport_SpaceWrap::IntToEnum(System.IntPtr)\" Index=\"311\" />\n    <Method Name=\"Push\" PublishedName=\"Push\" Signature=\"Push-IntPtr-Space\" FullSignature=\"System.Void TestExport_SpaceWrap::Push(System.IntPtr,TestExport/Space)\" Index=\"308\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void TestExport_SpaceWrap::Register(LuaInterface.LuaState)\" Index=\"307\" />\n  </Type>\n  <Type Name=\"TestExportWrap\">\n    <Method Name=\"_CreateTestExport\" PublishedName=\"_CreateTestExport\" Signature=\"_CreateTestExport-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::_CreateTestExport(System.IntPtr)\" Index=\"277\" />\n    <Method Name=\"_get_this\" PublishedName=\"_get_this\" Signature=\"_get_this-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::_get_this(System.IntPtr)\" Index=\"278\" />\n    <Method Name=\"_set_this\" PublishedName=\"_set_this\" Signature=\"_set_this-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::_set_this(System.IntPtr)\" Index=\"279\" />\n    <Method Name=\"_this\" PublishedName=\"_this\" Signature=\"_this-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::_this(System.IntPtr)\" Index=\"280\" />\n    <Method Name=\"DoClick\" PublishedName=\"DoClick\" Signature=\"DoClick-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::DoClick(System.IntPtr)\" Index=\"293\" />\n    <Method Name=\"get_buffer\" PublishedName=\"get_buffer\" Signature=\"get_buffer-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::get_buffer(System.IntPtr)\" Index=\"298\" />\n    <Method Name=\"get_field\" PublishedName=\"get_field\" Signature=\"get_field-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::get_field(System.IntPtr)\" Index=\"295\" />\n    <Method Name=\"get_Item\" PublishedName=\"get_Item\" Signature=\"get_Item-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::get_Item(System.IntPtr)\" Index=\"281\" />\n    <Method Name=\"get_Number\" PublishedName=\"get_Number\" Signature=\"get_Number-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::get_Number(System.IntPtr)\" Index=\"299\" />\n    <Method Name=\"get_OnClick\" PublishedName=\"get_OnClick\" Signature=\"get_OnClick-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::get_OnClick(System.IntPtr)\" Index=\"296\" />\n    <Method Name=\"get_OnRefEvent\" PublishedName=\"get_OnRefEvent\" Signature=\"get_OnRefEvent-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::get_OnRefEvent(System.IntPtr)\" Index=\"297\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void TestExportWrap::Register(LuaInterface.LuaState)\" Index=\"276\" />\n    <Method Name=\"set_buffer\" PublishedName=\"set_buffer\" Signature=\"set_buffer-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::set_buffer(System.IntPtr)\" Index=\"303\" />\n    <Method Name=\"set_field\" PublishedName=\"set_field\" Signature=\"set_field-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::set_field(System.IntPtr)\" Index=\"300\" />\n    <Method Name=\"set_Item\" PublishedName=\"set_Item\" Signature=\"set_Item-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::set_Item(System.IntPtr)\" Index=\"282\" />\n    <Method Name=\"set_Number\" PublishedName=\"set_Number\" Signature=\"set_Number-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::set_Number(System.IntPtr)\" Index=\"304\" />\n    <Method Name=\"set_OnClick\" PublishedName=\"set_OnClick\" Signature=\"set_OnClick-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::set_OnClick(System.IntPtr)\" Index=\"301\" />\n    <Method Name=\"set_OnRefEvent\" PublishedName=\"set_OnRefEvent\" Signature=\"set_OnRefEvent-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::set_OnRefEvent(System.IntPtr)\" Index=\"302\" />\n    <Method Name=\"Test\" PublishedName=\"Test\" Signature=\"Test-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::Test(System.IntPtr)\" Index=\"284\" />\n    <Method Name=\"Test33\" PublishedName=\"Test33\" Signature=\"Test33-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::Test33(System.IntPtr)\" Index=\"286\" />\n    <Method Name=\"TestByteBuffer\" PublishedName=\"TestByteBuffer\" Signature=\"TestByteBuffer-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestByteBuffer(System.IntPtr)\" Index=\"283\" />\n    <Method Name=\"TestChar\" PublishedName=\"TestChar\" Signature=\"TestChar-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestChar(System.IntPtr)\" Index=\"285\" />\n    <Method Name=\"TestCheckParamNumber\" PublishedName=\"TestCheckParamNumber\" Signature=\"TestCheckParamNumber-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestCheckParamNumber(System.IntPtr)\" Index=\"289\" />\n    <Method Name=\"TestCheckParamString\" PublishedName=\"TestCheckParamString\" Signature=\"TestCheckParamString-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestCheckParamString(System.IntPtr)\" Index=\"290\" />\n    <Method Name=\"TestEnum\" PublishedName=\"TestEnum\" Signature=\"TestEnum-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestEnum(System.IntPtr)\" Index=\"288\" />\n    <Method Name=\"TestExport_TestBuffer\" PublishedName=\"TestExport_TestBuffer\" Signature=\"TestExport_TestBuffer-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestExport_TestBuffer(System.IntPtr)\" Index=\"305\" />\n    <Method Name=\"TestExport_TestRefEvent\" PublishedName=\"TestExport_TestRefEvent\" Signature=\"TestExport_TestRefEvent-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestExport_TestRefEvent(System.IntPtr)\" Index=\"306\" />\n    <Method Name=\"TestGeneric\" PublishedName=\"TestGeneric\" Signature=\"TestGeneric-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestGeneric(System.IntPtr)\" Index=\"287\" />\n    <Method Name=\"TestNullable\" PublishedName=\"TestNullable\" Signature=\"TestNullable-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestNullable(System.IntPtr)\" Index=\"294\" />\n    <Method Name=\"TestRefGameObject\" PublishedName=\"TestRefGameObject\" Signature=\"TestRefGameObject-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestRefGameObject(System.IntPtr)\" Index=\"292\" />\n    <Method Name=\"TestReflection\" PublishedName=\"TestReflection\" Signature=\"TestReflection-IntPtr\" FullSignature=\"System.Int32 TestExportWrap::TestReflection(System.IntPtr)\" Index=\"291\" />\n  </Type>\n  <Type Name=\"TestGameObject\">\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestGameObject::OnApplicationQuit()\" Index=\"135\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestGameObject::OnGUI()\" Index=\"136\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestGameObject::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"134\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void TestGameObject::Start()\" Index=\"132\" />\n    <Method Name=\"Update\" PublishedName=\"Update\" Signature=\"Update\" FullSignature=\"System.Void TestGameObject::Update()\" Index=\"133\" />\n  </Type>\n  <Type Name=\"TestInherit\">\n    <Method Name=\"OnDestroy\" PublishedName=\"OnDestroy\" Signature=\"OnDestroy\" FullSignature=\"System.Void TestInherit::OnDestroy()\" Index=\"167\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestInherit::OnGUI()\" Index=\"168\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestInherit::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"166\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void TestInherit::Start()\" Index=\"165\" />\n  </Type>\n  <Type Name=\"TestInstantiate\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestInstantiate::Awake()\" Index=\"226\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void TestInstantiate::Start()\" Index=\"227\" />\n  </Type>\n  <Type Name=\"TestInstantiate2\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestInstantiate2::Awake()\" Index=\"228\" />\n  </Type>\n  <Type Name=\"TestInt64\">\n    <Method Name=\"OnDestroy\" PublishedName=\"OnDestroy\" Signature=\"OnDestroy\" FullSignature=\"System.Void TestInt64::OnDestroy()\" Index=\"163\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestInt64::OnGUI()\" Index=\"164\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestInt64::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"162\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void TestInt64::Start()\" Index=\"161\" />\n  </Type>\n  <Type Name=\"TestLuaStack\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestLuaStack::Awake()\" Index=\"245\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestLuaStack::OnApplicationQuit()\" Index=\"247\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestLuaStack::OnGUI()\" Index=\"251\" />\n    <Method Name=\"OnSendMsg\" PublishedName=\"OnSendMsg\" Signature=\"OnSendMsg\" FullSignature=\"System.Void TestLuaStack::OnSendMsg()\" Index=\"244\" />\n    <Method Name=\"PushLuaError\" PublishedName=\"PushLuaError\" Signature=\"PushLuaError-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::PushLuaError(System.IntPtr)\" Index=\"230\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestLuaStack::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"248\" />\n    <Method Name=\"Test1\" PublishedName=\"Test1\" Signature=\"Test1-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::Test1(System.IntPtr)\" Index=\"229\" />\n    <Method Name=\"Test3\" PublishedName=\"Test3\" Signature=\"Test3-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::Test3(System.IntPtr)\" Index=\"231\" />\n    <Method Name=\"Test4\" PublishedName=\"Test4\" Signature=\"Test4-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::Test4(System.IntPtr)\" Index=\"232\" />\n    <Method Name=\"Test5\" PublishedName=\"Test5\" Signature=\"Test5-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::Test5(System.IntPtr)\" Index=\"233\" />\n    <Method Name=\"Test6\" PublishedName=\"Test6\" Signature=\"Test6-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::Test6(System.IntPtr)\" Index=\"234\" />\n    <Method Name=\"TestAddComponent\" PublishedName=\"TestAddComponent\" Signature=\"TestAddComponent-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::TestAddComponent(System.IntPtr)\" Index=\"240\" />\n    <Method Name=\"TestArgError\" PublishedName=\"TestArgError\" Signature=\"TestArgError-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::TestArgError(System.IntPtr)\" Index=\"236\" />\n    <Method Name=\"TestCo\" PublishedName=\"TestCo\" Signature=\"TestCo-Action\" FullSignature=\"System.Collections.IEnumerator TestLuaStack::TestCo(System.Action)\" Index=\"252\" />\n    <Method Name=\"TestCycle\" PublishedName=\"TestCycle\" Signature=\"TestCycle-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::TestCycle(System.IntPtr)\" Index=\"238\" />\n    <Method Name=\"TestD1\" PublishedName=\"TestD1\" Signature=\"TestD1\" FullSignature=\"System.Void TestLuaStack::TestD1()\" Index=\"249\" />\n    <Method Name=\"TestD2\" PublishedName=\"TestD2\" Signature=\"TestD2\" FullSignature=\"System.Void TestLuaStack::TestD2()\" Index=\"250\" />\n    <Method Name=\"TestMul0\" PublishedName=\"TestMul0\" Signature=\"TestMul0\" FullSignature=\"System.Void TestLuaStack::TestMul0()\" Index=\"242\" />\n    <Method Name=\"TestMul1\" PublishedName=\"TestMul1\" Signature=\"TestMul1\" FullSignature=\"System.Void TestLuaStack::TestMul1()\" Index=\"241\" />\n    <Method Name=\"TestMulStack\" PublishedName=\"TestMulStack\" Signature=\"TestMulStack-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::TestMulStack(System.IntPtr)\" Index=\"243\" />\n    <Method Name=\"TestNull\" PublishedName=\"TestNull\" Signature=\"TestNull-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::TestNull(System.IntPtr)\" Index=\"239\" />\n    <Method Name=\"TestOutOfBound\" PublishedName=\"TestOutOfBound\" Signature=\"TestOutOfBound-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::TestOutOfBound(System.IntPtr)\" Index=\"235\" />\n    <Method Name=\"TestTableInCo\" PublishedName=\"TestTableInCo\" Signature=\"TestTableInCo-IntPtr\" FullSignature=\"System.Int32 TestLuaStack::TestTableInCo(System.IntPtr)\" Index=\"237\" />\n    <Method Name=\"Update\" PublishedName=\"Update\" Signature=\"Update\" FullSignature=\"System.Void TestLuaStack::Update()\" Index=\"246\" />\n  </Type>\n  <Type Name=\"TestLuaThread\">\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestLuaThread::OnApplicationQuit()\" Index=\"47\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestLuaThread::OnGUI()\" Index=\"50\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestLuaThread::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"48\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void TestLuaThread::Start()\" Index=\"46\" />\n    <Method Name=\"Update\" PublishedName=\"Update\" Signature=\"Update\" FullSignature=\"System.Void TestLuaThread::Update()\" Index=\"49\" />\n  </Type>\n  <Type Name=\"TestOutArg\">\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestOutArg::OnApplicationQuit()\" Index=\"146\" />\n    <Method Name=\"OnDestroy\" PublishedName=\"OnDestroy\" Signature=\"OnDestroy\" FullSignature=\"System.Void TestOutArg::OnDestroy()\" Index=\"149\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestOutArg::OnGUI()\" Index=\"147\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestOutArg::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"145\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void TestOutArg::Start()\" Index=\"144\" />\n    <Method Name=\"Update\" PublishedName=\"Update\" Signature=\"Update\" FullSignature=\"System.Void TestOutArg::Update()\" Index=\"148\" />\n  </Type>\n  <Type Name=\"TestOverload\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestOverload::Awake()\" Index=\"350\" />\n    <Method Name=\"Bind\" PublishedName=\"Bind\" Signature=\"Bind-LuaState\" FullSignature=\"System.Void TestOverload::Bind(LuaInterface.LuaState)\" Index=\"351\" />\n  </Type>\n  <Type Name=\"TestPerformance\">\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestPerformance::OnApplicationQuit()\" Index=\"224\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestPerformance::OnGUI()\" Index=\"225\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestPerformance::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"223\" />\n    <Method Name=\"Start\" PublishedName=\"Start\" Signature=\"Start\" FullSignature=\"System.Void TestPerformance::Start()\" Index=\"222\" />\n  </Type>\n  <Type Name=\"TestProtoBuffer\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void TestProtoBuffer::Awake()\" Index=\"150\" />\n    <Method Name=\"Bind\" PublishedName=\"Bind\" Signature=\"Bind\" FullSignature=\"System.Void TestProtoBuffer::Bind()\" Index=\"152\" />\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void TestProtoBuffer::CallMain()\" Index=\"153\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils TestProtoBuffer::InitLoader()\" Index=\"151\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestProtoBuffer::OnApplicationQuit()\" Index=\"157\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestProtoBuffer::OnGUI()\" Index=\"156\" />\n    <Method Name=\"OnLoadFinished\" PublishedName=\"OnLoadFinished\" Signature=\"OnLoadFinished\" FullSignature=\"System.Void TestProtoBuffer::OnLoadFinished()\" Index=\"154\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestProtoBuffer::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"155\" />\n  </Type>\n  <Type Name=\"TestProtolWrap\">\n    <Method Name=\"get_data\" PublishedName=\"get_data\" Signature=\"get_data-IntPtr\" FullSignature=\"System.Int32 TestProtolWrap::get_data(System.IntPtr)\" Index=\"159\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void TestProtolWrap::Register(LuaInterface.LuaState)\" Index=\"158\" />\n    <Method Name=\"set_data\" PublishedName=\"set_data\" Signature=\"set_data-IntPtr\" FullSignature=\"System.Int32 TestProtolWrap::set_data(System.IntPtr)\" Index=\"160\" />\n  </Type>\n  <Type Name=\"TestReflection\">\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void TestReflection::CallMain()\" Index=\"197\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils TestReflection::InitLoader()\" Index=\"196\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestReflection::OnApplicationQuit()\" Index=\"201\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestReflection::OnGUI()\" Index=\"202\" />\n    <Method Name=\"OnLoadFinished\" PublishedName=\"OnLoadFinished\" Signature=\"OnLoadFinished\" FullSignature=\"System.Void TestReflection::OnLoadFinished()\" Index=\"199\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestReflection::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"200\" />\n    <Method Name=\"TestAction\" PublishedName=\"TestAction\" Signature=\"TestAction\" FullSignature=\"System.Void TestReflection::TestAction()\" Index=\"198\" />\n  </Type>\n  <Type Name=\"TestString\">\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void TestString::CallMain()\" Index=\"191\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils TestString::InitLoader()\" Index=\"190\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestString::OnApplicationQuit()\" Index=\"194\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestString::OnGUI()\" Index=\"195\" />\n    <Method Name=\"OnLoadFinished\" PublishedName=\"OnLoadFinished\" Signature=\"OnLoadFinished\" FullSignature=\"System.Void TestString::OnLoadFinished()\" Index=\"192\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestString::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"193\" />\n  </Type>\n  <Type Name=\"TestUTF8\">\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void TestUTF8::CallMain()\" Index=\"185\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils TestUTF8::InitLoader()\" Index=\"184\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void TestUTF8::OnApplicationQuit()\" Index=\"188\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void TestUTF8::OnGUI()\" Index=\"189\" />\n    <Method Name=\"OnLoadFinished\" PublishedName=\"OnLoadFinished\" Signature=\"OnLoadFinished\" FullSignature=\"System.Void TestUTF8::OnLoadFinished()\" Index=\"186\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void TestUTF8::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"187\" />\n  </Type>\n  <Type Name=\"ToLuaInjectionTest\">\n    <Method Name=\"get_PropertyTest\" PublishedName=\"get_PropertyTest\" Signature=\"get_PropertyTest\" FullSignature=\"System.Int32 ToLuaInjectionTest::get_PropertyTest()\" Index=\"261\" />\n    <Method Name=\"Inject\" PublishedName=\"Inject\" Signature=\"Inject-bool-int\" FullSignature=\"System.Void ToLuaInjectionTest::Inject(System.Boolean,System.Int32)\" Index=\"267\" />\n    <Method Name=\"set_PropertyTest\" PublishedName=\"set_PropertyTest\" Signature=\"set_PropertyTest-int\" FullSignature=\"System.Void ToLuaInjectionTest::set_PropertyTest(System.Int32)\" Index=\"262\" />\n    <Method Name=\"TestCoroutine\" PublishedName=\"TestCoroutine\" Signature=\"TestCoroutine-float\" FullSignature=\"System.Collections.IEnumerator ToLuaInjectionTest::TestCoroutine(System.Single)\" Index=\"268\" />\n    <Method Name=\"TestOverload\" PublishedName=\"TestOverload-bool-int\" Signature=\"TestOverload-bool-int\" FullSignature=\"System.Void ToLuaInjectionTest::TestOverload(System.Boolean,System.Int32)\" Index=\"266\" />\n    <Method Name=\"TestOverload\" PublishedName=\"TestOverload-int-bool\" Signature=\"TestOverload-int-bool\" FullSignature=\"System.Void ToLuaInjectionTest::TestOverload(System.Int32,System.Boolean)\" Index=\"264\" />\n    <Method Name=\"TestOverload\" PublishedName=\"TestOverload-int-bool&amp;\" Signature=\"TestOverload-int-bool&amp;\" FullSignature=\"System.Void ToLuaInjectionTest::TestOverload(System.Int32,System.Boolean&amp;)\" Index=\"265\" />\n    <Method Name=\"TestRef\" PublishedName=\"TestRef\" Signature=\"TestRef-int&amp;\" FullSignature=\"System.Int32 ToLuaInjectionTest::TestRef(System.Int32&amp;)\" Index=\"263\" />\n  </Type>\n  <Type Name=\"ToLuaInjectionTestWrap\">\n    <Method Name=\"_CreateToLuaInjectionTest\" PublishedName=\"_CreateToLuaInjectionTest\" Signature=\"_CreateToLuaInjectionTest-IntPtr\" FullSignature=\"System.Int32 ToLuaInjectionTestWrap::_CreateToLuaInjectionTest(System.IntPtr)\" Index=\"270\" />\n    <Method Name=\"get_PropertyTest\" PublishedName=\"get_PropertyTest\" Signature=\"get_PropertyTest-IntPtr\" FullSignature=\"System.Int32 ToLuaInjectionTestWrap::get_PropertyTest(System.IntPtr)\" Index=\"274\" />\n    <Method Name=\"Register\" PublishedName=\"Register\" Signature=\"Register-LuaState\" FullSignature=\"System.Void ToLuaInjectionTestWrap::Register(LuaInterface.LuaState)\" Index=\"269\" />\n    <Method Name=\"set_PropertyTest\" PublishedName=\"set_PropertyTest\" Signature=\"set_PropertyTest-IntPtr\" FullSignature=\"System.Int32 ToLuaInjectionTestWrap::set_PropertyTest(System.IntPtr)\" Index=\"275\" />\n    <Method Name=\"TestCoroutine\" PublishedName=\"TestCoroutine\" Signature=\"TestCoroutine-IntPtr\" FullSignature=\"System.Int32 ToLuaInjectionTestWrap::TestCoroutine(System.IntPtr)\" Index=\"273\" />\n    <Method Name=\"TestOverload\" PublishedName=\"TestOverload\" Signature=\"TestOverload-IntPtr\" FullSignature=\"System.Int32 ToLuaInjectionTestWrap::TestOverload(System.IntPtr)\" Index=\"272\" />\n    <Method Name=\"TestRef\" PublishedName=\"TestRef\" Signature=\"TestRef-IntPtr\" FullSignature=\"System.Int32 ToLuaInjectionTestWrap::TestRef(System.IntPtr)\" Index=\"271\" />\n  </Type>\n  <Type Name=\"UseDictionary\">\n    <Method Name=\"Awake\" PublishedName=\"Awake\" Signature=\"Awake\" FullSignature=\"System.Void UseDictionary::Awake()\" Index=\"98\" />\n    <Method Name=\"BindMap\" PublishedName=\"BindMap\" Signature=\"BindMap-LuaState\" FullSignature=\"System.Void UseDictionary::BindMap(LuaInterface.LuaState)\" Index=\"102\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void UseDictionary::OnApplicationQuit()\" Index=\"99\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void UseDictionary::OnGUI()\" Index=\"101\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void UseDictionary::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"100\" />\n  </Type>\n  <Type Name=\"UseList\">\n    <Method Name=\"CallMain\" PublishedName=\"CallMain\" Signature=\"CallMain\" FullSignature=\"System.Void UseList::CallMain()\" Index=\"204\" />\n    <Method Name=\"InitLoader\" PublishedName=\"InitLoader\" Signature=\"InitLoader\" FullSignature=\"LuaInterface.LuaFileUtils UseList::InitLoader()\" Index=\"203\" />\n    <Method Name=\"OnApplicationQuit\" PublishedName=\"OnApplicationQuit\" Signature=\"OnApplicationQuit\" FullSignature=\"System.Void UseList::OnApplicationQuit()\" Index=\"207\" />\n    <Method Name=\"OnGUI\" PublishedName=\"OnGUI\" Signature=\"OnGUI\" FullSignature=\"System.Void UseList::OnGUI()\" Index=\"208\" />\n    <Method Name=\"OnLoadFinished\" PublishedName=\"OnLoadFinished\" Signature=\"OnLoadFinished\" FullSignature=\"System.Void UseList::OnLoadFinished()\" Index=\"205\" />\n    <Method Name=\"ShowTips\" PublishedName=\"ShowTips\" Signature=\"ShowTips-string-string-LogType\" FullSignature=\"System.Void UseList::ShowTips(System.String,System.String,UnityEngine.LogType)\" Index=\"206\" />\n  </Type>\n</Root>"
  },
  {
    "path": "Assets/ToLua/Injection/InjectionBridgeEditorInfo.xml.meta",
    "content": "fileFormatVersion: 2\nguid: 7a03414dd6167d14db5ffeec44c8ebf9\ntimeCreated: 1536240865\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/LuaInjectionSkipPaths.txt",
    "content": "Assets/ToLua/Core/\nAssets/ToLua/Injection/\nAssets/ToLua/Misc/\nAssets/ToLua/Reflection/\nAssets/Plugins/\nAssets/ToLua/BaseType/\nAssets/Source/Generate/\n"
  },
  {
    "path": "Assets/ToLua/Injection/LuaInjectionSkipPaths.txt.meta",
    "content": "fileFormatVersion: 2\nguid: 4b40d8aec6722dd489e0cf5180707926\ntimeCreated: 1515038066\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection/LuaInjectionStation.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace LuaInterface\n{\n    [Flags]\n    public enum InjectType\n    {\n        None = 0,\n        After = 1,\n        Before = 1 << 1,\n        Replace = 1 << 2,\n        ReplaceWithPreInvokeBase = 1 << 3,\n        ReplaceWithPostInvokeBase = 1 << 4\n    }\n\n    public class LuaInjectionStation\n    {\n        public const byte NOT_INJECTION_FLAG = 0;\n        public const byte INVALID_INJECTION_FLAG = byte.MaxValue;\n\n        static int cacheSize = 0;\n        static byte[] injectionFlagCache;\n        static LuaFunction[] injectFunctionCache;\n\n        static LuaInjectionStation()\n        {\n            injectionFlagCache = new byte[cacheSize];\n            injectFunctionCache = new LuaFunction[cacheSize];\n        }\n\n        [NoToLua]\n        public static byte GetInjectFlag(int index)\n        {\n            byte result = injectionFlagCache[index];\n\n            if (result == INVALID_INJECTION_FLAG)\n            {\n                return NOT_INJECTION_FLAG;\n            }\n            else if (result == NOT_INJECTION_FLAG)\n            {\n                /// Delay injection not supported\n                if (LuaState.GetInjectInitState(index))\n                {\n                    injectionFlagCache[index] = INVALID_INJECTION_FLAG;\n                }\n            }\n\n            return result;\n        }\n\n        [NoToLua]\n        public static LuaFunction GetInjectionFunction(int index)\n        {\n            return injectFunctionCache[index];\n        }\n\n        public static void CacheInjectFunction(int index, byte injectFlag, LuaFunction func)\n        {\n            if (index >= cacheSize)\n            {\n                return;\n            }\n\n            injectFunctionCache[index] = func;\n            injectionFlagCache[index] = injectFlag;\n        }\n\n        public static void Clear()\n        {\n            for (int i = 0, len = injectionFlagCache.Length; i < len; ++i)\n            {\n                injectionFlagCache[i] = 0;\n                injectFunctionCache[i] = null;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Injection/LuaInjectionStation.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 50962a9cc65f2be42af0d2419c4bc074\ntimeCreated: 1512461673\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Injection.meta",
    "content": "fileFormatVersion: 2\nguid: eb513010fb16d5d4199be09f3c2f60c4\nfolderAsset: yes\ntimeCreated: 1515031211\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/Build.bat",
    "content": "@echo off\ncd /d %~dp0\nrd /s/q Out\nmkdir jit\nmkdir Out\n\nxcopy /Y /D ..\\..\\..\\Luajit\\jit jit\nsetlocal enabledelayedexpansion\n\nfor /r %%i in (*.lua) do (\n set v=%%~dpi  \n call :loop\n set v=!v:%~dp0=!\n if not exist %~dp0out\\!v! (mkdir %~dp0Out\\!v!)\n )\n\nfor /r %%i in (*.lua) do (\n set v=%%i \n set v=!v:%~dp0=! \n call :loop\n ..\\..\\..\\Luajit\\luajit.exe -b -g !v! Out\\!v!.bytes \n)\n\nrd /s/q jit\nrd /s/q .\\Out\\jit\\\nxcopy /Y /D /S Out ..\\..\\StreamingAssets\\Lua\nsetlocal disabledelayedexpansion\n\n:loop \nif \"!v:~-1!\"==\" \" set \"v=!v:~0,-1!\" & goto loop \n\n"
  },
  {
    "path": "Assets/ToLua/Lua/Build.bat.meta",
    "content": "fileFormatVersion: 2\nguid: df27f3565c885a1419249346792d53b7\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/Injection/InjectionBridgeInfo.lua",
    "content": "return {\n\t[\"AccessingArray\"] = \n\t\t{\n\t\t\t[\"OnApplicationQuit\"] = 54, \n\t\t\t[\"OnGUI\"] = 53, \n\t\t\t[\"ShowTips\"] = 52, \n\t\t\t[\"Start\"] = 51, \n\t\t},\n\t[\"AccessingEnum\"] = \n\t\t{\n\t\t\t[\"OnApplicationQuit\"] = 104, \n\t\t\t[\"OnGUI\"] = 106, \n\t\t\t[\"ShowTips\"] = 105, \n\t\t\t[\"Start\"] = 103, \n\t\t},\n\t[\"AccessingLuaVariables\"] = \n\t\t{\n\t\t\t[\"OnApplicationQuit\"] = 32, \n\t\t\t[\"OnGUI\"] = 34, \n\t\t\t[\"ShowTips\"] = 33, \n\t\t\t[\"Start\"] = 31, \n\t\t},\n\t[\"BaseTest\"] = \n\t\t{\n\t\t\t[\"get_PropertyTest\"] = 259, \n\t\t\t[\"set_PropertyTest\"] = 260, \n\t\t\t[\"TestRef\"] = 258, \n\t\t},\n\t[\"BaseTestWrap\"] = \n\t\t{\n\t\t\t[\"_CreateBaseTest\"] = 254, \n\t\t\t[\"get_PropertyTest\"] = 256, \n\t\t\t[\"Register\"] = 253, \n\t\t\t[\"set_PropertyTest\"] = 257, \n\t\t\t[\"TestRef\"] = 255, \n\t\t},\n\t[\"CallLuaFunction\"] = \n\t\t{\n\t\t\t[\"CallFunc\"] = 30, \n\t\t\t[\"OnDestroy\"] = 29, \n\t\t\t[\"OnGUI\"] = 28, \n\t\t\t[\"ShowTips\"] = 27, \n\t\t\t[\"Start\"] = 26, \n\t\t},\n\t[\"HelloWorld\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 21, \n\t\t},\n\t[\"LuaInterface_InjectTypeWrap\"] = \n\t\t{\n\t\t\t[\"CheckType\"] = 3, \n\t\t\t[\"get_After\"] = 5, \n\t\t\t[\"get_Before\"] = 6, \n\t\t\t[\"get_None\"] = 4, \n\t\t\t[\"get_Replace\"] = 7, \n\t\t\t[\"get_ReplaceWithPostInvokeBase\"] = 9, \n\t\t\t[\"get_ReplaceWithPreInvokeBase\"] = 8, \n\t\t\t[\"IntToEnum\"] = 10, \n\t\t\t[\"Push\"] = 2, \n\t\t\t[\"Register\"] = 1, \n\t\t},\n\t[\"LuaInterface_LuaInjectionStationWrap\"] = \n\t\t{\n\t\t\t[\"_CreateLuaInterface_LuaInjectionStation\"] = 12, \n\t\t\t[\"CacheInjectFunction\"] = 13, \n\t\t\t[\"Register\"] = 11, \n\t\t},\n\t[\"LuaProfilerWrap\"] = \n\t\t{\n\t\t\t[\"BeginSample\"] = 17, \n\t\t\t[\"Clear\"] = 15, \n\t\t\t[\"EndSample\"] = 18, \n\t\t\t[\"get_list\"] = 19, \n\t\t\t[\"GetID\"] = 16, \n\t\t\t[\"Register\"] = 14, \n\t\t\t[\"set_list\"] = 20, \n\t\t},\n\t[\"PassStruct\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 217, \n\t\t\t[\"CallMain\"] = 221, \n\t\t\t[\"CheckNullRectType\"] = 213, \n\t\t\t[\"CheckRectType\"] = 212, \n\t\t\t[\"CheckRectValue\"] = 211, \n\t\t\t[\"InitLoader\"] = 219, \n\t\t\t[\"OnApplicationQuit\"] = 216, \n\t\t\t[\"OnGUI\"] = 220, \n\t\t\t[\"OnLoadFinished\"] = 218, \n\t\t\t[\"PushRect\"] = 209, \n\t\t\t[\"ShowTips\"] = 215, \n\t\t\t[\"ToRectTable\"] = 214, \n\t\t\t[\"ToRectValue\"] = 210, \n\t\t},\n\t[\"ScriptsFromFile\"] = \n\t\t{\n\t\t\t[\"Log\"] = 23, \n\t\t\t[\"OnApplicationQuit\"] = 25, \n\t\t\t[\"OnGUI\"] = 24, \n\t\t\t[\"Start\"] = 22, \n\t\t},\n\t[\"System_Collections_Generic_Dictionary_int_TestAccount_KeyCollectionWrap\"] = \n\t\t{\n\t\t\t[\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_KeyCollection\"] = 76, \n\t\t\t[\"CopyTo\"] = 77, \n\t\t\t[\"get_Count\"] = 79, \n\t\t\t[\"GetEnumerator\"] = 78, \n\t\t\t[\"Register\"] = 75, \n\t\t},\n\t[\"System_Collections_Generic_Dictionary_int_TestAccount_ValueCollectionWrap\"] = \n\t\t{\n\t\t\t[\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount_ValueCollection\"] = 81, \n\t\t\t[\"CopyTo\"] = 82, \n\t\t\t[\"get_Count\"] = 84, \n\t\t\t[\"GetEnumerator\"] = 83, \n\t\t\t[\"Register\"] = 80, \n\t\t},\n\t[\"System_Collections_Generic_Dictionary_int_TestAccountWrap\"] = \n\t\t{\n\t\t\t[\"_CreateSystem_Collections_Generic_Dictionary_int_TestAccount\"] = 56, \n\t\t\t[\"_get_this\"] = 57, \n\t\t\t[\"_set_this\"] = 58, \n\t\t\t[\"_this\"] = 59, \n\t\t\t[\"Add\"] = 62, \n\t\t\t[\"Clear\"] = 63, \n\t\t\t[\"ContainsKey\"] = 64, \n\t\t\t[\"ContainsValue\"] = 65, \n\t\t\t[\"get_Comparer\"] = 72, \n\t\t\t[\"get_Count\"] = 71, \n\t\t\t[\"get_Item\"] = 60, \n\t\t\t[\"get_Keys\"] = 73, \n\t\t\t[\"get_Values\"] = 74, \n\t\t\t[\"GetEnumerator\"] = 70, \n\t\t\t[\"GetObjectData\"] = 66, \n\t\t\t[\"OnDeserialization\"] = 67, \n\t\t\t[\"Register\"] = 55, \n\t\t\t[\"Remove\"] = 68, \n\t\t\t[\"set_Item\"] = 61, \n\t\t\t[\"TryGetValue\"] = 69, \n\t\t},\n\t[\"System_Collections_Generic_KeyValuePair_int_TestAccountWrap\"] = \n\t\t{\n\t\t\t[\"_CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount\"] = 86, \n\t\t\t[\"get_Key\"] = 88, \n\t\t\t[\"get_Value\"] = 89, \n\t\t\t[\"Register\"] = 85, \n\t\t\t[\"ToString\"] = 87, \n\t\t},\n\t[\"TestABLoader\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 172, \n\t\t\t[\"CoLoadBundle\"] = 169, \n\t\t\t[\"LoadBundles\"] = 171, \n\t\t\t[\"LoadFinished\"] = 170, \n\t\t\t[\"OnApplicationQuit\"] = 175, \n\t\t\t[\"OnBundleLoad\"] = 176, \n\t\t\t[\"OnGUI\"] = 174, \n\t\t\t[\"ShowTips\"] = 173, \n\t\t},\n\t[\"TestAccountWrap\"] = \n\t\t{\n\t\t\t[\"_CreateTestAccount\"] = 91, \n\t\t\t[\"get_id\"] = 92, \n\t\t\t[\"get_name\"] = 93, \n\t\t\t[\"get_sex\"] = 94, \n\t\t\t[\"Register\"] = 90, \n\t\t\t[\"set_id\"] = 95, \n\t\t\t[\"set_name\"] = 96, \n\t\t\t[\"set_sex\"] = 97, \n\t\t},\n\t[\"TestCJson\"] = \n\t\t{\n\t\t\t[\"CallMain\"] = 180, \n\t\t\t[\"InitLoader\"] = 177, \n\t\t\t[\"OnApplicationQuit\"] = 182, \n\t\t\t[\"OnGUI\"] = 183, \n\t\t\t[\"OnLoadFinished\"] = 179, \n\t\t\t[\"OpenLibs\"] = 178, \n\t\t\t[\"ShowTips\"] = 181, \n\t\t},\n\t[\"TestCoroutine\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 35, \n\t\t\t[\"OnApplicationQuit\"] = 36, \n\t\t\t[\"OnGUI\"] = 38, \n\t\t\t[\"ShowTips\"] = 37, \n\t\t},\n\t[\"TestCoroutine2\"] = \n\t\t{\n\t\t\t[\"CallMain\"] = 41, \n\t\t\t[\"InitLoader\"] = 39, \n\t\t\t[\"OnApplicationQuit\"] = 44, \n\t\t\t[\"OnGUI\"] = 45, \n\t\t\t[\"OnLoadFinished\"] = 40, \n\t\t\t[\"ShowTips\"] = 43, \n\t\t\t[\"Start\"] = 42, \n\t\t},\n\t[\"TestCustomLoader\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 140, \n\t\t\t[\"CallMain\"] = 138, \n\t\t\t[\"InitLoader\"] = 137, \n\t\t\t[\"Logger\"] = 142, \n\t\t\t[\"OnApplicationQuit\"] = 141, \n\t\t\t[\"OnGUI\"] = 143, \n\t\t\t[\"StartMain\"] = 139, \n\t\t},\n\t[\"TestDelegate\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 109, \n\t\t\t[\"Bind\"] = 110, \n\t\t\t[\"CallLuaFunction\"] = 111, \n\t\t\t[\"OnApplicationQuit\"] = 118, \n\t\t\t[\"OnGUI\"] = 114, \n\t\t\t[\"SafeRelease\"] = 116, \n\t\t\t[\"ShowTips\"] = 117, \n\t\t\t[\"TestEventListener_OnClick\"] = 112, \n\t\t\t[\"TestEventListener_VoidDelegate\"] = 113, \n\t\t\t[\"Update\"] = 115, \n\t\t},\n\t[\"TestDelegate.TestEventListener_OnClick_Event\"] = \n\t\t{\n\t\t\t[\"Call\"] = 107, \n\t\t},\n\t[\"TestDelegate.TestEventListener_VoidDelegate_Event\"] = \n\t\t{\n\t\t\t[\"Call\"] = 108, \n\t\t},\n\t[\"TestEnum\"] = \n\t\t{\n\t\t\t[\"Test\"] = 312, \n\t\t},\n\t[\"TestEventListener\"] = \n\t\t{\n\t\t\t[\"SetOnFinished-OnClick\"] = 119, \n\t\t\t[\"SetOnFinished-VoidDelegate\"] = 120, \n\t\t},\n\t[\"TestEventListenerWrap\"] = \n\t\t{\n\t\t\t[\"get_onClick\"] = 124, \n\t\t\t[\"get_onClickEvent\"] = 126, \n\t\t\t[\"get_TestFunc\"] = 125, \n\t\t\t[\"op_Equality\"] = 123, \n\t\t\t[\"Register\"] = 121, \n\t\t\t[\"set_onClick\"] = 127, \n\t\t\t[\"set_onClickEvent\"] = 129, \n\t\t\t[\"set_TestFunc\"] = 128, \n\t\t\t[\"SetOnFinished\"] = 122, \n\t\t\t[\"TestEventListener_OnClick\"] = 130, \n\t\t\t[\"TestEventListener_VoidDelegate\"] = 131, \n\t\t},\n\t[\"TestExport\"] = \n\t\t{\n\t\t\t[\"DoClick\"] = 348, \n\t\t\t[\"get_Item-char-int\"] = 317, \n\t\t\t[\"get_Item-double\"] = 320, \n\t\t\t[\"get_Item-int\"] = 315, \n\t\t\t[\"get_Item-int-int-int\"] = 321, \n\t\t\t[\"get_Item-string\"] = 319, \n\t\t\t[\"get_Number\"] = 313, \n\t\t\t[\"set_Item-char-int-int\"] = 318, \n\t\t\t[\"set_Item-double\"] = 322, \n\t\t\t[\"set_Item-int-int\"] = 316, \n\t\t\t[\"set_Number\"] = 314, \n\t\t\t[\"Test\"] = 327, \n\t\t\t[\"Test33\"] = 342, \n\t\t\t[\"Test-bool\"] = 328, \n\t\t\t[\"TestByteBuffer\"] = 323, \n\t\t\t[\"Test-char\"] = 326, \n\t\t\t[\"TestCheckParamNumber\"] = 344, \n\t\t\t[\"TestCheckParamString\"] = 345, \n\t\t\t[\"Test-double\"] = 331, \n\t\t\t[\"TestEnum\"] = 343, \n\t\t\t[\"Test-int\"] = 330, \n\t\t\t[\"Test-int&\"] = 332, \n\t\t\t[\"Test-int[,]\"] = 329, \n\t\t\t[\"Test-int[]\"] = 337, \n\t\t\t[\"Test-int-int\"] = 333, \n\t\t\t[\"TestNullable\"] = 349, \n\t\t\t[\"Test-object\"] = 336, \n\t\t\t[\"Test-object[]\"] = 340, \n\t\t\t[\"Test-object-string\"] = 324, \n\t\t\t[\"Test-object-string-int\"] = 325, \n\t\t\t[\"TestRefGameObject\"] = 347, \n\t\t\t[\"TestReflection\"] = 346, \n\t\t\t[\"Test-Space\"] = 341, \n\t\t\t[\"Test-string\"] = 334, \n\t\t\t[\"Test-string[]\"] = 338, \n\t\t\t[\"Test-string[]-bool\"] = 339, \n\t\t\t[\"Test-string-string\"] = 335, \n\t\t},\n\t[\"TestExport_SpaceWrap\"] = \n\t\t{\n\t\t\t[\"CheckType\"] = 309, \n\t\t\t[\"get_World\"] = 310, \n\t\t\t[\"IntToEnum\"] = 311, \n\t\t\t[\"Push\"] = 308, \n\t\t\t[\"Register\"] = 307, \n\t\t},\n\t[\"TestExportWrap\"] = \n\t\t{\n\t\t\t[\"_CreateTestExport\"] = 277, \n\t\t\t[\"_get_this\"] = 278, \n\t\t\t[\"_set_this\"] = 279, \n\t\t\t[\"_this\"] = 280, \n\t\t\t[\"DoClick\"] = 293, \n\t\t\t[\"get_buffer\"] = 298, \n\t\t\t[\"get_field\"] = 295, \n\t\t\t[\"get_Item\"] = 281, \n\t\t\t[\"get_Number\"] = 299, \n\t\t\t[\"get_OnClick\"] = 296, \n\t\t\t[\"get_OnRefEvent\"] = 297, \n\t\t\t[\"Register\"] = 276, \n\t\t\t[\"set_buffer\"] = 303, \n\t\t\t[\"set_field\"] = 300, \n\t\t\t[\"set_Item\"] = 282, \n\t\t\t[\"set_Number\"] = 304, \n\t\t\t[\"set_OnClick\"] = 301, \n\t\t\t[\"set_OnRefEvent\"] = 302, \n\t\t\t[\"Test\"] = 284, \n\t\t\t[\"Test33\"] = 286, \n\t\t\t[\"TestByteBuffer\"] = 283, \n\t\t\t[\"TestChar\"] = 285, \n\t\t\t[\"TestCheckParamNumber\"] = 289, \n\t\t\t[\"TestCheckParamString\"] = 290, \n\t\t\t[\"TestEnum\"] = 288, \n\t\t\t[\"TestExport_TestBuffer\"] = 305, \n\t\t\t[\"TestExport_TestRefEvent\"] = 306, \n\t\t\t[\"TestGeneric\"] = 287, \n\t\t\t[\"TestNullable\"] = 294, \n\t\t\t[\"TestRefGameObject\"] = 292, \n\t\t\t[\"TestReflection\"] = 291, \n\t\t},\n\t[\"TestGameObject\"] = \n\t\t{\n\t\t\t[\"OnApplicationQuit\"] = 135, \n\t\t\t[\"OnGUI\"] = 136, \n\t\t\t[\"ShowTips\"] = 134, \n\t\t\t[\"Start\"] = 132, \n\t\t\t[\"Update\"] = 133, \n\t\t},\n\t[\"TestInherit\"] = \n\t\t{\n\t\t\t[\"OnDestroy\"] = 167, \n\t\t\t[\"OnGUI\"] = 168, \n\t\t\t[\"ShowTips\"] = 166, \n\t\t\t[\"Start\"] = 165, \n\t\t},\n\t[\"TestInstantiate\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 226, \n\t\t\t[\"Start\"] = 227, \n\t\t},\n\t[\"TestInstantiate2\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 228, \n\t\t},\n\t[\"TestInt64\"] = \n\t\t{\n\t\t\t[\"OnDestroy\"] = 163, \n\t\t\t[\"OnGUI\"] = 164, \n\t\t\t[\"ShowTips\"] = 162, \n\t\t\t[\"Start\"] = 161, \n\t\t},\n\t[\"TestLuaStack\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 245, \n\t\t\t[\"OnApplicationQuit\"] = 247, \n\t\t\t[\"OnGUI\"] = 251, \n\t\t\t[\"OnSendMsg\"] = 244, \n\t\t\t[\"PushLuaError\"] = 230, \n\t\t\t[\"ShowTips\"] = 248, \n\t\t\t[\"Test1\"] = 229, \n\t\t\t[\"Test3\"] = 231, \n\t\t\t[\"Test4\"] = 232, \n\t\t\t[\"Test5\"] = 233, \n\t\t\t[\"Test6\"] = 234, \n\t\t\t[\"TestAddComponent\"] = 240, \n\t\t\t[\"TestArgError\"] = 236, \n\t\t\t[\"TestCo\"] = 252, \n\t\t\t[\"TestCycle\"] = 238, \n\t\t\t[\"TestD1\"] = 249, \n\t\t\t[\"TestD2\"] = 250, \n\t\t\t[\"TestMul0\"] = 242, \n\t\t\t[\"TestMul1\"] = 241, \n\t\t\t[\"TestMulStack\"] = 243, \n\t\t\t[\"TestNull\"] = 239, \n\t\t\t[\"TestOutOfBound\"] = 235, \n\t\t\t[\"TestTableInCo\"] = 237, \n\t\t\t[\"Update\"] = 246, \n\t\t},\n\t[\"TestLuaThread\"] = \n\t\t{\n\t\t\t[\"OnApplicationQuit\"] = 47, \n\t\t\t[\"OnGUI\"] = 50, \n\t\t\t[\"ShowTips\"] = 48, \n\t\t\t[\"Start\"] = 46, \n\t\t\t[\"Update\"] = 49, \n\t\t},\n\t[\"TestOutArg\"] = \n\t\t{\n\t\t\t[\"OnApplicationQuit\"] = 146, \n\t\t\t[\"OnDestroy\"] = 149, \n\t\t\t[\"OnGUI\"] = 147, \n\t\t\t[\"ShowTips\"] = 145, \n\t\t\t[\"Start\"] = 144, \n\t\t\t[\"Update\"] = 148, \n\t\t},\n\t[\"TestOverload\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 350, \n\t\t\t[\"Bind\"] = 351, \n\t\t},\n\t[\"TestPerformance\"] = \n\t\t{\n\t\t\t[\"OnApplicationQuit\"] = 224, \n\t\t\t[\"OnGUI\"] = 225, \n\t\t\t[\"ShowTips\"] = 223, \n\t\t\t[\"Start\"] = 222, \n\t\t},\n\t[\"TestProtoBuffer\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 150, \n\t\t\t[\"Bind\"] = 152, \n\t\t\t[\"CallMain\"] = 153, \n\t\t\t[\"InitLoader\"] = 151, \n\t\t\t[\"OnApplicationQuit\"] = 157, \n\t\t\t[\"OnGUI\"] = 156, \n\t\t\t[\"OnLoadFinished\"] = 154, \n\t\t\t[\"ShowTips\"] = 155, \n\t\t},\n\t[\"TestProtolWrap\"] = \n\t\t{\n\t\t\t[\"get_data\"] = 159, \n\t\t\t[\"Register\"] = 158, \n\t\t\t[\"set_data\"] = 160, \n\t\t},\n\t[\"TestReflection\"] = \n\t\t{\n\t\t\t[\"CallMain\"] = 197, \n\t\t\t[\"InitLoader\"] = 196, \n\t\t\t[\"OnApplicationQuit\"] = 201, \n\t\t\t[\"OnGUI\"] = 202, \n\t\t\t[\"OnLoadFinished\"] = 199, \n\t\t\t[\"ShowTips\"] = 200, \n\t\t\t[\"TestAction\"] = 198, \n\t\t},\n\t[\"TestString\"] = \n\t\t{\n\t\t\t[\"CallMain\"] = 191, \n\t\t\t[\"InitLoader\"] = 190, \n\t\t\t[\"OnApplicationQuit\"] = 194, \n\t\t\t[\"OnGUI\"] = 195, \n\t\t\t[\"OnLoadFinished\"] = 192, \n\t\t\t[\"ShowTips\"] = 193, \n\t\t},\n\t[\"TestUTF8\"] = \n\t\t{\n\t\t\t[\"CallMain\"] = 185, \n\t\t\t[\"InitLoader\"] = 184, \n\t\t\t[\"OnApplicationQuit\"] = 188, \n\t\t\t[\"OnGUI\"] = 189, \n\t\t\t[\"OnLoadFinished\"] = 186, \n\t\t\t[\"ShowTips\"] = 187, \n\t\t},\n\t[\"ToLuaInjectionTest\"] = \n\t\t{\n\t\t\t[\"get_PropertyTest\"] = 261, \n\t\t\t[\"Inject\"] = 267, \n\t\t\t[\"set_PropertyTest\"] = 262, \n\t\t\t[\"TestCoroutine\"] = 268, \n\t\t\t[\"TestOverload-bool-int\"] = 266, \n\t\t\t[\"TestOverload-int-bool\"] = 264, \n\t\t\t[\"TestOverload-int-bool&\"] = 265, \n\t\t\t[\"TestRef\"] = 263, \n\t\t},\n\t[\"ToLuaInjectionTestWrap\"] = \n\t\t{\n\t\t\t[\"_CreateToLuaInjectionTest\"] = 270, \n\t\t\t[\"get_PropertyTest\"] = 274, \n\t\t\t[\"Register\"] = 269, \n\t\t\t[\"set_PropertyTest\"] = 275, \n\t\t\t[\"TestCoroutine\"] = 273, \n\t\t\t[\"TestOverload\"] = 272, \n\t\t\t[\"TestRef\"] = 271, \n\t\t},\n\t[\"UseDictionary\"] = \n\t\t{\n\t\t\t[\"Awake\"] = 98, \n\t\t\t[\"BindMap\"] = 102, \n\t\t\t[\"OnApplicationQuit\"] = 99, \n\t\t\t[\"OnGUI\"] = 101, \n\t\t\t[\"ShowTips\"] = 100, \n\t\t},\n\t[\"UseList\"] = \n\t\t{\n\t\t\t[\"CallMain\"] = 204, \n\t\t\t[\"InitLoader\"] = 203, \n\t\t\t[\"OnApplicationQuit\"] = 207, \n\t\t\t[\"OnGUI\"] = 208, \n\t\t\t[\"OnLoadFinished\"] = 205, \n\t\t\t[\"ShowTips\"] = 206, \n\t\t},\n}"
  },
  {
    "path": "Assets/ToLua/Lua/System/Injection/InjectionBridgeInfo.lua.meta",
    "content": "fileFormatVersion: 2\nguid: ddd0929c7e5e87a43ac765a3d62c90a7\ntimeCreated: 1514865200\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/Injection/LuaInjectionBus.lua",
    "content": "--[[MIT License\n\nCopyright (c) 2018 Jonson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.]]--\n\n\n--Load All The Injectores\n--require \"System.Injection.ToLuaInjectionTestInjector\""
  },
  {
    "path": "Assets/ToLua/Lua/System/Injection/LuaInjectionBus.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 3f358679c92622642a844c157ce4fece\ntimeCreated: 1514865200\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/Injection/LuaInjectionStation.lua",
    "content": "--[[\n--- File:LuaInjectionStation.lua\n--- Created by Jonson\n--- DateTime: 2018/1/2 10:24\n]]--\n\nlocal pcall = pcall\nlocal pairs = pairs\nlocal error = error\nlocal rawset = rawset\nlocal rawget = rawget\nlocal string = string\nlocal tolua_tag = tolua_tag\nlocal getmetatable = getmetatable\nlocal CSLuaInjectStation\nlocal bridgeInfo = require \"System.Injection.InjectionBridgeInfo\"\n\nlocal function Check(csModule)\n\tlocal existmt = getmetatable(csModule)\n\tif rawget(existmt, tolua_tag) ~= 1 then\n\t\terror(\"Can't Inject\")\n\tend\n\n\treturn existmt\nend\n\nlocal function CacheCSLuaInjectStation()\n\tif CSLuaInjectStation == nil then\n\t\tCSLuaInjectStation = LuaInterface.LuaInjectionStation\n\tend\nend\n\nlocal function UpdateFunctionReference(metatable, injectInfo)\n\tlocal oldIndexMetamethod = metatable.__index\n\tlocal newMethodGroup = {}\n\tfor funcName, infoPipeline in pairs(injectInfo) do\n\t\tlocal injectFunction, injectFlag = infoPipeline()\n\t\tif injectFlag == LuaInterface.InjectType.Replace\n\t\t\t\tor injectFlag == LuaInterface.InjectType.ReplaceWithPostInvokeBase\n\t\t\t\tor injectFlag == LuaInterface.InjectType.ReplaceWithPreInvokeBase\n\t\tthen\n\t\t\trawset(newMethodGroup, funcName, injectFunction)\n\t\tend\n\tend\n\n\tmetatable.__index = function(t, k)\n\t\t--Ignore Overload Function\n\t\tlocal injectFunc = rawget(newMethodGroup, k)\n\t\tif injectFunc ~= nil then\n\t\t\treturn injectFunc\n\t\tend\n\n\t\tlocal status, result = pcall(oldIndexMetamethod, t, k)\n\t\tif status then\n\t\t\treturn result\n\t\telse\n\t\t\terror(result)\n\t\t\treturn nil\n\t\tend\n\tend\nend\n\nfunction InjectByModule(csModule, injectInfo)\n\tlocal mt = Check(csModule)\n\tlocal moduleName = mt[\".name\"]\n\n\tInjectByName(moduleName, injectInfo)\n\tUpdateFunctionReference(mt, injectInfo)\nend\n\n--Won't Update Function Reference In Lua Env\nfunction InjectByName(moduleName, injectInfo)\n\tCacheCSLuaInjectStation()\n\tlocal moduleBridgeInfo = rawget(bridgeInfo, moduleName)\n\tif moduleBridgeInfo == nil then\n\t\terror(string.format(\"Module %s Can't Inject\", moduleName))\n\tend\n\n\tfor funcName, infoPipeline in pairs(injectInfo) do\n\t\tlocal injectFunction, injectFlag = infoPipeline()\n\t\tlocal injectIndex = rawget(moduleBridgeInfo, funcName)\n\t\tif injectIndex == nil then\n\t\t\terror(string.format(\"Function %s Doesn't Exist In Module %s\", funcName, moduleName))\n\t\tend\n\n\t\tCSLuaInjectStation.CacheInjectFunction(injectIndex, injectFlag:ToInt(), injectFunction)\n\tend\nend\n\nrequire \"System.Injection.LuaInjectionBus\""
  },
  {
    "path": "Assets/ToLua/Lua/System/Injection/LuaInjectionStation.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 78b8ba284d726bf48803904bd5ada5c4\ntimeCreated: 1514865423\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/Injection.meta",
    "content": "fileFormatVersion: 2\nguid: cd35ae0a721aca5469a1dc038b2b6158\nfolderAsset: yes\ntimeCreated: 1515034041\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/Reflection/BindingFlags.lua",
    "content": "if System.Reflection == nil then    \n    System.Reflection = {}\nend\n\nlocal function GetMask(...)\n    local arg = {...}\n    local value = 0 \n\n    for i = 1, #arg do              \n        value = value + arg[i]    \n    end \n        \n    return value\nend\n\nlocal BindingFlags = \n{\n    Default = 0,\n    IgnoreCase = 1,\n    DeclaredOnly = 2,\n    Instance = 4,\n    Static = 8,\n    Public = 16,\n    NonPublic = 32,\n    FlattenHierarchy = 64,\n    InvokeMethod = 256,\n    CreateInstance = 512,\n    GetField = 1024,\n    SetField = 2048,\n    GetProperty = 4096,\n    SetProperty = 8192,\n    PutDispProperty = 16384,\n    PutRefDispProperty = 32768,\n    ExactBinding = 65536,\n    SuppressChangeType = 131072,\n    OptionalParamBinding = 262144,\n    IgnoreReturn = 16777216,\n}\n\nSystem.Reflection.BindingFlags = BindingFlags\nSystem.Reflection.BindingFlags.GetMask = GetMask\n\nreturn BindingFlags"
  },
  {
    "path": "Assets/ToLua/Lua/System/Reflection/BindingFlags.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 447334b96205b8040b534702d8d806c6\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/Reflection.meta",
    "content": "fileFormatVersion: 2\nguid: b31921aad5a29bf48b69fbad423de1be\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/Timer.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal setmetatable = setmetatable\nlocal UpdateBeat = UpdateBeat\nlocal CoUpdateBeat = CoUpdateBeat\nlocal Time = Time\n\nTimer = {}\n\nlocal Timer = Timer\nlocal mt = {__index = Timer}\n\n--unscaled false 采用deltaTime计时，true 采用 unscaledDeltaTime计时\nfunction Timer.New(func, duration, loop, unscaled)\n\tunscaled = unscaled or false and true\t\n\tloop = loop or 1\n\treturn setmetatable({func = func, duration = duration, time = duration, loop = loop, unscaled = unscaled, running = false}, mt)\t\nend\n\nfunction Timer:Start()\n\tself.running = true\n\n\tif not self.handle then\n\t\tself.handle = UpdateBeat:CreateListener(self.Update, self)\n\tend\n\n\tUpdateBeat:AddListener(self.handle)\t\nend\n\nfunction Timer:Reset(func, duration, loop, unscaled)\n\tself.duration \t= duration\n\tself.loop\t\t= loop or 1\n\tself.unscaled\t= unscaled\n\tself.func\t\t= func\n\tself.time\t\t= duration\t\t\nend\n\nfunction Timer:Stop()\n\tself.running = false\n\n\tif self.handle then\n\t\tUpdateBeat:RemoveListener(self.handle)\t\n\tend\nend\n\nfunction Timer:Update()\n\tif not self.running then\n\t\treturn\n\tend\n\n\tlocal delta = self.unscaled and Time.unscaledDeltaTime or Time.deltaTime\t\n\tself.time = self.time - delta\n\t\n\tif self.time <= 0 then\n\t\tself.func()\n\t\t\n\t\tif self.loop > 0 then\n\t\t\tself.loop = self.loop - 1\n\t\t\tself.time = self.time + self.duration\n\t\tend\n\t\t\n\t\tif self.loop == 0 then\n\t\t\tself:Stop()\n\t\telseif self.loop < 0 then\n\t\t\tself.time = self.time + self.duration\n\t\tend\n\tend\nend\n\n--给协同使用的帧计数timer\nFrameTimer = {}\n\nlocal FrameTimer = FrameTimer\nlocal mt2 = {__index = FrameTimer}\n\nfunction FrameTimer.New(func, count, loop)\t\n\tlocal c = Time.frameCount + count\n\tloop = loop or 1\n\treturn setmetatable({func = func, loop = loop, duration = count, count = c, running = false}, mt2)\t\t\nend\n\nfunction FrameTimer:Reset(func, count, loop)\n\tself.func = func\n\tself.duration = count\n\tself.loop = loop\n\tself.count = Time.frameCount + count\t\nend\n\nfunction FrameTimer:Start()\t\t\n\tif not self.handle then\n\t\tself.handle = CoUpdateBeat:CreateListener(self.Update, self)\n\tend\n\t\n\tCoUpdateBeat:AddListener(self.handle)\t\n\tself.running = true\nend\n\nfunction FrameTimer:Stop()\t\n\tself.running = false\n\n\tif self.handle then\n\t\tCoUpdateBeat:RemoveListener(self.handle)\t\n\tend\nend\n\nfunction FrameTimer:Update()\t\n\tif not self.running then\n\t\treturn\n\tend\n\n\tif Time.frameCount >= self.count then\n\t\tself.func()\t\n\t\t\n\t\tif self.loop > 0 then\n\t\t\tself.loop = self.loop - 1\n\t\tend\n\t\t\n\t\tif self.loop == 0 then\n\t\t\tself:Stop()\n\t\telse\n\t\t\tself.count = Time.frameCount + self.duration\n\t\tend\n\tend\nend\n\nCoTimer = {}\n\nlocal CoTimer = CoTimer\nlocal mt3 = {__index = CoTimer}\n\nfunction CoTimer.New(func, duration, loop)\t\n\tloop = loop or 1\n\treturn setmetatable({duration = duration, loop = loop, func = func, time = duration, running = false}, mt3)\t\t\t\nend\n\nfunction CoTimer:Start()\t\t\n\tif not self.handle then\t\n\t\tself.handle = CoUpdateBeat:CreateListener(self.Update, self)\n\tend\n\t\n\tself.running = true\n\tCoUpdateBeat:AddListener(self.handle)\t\nend\n\nfunction CoTimer:Reset(func, duration, loop)\n\tself.duration \t= duration\n\tself.loop\t\t= loop or 1\t\n\tself.func\t\t= func\n\tself.time\t\t= duration\t\t\nend\n\nfunction CoTimer:Stop()\n\tself.running = false\n\n\tif self.handle then\n\t\tCoUpdateBeat:RemoveListener(self.handle)\t\n\tend\nend\n\nfunction CoTimer:Update()\t\n\tif not self.running then\n\t\treturn\n\tend\n\n\tif self.time <= 0 then\n\t\tself.func()\t\t\n\t\t\n\t\tif self.loop > 0 then\n\t\t\tself.loop = self.loop - 1\n\t\t\tself.time = self.time + self.duration\n\t\tend\n\t\t\n\t\tif self.loop == 0 then\n\t\t\tself:Stop()\n\t\telseif self.loop < 0 then\n\t\t\tself.time = self.time + self.duration\n\t\tend\n\tend\n\t\n\tself.time = self.time - Time.deltaTime\nend"
  },
  {
    "path": "Assets/ToLua/Lua/System/Timer.lua.meta",
    "content": "fileFormatVersion: 2\nguid: e891968e6d367cf4da81d8c24a52c358\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/ValueType.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal ValueType = {}\n\nValueType[Vector3] \t\t= 1\nValueType[Quaternion]\t= 2\nValueType[Vector2]\t\t= 3\nValueType[Color]\t\t= 4\nValueType[Vector4]\t\t= 5\nValueType[Ray]\t\t\t= 6\nValueType[Bounds]\t\t= 7\nValueType[Touch]\t\t= 8\nValueType[LayerMask]\t= 9\nValueType[RaycastHit]\t= 10\nValueType[int64]\t\t= 11\nValueType[uint64]\t\t= 12\n\nlocal function GetValueType()\t\n\tlocal getmetatable = getmetatable\n\tlocal ValueType = ValueType\n\n\treturn function(udata)\n\t\tlocal meta = getmetatable(udata)\t\n\n\t\tif meta == nil then\n\t\t\treturn 0\n\t\tend\n\n\t\treturn ValueType[meta] or 0\n\tend\nend\n\nfunction AddValueType(table, type)\n\tValueType[table] = type\nend\n\nGetLuaValueType = GetValueType() "
  },
  {
    "path": "Assets/ToLua/Lua/System/ValueType.lua.meta",
    "content": "fileFormatVersion: 2\nguid: fab9e4d6fcf702740a4c66965903ed1f\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System/coroutine.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal create = coroutine.create\nlocal running = coroutine.running\nlocal resume = coroutine.resume\nlocal yield = coroutine.yield\nlocal error = error\nlocal unpack = unpack\nlocal debug = debug\nlocal FrameTimer = FrameTimer\nlocal CoTimer = CoTimer\n\nlocal comap = {}\nlocal pool = {}\nsetmetatable(comap, {__mode = \"kv\"})\n\nfunction coroutine.start(f, ...)\t\n\tlocal co = create(f)\n\t\n\tif running() == nil then\n\t\tlocal flag, msg = resume(co, ...)\n\t\n\t\tif not flag then\t\t\t\t\t\n\t\t\terror(debug.traceback(co, msg))\n\t\tend\t\t\t\t\t\n\telse\n\t\tlocal args = {...}\n\t\tlocal timer = nil\t\t\n\t\t\n\t\tlocal action = function()\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\tcomap[co] = nil\n\t\t\ttimer.func = nil\n\t\t\tlocal flag, msg = resume(co, unpack(args, 1, table.maxn(args)))\t\t\t\t\t\t\n\t\t\ttable.insert(pool, timer)\n\t\n\t\t\tif not flag then\t\n\t\t\t\ttimer:Stop()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\terror(debug.traceback(co, msg))\t\t\t\t\t\t\n\t\t\tend\t\t\n\t\tend\n\t\t\t\n\t\tif #pool > 0 then\n\t\t\ttimer = table.remove(pool)\n\t\t\ttimer:Reset(action, 0, 1)\n\t\telse\n\t\t\ttimer = FrameTimer.New(action, 0, 1)\n\t\tend\n\t\t\n\t\tcomap[co] = timer\n\t\ttimer:Start()\t\t\n\tend\n\n\treturn co\nend\n\nfunction coroutine.wait(t, co, ...)\n\tlocal args = {...}\n\tco = co or running()\t\t\n\tlocal timer = nil\n\t\t\n\tlocal action = function()\t\t\n\t\tcomap[co] = nil\t\t\n\t\ttimer.func = nil\n\t\tlocal flag, msg = resume(co, unpack(args, 1, table.maxn(args)))\n\t\t\n\t\tif not flag then\t\n\t\t\ttimer:Stop()\t\t\t\t\t\t\n\t\t\terror(debug.traceback(co, msg))\t\t\t\n\t\t\treturn\n\t\tend\n\tend\n\t\n\ttimer = CoTimer.New(action, t, 1)\n\tcomap[co] = timer\t\n\ttimer:Start()\n\treturn yield()\nend\n\nfunction coroutine.step(t, co, ...)\n\tlocal args = {...}\n\tco = co or running()\t\t\n\tlocal timer = nil\n\t\n\tlocal action = function()\t\n\t\tcomap[co] = nil\t\t\t\t\t\n\t\ttimer.func = nil\n\t\tlocal flag, msg = resume(co, unpack(args, 1, table.maxn(args)))\n\t\ttable.insert(pool, timer)\n\t\n\t\tif not flag then\t\n\t\t\ttimer:Stop()\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\terror(debug.traceback(co, msg))\n\t\t\treturn\t\n\t\tend\t\t\n\tend\n\t\t\t\t\n\tif #pool > 0 then\n\t\ttimer = table.remove(pool)\n\t\ttimer:Reset(action, t or 1, 1)\n\telse\n\t\ttimer = FrameTimer.New(action, t or 1, 1)\n\tend\n\n\tcomap[co] = timer\n\ttimer:Start()\n\treturn yield()\nend\n\nfunction coroutine.www(www, co)\t\t\t\n\tco = co or running()\t\t\t\n\tlocal timer = nil\t\t\t\n\t\t\t\n\tlocal action = function()\t\t\t\t\n\t\tif not www.isDone then\t\t\n\t\t\treturn\t\t\n\t\tend\t\t\n\t\t\t\t\n\t\tcomap[co] = nil\n\t\ttimer:Stop()\t\t\n\t\ttimer.func = nil\n\t\tlocal flag, msg = resume(co)\t\t\t\n\t\ttable.insert(pool, timer)\t\n\t\t\t\n\t\tif not flag then\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\terror(debug.traceback(co, msg))\t\t\t\n\t\t\treturn\t\t\t\n\t\tend\t\t\t\t\n\tend\t\t\n\t\t\t\t\n\tif #pool > 0 then\n\t\ttimer = table.remove(pool)\n\t\ttimer:Reset(action, 1, -1)\n\telse\t\n\t\ttimer = FrameTimer.New(action, 1, -1)\t\n\tend\n\tcomap[co] = timer\t\n \ttimer:Start()\n \treturn yield()\nend\n\nfunction coroutine.stop(co)\n \tlocal timer = comap[co] \t \t\n\n \tif timer ~= nil then\n \t\tcomap[co] = nil\n \t\ttimer:Stop()  \t\n \t\ttimer.func = nil\t\n \tend\nend\n"
  },
  {
    "path": "Assets/ToLua/Lua/System/coroutine.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 69692ffc56243fb4a8d655a208364fec\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/System.meta",
    "content": "fileFormatVersion: 2\nguid: c23205cbb914d9943ba97091e50d9d34\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Bounds.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal rawget = rawget\nlocal setmetatable = setmetatable\nlocal type = type\nlocal Vector3 = Vector3\nlocal zero = Vector3.zero\n\nlocal Bounds = \n{\n\tcenter = Vector3.zero,\n\textents = Vector3.zero,\n}\n\nlocal get = tolua.initget(Bounds)\n\nBounds.__index = function(t,k)\n\tlocal var = rawget(Bounds, k)\n\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\n\t\tend\n\tend\n\t\n\treturn var\nend\n\nBounds.__call = function(t, center, size)\n\treturn setmetatable({center = center, extents = size * 0.5}, Bounds)\t\t\nend\n\nfunction Bounds.New(center, size)\t\n\treturn setmetatable({center = center, extents = size * 0.5}, Bounds)\t\t\nend\n\nfunction Bounds:Get()\n\tlocal size = self:GetSize()\t\n\treturn self.center, size\nend\n\nfunction Bounds:GetSize()\n\treturn self.extents * 2\nend\n\nfunction Bounds:SetSize(value)\n\tself.extents = value * 0.5\nend\n\nfunction Bounds:GetMin()\n\treturn self.center - self.extents\nend\n\nfunction Bounds:SetMin(value)\n\tself:SetMinMax(value, self:GetMax())\nend\n\nfunction Bounds:GetMax()\n\treturn self.center + self.extents\nend\n\nfunction Bounds:SetMax(value)\n\tself:SetMinMax(self:GetMin(), value)\nend\n\nfunction Bounds:SetMinMax(min, max)\n\tself.extents = (max - min) * 0.5\n\tself.center = min + self.extents\nend\n\nfunction Bounds:Encapsulate(point)\n\tself:SetMinMax(Vector3.Min(self:GetMin(), point), Vector3.Max(self:GetMax(), point))\nend\n\nfunction Bounds:Expand(amount)\t\n\tif type(amount) == \"number\" then\n\t\tamount = amount * 0.5\n\t\tself.extents:Add(Vector3.New(amount, amount, amount))\n\telse\n\t\tself.extents:Add(amount * 0.5)\n\tend\nend\n\nfunction Bounds:Intersects(bounds)\n\tlocal min = self:GetMin()\n\tlocal max = self:GetMax()\n\t\n\tlocal min2 = bounds:GetMin()\n\tlocal max2 = bounds:GetMax()\n\t\n\treturn min.x <= max2.x and max.x >= min2.x and min.y <= max2.y and max.y >= min2.y and min.z <= max2.z and max.z >= min2.z\nend    \n\nfunction Bounds:Contains(p)\n\tlocal min = self:GetMin()\n\tlocal max = self:GetMax()\n\t\n\tif p.x < min.x or p.y < min.y or p.z < min.z or p.x > max.x or p.y > max.y or p.z > max.z then\n\t\treturn false\n\tend\n\t\n\treturn true\nend\n\nfunction Bounds:IntersectRay(ray)\n\tlocal tmin = -Mathf.Infinity\n\tlocal tmax = Mathf.Infinity\n\t\n\tlocal t0, t1, f\n\tlocal t = self:GetCenter () - ray:GetOrigin()\n\tlocal p = {t.x, t.y, t.z}\n\tt = self.extents\n\tlocal extent = {t.x, t.y, t.z}\n\tt = ray:GetDirection()\n\tlocal dir = {t.x, t.y, t.z}\n  \n\tfor i = 1, 3 do\t\n\t\tf = 1 / dir[i]\n\t\tt0 = (p[i] + extent[i]) * f\n\t\tt1 = (p[i] - extent[i]) * f\n\t\t\t\n\t\tif t0 < t1 then\t\t\t\n\t\t\tif t0 > tmin then tmin = t0 end\t\t\t\t\n\t\t\tif t1 < tmax then tmax = t1 end\t\t\t\t\n\t\t\tif tmin > tmax then return false end\t\t\t\t\n\t\t\tif tmax < 0 then return false end        \n\t\telse\t\t\t\n\t\t\tif t1 > tmin then tmin = t1 end\t\t\t\t\n\t\t\tif t0 < tmax then tmax = t0 end\t\t\t\t\n\t\t\tif tmin > tmax then return false end\t\t\t\t\n\t\t\tif tmax < 0 then return false end\n\t\tend\n\tend\n\t\n\treturn true, tmin\nend\n\nfunction Bounds:ClosestPoint(point)\n\tlocal t = point - self:GetCenter()\n\tlocal closest = {t.x, t.y, t.z}\n\tlocal et = self.extents\n\tlocal extent = {et.x, et.y, et.z}\n\tlocal distance = 0\n\tlocal delta\n\t\n\tfor i = 1, 3 do\t\n\t\tif  closest[i] < - extent[i] then\t\t\n\t\t\tdelta = closest[i] + extent[i]\n\t\t\tdistance = distance + delta * delta\n\t\t\tclosest[i] = -extent[i]\n\t\telseif closest[i] > extent[i]  then\n\t\t\tdelta = closest[i] - extent[i]\n\t\t\tdistance = distance + delta * delta\n\t\t\tclosest[i] = extent[i]\n\t\tend\n\tend\n\t\t\n\tif distance == 0 then\t    \n\t\treturn point, 0\n\telse\t\n\t\toutPoint = closest + self:GetCenter()\n\t\treturn outPoint, distance\n\tend\nend\n\nfunction Bounds:Destroy()\n\tself.center\t= nil\n\tself.size\t= nil\nend\n\nBounds.__tostring = function(self)\t\n\treturn string.format(\"Center: %s, Extents %s\", tostring(self.center), tostring(self.extents))\nend\n\nBounds.__eq = function(a, b)\n\treturn a.center == b.center and a.extents == b.extents\nend\n\nget.size = Bounds.GetSize\nget.min = Bounds.GetMin\nget.max = Bounds.GetMax\n\nUnityEngine.Bounds = Bounds\nsetmetatable(Bounds, Bounds)\nreturn Bounds\n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Bounds.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 8643f0e46fe222e48919766d7b0c7c5f\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Color.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\n\nlocal rawget = rawget\nlocal setmetatable = setmetatable\nlocal type = type\nlocal Mathf = Mathf\n\nlocal Color = {}\nlocal get = tolua.initget(Color)\n\nColor.__index = function(t,k)\n\tlocal var = rawget(Color, k)\n\t\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\n\t\tend\n\tend\n\t\n\treturn var\nend\n\nColor.__call = function(t, r, g, b, a)\n\treturn setmetatable({r = r or 0, g = g or 0, b = b or 0, a = a or 1}, Color)   \nend\n\nfunction Color.New(r, g, b, a)\n\treturn setmetatable({r = r or 0, g = g or 0, b = b or 0, a = a or 1}, Color)\t\t\nend\n\nfunction Color:Set(r, g, b, a)\n\tself.r = r\n\tself.g = g\n\tself.b = b\n\tself.a = a or 1 \nend\n\nfunction Color:Get()\n\treturn self.r, self.g, self.b, self.a\nend\n\nfunction Color:Equals(other)\n\treturn self.r == other.r and self.g == other.g and self.b == other.b and self.a == other.a\nend\n\nfunction Color.Lerp(a, b, t)\n\tt = Mathf.Clamp01(t)\n\treturn Color.New(a.r + t * (b.r - a.r), a.g + t * (b.g - a.g), a.b + t * (b.b - a.b), a.a + t * (b.a - a.a))\nend\n\nfunction Color.LerpUnclamped(a, b, t)\n  return Color.New(a.r + t * (b.r - a.r), a.g + t * (b.g - a.g), a.b + t * (b.b - a.b), a.a + t * (b.a - a.a))\nend\n\nfunction Color.HSVToRGB(H, S, V, hdr)\n  hdr = hdr and false or true  \n  local white = Color.New(1,1,1,1)\n  \n  if S == 0 then    \n    white.r = V\n    white.g = V\n    white.b = V\n    return white\n  end\n  \n  if V == 0 then    \n    white.r = 0\n    white.g = 0\n    white.b = 0\n    return white\n  end\n  \n  white.r = 0\n  white.g = 0\n  white.b = 0;\n  local num = S\n  local num2 = V\n  local f = H * 6;\n  local num4 = Mathf.Floor(f)\n  local num5 = f - num4\n  local num6 = num2 * (1 - num)\n  local num7 = num2 * (1 - (num * num5))\n  local num8 = num2 * (1 - (num * (1 - num5)))\n  local num9 = num4\n  \n  local flag = num9 + 1\n  \n  if flag == 0 then\n    white.r = num2\n    white.g = num6\n    white.b = num7\n  elseif flag == 1 then\n    white.r = num2\n    white.g = num8\n    white.b = num6\n  elseif flag == 2 then\n    white.r = num7\n    white.g = num2\n    white.b = num6\n  elseif flag == 3 then\n    white.r = num6\n    white.g = num2\n    white.b = num8\n  elseif flag == 4 then\n    white.r = num6\n    white.g = num7\n    white.b = num2\n  elseif flag == 5 then\n    white.r = num8\n    white.g = num6\n    white.b = num2\n  elseif flag == 6 then\n    white.r = num2\n    white.g = num6\n    white.b = num7\n  elseif flag == 7 then\n    white.r = num2\n    white.g = num8\n    white.b = num6\n  end\n  \n  if not hdr then    \n    white.r = Mathf.Clamp(white.r, 0, 1)\n    white.g = Mathf.Clamp(white.g, 0, 1)\n    white.b = Mathf.Clamp(white.b, 0, 1)\n  end\n    \n  return white\nend\n\nlocal function RGBToHSVHelper(offset, dominantcolor, colorone, colortwo)\n  local V = dominantcolor\n    \n  if V ~= 0 then    \n    local num = 0\n        \n    if colorone > colortwo then        \n      num = colortwo\n    else        \n      num = colorone\n    end\n        \n    local num2 = V - num\n    local H = 0\n    local S = 0\n        \n    if num2 ~= 0 then        \n      S = num2 / V\n      H = offset + (colorone - colortwo) / num2\n    else        \n      S = 0\n      H = offset + (colorone - colortwo)\n    end\n        \n    H = H / 6  \n    if H < 0 then H = H + 1 end                \n    return H, S, V\n  end\n  \n  return 0, 0, V  \nend\n\nfunction Color.RGBToHSV(rgbColor)\n    if rgbColor.b > rgbColor.g and rgbColor.b > rgbColor.r then    \n        return RGBToHSVHelper(4, rgbColor.b, rgbColor.r, rgbColor.g)    \n    elseif rgbColor.g > rgbColor.r then    \n        return RGBToHSVHelper(2, rgbColor.g, rgbColor.b, rgbColor.r)\n    else    \n        return RGBToHSVHelper(0, rgbColor.r, rgbColor.g, rgbColor.b)\n    end\nend\n\nfunction Color.GrayScale(a)\n\treturn 0.299 * a.r + 0.587 * a.g + 0.114 * a.b\nend\n\nColor.__tostring = function(self)\n\treturn string.format(\"RGBA(%f,%f,%f,%f)\", self.r, self.g, self.b, self.a)\nend\n\nColor.__add = function(a, b)\n\treturn Color.New(a.r + b.r, a.g + b.g, a.b + b.b, a.a + b.a)\nend\n\nColor.__sub = function(a, b)\t\n\treturn Color.New(a.r - b.r, a.g - b.g, a.b - b.b, a.a - b.a)\nend\n\nColor.__mul = function(a, b)\n\tif type(b) == \"number\" then\n\t\treturn Color.New(a.r * b, a.g * b, a.b * b, a.a * b)\n\telseif getmetatable(b) == Color then\n\t\treturn Color.New(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a)\n\tend\nend\n\nColor.__div = function(a, d)\n\treturn Color.New(a.r / d, a.g / d, a.b / d, a.a / d)\nend\n\nColor.__eq = function(a,b)\n\treturn a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a\nend\n\nget.red \t= function() return Color.New(1,0,0,1) end\nget.green\t= function() return Color.New(0,1,0,1) end\nget.blue\t= function() return Color.New(0,0,1,1) end\nget.white\t= function() return Color.New(1,1,1,1) end\nget.black\t= function() return Color.New(0,0,0,1) end\nget.yellow\t= function() return Color.New(1, 0.9215686, 0.01568628, 1) end\nget.cyan\t= function() return Color.New(0,1,1,1) end\nget.magenta\t= function() return Color.New(1,0,1,1) end\nget.gray\t= function() return Color.New(0.5,0.5,0.5,1) end\nget.clear\t= function() return Color.New(0,0,0,0) end\n\nget.gamma = function(c) \n  return Color.New(Mathf.LinearToGammaSpace(c.r), Mathf.LinearToGammaSpace(c.g), Mathf.LinearToGammaSpace(c.b), c.a)  \nend\n\nget.linear = function(c)\n  return Color.New(Mathf.GammaToLinearSpace(c.r), Mathf.GammaToLinearSpace(c.g), Mathf.GammaToLinearSpace(c.b), c.a)\nend\n\nget.maxColorComponent = function(c)    \n  return Mathf.Max(Mathf.Max(c.r, c.g), c.b)\nend\n\nget.grayscale = Color.GrayScale\n\nUnityEngine.Color = Color\nsetmetatable(Color, Color)\nreturn Color\n\n\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Color.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 54770d2645593c347ac25713a6d332e3\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Color32.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\n\nlocal rawget = rawget\nlocal setmetatable = setmetatable\nlocal type = type\nlocal Mathf = Mathf\n\nlocal Color32 = {}\nlocal get = tolua.initget(Color32)\n\nColor32.__index = function(t,k)\n\tlocal var = rawget(Color32, k)\n\t\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\n\t\tend\n\tend\n\t\n\treturn var\nend\n\nColor32.__call = function(t, r, g, b, a)\n\treturn setmetatable({r = r or 0, g = g or 0, b = b or 0, a = a or 255}, Color32)   \nend\n\nfunction Color32.New(r, g, b, a)\n\treturn setmetatable({r = r or 0, g = g or 0, b = b or 0, a = a or 255}, Color32)\t\t\nend\n\nfunction Color32:Set(r, g, b, a)\n\tself.r = r\n\tself.g = g\n\tself.b = b\n\tself.a = a or 255 \nend\n\nfunction Color32:Get()\n\treturn self.r, self.g, self.b, self.a\nend\n\nfunction Color32:Equals(other)\n\treturn self.r == other.r and self.g == other.g and self.b == other.b and self.a == other.a\nend\n\nfunction Color32.Lerp(a, b, t)\n\tt = Mathf.Clamp01(t)\n\treturn Color32.New(a.r + t * (b.r - a.r), a.g + t * (b.g - a.g), a.b + t * (b.b - a.b), a.a + t * (b.a - a.a))\nend\n\nfunction Color32.LerpUnclamped(a, b, t)\n  return Color32.New(a.r + t * (b.r - a.r), a.g + t * (b.g - a.g), a.b + t * (b.b - a.b), a.a + t * (b.a - a.a))\nend\n\n\nColor32.__tostring = function(self)\n\treturn string.format(\"RGBA(%f,%f,%f,%f)\", self.r, self.g, self.b, self.a)\nend\n\nColor32.__add = function(a, b)\n\treturn Color32.New(a.r + b.r, a.g + b.g, a.b + b.b, a.a + b.a)\nend\n\nColor32.__sub = function(a, b)\t\n\treturn Color32.New(a.r - b.r, a.g - b.g, a.b - b.b, a.a - b.a)\nend\n\nColor32.__mul = function(a, b)\n\tif type(b) == \"number\" then\n\t\treturn Color32.New(a.r * b, a.g * b, a.b * b, a.a * b)\n\telseif getmetatable(b) == Color32 then\n\t\treturn Color32.New(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a)\n\tend\nend\n\nColor32.__div = function(a, d)\n\treturn Color32.New(a.r / d, a.g / d, a.b / d, a.a / d)\nend\n\nColor32.__eq = function(a,b)\n\treturn a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a\nend\n\nUnityEngine.Color32 = Color32\nsetmetatable(Color32, Color32)\nreturn Color32\n\n\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Color32.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 8f6f1125c9c29f74c93411831e239a76\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/LayerMask.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal Layer = Layer\nlocal rawget = rawget\nlocal setmetatable = setmetatable\n\nlocal LayerMask = {}\n\nLayerMask.__index = function(t,k)\n\treturn rawget(LayerMask, k)\t\nend\n\nLayerMask.__call = function(t,v)\n\treturn setmetatable({value = value or 0}, LayerMask)\nend\n\nfunction LayerMask.New(value)\t\n\treturn setmetatable({value = value or 0}, LayerMask)\t\t\nend\n\nfunction LayerMask:Get()\n\treturn self.value\nend\n\nfunction LayerMask.NameToLayer(name)\n\treturn Layer[name]\nend\n\nfunction LayerMask.GetMask(...)\n\tlocal arg = {...}\n\tlocal value = 0\t\n\n\tfor i = 1, #arg do\t\t\n\t\tlocal n = LayerMask.NameToLayer(arg[i])\n\t\t\n\t\tif n ~= nil then\n\t\t\tvalue = value + 2 ^ n\t\t\t\t\n\t\tend\n\tend\t\n\t\t\n\treturn value\nend\n\nUnityEngine.LayerMask = LayerMask\nsetmetatable(LayerMask, LayerMask)\nreturn LayerMask\n\n\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/LayerMask.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 08700fd491ce4cf4ba55fd9832b9f9cf\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Mathf.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal math = math\nlocal floor = math.floor\nlocal abs = math.abs\nlocal Mathf = Mathf\n\nMathf.Deg2Rad = math.rad(1)\nMathf.Epsilon = 1.4013e-45\nMathf.Infinity = math.huge\nMathf.NegativeInfinity = -math.huge\nMathf.PI = math.pi\nMathf.Rad2Deg = math.deg(1)\n\t\t\nMathf.Abs = math.abs\nMathf.Acos = math.acos\nMathf.Asin = math.asin\nMathf.Atan = math.atan\nMathf.Atan2 = math.atan2\nMathf.Ceil = math.ceil\nMathf.Cos = math.cos\nMathf.Exp = math.exp\nMathf.Floor = math.floor\nMathf.Log = math.log\nMathf.Log10 = math.log10\nMathf.Max = math.max\nMathf.Min = math.min\nMathf.Pow = math.pow\nMathf.Sin = math.sin\nMathf.Sqrt = math.sqrt\nMathf.Tan = math.tan\nMathf.Deg = math.deg\nMathf.Rad = math.rad\nMathf.Random = math.random\n\nfunction Mathf.Approximately(a, b)\n\treturn abs(b - a) < math.max(1e-6 * math.max(abs(a), abs(b)), 1.121039e-44)\nend\n\nfunction Mathf.Clamp(value, min, max)\n\tif value < min then\n\t\tvalue = min\n\telseif value > max then\n\t\tvalue = max    \n\tend\n\t\n\treturn value\nend\n\nfunction Mathf.Clamp01(value)\n\tif value < 0 then\n\t\treturn 0\n\telseif value > 1 then\n\t\treturn 1   \n\tend\n\t\n\treturn value\nend\n\nfunction Mathf.DeltaAngle(current, target)    \n\tlocal num = Mathf.Repeat(target - current, 360)\n\n\tif num > 180 then\n\t\tnum = num - 360\n\tend\n\n\treturn num\nend \n\nfunction Mathf.Gamma(value, absmax, gamma) \n\tlocal flag = false\n\t\n    if value < 0 then    \n        flag = true\n    end\n\t\n    local num = abs(value)\n\t\n    if num > absmax then    \n        return (not flag) and num or -num\n    end\n\t\n    local num2 = math.pow(num / absmax, gamma) * absmax\n    return (not flag) and num2 or -num2\nend\n\nfunction Mathf.InverseLerp(from, to, value)\n\tif from < to then      \n\t\tif value < from then \n\t\t\treturn 0\n\t\tend\n\n\t\tif value > to then      \n\t\t\treturn 1\n\t\tend\n\n\t\tvalue = value - from\n\t\tvalue = value/(to - from)\n\t\treturn value\n\tend\n\n\tif from <= to then\n\t\treturn 0\n\tend\n\n\tif value < to then\n\t\treturn 1\n\tend\n\n\tif value > from then\n        return 0\n\tend\n\n\treturn 1 - ((value - to) / (from - to))\nend\n\nfunction Mathf.Lerp(from, to, t)\n\treturn from + (to - from) * Mathf.Clamp01(t)\nend\n\nfunction Mathf.LerpAngle(a, b, t)\n\tlocal num = Mathf.Repeat(b - a, 360)\n\n\tif num > 180 then\n\t\tnum = num - 360\n\tend\n\n\treturn a + num * Mathf.Clamp01(t)\nend\n\nfunction Mathf.LerpUnclamped(a, b, t)\n    return a + (b - a) * t;\nend\n\nfunction Mathf.MoveTowards(current, target, maxDelta)\n\tif abs(target - current) <= maxDelta then\n\t\treturn target\n\tend\n\n\treturn current + Mathf.Sign(target - current) * maxDelta\nend\n\nfunction Mathf.MoveTowardsAngle(current, target, maxDelta)\n\ttarget = current + Mathf.DeltaAngle(current, target)\n\treturn Mathf.MoveTowards(current, target, maxDelta)\nend\n\nfunction Mathf.PingPong(t, length)\n    t = Mathf.Repeat(t, length * 2)\n    return length - abs(t - length)\nend\n\nfunction Mathf.Repeat(t, length)    \n\treturn t - (floor(t / length) * length)\nend  \n\nfunction Mathf.Round(num)\n\treturn floor(num + 0.5)\nend\n\nfunction Mathf.Sign(num)  \n\tif num > 0 then\n\t\tnum = 1\n\telseif num < 0 then\n\t\tnum = -1\n\telse \n\t\tnum = 0\n\tend\n\n\treturn num\nend\n\nfunction Mathf.SmoothDamp(current, target, currentVelocity, smoothTime, maxSpeed, deltaTime)\n\tmaxSpeed = maxSpeed or Mathf.Infinity\n\tdeltaTime = deltaTime or Time.deltaTime\n    smoothTime = Mathf.Max(0.0001, smoothTime)\n    local num = 2 / smoothTime\n    local num2 = num * deltaTime\n    local num3 = 1 / (1 + num2 + 0.48 * num2 * num2 + 0.235 * num2 * num2 * num2)\n    local num4 = current - target\n    local num5 = target\n    local max = maxSpeed * smoothTime\n    num4 = Mathf.Clamp(num4, -max, max)\n    target = current - num4\n    local num7 = (currentVelocity + (num * num4)) * deltaTime\n    currentVelocity = (currentVelocity - num * num7) * num3\n    local num8 = target + (num4 + num7) * num3\n\t\n    if (num5 > current) == (num8 > num5)  then    \n        num8 = num5\n        currentVelocity = (num8 - num5) / deltaTime\t\t\n    end\n\t\n    return num8,currentVelocity\nend\n\nfunction Mathf.SmoothDampAngle(current, target, currentVelocity, smoothTime, maxSpeed, deltaTime)\n\tdeltaTime = deltaTime or Time.deltaTime\n\tmaxSpeed = maxSpeed or Mathf.Infinity\t\n\ttarget = current + Mathf.DeltaAngle(current, target)\n    return Mathf.SmoothDamp(current, target, currentVelocity, smoothTime, maxSpeed, deltaTime)\nend\n\n\nfunction Mathf.SmoothStep(from, to, t)\n    t = Mathf.Clamp01(t)\n    t = -2 * t * t * t + 3 * t * t\n    return to * t + from * (1 - t)\nend\n\nfunction Mathf.HorizontalAngle(dir) \n\treturn math.deg(math.atan2(dir.x, dir.z))\nend\n\nfunction Mathf.IsNan(number)\n\treturn not (number == number)\nend\n\nUnityEngine.Mathf = Mathf\nreturn Mathf"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Mathf.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 5cfbc4fb807d4e444bd41df7de6c249e\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Plane.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal setmetatable = setmetatable\nlocal Mathf = Mathf\nlocal Vector3 = Vector3\n\nlocal Plane = {}\n\nPlane.__index = function(t,k)\n\treturn rawget(Plane, k)\t\nend\n\nPlane.__call = function(t,v)\n\treturn Plane.New(v)\nend\n\nfunction Plane.New(normal, d)\n\treturn setmetatable({normal = normal:Normalize(), distance = d}, Plane)\t\nend\n\nfunction Plane:Get()\n\treturn self.normal, self.distance\nend\n\nfunction Plane:Raycast(ray)\n\tlocal a = Vector3.Dot(ray.direction, self.normal)\n    local num2 = -Vector3.Dot(ray.origin, self.normal) - self.distance\n\t\n    if Mathf.Approximately(a, 0) then                   \n\t\treturn false, 0        \n\tend\n\t\n    local enter = num2 / a    \n\treturn enter > 0, enter\nend\n\nfunction Plane:SetNormalAndPosition(inNormal, inPoint)    \n    self.normal = inNormal:Normalize()\n    self.distance = -Vector3.Dot(inNormal, inPoint)\nend    \n\nfunction Plane:Set3Points(a, b, c)    \n    self.normal = Vector3.Normalize(Vector3.Cross(b - a, c - a))\n    self.distance = -Vector3.Dot(self.normal, a)\nend\t\t    \n\nfunction Plane:GetDistanceToPoint(inPt)    \n\treturn Vector3.Dot(self.normal, inPt) + self.distance\nend    \n\nfunction Plane:GetSide(inPt)    \n\treturn (Vector3.Dot(self.normal, inPt) + self.distance) > 0\nend    \n\nfunction Plane:SameSide(inPt0, inPt1)    \n\tlocal distanceToPoint = self:GetDistanceToPoint(inPt0)\n\tlocal num2 = self:GetDistanceToPoint(inPt1)\n\treturn (distanceToPoint > 0 and num2 > 0) or (distanceToPoint <= 0 and num2 <= 0)\nend    \n\nUnityEngine.Plane = Plane\nsetmetatable(Plane, Plane)\nreturn Plane"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Plane.lua.meta",
    "content": "fileFormatVersion: 2\nguid: a3971497c90061f4d9c0e9a99b5bbcbe\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Profiler.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2018 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal LuaProfiler = LuaProfiler\nlocal vmdef = jit and require(\"jit.vmdef\")\n\n--通过文件名和行数指定一个函数名字\nlocal ffnames = \n{\n\tevent =\n\t{\n\t\t[20] = \"_xpcall.__call\",\n\t\t[142] = \"event.__call\",\t\t\n\t},\n\n    slot = \n    {\n        [11] = \"slot.__call\",\n    },\n\n    MainScene = \n    {\n        [250] = \"MainScene.Update\"\n    }\n}\n\n--不需要Profiler的函数\nlocal blacklist = \n{\n    [\"ipairs_aux\"] = 1,\n    [\"_xpcall.__call\"] = 1,    \n    [\"unknow\"] = 1,\n}\n\nlocal profiler = \n{\n    mark = 1,\n    cache = 1,    \n}\n\nlocal stacktrace = {}\n\nfunction profiler:scan(t, name)\n    if self.mark[t] then\n        return\n    end\n\n    self.mark[t] = true    \n\n\tfor k, v in pairs(t) do\n        if type(k) == \"string\" then\n\t\t  if type(v) == \"function\" then\n            local str = k\n\n\t\t\tif name then \n                str = name ..\".\".. str \n            end\n\n            if not blacklist[str] and k ~= \"__index\" and k ~= \"__newindex\" then            \n                self.cache[v] = {name = str, id = -1}\n            end\n\t\t  elseif type(v) == \"table\" and not self.mark[v] then            \n\t\t\tself:scan(v, k)\t\t            \n\t\t  end\n        elseif name and k == tolua.gettag or k == tolua.settag then            \n            self:scan(v, name)\n        end\n\tend\nend\n\nfunction profiler:scanlibs()\n    local t = package.loaded\n    self.mark[t] = true\n\n    for k, v in pairs(t) do\n        if type(k) == \"string\" and type(v) == \"table\" then\n            self:scan(v, k)\n            local mt = getmetatable(v)\n\n            if mt then\n                self:scan(mt, k)\n            end\n        end\n    end\nend\n\nlocal function findstack(func)\n    local pos = #stacktrace + 1\n\n    for i, v in ipairs(stacktrace) do\n        if v == func then\n            pos = i\n        end\n    end\n\n    return pos\nend\n\nlocal function jitreturn(count)    \n    local top = #stacktrace\n\n    if top > 0 then        \n        local ar = debug.getinfo (5, \"f\")    \n\n        if ar then\n            local func = ar.func                        \n            local index = findstack(func)\n\n            if index > top then\n                ar = debug.getinfo(6, \"f\")                \n\n                if ar then \n                    func = ar.func \n                    index = findstack(func) or index\n                end                                    \n            end\n\n            for i = index + 1, top do\n                table.remove(stacktrace)\n                LuaProfiler.EndSample()\n            end            \n        end\n    end   \nend\n\nlocal function BeginSample(name, func, cache)\n    jitreturn()\n    table.insert(stacktrace, func)    \n\n    if cache.id == -1 then \n        cache.name = name \n        cache.id = LuaProfiler.GetID(name)\n    end\n\n    LuaProfiler.BeginSample(cache.id)  \nend\n\nlocal function BeginSampleNick(name, func, cache)\n    jitreturn()\n    table.insert(stacktrace, func)        \n    local id = -1\n\n    if cache.nick == nil then \n        cache.nick = {}        \n    end\n\n    id = cache.nick[name]\n\n    if not id then\n        id = LuaProfiler.GetID(name)\n        cache.nick[name] = id\n    end\n\n    LuaProfiler.BeginSample(id)  \nend\n\nfunction profiler_hook(event, line)    \n    if event == 'call' then        \n        local name = nil\n        local func = debug.getinfo (2, 'f').func\n        local cache = profiler.cache[func]        \n\n        if cache then\n            name = cache.name         \n        end\n\n        if blacklist[name] then                         \n            return\n        end     \n        \n        if name == \"event.__call\" then            \n            local ar = debug.getinfo (2, 'n')                  \n            BeginSampleNick(ar.name or name, func, cache)\n        elseif name then          \n            BeginSample(name, func, cache)                                                                      \n        else\n            local ar = debug.getinfo (2, 'Sn')\n            local method = ar.name\n            local linedefined = ar.linedefined          \n\n            if not cache then\n                cache = {name = \"unknow\", id = -1}\n                profiler.cache[func] = cache\n            end    \n\n            if ar.short_src == \"[C]\" then\n                if method == \"__index\" or method == \"__newindex\" then\n                    return\n                end\n\n                local name = tostring(func)                                                             \n                local index = name:match(\"function: builtin#(%d+)\")       \n\n                if not index then   \n                    if method then\n                        name = method    \n                        BeginSample(method, func, cache)                                             \n                    elseif linedefined ~= -1 then\n                        name = ar.short_src .. linedefined                        \n                        BeginSample(name, func, cache)                              \n                    end \n                else\n                    name = vmdef.ffnames[tonumber(index)]\n\n                    if not blacklist[name] then                        \n                        BeginSample(name, func, cache)                      \n                    end\n                end                              \n            elseif linedefined ~= -1 or method then\n                local short_src = ar.short_src\n                method = method or linedefined\n\n                local name = nil                \n                name = short_src:match('([^/\\\\]+)%.%w+$')\n                name = name or short_src:match('([^/\\\\]+)$')\n\n                local ffname = ffnames[name]\n                \n                if ffname then\n                    name = ffname[linedefined]   \n                else\n                    name = name .. \".\" .. method                 \n                end\n                \n                if not name then\n                    name = short_src .. \".\" .. method\n                end\n                                                                            \n                BeginSample(name, func, cache)\n            else      \n                BeginSample(name, func, cache)                                                                                         \n            end\n        end\n    elseif event == \"return\" then   \n        local top = #stacktrace\n\n        if top == 0 then                                \n            return \n        end\n\n        local ar = debug.getinfo (2, 'f')\n\n        if ar.func == stacktrace[top] then            \n            table.remove(stacktrace)\n            LuaProfiler.EndSample()         \n        else            \n            local index = findstack(ar.func)\n            if index > top then return end\n\n            for i = index, top do\n                table.remove(stacktrace)\n                LuaProfiler.EndSample()\n            end\n        end\n    end    \nend\n\nfunction profiler:start()\n    self.mark = {}    \n    self.cache = {__mode = \"k\"}\n    \n    self:scan(_G, nil)\n    self:scanlibs()\n    self.mark = nil\n\n    debug.sethook(profiler_hook, 'cr', 0)\nend\n\nfunction profiler:print()\n    for k, v in pairs(self.cache) do\n        print(v.name)\n    end\nend\n\nfunction profiler:stop()\n    debug.sethook(nil)    \n    self.cache = nil          \nend\n\nreturn profiler"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Profiler.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 37c51fa1e5d7c094f8620b364c731293\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Quaternion.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal math\t= math\nlocal sin \t= math.sin\nlocal cos \t= math.cos\nlocal acos \t= math.acos\nlocal asin \t= math.asin\nlocal sqrt \t= math.sqrt\nlocal min\t= math.min\nlocal max \t= math.max\nlocal sign\t= math.sign\nlocal atan2 = math.atan2\nlocal clamp = Mathf.Clamp\nlocal abs\t= math.abs\nlocal setmetatable = setmetatable\nlocal getmetatable = getmetatable\nlocal rawget = rawget\nlocal rawset = rawset\nlocal Vector3 = Vector3\n\nlocal rad2Deg = Mathf.Rad2Deg\nlocal halfDegToRad = 0.5 * Mathf.Deg2Rad\nlocal _forward = Vector3.forward\nlocal _up = Vector3.up\nlocal _next = { 2, 3, 1 }\n\nlocal Quaternion = {}\nlocal get = tolua.initget(Quaternion)\n\nQuaternion.__index = function(t, k)\t\t\n\tlocal var = rawget(Quaternion, k)\n\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\n\t\tend\n\tend\n\n\treturn var\nend\n\nQuaternion.__newindex = function(t, name, k)\t\n\tif name == \"eulerAngles\" then\n\t\tt:SetEuler(k)\n\telse\n\t\trawset(t, name, k)\n\tend\t\nend\n\nfunction Quaternion.New(x, y, z, w)\t\n\tlocal t = {x = x or 0, y = y or 0, z = z or 0, w = w or 0}\n\tsetmetatable(t, Quaternion)\t\n\treturn t\nend\n\nlocal _new = Quaternion.New\n\nQuaternion.__call = function(t, x, y, z, w)\n\tlocal t = {x = x or 0, y = y or 0, z = z or 0, w = w or 0}\n\tsetmetatable(t, Quaternion)\t\n\treturn t\nend\n\nfunction Quaternion:Set(x,y,z,w)\n\tself.x = x or 0\n\tself.y = y or 0\n\tself.z = z or 0\n\tself.w = w or 0\nend\n\nfunction Quaternion:Clone()\n\treturn _new(self.x, self.y, self.z, self.w)\nend\n\nfunction Quaternion:Get()\n\treturn self.x, self.y, self.z, self.w\nend\n\nfunction Quaternion.Dot(a, b)\n\treturn a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w\nend\n\nfunction Quaternion.Angle(a, b)\n\tlocal dot = Quaternion.Dot(a, b)\n\tif dot < 0 then dot = -dot end\n\treturn acos(min(dot, 1)) * 2 * 57.29578\t\nend\n\nfunction Quaternion.AngleAxis(angle, axis)\n\tlocal normAxis = axis:Normalize()\n    angle = angle * halfDegToRad\n    local s = sin(angle)    \n    \n    local w = cos(angle)\n    local x = normAxis.x * s\n    local y = normAxis.y * s\n    local z = normAxis.z * s\n\t\n\treturn _new(x,y,z,w)\nend\n\nfunction Quaternion.Equals(a, b)\n\treturn a.x == b.x and a.y == b.y and a.z == b.z and a.w == b.w\nend\n\nfunction Quaternion.Euler(x, y, z)\n\tif y == nil and z == nil then\t\t\n\t\ty = x.y\n\t\tz = x.z\t\n\t\tx = x.x\n\tend\n\t\n\tx = x * 0.0087266462599716\n    y = y * 0.0087266462599716\n    z = z * 0.0087266462599716\n\n\tlocal sinX = sin(x)\n    x = cos(x)\n    local sinY = sin(y)\n    y = cos(y)\n    local sinZ = sin(z)\n    z = cos(z)\n\n    local q = {x = y * sinX * z + sinY * x * sinZ, y = sinY * x * z - y * sinX * sinZ, z = y * x * sinZ - sinY * sinX * z, w = y * x * z + sinY * sinX * sinZ}\n\tsetmetatable(q, Quaternion)\n\treturn q\nend\n\nfunction Quaternion:SetEuler(x, y, z)\t\t\n\tif y == nil and z == nil then\t\t\n\t\ty = x.y\n\t\tz = x.z\t\n\t\tx = x.x\n\tend\n\t\t\n\tx = x * 0.0087266462599716\n    y = y * 0.0087266462599716\n    z = z * 0.0087266462599716\n\t\n\tlocal sinX = sin(x)\n    local cosX = cos(x)\n    local sinY = sin(y)\n    local cosY = cos(y)\n    local sinZ = sin(z)\n    local cosZ = cos(z)\n    \n    self.w = cosY * cosX * cosZ + sinY * sinX * sinZ\n    self.x = cosY * sinX * cosZ + sinY * cosX * sinZ\n    self.y = sinY * cosX * cosZ - cosY * sinX * sinZ\n    self.z = cosY * cosX * sinZ - sinY * sinX * cosZ\n\t\n\treturn self\nend\n\nfunction Quaternion:Normalize()\n\tlocal quat = self:Clone()\n\tquat:SetNormalize()\n\treturn quat\nend\n\nfunction Quaternion:SetNormalize()\n\tlocal n = self.x * self.x + self.y * self.y + self.z * self.z + self.w * self.w\n\t\n\tif n ~= 1 and n > 0 then\n\t\tn = 1 / sqrt(n)\n\t\tself.x = self.x * n\n\t\tself.y = self.y * n\n\t\tself.z = self.z * n\n\t\tself.w = self.w * n\t\t\n\tend\nend\n\n--产生一个新的从from到to的四元数\nfunction Quaternion.FromToRotation(from, to)\n\tlocal quat = Quaternion.New()\n\tquat:SetFromToRotation(from, to)\n\treturn quat\nend\n\n--设置当前四元数为 from 到 to的旋转, 注意from和to同 forward平行会同unity不一致\nfunction Quaternion:SetFromToRotation1(from, to)\n\tlocal v0 = from:Normalize()\n\tlocal v1 = to:Normalize()\n\tlocal d = Vector3.Dot(v0, v1)\n\n\tif d > -1 + 1e-6 then\t\n\t\tlocal s = sqrt((1+d) * 2)\n\t\tlocal invs = 1 / s\n\t\tlocal c = Vector3.Cross(v0, v1) * invs\n\t\tself:Set(c.x, c.y, c.z, s * 0.5)\t\n\telseif d > 1 - 1e-6 then\n\t\treturn _new(0, 0, 0, 1)\n\telse\n\t\tlocal axis = Vector3.Cross(Vector3.right, v0)\n\t\t\n\t\tif axis:SqrMagnitude() < 1e-6 then\n\t\t\taxis = Vector3.Cross(Vector3.forward, v0)\n\t\tend\n\n\t\tself:Set(axis.x, axis.y, axis.z, 0)\t\t\n\t\treturn self\n\tend\n\t\n\treturn self\nend\n\nlocal function MatrixToQuaternion(rot, quat)\n\tlocal trace = rot[1][1] + rot[2][2] + rot[3][3]\n\t\n\tif trace > 0 then\t\t\n\t\tlocal s = sqrt(trace + 1)\n\t\tquat.w = 0.5 * s\n\t\ts = 0.5 / s\n\t\tquat.x = (rot[3][2] - rot[2][3]) * s\n\t\tquat.y = (rot[1][3] - rot[3][1]) * s\n\t\tquat.z = (rot[2][1] - rot[1][2]) * s\n\t\tquat:SetNormalize()\n\telse\n\t\tlocal i = 1\t\t\n\t\tlocal q = {0, 0, 0}\n\t\t\n\t\tif rot[2][2] > rot[1][1] then\t\t\t\n\t\t\ti = 2\t\t\t\n\t\tend\n\t\t\n\t\tif rot[3][3] > rot[i][i] then\n\t\t\ti = 3\t\t\t\n\t\tend\n\t\t\n\t\tlocal j = _next[i]\n\t\tlocal k = _next[j]\n\t\t\n\t\tlocal t = rot[i][i] - rot[j][j] - rot[k][k] + 1\n\t\tlocal s = 0.5 / sqrt(t)\n\t\tq[i] = s * t\n\t\tlocal w = (rot[k][j] - rot[j][k]) * s\n\t\tq[j] = (rot[j][i] + rot[i][j]) * s\n\t\tq[k] = (rot[k][i] + rot[i][k]) * s\n\t\t\n\t\tquat:Set(q[1], q[2], q[3], w)\t\t\t\n\t\tquat:SetNormalize()\t\t\n\tend\nend\n\nfunction Quaternion:SetFromToRotation(from, to)\n\tfrom = from:Normalize()\n\tto = to:Normalize()\n\t\n\tlocal e = Vector3.Dot(from, to)\n\t\n\tif e > 1 - 1e-6 then\n\t\tself:Set(0, 0, 0, 1)\n\telseif e < -1 + 1e-6 then\t\t\n\t\tlocal left = {0, from.z, from.y}\t\n\t\tlocal mag = left[2] * left[2] + left[3] * left[3]  --+ left[1] * left[1] = 0\n\t\t\n\t\tif mag < 1e-6 then\t\t\n\t\t\tleft[1] = -from.z\n\t\t\tleft[2] = 0\n\t\t\tleft[3] = from.x\n\t\t\tmag = left[1] * left[1] + left[3] * left[3]\n\t\tend\n\t\t\t\t\n\t\tlocal invlen = 1/sqrt(mag)\n\t\tleft[1] = left[1] * invlen\n\t\tleft[2] = left[2] * invlen\n\t\tleft[3] = left[3] * invlen\n\t\t\n\t\tlocal up = {0, 0, 0}\n\t\tup[1] = left[2] * from.z - left[3] * from.y\n\t\tup[2] = left[3] * from.x - left[1] * from.z\n\t\tup[3] = left[1] * from.y - left[2] * from.x\n\t\t\t\t\n\n\t\tlocal fxx = -from.x * from.x\n\t\tlocal fyy = -from.y * from.y\n\t\tlocal fzz = -from.z * from.z\n\t\t\n\t\tlocal fxy = -from.x * from.y\n\t\tlocal fxz = -from.x * from.z\n\t\tlocal fyz = -from.y * from.z\n\n\t\tlocal uxx = up[1] * up[1]\n\t\tlocal uyy = up[2] * up[2]\n\t\tlocal uzz = up[3] * up[3]\n\t\tlocal uxy = up[1] * up[2]\n\t\tlocal uxz = up[1] * up[3]\n\t\tlocal uyz = up[2] * up[3]\n\n\t\tlocal lxx = -left[1] * left[1]\n\t\tlocal lyy = -left[2] * left[2]\n\t\tlocal lzz = -left[3] * left[3]\n\t\tlocal lxy = -left[1] * left[2]\n\t\tlocal lxz = -left[1] * left[3]\n\t\tlocal lyz = -left[2] * left[3]\n\t\t\n\t\tlocal rot = \n\t\t{\n\t\t\t{fxx + uxx + lxx, fxy + uxy + lxy, fxz + uxz + lxz},\n\t\t\t{fxy + uxy + lxy, fyy + uyy + lyy, fyz + uyz + lyz},\n\t\t\t{fxz + uxz + lxz, fyz + uyz + lyz, fzz + uzz + lzz},\n\t\t}\n\t\t\n\t\tMatrixToQuaternion(rot, self)\t\t\n\telse\n\t\tlocal v = Vector3.Cross(from, to)\n\t\tlocal h = (1 - e) / Vector3.Dot(v, v) \n\t\t\n\t\tlocal hx = h * v.x\n\t\tlocal hz = h * v.z\n\t\tlocal hxy = hx * v.y\n\t\tlocal hxz = hx * v.z\n\t\tlocal hyz = hz * v.y\n\t\t\n\t\tlocal rot = \n\t\t{ \t\t\t\t\t\n\t\t\t{e + hx*v.x, \thxy - v.z, \t\thxz + v.y},\n\t\t\t{hxy + v.z,  \te + h*v.y*v.y, \thyz-v.x},\n\t\t\t{hxz - v.y,  \thyz + v.x,    \te + hz*v.z},\n\t\t}\n\t\t\n\t\tMatrixToQuaternion(rot, self)\n\tend\nend\n\nfunction Quaternion:Inverse()\n\tlocal quat = Quaternion.New()\n\t\t\n\tquat.x = -self.x\n\tquat.y = -self.y\n\tquat.z = -self.z\n\tquat.w = self.w\n\t\n\treturn quat\nend\n\nfunction Quaternion.Lerp(q1, q2, t)\n\tt = clamp(t, 0, 1)\n\tlocal q = {x = 0, y = 0, z = 0, w = 1}\t\n\t\n\tif Quaternion.Dot(q1, q2) < 0 then\n\t\tq.x = q1.x + t * (-q2.x -q1.x)\n\t\tq.y = q1.y + t * (-q2.y -q1.y)\n\t\tq.z = q1.z + t * (-q2.z -q1.z)\n\t\tq.w = q1.w + t * (-q2.w -q1.w)\n\telse\n\t\tq.x = q1.x + (q2.x - q1.x) * t\n\t\tq.y = q1.y + (q2.y - q1.y) * t\n\t\tq.z = q1.z + (q2.z - q1.z) * t\n\t\tq.w = q1.w + (q2.w - q1.w) * t\n\tend\t\n\t\n\tQuaternion.SetNormalize(q)\t\n\tsetmetatable(q, Quaternion)\n\treturn q\nend\n\n\nfunction Quaternion.LookRotation(forward, up)\n\tlocal mag = forward:Magnitude()\n\tif mag < 1e-6 then\n\t\terror(\"error input forward to Quaternion.LookRotation\"..tostring(forward))\n\t\treturn nil\n\tend\n\t\n\tforward = forward / mag\n\tup = up or _up\t\t\t\t\n\tlocal right = Vector3.Cross(up, forward)\n\tright:SetNormalize()    \n    up = Vector3.Cross(forward, right)\n    right = Vector3.Cross(up, forward)\t\n\t\n--[[\tlocal quat = _new(0,0,0,1)\n\tlocal rot = \n\t{ \t\t\t\t\t\n\t\t{right.x, up.x, forward.x},\n\t\t{right.y, up.y, forward.y},\n\t\t{right.z, up.z, forward.z},\n\t}\n\t\n\tMatrixToQuaternion(rot, quat)\n\treturn quat--]]\n\t\t\n\tlocal t = right.x + up.y + forward.z\n    \n\tif t > 0 then\t\t\n\t\tlocal x, y, z, w\n\t\tt = t + 1\n\t\tlocal s = 0.5 / sqrt(t)\t\t\n\t\tw = s * t\n\t\tx = (up.z - forward.y) * s\t\t\n\t\ty = (forward.x - right.z) * s\n\t\tz = (right.y - up.x) * s\n\t\t\n\t\tlocal ret = _new(x, y, z, w)\t\n\t\tret:SetNormalize()\n\t\treturn ret\n\telse\n\t\tlocal rot = \n\t\t{ \t\t\t\t\t\n\t\t\t{right.x, up.x, forward.x},\n\t\t\t{right.y, up.y, forward.y},\n\t\t\t{right.z, up.z, forward.z},\n\t\t}\n\t\n\t\tlocal q = {0, 0, 0}\n\t\tlocal i = 1\t\t\n\t\t\n\t\tif up.y > right.x then\t\t\t\n\t\t\ti = 2\t\t\t\n\t\tend\n\t\t\n\t\tif forward.z > rot[i][i] then\n\t\t\ti = 3\t\t\t\n\t\tend\n\t\t\n\t\tlocal j = _next[i]\n\t\tlocal k = _next[j]\n\t\t\n\t\tlocal t = rot[i][i] - rot[j][j] - rot[k][k] + 1\n\t\tlocal s = 0.5 / sqrt(t)\n\t\tq[i] = s * t\n\t\tlocal w = (rot[k][j] - rot[j][k]) * s\n\t\tq[j] = (rot[j][i] + rot[i][j]) * s\n\t\tq[k] = (rot[k][i] + rot[i][k]) * s\n\t\t\n\t\tlocal ret = _new(q[1], q[2], q[3], w)\t\t\t\n\t\tret:SetNormalize()\n\t\treturn ret\n\tend\nend\n\nfunction Quaternion:SetIdentity()\n\tself.x = 0\n\tself.y = 0\n\tself.z = 0\n\tself.w = 1\nend\n\nlocal function UnclampedSlerp(q1, q2, t)\t\t\n\tlocal dot = q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w\n\n    if dot < 0 then\n        dot = -dot        \n        q2 = setmetatable({x = -q2.x, y = -q2.y, z = -q2.z, w = -q2.w}, Quaternion)        \n    end\n\n    if dot < 0.95 then\t\t\n\t    local angle = acos(dot)\n        local invSinAngle = 1 / sin(angle)\n        local t1 = sin((1 - t) * angle) * invSinAngle\n        local t2 = sin(t * angle) * invSinAngle\n        q1 = {x = q1.x * t1 + q2.x * t2, y = q1.y * t1 + q2.y * t2, z = q1.z * t1 + q2.z * t2, w = q1.w * t1 + q2.w * t2}\n\t\tsetmetatable(q1, Quaternion)\t\t\n\t\treturn q1\n\telse\n\t\tq1 = {x = q1.x + t * (q2.x - q1.x), y = q1.y + t * (q2.y - q1.y), z = q1.z + t * (q2.z - q1.z), w = q1.w + t * (q2.w - q1.w)}\t\t\n\t\tQuaternion.SetNormalize(q1)\t\t\n\t\tsetmetatable(q1, Quaternion)\n\t\treturn q1\n    end\nend\n\n\nfunction Quaternion.Slerp(from, to, t)\t\n\tif t < 0 then\n\t\tt = 0\n\telseif t > 1 then\n\t\tt = 1\n\tend\n\n\treturn UnclampedSlerp(from, to, t)\nend\n\nfunction Quaternion.RotateTowards(from, to, maxDegreesDelta)   \t\n\tlocal angle = Quaternion.Angle(from, to)\n\t\n\tif angle == 0 then\n\t\treturn to\n\tend\n\t\n\tlocal t = min(1, maxDegreesDelta / angle)\n\treturn UnclampedSlerp(from, to, t)\nend\n\nlocal function Approximately(f0, f1)\n\treturn abs(f0 - f1) < 1e-6\t\nend\n\nfunction Quaternion:ToAngleAxis()\t\t\n\tlocal angle = 2 * acos(self.w)\n\t\n\tif Approximately(angle, 0) then\n\t\treturn angle * 57.29578, Vector3.New(1, 0, 0)\n\tend\n\t\n\tlocal div = 1 / sqrt(1 - sqrt(self.w))\n\treturn angle * 57.29578, Vector3.New(self.x * div, self.y * div, self.z * div)\nend\n\nlocal pi = Mathf.PI\nlocal half_pi = pi * 0.5\nlocal two_pi = 2 * pi\nlocal negativeFlip = -0.0001\nlocal positiveFlip = two_pi - 0.0001\n\t\nlocal function SanitizeEuler(euler)\t\n\tif euler.x < negativeFlip then\n\t\teuler.x = euler.x + two_pi\n\telseif euler.x > positiveFlip then\n\t\teuler.x = euler.x - two_pi\n\tend\n\n\tif euler.y < negativeFlip then\n\t\teuler.y = euler.y + two_pi\n\telseif euler.y > positiveFlip then\n\t\teuler.y = euler.y - two_pi\n\tend\n\n\tif euler.z < negativeFlip then\n\t\teuler.z = euler.z + two_pi\n\telseif euler.z > positiveFlip then\n\t\teuler.z = euler.z + two_pi\n\tend\nend\n\n--from http://www.geometrictools.com/Documentation/EulerAngles.pdf\n--Order of rotations: YXZ\nfunction Quaternion:ToEulerAngles()\n\tlocal x = self.x\n\tlocal y = self.y\n\tlocal z = self.z\n\tlocal w = self.w\n\t\t\n\tlocal check = 2 * (y * z - w * x)\n\t\n\tif check < 0.999 then\n\t\tif check > -0.999 then\n\t\t\tlocal v = Vector3.New( -asin(check), \n\t\t\t\t\t\tatan2(2 * (x * z + w * y), 1 - 2 * (x * x + y * y)), \n\t\t\t\t\t\tatan2(2 * (x * y + w * z), 1 - 2 * (x * x + z * z)))\n\t\t\tSanitizeEuler(v)\n\t\t\tv:Mul(rad2Deg)\n\t\t\treturn v\n\t\telse\n\t\t\tlocal v = Vector3.New(half_pi, atan2(2 * (x * y - w * z), 1 - 2 * (y * y + z * z)), 0)\n\t\t\tSanitizeEuler(v)\n\t\t\tv:Mul(rad2Deg)\n\t\t\treturn v\n\t\tend\n\telse\n\t\tlocal v = Vector3.New(-half_pi, atan2(-2 * (x * y - w * z), 1 - 2 * (y * y + z * z)), 0)\n\t\tSanitizeEuler(v)\n\t\tv:Mul(rad2Deg)\n\t\treturn v\t\t\n\tend\nend\n\nfunction Quaternion:Forward()\n\treturn self:MulVec3(_forward)\nend\n\nfunction Quaternion.MulVec3(self, point)\n\tlocal vec = Vector3.New()\n    \n\tlocal num \t= self.x * 2\n\tlocal num2 \t= self.y * 2\n\tlocal num3 \t= self.z * 2\n\tlocal num4 \t= self.x * num\n\tlocal num5 \t= self.y * num2\n\tlocal num6 \t= self.z * num3\n\tlocal num7 \t= self.x * num2\n\tlocal num8 \t= self.x * num3\n\tlocal num9 \t= self.y * num3\n\tlocal num10 = self.w * num\n\tlocal num11 = self.w * num2\n\tlocal num12 = self.w * num3\n\t\n\tvec.x = (((1 - (num5 + num6)) * point.x) + ((num7 - num12) * point.y)) + ((num8 + num11) * point.z)\n\tvec.y = (((num7 + num12) * point.x) + ((1 - (num4 + num6)) * point.y)) + ((num9 - num10) * point.z)\n\tvec.z = (((num8 - num11) * point.x) + ((num9 + num10) * point.y)) + ((1 - (num4 + num5)) * point.z)\n\t\n\treturn vec\nend\n\nQuaternion.__mul = function(lhs, rhs)\n\tif Quaternion == getmetatable(rhs) then\n\t\treturn Quaternion.New((((lhs.w * rhs.x) + (lhs.x * rhs.w)) + (lhs.y * rhs.z)) - (lhs.z * rhs.y), (((lhs.w * rhs.y) + (lhs.y * rhs.w)) + (lhs.z * rhs.x)) - (lhs.x * rhs.z), (((lhs.w * rhs.z) + (lhs.z * rhs.w)) + (lhs.x * rhs.y)) - (lhs.y * rhs.x), (((lhs.w * rhs.w) - (lhs.x * rhs.x)) - (lhs.y * rhs.y)) - (lhs.z * rhs.z))\t\n\telseif Vector3 == getmetatable(rhs) then\n\t\treturn lhs:MulVec3(rhs)\n\tend\nend\n\nQuaternion.__unm = function(q)\n\treturn Quaternion.New(-q.x, -q.y, -q.z, -q.w)\nend\n\nQuaternion.__eq = function(lhs,rhs)\n\treturn Quaternion.Dot(lhs, rhs) > 0.999999\nend\n\nQuaternion.__tostring = function(self)\n\treturn \"[\"..self.x..\",\"..self.y..\",\"..self.z..\",\"..self.w..\"]\"\nend\n\nget.identity = function() return _new(0, 0, 0, 1) end\nget.eulerAngles = Quaternion.ToEulerAngles\n\nUnityEngine.Quaternion = Quaternion\nsetmetatable(Quaternion, Quaternion)\nreturn Quaternion"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Quaternion.lua.meta",
    "content": "fileFormatVersion: 2\nguid: bc8181e6244125146a87c5b83c380a92\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Ray.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal rawget = rawget\nlocal setmetatable = setmetatable\nlocal Vector3 = Vector3\n\nlocal Ray = \n{\n\tdirection = Vector3.zero,\n\torigin = Vector3.zero,\n}\n\nlocal get = tolua.initget(Ray)\n\nRay.__index = function(t,k)\n\tlocal var = rawget(Ray, k)\n\t\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\n\t\tend\n\tend\n\t\n\treturn var\nend\n\nRay.__call = function(t, direction, origin)\n\treturn Ray.New(direction, origin)\nend\n\nfunction Ray.New(direction, origin)\n\tlocal ray = {}\t\n\tray.direction \t= direction:Normalize()\n\tray.origin \t\t= origin\n\tsetmetatable(ray, Ray)\t\n\treturn ray\nend\n\nfunction Ray:GetPoint(distance)\n\tlocal dir = self.direction * distance\n\tdir:Add(self.origin)\n\treturn dir\nend\n\nfunction Ray:Get()\t\t\n\tlocal o = self.origin\n\tlocal d = self.direction\n\treturn o.x, o.y, o.z, d.x, d.y, d.z\nend\n\nRay.__tostring = function(self)\n\treturn string.format(\"Origin:(%f,%f,%f),Dir:(%f,%f, %f)\", self.origin.x, self.origin.y, self.origin.z, self.direction.x, self.direction.y, self.direction.z)\nend\n\nUnityEngine.Ray = Ray\nsetmetatable(Ray, Ray)\nreturn Ray"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Ray.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 436d981c3546acd44a03048767c0d85a\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/RaycastHit.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal rawget = rawget\nlocal setmetatable = setmetatable\n\nRaycastBits = \n{\n\tCollider = 1,\n    Normal = 2,\n    Point = 4,\n    Rigidbody = 8,\n    Transform = 16,\n    ALL = 31,\n}\n\t\nlocal RaycastBits = RaycastBits\nlocal RaycastHit = {}\nlocal get = tolua.initget(RaycastHit)\n\nRaycastHit.__index = function(t,k)\n\tlocal var = rawget(RaycastHit, k)\n\t\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\n\t\tend\n\tend\n\t\n\treturn var\nend\n\n--c# 创建\nfunction RaycastHit.New(collider, distance, normal, point, rigidbody, transform)\n\tlocal hit = {collider = collider, distance = distance, normal = normal, point = point, rigidbody = rigidbody, transform = transform}\n\tsetmetatable(hit, RaycastHit)\n\treturn hit\nend\n\nfunction RaycastHit:Init(collider, distance, normal, point, rigidbody, transform)\n\tself.collider \t= collider\n\tself.distance \t= distance\n\tself.normal \t= normal\n\tself.point \t\t= point\n\tself.rigidbody \t= rigidbody\n\tself.transform \t= transform\nend\n\nfunction RaycastHit:Get()\n\treturn self.collider, self.distance, self.normal, self.point, self.rigidbody, self.transform\nend\n\nfunction RaycastHit:Destroy()\t\t\t\t\n\tself.collider \t= nil\t\t\t\n\tself.rigidbody \t= nil\t\t\t\t\t\n\tself.transform \t= nil\t\t\nend\n\nfunction RaycastHit.GetMask(...)\n\tlocal arg = {...}\n\tlocal value = 0\t\n\n\tfor i = 1, #arg do\t\t\n\t\tlocal n = RaycastBits[arg[i]] or 0\n\t\t\n\t\tif n ~= 0 then\n\t\t\tvalue = value + n\t\t\t\t\n\t\tend\n\tend\t\n\t\t\n\tif value == 0 then value = RaycastBits[\"all\"] end\n\treturn value\nend\n\nUnityEngine.RaycastHit = RaycastHit\nsetmetatable(RaycastHit, RaycastHit)\nreturn RaycastHit"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/RaycastHit.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 707a4e1a225007d45923200abf2c9c13\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Time.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal rawget = rawget\nlocal uTime = UnityEngine.Time\nlocal gettime = tolua.gettime\n\nlocal _Time = \n{\t\n\tdeltaTime\t\t\t= 0,\n\tfixedDeltaTime \t \t= 0,\n\tmaximumDeltaTime\t= 0.3333333,\n\tfixedTime\t\t\t= 0,\n\tframeCount\t\t\t= 1,\t\n\trealtimeSinceStartup=0,\n\ttime \t\t\t\t= 0,\n\ttimeScale\t\t\t= 1,\n\ttimeSinceLevelLoad\t= 0,\n\tunscaledDeltaTime\t= 0,\t\n\tunscaledTime\t\t= 0,\t\n}\n\nlocal _set = {}\n\nfunction _set.fixedDeltaTime(v)\n\t_Time.fixedDeltaTime = v\n\tuTime.fixedDeltaTime = v\nend\n\nfunction _set.maximumDeltaTime(v)\n\t_Time.maximumDeltaTime = v\n\tuTime.maximumDeltaTime = v\nend\n\nfunction _set.timeScale(v)\n\t_Time.timeScale = v\n\tuTime.timeScale = v\nend\n\nfunction _set.captureFramerate(v)\n\t_Time.captureFramerate = v\n\tuTime.captureFramerate = v\nend\n\nfunction _set.timeSinceLevelLoad(v)\n\t_Time.timeSinceLevelLoad = v\nend\n\n_Time.__index = function(t, k)\n\tlocal var = rawget(_Time, k)\n\t\n\tif var then\n\t\treturn var\n\tend\n\n\treturn uTime.__index(uTime, k)\t\nend\n\n_Time.__newindex = function(t, k, v)\n\tlocal func = rawget(_set, k)\n\n\tif func then\n\t\treturn func(v)\n\tend\n\n\terror(string.format(\"Property or indexer `UnityEngine.Time.%s' cannot be assigned to (it is read only)\", k))\t\nend\n\nlocal Time = {}\nlocal counter = 1\n\nfunction Time:SetDeltaTime(deltaTime, unscaledDeltaTime)\t\n\tlocal _Time = _Time\n\t_Time.deltaTime = deltaTime\t\n\t_Time.unscaledDeltaTime = unscaledDeltaTime\n\tcounter = counter - 1\n\n\tif counter == 0 and uTime then\t\n\t\t_Time.time = uTime.time\n\t\t_Time.timeSinceLevelLoad = uTime.timeSinceLevelLoad\n\t\t_Time.unscaledTime = uTime.unscaledTime\n\t\t_Time.realtimeSinceStartup = uTime.realtimeSinceStartup\n\t\t_Time.frameCount = uTime.frameCount\n\t\tcounter = 1000000\n\telse\n\t\t_Time.time = _Time.time + deltaTime\n\t\t_Time.realtimeSinceStartup = _Time.realtimeSinceStartup + unscaledDeltaTime\n\t\t_Time.timeSinceLevelLoad = _Time.timeSinceLevelLoad + deltaTime\t\n\t\t_Time.unscaledTime = _Time.unscaledTime + unscaledDeltaTime \n\tend\t\t\nend\n\nfunction Time:SetFixedDelta(fixedDeltaTime)\t\n\t_Time.deltaTime = fixedDeltaTime\n\t_Time.fixedDeltaTime = fixedDeltaTime\n\n\t_Time.fixedTime = _Time.fixedTime + fixedDeltaTime\nend\n\nfunction Time:SetFrameCount()\n\t_Time.frameCount = _Time.frameCount + 1\nend\n\nfunction Time:SetTimeScale(scale)\n\tlocal last = _Time.timeScale\n\t_Time.timeScale = scale\n\tuTime.timeScale = scale\n\treturn last\nend\n\nfunction Time:GetTimestamp()\n\treturn gettime()\nend\n\nUnityEngine.Time = Time\nsetmetatable(Time, _Time)\n\nif uTime ~= nil then\n\t_Time.maximumDeltaTime = uTime.maximumDeltaTime\t\n\t_Time.timeScale = uTime.timeScale\t\nend\n\n\nreturn Time"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Time.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 0f2e1d9dee4ecaf4b8734c59f1c9f3b5\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Touch.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal zero = Vector2.zero\nlocal rawget = rawget\nlocal setmetatable = setmetatable\n\nTouchPhase =\n{\n\tBegan = 0,\n\tMoved = 1,\n\tStationary = 2,\n\tEnded = 3,\n\tCanceled = 4,\n}\n\nTouchBits = \n{\n\tDeltaPosition = 1,\n\tPosition = 2,\n\tRawPosition = 4,\n\tALL = 7,\n}\n\nlocal TouchPhase = TouchPhase\nlocal TouchBits = TouchBits\nlocal Touch = {}\nlocal get = tolua.initget(Touch)\n\nTouch.__index = function(t,k)\n\tlocal var = rawget(Touch, k)\n\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\n\t\tend\n\tend\n\t\n\treturn var\nend\n\n--c# 创建\nfunction Touch.New(fingerId, position, rawPosition, deltaPosition, deltaTime, tapCount, phase)\t\n\treturn setmetatable({fingerId = fingerId or 0, position = position or zero, rawPosition = rawPosition or zero, deltaPosition = deltaPosition or zero, deltaTime = deltaTime or 0, tapCount = tapCount or 0, phase = phase or 0}, Touch)\t\nend\n\nfunction Touch:Init(fingerId, position, rawPosition, deltaPosition, deltaTime, tapCount, phase)\n\tself.fingerId = fingerId\n\tself.position = position\n\tself.rawPosition = rawPosition\n\tself.deltaPosition = deltaPosition\n\tself.deltaTime = deltaTime\n\tself.tapCount = tapCount\n\tself.phase = phase\t\nend\n\nfunction Touch:Destroy()\n\tself.position \t\t= nil\n\tself.rawPosition\t= nil\n\tself.deltaPosition \t= nil\t\nend\n\nfunction Touch.GetMask(...)\n\tlocal arg = {...}\n\tlocal value = 0\t\n\n\tfor i = 1, #arg do\t\t\n\t\tlocal n = TouchBits[arg[i]] or 0\n\t\t\n\t\tif n ~= 0 then\n\t\t\tvalue = value + n\t\t\t\t\n\t\tend\n\tend\t\n\t\t\n\tif value == 0 then value = TouchBits[\"all\"] end\n\t\t\n\treturn value\nend\n\nUnityEngine.TouchPhase = TouchPhase\nUnityEngine.Touch = Touch\nsetmetatable(Touch, Touch)\nreturn Touch\n\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Touch.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 48ee0c1b8478eba4f9338e5ec4a14d40\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Vector2.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\n\nlocal sqrt = math.sqrt\nlocal setmetatable = setmetatable\nlocal rawget = rawget\nlocal math = math\nlocal acos = math.acos\nlocal max = math.max\n\nlocal Vector2 = {}\nlocal get = tolua.initget(Vector2)\n\nVector2.__index = function(t,k)\n\tlocal var = rawget(Vector2, k)\n\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\n\t\tend\n\tend\n\t\n\treturn var\nend\n\nVector2.__call = function(t, x, y)\n\treturn setmetatable({x = x or 0, y = y or 0}, Vector2)\nend\n\nfunction Vector2.New(x, y)\n\treturn setmetatable({x = x or 0, y = y or 0}, Vector2)\nend\n\nfunction Vector2:Set(x,y)\n\tself.x = x or 0\n\tself.y = y or 0\t\nend\n\nfunction Vector2:Get()\n\treturn self.x, self.y\nend\n\nfunction Vector2:SqrMagnitude()\n\treturn self.x * self.x + self.y * self.y\nend\n\nfunction Vector2:Clone()\n\treturn setmetatable({x = self.x, y = self.y}, Vector2)\nend\n\n\nfunction Vector2.Normalize(v)\n\tlocal x = v.x\n\tlocal y = v.y\n\tlocal magnitude = sqrt(x * x + y * y)\n\n\tif magnitude > 1e-05 then\n\t\tx = x / magnitude\n\t\ty = y / magnitude\n    else\n        x = 0\n\t\ty = 0\n\tend\n\n\treturn setmetatable({x = x, y = y}, Vector2)\nend\n\nfunction Vector2:SetNormalize()\n\tlocal magnitude = sqrt(self.x * self.x + self.y * self.y)\n\n\tif magnitude > 1e-05 then\n\t\tself.x = self.x / magnitude\n\t\tself.y = self.y / magnitude\n    else\n        self.x = 0\n\t\tself.y = 0\n\tend\n\n\treturn self\nend\n\n\nfunction Vector2.Dot(lhs, rhs)\n\treturn lhs.x * rhs.x + lhs.y * rhs.y\nend\n\nfunction Vector2.Angle(from, to)\n\tlocal x1,y1 = from.x, from.y\n\tlocal d = sqrt(x1 * x1 + y1 * y1)\n\n\tif d > 1e-5 then\n\t\tx1 = x1/d\n\t\ty1 = y1/d\n\telse\n\t\tx1,y1 = 0,0\n\tend\n\n\tlocal x2,y2 = to.x, to.y\n\td = sqrt(x2 * x2 + y2 * y2)\n\n\tif d > 1e-5 then\n\t\tx2 = x2/d\n\t\ty2 = y2/d\n\telse\n\t\tx2,y2 = 0,0\n\tend\n\n\td = x1 * x2 + y1 * y2\n\n\tif d < -1 then\n\t\td = -1\n\telseif d > 1 then\n\t\td = 1\n\tend\n\n\treturn acos(d) * 57.29578\nend\n\nfunction Vector2.Magnitude(v)\n\treturn sqrt(v.x * v.x + v.y * v.y)\nend\n\nfunction Vector2.Reflect(dir, normal)\n\tlocal dx = dir.x\n\tlocal dy = dir.y\n\tlocal nx = normal.x\n\tlocal ny = normal.y\n\tlocal s = -2 * (dx * nx + dy * ny)\n\n\treturn setmetatable({x = s * nx + dx, y = s * ny + dy}, Vector2)\nend\n\nfunction Vector2.Distance(a, b)\n\treturn sqrt((a.x - b.x) ^ 2 + (a.y - b.y) ^ 2)\nend\n\nfunction Vector2.Lerp(a, b, t)\n\tif t < 0 then\n\t\tt = 0\n\telseif t > 1 then\n\t\tt = 1\n\tend\n\n    return setmetatable({x = a.x + (b.x - a.x) * t, y = a.y + (b.y - a.y) * t}, Vector2)\nend\n\nfunction Vector2.LerpUnclamped(a, b, t)\n    return setmetatable({x = a.x + (b.x - a.x) * t, y = a.y + (b.y - a.y) * t}, Vector2)\nend\n\nfunction Vector2.MoveTowards(current, target, maxDistanceDelta)\n\tlocal cx = current.x\n\tlocal cy = current.y\n\tlocal x = target.x - cx\n\tlocal y = target.y - cy\n\tlocal s = x * x + y * y\n\n\tif s  > maxDistanceDelta * maxDistanceDelta and s ~= 0 then\n\t\ts = maxDistanceDelta / sqrt(s)\n\t\treturn setmetatable({x = cx + x * s, y = cy + y * s}, Vector2)\n\tend\n\n    return setmetatable({x = target.x, y = target.y}, Vector2)\nend\n\nfunction Vector2.ClampMagnitude(v, maxLength)\n\tlocal x = v.x\n\tlocal y = v.y\n\tlocal sqrMag = x * x + y * y\n\n    if sqrMag > maxLength * maxLength then\n\t\tlocal mag = maxLength / sqrt(sqrMag)\n\t\tx = x * mag\n\t\ty = y * mag\n        return setmetatable({x = x, y = y}, Vector2)\n    end\n\n    return setmetatable({x = x, y = y}, Vector2)\nend\n\nfunction Vector2.SmoothDamp(current, target, Velocity, smoothTime, maxSpeed, deltaTime)\n\tdeltaTime = deltaTime or Time.deltaTime\n\tmaxSpeed = maxSpeed or math.huge\n\tsmoothTime = math.max(0.0001, smoothTime)\n\n\tlocal num = 2 / smoothTime\n    local num2 = num * deltaTime\n    num2 = 1 / (1 + num2 + 0.48 * num2 * num2 + 0.235 * num2 * num2 * num2)\n\n\tlocal tx = target.x\n\tlocal ty = target.y\n\tlocal cx = current.x\n\tlocal cy = current.y\n    local vecx = cx - tx\n\tlocal vecy = cy - ty\n\tlocal m = vecx * vecx + vecy * vecy\n\tlocal n = maxSpeed * smoothTime\n\n\tif m > n * n then\n\t\tm = n / sqrt(m)\n\t\tvecx = vecx * m\n\t\tvecy = vecy * m\n\tend\n\n\tm = Velocity.x\n\tn = Velocity.y\n\n\tlocal vec3x = (m + num * vecx) * deltaTime\n\tlocal vec3y = (n + num * vecy) * deltaTime\n\tVelocity.x = (m - num * vec3x) * num2\n\tVelocity.y = (n - num * vec3y) * num2\n\tm = cx - vecx + (vecx + vec3x) * num2\n\tn = cy - vecy + (vecy + vec3y) * num2\n\n\tif (tx - cx) * (m - tx) + (ty - cy) * (n - ty)  > 0 then\n\t\tm = tx\n\t\tn = ty\n\t\tVelocity.x = 0\n\t\tVelocity.y = 0\n\tend\n\n    return setmetatable({x = m, y = n}, Vector2), Velocity\nend\n\nfunction Vector2.Max(a, b)\n\treturn setmetatable({x = math.max(a.x, b.x), y = math.max(a.y, b.y)}, Vector2)\nend\n\nfunction Vector2.Min(a, b)\n\treturn setmetatable({x = math.min(a.x, b.x), y = math.min(a.y, b.y)}, Vector2)\nend\n\nfunction Vector2.Scale(a, b)\n\treturn setmetatable({x = a.x * b.x, y = a.y * b.y}, Vector2)\nend\n\nfunction Vector2:Div(d)\n\tself.x = self.x / d\n\tself.y = self.y / d\t\n\t\n\treturn self\nend\n\nfunction Vector2:Mul(d)\n\tself.x = self.x * d\n\tself.y = self.y * d\n\t\n\treturn self\nend\n\nfunction Vector2:Add(b)\n\tself.x = self.x + b.x\n\tself.y = self.y + b.y\n\t\n\treturn self\nend\n\nfunction Vector2:Sub(b)\n\tself.x = self.x - b.x\n\tself.y = self.y - b.y\n\t\n\treturn\nend\n\nVector2.__tostring = function(self)\n\treturn string.format(\"(%f,%f)\", self.x, self.y)\nend\n\nVector2.__div = function(va, d)\n\treturn setmetatable({x = va.x / d, y = va.y / d}, Vector2)\nend\n\nVector2.__mul = function(a, d)\n\tif type(d) == \"number\" then\n\t\treturn setmetatable({x = a.x * d, y = a.y * d}, Vector2)\n\telse\n\t\treturn setmetatable({x = a * d.x, y = a * d.y}, Vector2)\n\tend\nend\n\nVector2.__add = function(a, b)\n\treturn setmetatable({x = a.x + b.x, y = a.y + b.y}, Vector2)\nend\n\nVector2.__sub = function(a, b)\n\treturn setmetatable({x = a.x - b.x, y = a.y - b.y}, Vector2)\nend\n\nVector2.__unm = function(v)\n\treturn setmetatable({x = -v.x, y = -v.y}, Vector2)\nend\n\nVector2.__eq = function(a,b)\n\treturn ((a.x - b.x) ^ 2 + (a.y - b.y) ^ 2) < 9.999999e-11\nend\n\nget.up \t\t= function() return setmetatable({x = 0, y = 1}, Vector2) end\nget.right\t= function() return setmetatable({x = 1, y = 0}, Vector2) end\nget.zero\t= function() return setmetatable({x = 0, y = 0}, Vector2) end\nget.one\t\t= function() return setmetatable({x = 1, y = 1}, Vector2) end\n\nget.magnitude \t\t= Vector2.Magnitude\nget.normalized \t\t= Vector2.Normalize\nget.sqrMagnitude \t= Vector2.SqrMagnitude\n\nUnityEngine.Vector2 = Vector2\nsetmetatable(Vector2, Vector2)\nreturn Vector2"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Vector2.lua.meta",
    "content": "fileFormatVersion: 2\nguid: ebac0a3bf4e463249a78081c5cc3abcf\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Vector3.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal math  = math\nlocal acos\t= math.acos\nlocal sqrt \t= math.sqrt\nlocal max \t= math.max\nlocal min \t= math.min\nlocal clamp = Mathf.Clamp\nlocal cos\t= math.cos\nlocal sin\t= math.sin\nlocal abs\t= math.abs\nlocal sign\t= Mathf.Sign\nlocal setmetatable = setmetatable\nlocal rawset = rawset\nlocal rawget = rawget\nlocal type = type\n\nlocal rad2Deg = 57.295779513082\nlocal deg2Rad = 0.017453292519943\n\nlocal Vector3 = {}\nlocal get = tolua.initget(Vector3)\n\nVector3.__index = function(t,k)\n\tlocal var = rawget(Vector3, k)\n\t\n\tif var == nil then\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\t\t\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\t\t\t\n\t\tend\t\t\n\tend\n\t\n\treturn var\nend\n\nfunction Vector3.New(x, y, z)\t\t\t\t\n\tlocal t = {x = x or 0, y = y or 0, z = z or 0}\n\tsetmetatable(t, Vector3)\t\t\t\t\t\t\n\treturn t\nend\n\nlocal _new = Vector3.New\n\nVector3.__call = function(t,x,y,z)\n\tlocal t = {x = x or 0, y = y or 0, z = z or 0}\n\tsetmetatable(t, Vector3)\t\t\t\t\t\n\treturn t\nend\n\t\nfunction Vector3:Set(x,y,z)\t\n\tself.x = x or 0\n\tself.y = y or 0\n\tself.z = z or 0\nend\n\nfunction Vector3.Get(v)\t\t\n\treturn v.x, v.y, v.z\t\nend\n\nfunction Vector3:Clone()\n\treturn setmetatable({x = self.x, y = self.y, z = self.z}, Vector3)\nend\n\nfunction Vector3.Distance(va, vb)\n\treturn sqrt((va.x - vb.x)^2 + (va.y - vb.y)^2 + (va.z - vb.z)^2)\nend\n\nfunction Vector3.Dot(lhs, rhs)\n\treturn lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z\nend\n\nfunction Vector3.Lerp(from, to, t)\t\n\tt = clamp(t, 0, 1)\n\treturn _new(from.x + (to.x - from.x) * t, from.y + (to.y - from.y) * t, from.z + (to.z - from.z) * t)\nend\n\nfunction Vector3:Magnitude()\n\treturn sqrt(self.x * self.x + self.y * self.y + self.z * self.z)\nend\n\nfunction Vector3.Max(lhs, rhs)\n\treturn _new(max(lhs.x, rhs.x), max(lhs.y, rhs.y), max(lhs.z, rhs.z))\nend\n\nfunction Vector3.Min(lhs, rhs)\n\treturn _new(min(lhs.x, rhs.x), min(lhs.y, rhs.y), min(lhs.z, rhs.z))\nend\n\nfunction Vector3.Normalize(v)\n\tlocal x,y,z = v.x, v.y, v.z\t\t\n\tlocal num = sqrt(x * x + y * y + z * z)\t\n\t\n\tif num > 1e-5 then\t\t\n\t\treturn setmetatable({x = x / num, y = y / num, z = z / num}, Vector3)\n    end\n\t  \n\treturn setmetatable({x = 0, y = 0, z = 0}, Vector3)\nend\n\nfunction Vector3:SetNormalize()\n\tlocal num = sqrt(self.x * self.x + self.y * self.y + self.z * self.z)\n\t\n\tif num > 1e-5 then    \n        self.x = self.x / num\n\t\tself.y = self.y / num\n\t\tself.z = self.z /num\n    else    \n\t\tself.x = 0\n\t\tself.y = 0\n\t\tself.z = 0\n\tend \n\n\treturn self\nend\n\t\nfunction Vector3:SqrMagnitude()\n\treturn self.x * self.x + self.y * self.y + self.z * self.z\nend\n\nlocal dot = Vector3.Dot\n\nfunction Vector3.Angle(from, to)\n\treturn acos(clamp(dot(from:Normalize(), to:Normalize()), -1, 1)) * rad2Deg\nend\n\nfunction Vector3:ClampMagnitude(maxLength)\t\n\tif self:SqrMagnitude() > (maxLength * maxLength) then    \n\t\tself:SetNormalize()\n\t\tself:Mul(maxLength)        \n    end\n\t\n    return self\nend\n\n\nfunction Vector3.OrthoNormalize(va, vb, vc)\t\n\tva:SetNormalize()\n\tvb:Sub(vb:Project(va))\n\tvb:SetNormalize()\n\t\n\tif vc == nil then\n\t\treturn va, vb\n\tend\n\t\n\tvc:Sub(vc:Project(va))\n\tvc:Sub(vc:Project(vb))\n\tvc:SetNormalize()\t\t\n\treturn va, vb, vc\nend\n\t\nfunction Vector3.MoveTowards(current, target, maxDistanceDelta)\t\n\tlocal delta = target - current\t\n    local sqrDelta = delta:SqrMagnitude()\n\tlocal sqrDistance = maxDistanceDelta * maxDistanceDelta\n\t\n    if sqrDelta > sqrDistance then    \n\t\tlocal magnitude = sqrt(sqrDelta)\n\t\t\n\t\tif magnitude > 1e-6 then\n\t\t\tdelta:Mul(maxDistanceDelta / magnitude)\n\t\t\tdelta:Add(current)\n\t\t\treturn delta\n\t\telse\n\t\t\treturn current:Clone()\n\t\tend\n    end\n\t\n    return target:Clone()\nend\n\nfunction ClampedMove(lhs, rhs, clampedDelta)\n\tlocal delta = rhs - lhs\n\t\n\tif delta > 0 then\n\t\treturn lhs + min(delta, clampedDelta)\n\telse\n\t\treturn lhs - min(-delta, clampedDelta)\n\tend\nend\n\nlocal overSqrt2 = 0.7071067811865475244008443621048490\n\nlocal function OrthoNormalVector(vec)\n\tlocal res = _new()\n\t\n\tif abs(vec.z) > overSqrt2 then\t\t\t\n\t\tlocal a = vec.y * vec.y + vec.z * vec.z\n\t\tlocal k = 1 / sqrt (a)\n\t\tres.x = 0\n\t\tres.y = -vec.z * k\n\t\tres.z = vec.y * k\n\telse\t\t\t\n\t\tlocal a = vec.x * vec.x + vec.y * vec.y\n\t\tlocal k = 1 / sqrt (a)\n\t\tres.x = -vec.y * k\n\t\tres.y = vec.x * k\n\t\tres.z = 0\n\tend\n\t\n\treturn res\nend\n\nfunction Vector3.RotateTowards(current, target, maxRadiansDelta, maxMagnitudeDelta)\n\tlocal len1 = current:Magnitude()\n\tlocal len2 = target:Magnitude()\n\t\n\tif len1 > 1e-6 and len2 > 1e-6 then\t\n\t\tlocal from = current / len1\n\t\tlocal to = target / len2\t\t\n\t\tlocal cosom = dot(from, to)\n\t\t\t\t\n\t\tif cosom > 1 - 1e-6 then\t\t\n\t\t\treturn Vector3.MoveTowards (current, target, maxMagnitudeDelta)\t\t\n\t\telseif cosom < -1 + 1e-6 then\t\t\n\t\t\tlocal axis = OrthoNormalVector(from)\t\t\t\t\t\t\n\t\t\tlocal q = Quaternion.AngleAxis(maxRadiansDelta * rad2Deg, axis)\t\n\t\t\tlocal rotated = q:MulVec3(from)\n\t\t\tlocal delta = ClampedMove(len1, len2, maxMagnitudeDelta)\n\t\t\trotated:Mul(delta)\n\t\t\treturn rotated\n\t\telse\t\t\n\t\t\tlocal angle = acos(cosom)\n\t\t\tlocal axis = Vector3.Cross(from, to)\n\t\t\taxis:SetNormalize ()\n\t\t\tlocal q = Quaternion.AngleAxis(min(maxRadiansDelta, angle) * rad2Deg, axis)\t\t\t\n\t\t\tlocal rotated = q:MulVec3(from)\n\t\t\tlocal delta = ClampedMove(len1, len2, maxMagnitudeDelta)\n\t\t\trotated:Mul(delta)\n\t\t\treturn rotated\n\t\tend\n\tend\n\t\t\n\treturn Vector3.MoveTowards(current, target, maxMagnitudeDelta)\nend\n\t\nfunction Vector3.SmoothDamp(current, target, currentVelocity, smoothTime)\n\tlocal maxSpeed = Mathf.Infinity\n\tlocal deltaTime = Time.deltaTime\n    smoothTime = max(0.0001, smoothTime)\n    local num = 2 / smoothTime\n    local num2 = num * deltaTime\n    local num3 = 1 / (1 + num2 + 0.48 * num2 * num2 + 0.235 * num2 * num2 * num2)    \n    local vector2 = target:Clone()\n    local maxLength = maxSpeed * smoothTime\n\tlocal vector = current - target\n    vector:ClampMagnitude(maxLength)\n    target = current - vector\n    local vec3 = (currentVelocity + (vector * num)) * deltaTime\n    currentVelocity = (currentVelocity - (vec3 * num)) * num3\n    local vector4 = target + (vector + vec3) * num3\t\n\t\n    if Vector3.Dot(vector2 - current, vector4 - vector2) > 0 then    \n        vector4 = vector2\n        currentVelocity:Set(0,0,0)\n    end\n\t\n    return vector4, currentVelocity\nend\t\n\t\nfunction Vector3.Scale(a, b)\n\tlocal x = a.x * b.x\n\tlocal y = a.y * b.y\n\tlocal z = a.z * b.z\t\n\treturn _new(x, y, z)\nend\n\t\nfunction Vector3.Cross(lhs, rhs)\n\tlocal x = lhs.y * rhs.z - lhs.z * rhs.y\n\tlocal y = lhs.z * rhs.x - lhs.x * rhs.z\n\tlocal z = lhs.x * rhs.y - lhs.y * rhs.x\n\treturn _new(x,y,z)\t\nend\n\t\nfunction Vector3:Equals(other)\n\treturn self.x == other.x and self.y == other.y and self.z == other.z\nend\n\t\t\nfunction Vector3.Reflect(inDirection, inNormal)\n\tlocal num = -2 * dot(inNormal, inDirection)\n\tinNormal = inNormal * num\n\tinNormal:Add(inDirection)\n\treturn inNormal\nend\n\n\t\nfunction Vector3.Project(vector, onNormal)\n\tlocal num = onNormal:SqrMagnitude()\n\t\n\tif num < 1.175494e-38 then\t\n\t\treturn _new(0,0,0)\n\tend\n\t\n\tlocal num2 = dot(vector, onNormal)\n\tlocal v3 = onNormal:Clone()\n\tv3:Mul(num2/num)\t\n\treturn v3\nend\n\t\nfunction Vector3.ProjectOnPlane(vector, planeNormal)\n\tlocal v3 = Vector3.Project(vector, planeNormal)\n\tv3:Mul(-1)\n\tv3:Add(vector)\n\treturn v3\nend\t\t\n\nfunction Vector3.Slerp(from, to, t)\n\tlocal omega, sinom, scale0, scale1\n\n\tif t <= 0 then\t\t\n\t\treturn from:Clone()\n\telseif t >= 1 then\t\t\n\t\treturn to:Clone()\n\tend\n\t\n\tlocal v2 \t= to:Clone()\n\tlocal v1 \t= from:Clone()\n\tlocal len2 \t= to:Magnitude()\n\tlocal len1 \t= from:Magnitude()\t\n\tv2:Div(len2)\n\tv1:Div(len1)\n\n\tlocal len \t= (len2 - len1) * t + len1\n\tlocal cosom = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z\n\t\n\tif cosom > 1 - 1e-6 then\n\t\tscale0 = 1 - t\n\t\tscale1 = t\n\telseif cosom < -1 + 1e-6 then\t\t\n\t\tlocal axis = OrthoNormalVector(from)\t\t\n\t\tlocal q = Quaternion.AngleAxis(180.0 * t, axis)\t\t\n\t\tlocal v = q:MulVec3(from)\n\t\tv:Mul(len)\t\t\t\t\n\t\treturn v\n\telse\n\t\tomega \t= acos(cosom)\n\t\tsinom \t= sin(omega)\n\t\tscale0 \t= sin((1 - t) * omega) / sinom\n\t\tscale1 \t= sin(t * omega) / sinom\t\n\tend\n\n\tv1:Mul(scale0)\n\tv2:Mul(scale1)\n\tv2:Add(v1)\n\tv2:Mul(len)\n\treturn v2\nend\n\n\nfunction Vector3:Mul(q)\n\tif type(q) == \"number\" then\n\t\tself.x = self.x * q\n\t\tself.y = self.y * q\n\t\tself.z = self.z * q\n\telse\n\t\tself:MulQuat(q)\n\tend\n\t\n\treturn self\nend\n\nfunction Vector3:Div(d)\n\tself.x = self.x / d\n\tself.y = self.y / d\n\tself.z = self.z / d\n\t\n\treturn self\nend\n\nfunction Vector3:Add(vb)\n\tself.x = self.x + vb.x\n\tself.y = self.y + vb.y\n\tself.z = self.z + vb.z\n\t\n\treturn self\nend\n\nfunction Vector3:Sub(vb)\n\tself.x = self.x - vb.x\n\tself.y = self.y - vb.y\n\tself.z = self.z - vb.z\n\t\n\treturn self\nend\n\nfunction Vector3:MulQuat(quat)\t   \n\tlocal num \t= quat.x * 2\n\tlocal num2 \t= quat.y * 2\n\tlocal num3 \t= quat.z * 2\n\tlocal num4 \t= quat.x * num\n\tlocal num5 \t= quat.y * num2\n\tlocal num6 \t= quat.z * num3\n\tlocal num7 \t= quat.x * num2\n\tlocal num8 \t= quat.x * num3\n\tlocal num9 \t= quat.y * num3\n\tlocal num10 = quat.w * num\n\tlocal num11 = quat.w * num2\n\tlocal num12 = quat.w * num3\n\t\n\tlocal x = (((1 - (num5 + num6)) * self.x) + ((num7 - num12) * self.y)) + ((num8 + num11) * self.z)\n\tlocal y = (((num7 + num12) * self.x) + ((1 - (num4 + num6)) * self.y)) + ((num9 - num10) * self.z)\n\tlocal z = (((num8 - num11) * self.x) + ((num9 + num10) * self.y)) + ((1 - (num4 + num5)) * self.z)\n\t\n\tself:Set(x, y, z)\t\n\treturn self\nend\n\nfunction Vector3.AngleAroundAxis (from, to, axis)\t \t \n\tfrom = from - Vector3.Project(from, axis)\n\tto = to - Vector3.Project(to, axis) \t    \n\tlocal angle = Vector3.Angle (from, to)\t   \t    \n\treturn angle * (Vector3.Dot (axis, Vector3.Cross (from, to)) < 0 and -1 or 1)\nend\n\n\nVector3.__tostring = function(self)\n\treturn \"[\"..self.x..\",\"..self.y..\",\"..self.z..\"]\"\nend\n\nVector3.__div = function(va, d)\n\treturn _new(va.x / d, va.y / d, va.z / d)\nend\n\nVector3.__mul = function(va, d)\n\tif type(d) == \"number\" then\n\t\treturn _new(va.x * d, va.y * d, va.z * d)\n\telse\n\t\tlocal vec = va:Clone()\n\t\tvec:MulQuat(d)\n\t\treturn vec\n\tend\t\nend\n\nVector3.__add = function(va, vb)\n\treturn _new(va.x + vb.x, va.y + vb.y, va.z + vb.z)\nend\n\nVector3.__sub = function(va, vb)\n\treturn _new(va.x - vb.x, va.y - vb.y, va.z - vb.z)\nend\n\nVector3.__unm = function(va)\n\treturn _new(-va.x, -va.y, -va.z)\nend\n\nVector3.__eq = function(a,b)\n\tlocal v = a - b\n\tlocal delta = v:SqrMagnitude()\n\treturn delta < 1e-10\nend\n\nget.up \t\t= function() return _new(0,1,0) end\nget.down \t= function() return _new(0,-1,0) end\nget.right\t= function() return _new(1,0,0) end\nget.left\t= function() return _new(-1,0,0) end\nget.forward = function() return _new(0,0,1) end\nget.back\t= function() return _new(0,0,-1) end\nget.zero\t= function() return _new(0,0,0) end\nget.one\t\t= function() return _new(1,1,1) end\n\nget.magnitude\t= Vector3.Magnitude\nget.normalized\t= Vector3.Normalize\nget.sqrMagnitude= Vector3.SqrMagnitude\n\nUnityEngine.Vector3 = Vector3\nsetmetatable(Vector3, Vector3)\nreturn Vector3\n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Vector3.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 3697c841f98720444b380cc2756c17ea\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Vector4.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\n\nlocal clamp\t= Mathf.Clamp\nlocal sqrt\t= Mathf.Sqrt\nlocal min\t= Mathf.Min\nlocal max \t= Mathf.Max\nlocal setmetatable = setmetatable\nlocal rawget = rawget\n\nlocal Vector4 = {}\nlocal get = tolua.initget(Vector4)\n\nVector4.__index = function(t,k)\n\tlocal var = rawget(Vector4, k)\n\t\n\tif var == nil then\t\t\t\t\t\t\t\n\t\tvar = rawget(get, k)\n\t\t\n\t\tif var ~= nil then\n\t\t\treturn var(t)\t\n\t\tend\n\tend\n\t\n\treturn var\nend\n\nVector4.__call = function(t, x, y, z, w)\n\treturn setmetatable({x = x or 0, y = y or 0, z = z or 0, w = w or 0}, Vector4)\t\t\nend\n\nfunction Vector4.New(x, y, z, w)\t\n\treturn setmetatable({x = x or 0, y = y or 0, z = z or 0, w = w or 0}, Vector4)\t\t\nend\n\nfunction Vector4:Set(x,y,z,w)\n\tself.x = x or 0\n\tself.y = y or 0\t\n\tself.z = z or 0\n\tself.w = w or 0\nend\n\nfunction Vector4:Get()\n\treturn self.x, self.y, self.z, self.w\nend\n\nfunction Vector4.Lerp(from, to, t)    \n    t = clamp(t, 0, 1)\n    return Vector4.New(from.x + ((to.x - from.x) * t), from.y + ((to.y - from.y) * t), from.z + ((to.z - from.z) * t), from.w + ((to.w - from.w) * t))\nend    \n\nfunction Vector4.MoveTowards(current, target, maxDistanceDelta)    \n\tlocal vector = target - current\n\tlocal magnitude = vector:Magnitude()\t\n\t\n\tif magnitude > maxDistanceDelta and magnitude ~= 0 then     \n\t\tmaxDistanceDelta = maxDistanceDelta / magnitude\n\t\tvector:Mul(maxDistanceDelta)   \n\t\tvector:Add(current)\n\t\treturn vector\n\tend\n\t\n\treturn target\nend    \n\nfunction Vector4.Scale(a, b)    \n    return Vector4.New(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w)\nend    \n\nfunction Vector4:SetScale(scale)\n\tself.x = self.x * scale.x\n\tself.y = self.y * scale.y\n\tself.z = self.z * scale.z\n\tself.w = self.w * scale.w\nend\n\nfunction Vector4:Normalize()\n\tlocal v = vector4.New(self.x, self.y, self.z, self.w)\n\treturn v:SetNormalize()\nend\n\nfunction Vector4:SetNormalize()\n\tlocal num = self:Magnitude()\t\n\t\n\tif num == 1 then\n\t\treturn self\n    elseif num > 1e-05 then    \n        self:Div(num)\n    else    \n        self:Set(0,0,0,0)\n\tend \n\n\treturn self\nend\n\nfunction Vector4:Div(d)\n\tself.x = self.x / d\n\tself.y = self.y / d\t\n\tself.z = self.z / d\n\tself.w = self.w / d\n\t\n\treturn self\nend\n\nfunction Vector4:Mul(d)\n\tself.x = self.x * d\n\tself.y = self.y * d\n\tself.z = self.z * d\n\tself.w = self.w * d\t\n\t\n\treturn self\nend\n\nfunction Vector4:Add(b)\n\tself.x = self.x + b.x\n\tself.y = self.y + b.y\n\tself.z = self.z + b.z\n\tself.w = self.w + b.w\n\t\n\treturn self\nend\n\nfunction Vector4:Sub(b)\n\tself.x = self.x - b.x\n\tself.y = self.y - b.y\n\tself.z = self.z - b.z\n\tself.w = self.w - b.w\n\t\n\treturn self\nend\n\nfunction Vector4.Dot(a, b)\n\treturn a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w\nend\n\nfunction Vector4.Project(a, b)\n\tlocal s = Vector4.Dot(a, b) / Vector4.Dot(b, b)\n\treturn b * s\nend\n\nfunction Vector4.Distance(a, b)\n\tlocal v = a - b\n\treturn Vector4.Magnitude(v)\nend\n\nfunction Vector4.Magnitude(a)\n\treturn sqrt(a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w)\nend\n\nfunction Vector4.SqrMagnitude(a)\n\treturn a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w\nend\n\nfunction Vector4.Min(lhs, rhs)\n\treturn Vector4.New(max(lhs.x, rhs.x), max(lhs.y, rhs.y), max(lhs.z, rhs.z), max(lhs.w, rhs.w))\nend\n\nfunction Vector4.Max(lhs, rhs)\n\treturn Vector4.New(min(lhs.x, rhs.x), min(lhs.y, rhs.y), min(lhs.z, rhs.z), min(lhs.w, rhs.w))\nend\n\nVector4.__tostring = function(self)\n\treturn string.format(\"[%f,%f,%f,%f]\", self.x, self.y, self.z, self.w)\nend\n\nVector4.__div = function(va, d)\n\treturn Vector4.New(va.x / d, va.y / d, va.z / d, va.w / d)\nend\n\nVector4.__mul = function(va, d)\n\treturn Vector4.New(va.x * d, va.y * d, va.z * d, va.w * d)\nend\n\nVector4.__add = function(va, vb)\n\treturn Vector4.New(va.x + vb.x, va.y + vb.y, va.z + vb.z, va.w + vb.w)\nend\n\nVector4.__sub = function(va, vb)\n\treturn Vector4.New(va.x - vb.x, va.y - vb.y, va.z - vb.z, va.w - vb.w)\nend\n\nVector4.__unm = function(va)\n\treturn Vector4.New(-va.x, -va.y, -va.z, -va.w)\nend\n\nVector4.__eq = function(va,vb)\n\tlocal v = va - vb\n\tlocal delta = Vector4.SqrMagnitude(v)\t\n\treturn delta < 1e-10\nend\n\nget.zero = function() return Vector4.New(0, 0, 0, 0) end\nget.one\t = function() return Vector4.New(1, 1, 1, 1) end\n\nget.magnitude \t = Vector4.Magnitude\nget.normalized \t = Vector4.Normalize\nget.sqrMagnitude = Vector4.SqrMagnitude\n\nUnityEngine.Vector4 = Vector4\nsetmetatable(Vector4, Vector4)\nreturn Vector4"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine/Vector4.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 7e294d4af7e55084dadac8ee7a76099d\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/UnityEngine.meta",
    "content": "fileFormatVersion: 2\nguid: ec9654611f40bd64cb988c5f45494721\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/cjson/util.lua",
    "content": "local json = require \"cjson\"\n\n-- Various common routines used by the Lua CJSON package\n--\n-- Mark Pulford <mark@kyne.com.au>\n\n-- Determine with a Lua table can be treated as an array.\n-- Explicitly returns \"not an array\" for very sparse arrays.\n-- Returns:\n-- -1   Not an array\n-- 0    Empty table\n-- >0   Highest index in the array\nlocal function is_array(table)\n    local max = 0\n    local count = 0\n    for k, v in pairs(table) do\n        if type(k) == \"number\" then\n            if k > max then max = k end\n            count = count + 1\n        else\n            return -1\n        end\n    end\n    if max > count * 2 then\n        return -1\n    end\n\n    return max\nend\n\nlocal serialise_value\n\nlocal function serialise_table(value, indent, depth)\n    local spacing, spacing2, indent2\n    if indent then\n        spacing = \"\\n\" .. indent\n        spacing2 = spacing .. \"  \"\n        indent2 = indent .. \"  \"\n    else\n        spacing, spacing2, indent2 = \" \", \" \", false\n    end\n    depth = depth + 1\n    if depth > 50 then\n        return \"Cannot serialise any further: too many nested tables\"\n    end\n\n    local max = is_array(value)\n\n    local comma = false\n    local fragment = { \"{\" .. spacing2 }\n    if max > 0 then\n        -- Serialise array\n        for i = 1, max do\n            if comma then\n                table.insert(fragment, \",\" .. spacing2)\n            end\n            table.insert(fragment, serialise_value(value[i], indent2, depth))\n            comma = true\n        end\n    elseif max < 0 then\n        -- Serialise table\n        for k, v in pairs(value) do\n            if comma then\n                table.insert(fragment, \",\" .. spacing2)\n            end\n            table.insert(fragment,\n                (\"[%s] = %s\"):format(serialise_value(k, indent2, depth),\n                                     serialise_value(v, indent2, depth)))\n            comma = true\n        end\n    end\n    table.insert(fragment, spacing .. \"}\")\n\n    return table.concat(fragment)\nend\n\nfunction serialise_value(value, indent, depth)\n    if indent == nil then indent = \"\" end\n    if depth == nil then depth = 0 end\n\n    if value == json.null then\n        return \"json.null\"\n    elseif type(value) == \"string\" then\n        return (\"%q\"):format(value)\n    elseif type(value) == \"nil\" or type(value) == \"number\" or\n           type(value) == \"boolean\" then\n        return tostring(value)\n    elseif type(value) == \"table\" then\n        return serialise_table(value, indent, depth)\n    else\n        return \"\\\"<\" .. type(value) .. \">\\\"\"\n    end\nend\n\nlocal function file_load(filename)\n    local file\n    if filename == nil then\n        file = io.stdin\n    else\n        local err\n        file, err = io.open(filename, \"rb\")\n        if file == nil then\n            error((\"Unable to read '%s': %s\"):format(filename, err))\n        end\n    end\n    local data = file:read(\"*a\")\n\n    if filename ~= nil then\n        file:close()\n    end\n\n    if data == nil then\n        error(\"Failed to read \" .. filename)\n    end\n\n    return data\nend\n\nlocal function file_save(filename, data)\n    local file\n    if filename == nil then\n        file = io.stdout\n    else\n        local err\n        file, err = io.open(filename, \"wb\")\n        if file == nil then\n            error((\"Unable to write '%s': %s\"):format(filename, err))\n        end\n    end\n    file:write(data)\n    if filename ~= nil then\n        file:close()\n    end\nend\n\nlocal function compare_values(val1, val2)\n    local type1 = type(val1)\n    local type2 = type(val2)\n    if type1 ~= type2 then\n        return false\n    end\n\n    -- Check for NaN\n    if type1 == \"number\" and val1 ~= val1 and val2 ~= val2 then\n        return true\n    end\n\n    if type1 ~= \"table\" then\n        return val1 == val2\n    end\n\n    -- check_keys stores all the keys that must be checked in val2\n    local check_keys = {}\n    for k, _ in pairs(val1) do\n        check_keys[k] = true\n    end\n\n    for k, v in pairs(val2) do\n        if not check_keys[k] then\n            return false\n        end\n\n        if not compare_values(val1[k], val2[k]) then\n            return false\n        end\n\n        check_keys[k] = nil\n    end\n    for k, _ in pairs(check_keys) do\n        -- Not the same if any keys from val1 were not found in val2\n        return false\n    end\n    return true\nend\n\nlocal test_count_pass = 0\nlocal test_count_total = 0\n\nlocal function run_test_summary()\n    return test_count_pass, test_count_total\nend\n\nlocal function run_test(testname, func, input, should_work, output)\n    local function status_line(name, status, value)\n        local statusmap = { [true] = \":success\", [false] = \":error\" }\n        if status ~= nil then\n            name = name .. statusmap[status]\n        end\n        print((\"[%s] %s\"):format(name, serialise_value(value, false)))\n    end\n\n    local result = { pcall(func, unpack(input)) }\n    local success = table.remove(result, 1)\n\n    local correct = false\n    if success == should_work and compare_values(result, output) then\n        correct = true\n        test_count_pass = test_count_pass + 1\n    end\n    test_count_total = test_count_total + 1\n\n    local teststatus = { [true] = \"PASS\", [false] = \"FAIL\" }\n    print((\"==> Test [%d] %s: %s\"):format(test_count_total, testname,\n                                          teststatus[correct]))\n\n    status_line(\"Input\", nil, input)\n    if not correct then\n        status_line(\"Expected\", should_work, output)\n    end\n    status_line(\"Received\", success, result)\n    print()\n\n    return correct, result\nend\n\nlocal function run_test_group(tests)\n    local function run_helper(name, func, input)\n        if type(name) == \"string\" and #name > 0 then\n            print(\"==> \" .. name)\n        end\n        -- Not a protected call, these functions should never generate errors.\n        func(unpack(input or {}))\n        print()\n    end\n\n    for _, v in ipairs(tests) do\n        -- Run the helper if \"should_work\" is missing\n        if v[4] == nil then\n            run_helper(unpack(v))\n        else\n            run_test(unpack(v))\n        end\n    end\nend\n\n-- Run a Lua script in a separate environment\nlocal function run_script(script, env)\n    local env = env or {}\n    local func\n\n    -- Use setfenv() if it exists, otherwise assume Lua 5.2 load() exists\n    if _G.setfenv then\n        func = loadstring(script)\n        if func then\n            setfenv(func, env)\n        end\n    else\n        func = load(script, nil, nil, env)\n    end\n\n    if func == nil then\n            error(\"Invalid syntax.\")\n    end\n    func()\n\n    return env\nend\n\n-- Export functions\nreturn {\n    serialise_value = serialise_value,\n    file_load = file_load,\n    file_save = file_save,\n    compare_values = compare_values,\n    run_test_summary = run_test_summary,\n    run_test = run_test,\n    run_test_group = run_test_group,\n    run_script = run_script\n}\n\n-- vi:ai et sw=4 ts=4:\n"
  },
  {
    "path": "Assets/ToLua/Lua/cjson/util.lua.meta",
    "content": "fileFormatVersion: 2\nguid: d6b21c50e0c10c840bb4965a6b03fdc1\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/cjson.meta",
    "content": "fileFormatVersion: 2\nguid: 51fabff50886aea4ca5100ee3396939b\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/event.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\n\nlocal setmetatable = setmetatable\nlocal xpcall = xpcall\nlocal pcall = pcall\nlocal assert = assert\nlocal rawget = rawget\nlocal error = error\nlocal print = print\nlocal maxn = table.maxn\nlocal traceback = tolua.traceback\nlocal ilist = ilist\n\nlocal _xpcall = {}\n\n_xpcall.__call = function(self, ...)\t\n\tif jit then\n\t\tif nil == self.obj then\n\t\t\treturn xpcall(self.func, traceback, ...)\t\t\t\t\t\n\t\telse\t\t\n\t\t\treturn xpcall(self.func, traceback, self.obj, ...)\t\t\t\t\t\n\t\tend\n\telse\n\t\tlocal args = {...}\n\n\t\tif nil == self.obj then\n\t\t\tlocal func = function() self.func(unpack(args, 1, maxn(args))) end\n\t\t\treturn xpcall(func, traceback)\t\t\t\t\t\n\t\telse\t\t\n\t\t\tlocal func = function() self.func(self.obj, unpack(args, 1, maxn(args))) end\n\t\t\treturn xpcall(func, traceback)\n\t\tend\n\tend\t\nend\n\n_xpcall.__eq = function(lhs, rhs)\n\treturn lhs.func == rhs.func and lhs.obj == rhs.obj\nend\n\nlocal function xfunctor(func, obj)\t\n\treturn setmetatable({func = func, obj = obj}, _xpcall)\t\t\t\nend\n\nlocal _pcall = {}\n\n_pcall.__call = function(self, ...)\n\tif nil == self.obj then\n\t\treturn pcall(self.func, ...)\t\t\t\t\t\n\telse\t\t\n\t\treturn pcall(self.func, self.obj, ...)\t\t\t\t\t\n\tend\t\nend\n\n_pcall.__eq = function(lhs, rhs)\n\treturn lhs.func == rhs.func and lhs.obj == rhs.obj\nend\n\nlocal function functor(func, obj)\t\n\treturn setmetatable({func = func, obj = obj}, _pcall)\t\t\t\nend\n\nlocal _event = {}\n_event.__index = _event\n\n--废弃\nfunction _event:Add(func, obj)\n\tassert(func)\t\t\n\n\tif self.keepSafe then\t\t\t\n\t\tfunc = xfunctor(func, obj)\n\telse\n\t\tfunc = functor(func, obj)\n\tend\t\n\n\tif self.lock then\n\t\tlocal node = {value = func, _prev = 0, _next = 0, removed = true}\n\t\ttable.insert(self.opList, function() self.list:pushnode(node) end)\t\t\t\n\t\treturn node\n\telse\n\t\treturn self.list:push(func)\n\tend\t\nend\n\n--废弃\nfunction _event:Remove(func, obj)\t\n\tfor i, v in ilist(self.list) do\t\t\t\t\t\t\t\n\t\tif v.func == func and v.obj == obj then\n\t\t\tif self.lock then\n\t\t\t\ttable.insert(self.opList, function() self.list:remove(i) end)\t\t\t\t\n\t\t\telse\n\t\t\t\tself.list:remove(i)\n\t\t\tend\n\t\t\tbreak\n\t\tend\n\tend\t\t\nend\n\nfunction _event:CreateListener(func, obj)\n\tif self.keepSafe then\t\t\t\n\t\tfunc = xfunctor(func, obj)\n\telse\n\t\tfunc = functor(func, obj)\n\tend\t\n\t\n\treturn {value = func, _prev = 0, _next = 0, removed = true}\t\t\nend\n\nfunction _event:AddListener(handle)\t\n\tassert(handle)\n\n\tif self.lock then\t\t\n\t\ttable.insert(self.opList, function() self.list:pushnode(handle) end)\t\t\n\telse\n\t\tself.list:pushnode(handle)\n\tend\t\nend\n\nfunction _event:RemoveListener(handle)\t\n\tassert(handle)\t\n\n\tif self.lock then\t\t\n\t\ttable.insert(self.opList, function() self.list:remove(handle) end)\t\t\t\t\n\telse\n\t\tself.list:remove(handle)\n\tend\nend\n\nfunction _event:Count()\n\treturn self.list.length\nend\t\n\nfunction _event:Clear()\n\tself.list:clear()\n\tself.opList = {}\t\n\tself.lock = false\n\tself.keepSafe = false\n\tself.current = nil\nend\n\nfunction _event:Dump()\n\tlocal count = 0\n\t\n\tfor _, v in ilist(self.list) do\n\t\tif v.obj then\n\t\t\tprint(\"update function:\", v.func, \"object name:\", v.obj.name)\n\t\telse\n\t\t\tprint(\"update function: \", v.func)\n\t\tend\n\t\t\n\t\tcount = count + 1\n\tend\n\t\n\tprint(\"all function is:\", count)\nend\n\n_event.__call = function(self, ...)\t\t\t\n\tlocal _list = self.list\t\n\tself.lock = true\n\tlocal ilist = ilist\t\t\t\t\n\n\tfor i, f in ilist(_list) do\t\t\n\t\tself.current = i\t\t\t\t\t\t\n\t\tlocal flag, msg = f(...)\n\t\t\n\t\tif not flag then\t\t\t\n\t\t\t_list:remove(i)\t\t\t\n\t\t\tself.lock = false\t\t\n\t\t\terror(msg)\t\t\t\t\n\t\tend\n\tend\t\n\n\tlocal opList = self.opList\t\n\tself.lock = false\t\t\n\n\tfor i, op in ipairs(opList) do\t\t\t\t\t\t\t\t\t\n\t\top()\n\t\topList[i] = nil\n\tend\nend\n\nfunction event(name, safe)\n\tsafe = safe or false\n\treturn setmetatable({name = name, keepSafe = safe, lock = false, opList = {}, list = list:new()}, _event)\t\t\t\t\nend\n\nUpdateBeat \t\t= event(\"Update\", true)\nLateUpdateBeat\t= event(\"LateUpdate\", true)\nFixedUpdateBeat\t= event(\"FixedUpdate\", true)\nCoUpdateBeat\t= event(\"CoUpdate\")\t\t\t\t--只在协同使用\n\nlocal Time = Time\nlocal UpdateBeat = UpdateBeat\nlocal LateUpdateBeat = LateUpdateBeat\nlocal FixedUpdateBeat = FixedUpdateBeat\nlocal CoUpdateBeat = CoUpdateBeat\n\n--逻辑update\nfunction Update(deltaTime, unscaledDeltaTime)\n\tTime:SetDeltaTime(deltaTime, unscaledDeltaTime)\t\t\t\t\n\tUpdateBeat()\t\nend\n\nfunction LateUpdate()\t\n\tLateUpdateBeat()\t\t\n\tCoUpdateBeat()\t\t\n\tTime:SetFrameCount()\t\t\nend\n\n--物理update\nfunction FixedUpdate(fixedDeltaTime)\n\tTime:SetFixedDelta(fixedDeltaTime)\n\tFixedUpdateBeat()\nend\n\nfunction PrintEvents()\n\tUpdateBeat:Dump()\n\tFixedUpdateBeat:Dump()\nend"
  },
  {
    "path": "Assets/ToLua/Lua/event.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 3cb3ad8be0f474f4c997acf1b791b133\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/bc.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT bytecode listing module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module lists the bytecode of a Lua function. If it's loaded by -jbc\n-- it hooks into the parser and lists all functions of a chunk as they\n-- are parsed.\n--\n-- Example usage:\n--\n--   luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; print(x)'\n--   luajit -jbc=- foo.lua\n--   luajit -jbc=foo.list foo.lua\n--\n-- Default output is to stderr. To redirect the output to a file, pass a\n-- filename as an argument (use '-' for stdout) or set the environment\n-- variable LUAJIT_LISTFILE. The file is overwritten every time the module\n-- is started.\n--\n-- This module can also be used programmatically:\n--\n--   local bc = require(\"jit.bc\")\n--\n--   local function foo() print(\"hello\") end\n--\n--   bc.dump(foo)           --> -- BYTECODE -- [...]\n--   print(bc.line(foo, 2)) --> 0002    KSTR     1   1      ; \"hello\"\n--\n--   local out = {\n--     -- Do something with each line:\n--     write = function(t, ...) io.write(...) end,\n--     close = function(t) end,\n--     flush = function(t) end,\n--   }\n--   bc.dump(foo, out)\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal bit = require(\"bit\")\nlocal sub, gsub, format = string.sub, string.gsub, string.format\nlocal byte, band, shr = string.byte, bit.band, bit.rshift\nlocal funcinfo, funcbc, funck = jutil.funcinfo, jutil.funcbc, jutil.funck\nlocal funcuvname = jutil.funcuvname\nlocal bcnames = vmdef.bcnames\nlocal stdout, stderr = io.stdout, io.stderr\n\n------------------------------------------------------------------------------\n\nlocal function ctlsub(c)\n  if c == \"\\n\" then return \"\\\\n\"\n  elseif c == \"\\r\" then return \"\\\\r\"\n  elseif c == \"\\t\" then return \"\\\\t\"\n  else return format(\"\\\\%03d\", byte(c))\n  end\nend\n\n-- Return one bytecode line.\nlocal function bcline(func, pc, prefix, lineinfo)\n  local ins, m, l = funcbc(func, pc, lineinfo and 1 or 0)\n  if not ins then return end\n  local ma, mb, mc = band(m, 7), band(m, 15*8), band(m, 15*128)\n  local a = band(shr(ins, 8), 0xff)\n  local oidx = 6*band(ins, 0xff)\n  local op = sub(bcnames, oidx+1, oidx+6)\n  local s\n  if lineinfo then\n    s = format(\"%04d %7s %s %-6s %3s \",\n      pc, \"[\"..l..\"]\", prefix or \"  \", op, ma == 0 and \"\" or a)\n  else\n    s = format(\"%04d %s %-6s %3s \",\n      pc, prefix or \"  \", op, ma == 0 and \"\" or a)\n  end\n  local d = shr(ins, 16)\n  if mc == 13*128 then -- BCMjump\n    return format(\"%s=> %04d\\n\", s, pc+d-0x7fff)\n  end\n  if mb ~= 0 then\n    d = band(d, 0xff)\n  elseif mc == 0 then\n    return s..\"\\n\"\n  end\n  local kc\n  if mc == 10*128 then -- BCMstr\n    kc = funck(func, -d-1)\n    kc = format(#kc > 40 and '\"%.40s\"~' or '\"%s\"', gsub(kc, \"%c\", ctlsub))\n  elseif mc == 9*128 then -- BCMnum\n    kc = funck(func, d)\n    if op == \"TSETM \" then kc = kc - 2^52 end\n  elseif mc == 12*128 then -- BCMfunc\n    local fi = funcinfo(funck(func, -d-1))\n    if fi.ffid then\n      kc = vmdef.ffnames[fi.ffid]\n    else\n      kc = fi.loc\n    end\n  elseif mc == 5*128 then -- BCMuv\n    kc = funcuvname(func, d)\n  end\n  if ma == 5 then -- BCMuv\n    local ka = funcuvname(func, a)\n    if kc then kc = ka..\" ; \"..kc else kc = ka end\n  end\n  if mb ~= 0 then\n    local b = shr(ins, 24)\n    if kc then return format(\"%s%3d %3d  ; %s\\n\", s, b, d, kc) end\n    return format(\"%s%3d %3d\\n\", s, b, d)\n  end\n  if kc then return format(\"%s%3d      ; %s\\n\", s, d, kc) end\n  if mc == 7*128 and d > 32767 then d = d - 65536 end -- BCMlits\n  return format(\"%s%3d\\n\", s, d)\nend\n\n-- Collect branch targets of a function.\nlocal function bctargets(func)\n  local target = {}\n  for pc=1,1000000000 do\n    local ins, m = funcbc(func, pc)\n    if not ins then break end\n    if band(m, 15*128) == 13*128 then target[pc+shr(ins, 16)-0x7fff] = true end\n  end\n  return target\nend\n\n-- Dump bytecode instructions of a function.\nlocal function bcdump(func, out, all, lineinfo)\n  if not out then out = stdout end\n  local fi = funcinfo(func)\n  if all and fi.children then\n    for n=-1,-1000000000,-1 do\n      local k = funck(func, n)\n      if not k then break end\n      if type(k) == \"proto\" then bcdump(k, out, true, lineinfo) end\n    end\n  end\n  out:write(format(\"-- BYTECODE -- %s-%d\\n\", fi.loc, fi.lastlinedefined))\n\n  for n=-1,-1000000000,-1 do\n    local kc = funck(func, n)\n    if not kc then break end\n\n    local typ = type(kc)\n    if typ == \"string\" then\n      kc = format(#kc > 40 and '\"%.40s\"~' or '\"%s\"', gsub(kc, \"%c\", ctlsub))\n      out:write(format(\"KGC    %d    %s\\n\", -(n + 1), kc))\n    elseif typ == \"proto\" then\n      local fi = funcinfo(kc)\n      if fi.ffid then\n\tkc = vmdef.ffnames[fi.ffid]\n      else\n\tkc = fi.loc\n      end\n      out:write(format(\"KGC    %d    %s\\n\", -(n + 1), kc))\n    elseif typ == \"table\" then\n      out:write(format(\"KGC    %d    table\\n\", -(n + 1)))\n    else\n      -- error(\"unknown KGC type: \" .. typ)\n    end\n  end\n\n  for n=1,1000000000 do\n    local kc = funck(func, n)\n    if not kc then break end\n    if type(kc) == \"number\" then\n      out:write(format(\"KN    %d    %s\\n\", n, kc))\n    end\n  end\n\n  local target = bctargets(func)\n  for pc=1,1000000000 do\n    local s = bcline(func, pc, target[pc] and \"=>\", lineinfo)\n    if not s then break end\n    out:write(s)\n  end\n  out:write(\"\\n\")\n  out:flush()\nend\n\n------------------------------------------------------------------------------\n\n-- Active flag and output file handle.\nlocal active, out\n\n-- List handler.\nlocal function h_list(func)\n  return bcdump(func, out)\nend\n\n-- Detach list handler.\nlocal function bclistoff()\n  if active then\n    active = false\n    jit.attach(h_list)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach list handler.\nlocal function bcliston(outfile)\n  if active then bclistoff() end\n  if not outfile then outfile = os.getenv(\"LUAJIT_LISTFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stderr\n  end\n  jit.attach(h_list, \"bc\")\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  line = bcline,\n  dump = bcdump,\n  targets = bctargets,\n  on = bcliston,\n  off = bclistoff,\n  start = bcliston -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/bc.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 5f0b5eb903971c641845b50fec99cc42\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/bcsave.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT module to save/list bytecode.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module saves or lists the bytecode for an input file.\n-- It's run by the -b command line option.\n--\n------------------------------------------------------------------------------\n\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal bit = require(\"bit\")\n\n-- Symbol name prefix for LuaJIT bytecode.\nlocal LJBC_PREFIX = \"luaJIT_BC_\"\n\n------------------------------------------------------------------------------\n\nlocal function usage()\n  io.stderr:write[[\nSave LuaJIT bytecode: luajit -b[options] input output\n  -l        Only list bytecode.\n  -L        Only list bytecode with lineinfo.\n  -s        Strip debug info (default).\n  -g        Keep debug info.\n  -n name   Set module name (default: auto-detect from input name).\n  -t type   Set output file type (default: auto-detect from output name).\n  -a arch   Override architecture for object files (default: native).\n  -o os     Override OS for object files (default: native).\n  -e chunk  Use chunk string as input.\n  --        Stop handling options.\n  -         Use stdin as input and/or stdout as output.\n\nFile types: c h obj o raw (default)\n]]\n  os.exit(1)\nend\n\nlocal function check(ok, ...)\n  if ok then return ok, ... end\n  io.stderr:write(\"luajit: \", ...)\n  io.stderr:write(\"\\n\")\n  os.exit(1)\nend\n\nlocal function readfile(input)\n  if type(input) == \"function\" then return input end\n  if input == \"-\" then input = nil end\n  return check(loadfile(input))\nend\n\nlocal function savefile(name, mode)\n  if name == \"-\" then return io.stdout end\n  return check(io.open(name, mode))\nend\n\n------------------------------------------------------------------------------\n\nlocal map_type = {\n  raw = \"raw\", c = \"c\", h = \"h\", o = \"obj\", obj = \"obj\",\n}\n\nlocal map_arch = {\n  x86 = true, x64 = true, arm = true, arm64 = true, arm64be = true,\n  ppc = true, mips = true, mipsel = true,\n}\n\nlocal map_os = {\n  linux = true, windows = true, osx = true, freebsd = true, netbsd = true,\n  openbsd = true, dragonfly = true, solaris = true,\n}\n\nlocal function checkarg(str, map, err)\n  str = string.lower(str)\n  local s = check(map[str], \"unknown \", err)\n  return s == true and str or s\nend\n\nlocal function detecttype(str)\n  local ext = string.match(string.lower(str), \"%.(%a+)$\")\n  return map_type[ext] or \"raw\"\nend\n\nlocal function checkmodname(str)\n  check(string.match(str, \"^[%w_.%-]+$\"), \"bad module name\")\n  return string.gsub(str, \"[%.%-]\", \"_\")\nend\n\nlocal function detectmodname(str)\n  if type(str) == \"string\" then\n    local tail = string.match(str, \"[^/\\\\]+$\")\n    if tail then str = tail end\n    local head = string.match(str, \"^(.*)%.[^.]*$\")\n    if head then str = head end\n    str = string.match(str, \"^[%w_.%-]+\")\n  else\n    str = nil\n  end\n  check(str, \"cannot derive module name, use -n name\")\n  return string.gsub(str, \"[%.%-]\", \"_\")\nend\n\n------------------------------------------------------------------------------\n\nlocal function bcsave_tail(fp, output, s)\n  local ok, err = fp:write(s)\n  if ok and output ~= \"-\" then ok, err = fp:close() end\n  check(ok, \"cannot write \", output, \": \", err)\nend\n\nlocal function bcsave_raw(output, s)\n  local fp = savefile(output, \"wb\")\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_c(ctx, output, s)\n  local fp = savefile(output, \"w\")\n  if ctx.type == \"c\" then\n    fp:write(string.format([[\n#ifdef _cplusplus\nextern \"C\"\n#endif\n#ifdef _WIN32\n__declspec(dllexport)\n#endif\nconst unsigned char %s%s[] = {\n]], LJBC_PREFIX, ctx.modname))\n  else\n    fp:write(string.format([[\n#define %s%s_SIZE %d\nstatic const unsigned char %s%s[] = {\n]], LJBC_PREFIX, ctx.modname, #s, LJBC_PREFIX, ctx.modname))\n  end\n  local t, n, m = {}, 0, 0\n  for i=1,#s do\n    local b = tostring(string.byte(s, i))\n    m = m + #b + 1\n    if m > 78 then\n      fp:write(table.concat(t, \",\", 1, n), \",\\n\")\n      n, m = 0, #b + 1\n    end\n    n = n + 1\n    t[n] = b\n  end\n  bcsave_tail(fp, output, table.concat(t, \",\", 1, n)..\"\\n};\\n\")\nend\n\nlocal function bcsave_elfobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct {\n  uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7];\n  uint16_t type, machine;\n  uint32_t version;\n  uint32_t entry, phofs, shofs;\n  uint32_t flags;\n  uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx;\n} ELF32header;\ntypedef struct {\n  uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7];\n  uint16_t type, machine;\n  uint32_t version;\n  uint64_t entry, phofs, shofs;\n  uint32_t flags;\n  uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx;\n} ELF64header;\ntypedef struct {\n  uint32_t name, type, flags, addr, ofs, size, link, info, align, entsize;\n} ELF32sectheader;\ntypedef struct {\n  uint32_t name, type;\n  uint64_t flags, addr, ofs, size;\n  uint32_t link, info;\n  uint64_t align, entsize;\n} ELF64sectheader;\ntypedef struct {\n  uint32_t name, value, size;\n  uint8_t info, other;\n  uint16_t sectidx;\n} ELF32symbol;\ntypedef struct {\n  uint32_t name;\n  uint8_t info, other;\n  uint16_t sectidx;\n  uint64_t value, size;\n} ELF64symbol;\ntypedef struct {\n  ELF32header hdr;\n  ELF32sectheader sect[6];\n  ELF32symbol sym[2];\n  uint8_t space[4096];\n} ELF32obj;\ntypedef struct {\n  ELF64header hdr;\n  ELF64sectheader sect[6];\n  ELF64symbol sym[2];\n  uint8_t space[4096];\n} ELF64obj;\n]]\n  local symname = LJBC_PREFIX..ctx.modname\n  local is64, isbe = false, false\n  if ctx.arch == \"x64\" or ctx.arch == \"arm64\" or ctx.arch == \"arm64be\" then\n    is64 = true\n  elseif ctx.arch == \"ppc\" or ctx.arch == \"mips\" then\n    isbe = true\n  end\n\n  -- Handle different host/target endianess.\n  local function f32(x) return x end\n  local f16, fofs = f32, f32\n  if ffi.abi(\"be\") ~= isbe then\n    f32 = bit.bswap\n    function f16(x) return bit.rshift(bit.bswap(x), 16) end\n    if is64 then\n      local two32 = ffi.cast(\"int64_t\", 2^32)\n      function fofs(x) return bit.bswap(x)*two32 end\n    else\n      fofs = f32\n    end\n  end\n\n  -- Create ELF object and fill in header.\n  local o = ffi.new(is64 and \"ELF64obj\" or \"ELF32obj\")\n  local hdr = o.hdr\n  if ctx.os == \"bsd\" or ctx.os == \"other\" then -- Determine native hdr.eosabi.\n    local bf = assert(io.open(\"/bin/ls\", \"rb\"))\n    local bs = bf:read(9)\n    bf:close()\n    ffi.copy(o, bs, 9)\n    check(hdr.emagic[0] == 127, \"no support for writing native object files\")\n  else\n    hdr.emagic = \"\\127ELF\"\n    hdr.eosabi = ({ freebsd=9, netbsd=2, openbsd=12, solaris=6 })[ctx.os] or 0\n  end\n  hdr.eclass = is64 and 2 or 1\n  hdr.eendian = isbe and 2 or 1\n  hdr.eversion = 1\n  hdr.type = f16(1)\n  hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, mips=8, mipsel=8 })[ctx.arch])\n  if ctx.arch == \"mips\" or ctx.arch == \"mipsel\" then\n    hdr.flags = f32(0x50001006)\n  end\n  hdr.version = f32(1)\n  hdr.shofs = fofs(ffi.offsetof(o, \"sect\"))\n  hdr.ehsize = f16(ffi.sizeof(hdr))\n  hdr.shentsize = f16(ffi.sizeof(o.sect[0]))\n  hdr.shnum = f16(6)\n  hdr.shstridx = f16(2)\n\n  -- Fill in sections and symbols.\n  local sofs, ofs = ffi.offsetof(o, \"space\"), 1\n  for i,name in ipairs{\n      \".symtab\", \".shstrtab\", \".strtab\", \".rodata\", \".note.GNU-stack\",\n    } do\n    local sect = o.sect[i]\n    sect.align = fofs(1)\n    sect.name = f32(ofs)\n    ffi.copy(o.space+ofs, name)\n    ofs = ofs + #name+1\n  end\n  o.sect[1].type = f32(2) -- .symtab\n  o.sect[1].link = f32(3)\n  o.sect[1].info = f32(1)\n  o.sect[1].align = fofs(8)\n  o.sect[1].ofs = fofs(ffi.offsetof(o, \"sym\"))\n  o.sect[1].entsize = fofs(ffi.sizeof(o.sym[0]))\n  o.sect[1].size = fofs(ffi.sizeof(o.sym))\n  o.sym[1].name = f32(1)\n  o.sym[1].sectidx = f16(4)\n  o.sym[1].size = fofs(#s)\n  o.sym[1].info = 17\n  o.sect[2].type = f32(3) -- .shstrtab\n  o.sect[2].ofs = fofs(sofs)\n  o.sect[2].size = fofs(ofs)\n  o.sect[3].type = f32(3) -- .strtab\n  o.sect[3].ofs = fofs(sofs + ofs)\n  o.sect[3].size = fofs(#symname+2)\n  ffi.copy(o.space+ofs+1, symname)\n  ofs = ofs + #symname + 2\n  o.sect[4].type = f32(1) -- .rodata\n  o.sect[4].flags = fofs(2)\n  o.sect[4].ofs = fofs(sofs + ofs)\n  o.sect[4].size = fofs(#s)\n  o.sect[5].type = f32(1) -- .note.GNU-stack\n  o.sect[5].ofs = fofs(sofs + ofs + #s)\n\n  -- Write ELF object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_peobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct {\n  uint16_t arch, nsects;\n  uint32_t time, symtabofs, nsyms;\n  uint16_t opthdrsz, flags;\n} PEheader;\ntypedef struct {\n  char name[8];\n  uint32_t vsize, vaddr, size, ofs, relocofs, lineofs;\n  uint16_t nreloc, nline;\n  uint32_t flags;\n} PEsection;\ntypedef struct __attribute((packed)) {\n  union {\n    char name[8];\n    uint32_t nameref[2];\n  };\n  uint32_t value;\n  int16_t sect;\n  uint16_t type;\n  uint8_t scl, naux;\n} PEsym;\ntypedef struct __attribute((packed)) {\n  uint32_t size;\n  uint16_t nreloc, nline;\n  uint32_t cksum;\n  uint16_t assoc;\n  uint8_t comdatsel, unused[3];\n} PEsymaux;\ntypedef struct {\n  PEheader hdr;\n  PEsection sect[2];\n  // Must be an even number of symbol structs.\n  PEsym sym0;\n  PEsymaux sym0aux;\n  PEsym sym1;\n  PEsymaux sym1aux;\n  PEsym sym2;\n  PEsym sym3;\n  uint32_t strtabsize;\n  uint8_t space[4096];\n} PEobj;\n]]\n  local symname = LJBC_PREFIX..ctx.modname\n  local is64 = false\n  if ctx.arch == \"x86\" then\n    symname = \"_\"..symname\n  elseif ctx.arch == \"x64\" then\n    is64 = true\n  end\n  local symexport = \"   /EXPORT:\"..symname..\",DATA \"\n\n  -- The file format is always little-endian. Swap if the host is big-endian.\n  local function f32(x) return x end\n  local f16 = f32\n  if ffi.abi(\"be\") then\n    f32 = bit.bswap\n    function f16(x) return bit.rshift(bit.bswap(x), 16) end\n  end\n\n  -- Create PE object and fill in header.\n  local o = ffi.new(\"PEobj\")\n  local hdr = o.hdr\n  hdr.arch = f16(({ x86=0x14c, x64=0x8664, arm=0x1c0, ppc=0x1f2, mips=0x366, mipsel=0x366 })[ctx.arch])\n  hdr.nsects = f16(2)\n  hdr.symtabofs = f32(ffi.offsetof(o, \"sym0\"))\n  hdr.nsyms = f32(6)\n\n  -- Fill in sections and symbols.\n  o.sect[0].name = \".drectve\"\n  o.sect[0].size = f32(#symexport)\n  o.sect[0].flags = f32(0x00100a00)\n  o.sym0.sect = f16(1)\n  o.sym0.scl = 3\n  o.sym0.name = \".drectve\"\n  o.sym0.naux = 1\n  o.sym0aux.size = f32(#symexport)\n  o.sect[1].name = \".rdata\"\n  o.sect[1].size = f32(#s)\n  o.sect[1].flags = f32(0x40300040)\n  o.sym1.sect = f16(2)\n  o.sym1.scl = 3\n  o.sym1.name = \".rdata\"\n  o.sym1.naux = 1\n  o.sym1aux.size = f32(#s)\n  o.sym2.sect = f16(2)\n  o.sym2.scl = 2\n  o.sym2.nameref[1] = f32(4)\n  o.sym3.sect = f16(-1)\n  o.sym3.scl = 2\n  o.sym3.value = f32(1)\n  o.sym3.name = \"@feat.00\" -- Mark as SafeSEH compliant.\n  ffi.copy(o.space, symname)\n  local ofs = #symname + 1\n  o.strtabsize = f32(ofs + 4)\n  o.sect[0].ofs = f32(ffi.offsetof(o, \"space\") + ofs)\n  ffi.copy(o.space + ofs, symexport)\n  ofs = ofs + #symexport\n  o.sect[1].ofs = f32(ffi.offsetof(o, \"space\") + ofs)\n\n  -- Write PE object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_machobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct\n{\n  uint32_t magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags;\n} mach_header;\ntypedef struct\n{\n  mach_header; uint32_t reserved;\n} mach_header_64;\ntypedef struct {\n  uint32_t cmd, cmdsize;\n  char segname[16];\n  uint32_t vmaddr, vmsize, fileoff, filesize;\n  uint32_t maxprot, initprot, nsects, flags;\n} mach_segment_command;\ntypedef struct {\n  uint32_t cmd, cmdsize;\n  char segname[16];\n  uint64_t vmaddr, vmsize, fileoff, filesize;\n  uint32_t maxprot, initprot, nsects, flags;\n} mach_segment_command_64;\ntypedef struct {\n  char sectname[16], segname[16];\n  uint32_t addr, size;\n  uint32_t offset, align, reloff, nreloc, flags;\n  uint32_t reserved1, reserved2;\n} mach_section;\ntypedef struct {\n  char sectname[16], segname[16];\n  uint64_t addr, size;\n  uint32_t offset, align, reloff, nreloc, flags;\n  uint32_t reserved1, reserved2, reserved3;\n} mach_section_64;\ntypedef struct {\n  uint32_t cmd, cmdsize, symoff, nsyms, stroff, strsize;\n} mach_symtab_command;\ntypedef struct {\n  int32_t strx;\n  uint8_t type, sect;\n  int16_t desc;\n  uint32_t value;\n} mach_nlist;\ntypedef struct {\n  uint32_t strx;\n  uint8_t type, sect;\n  uint16_t desc;\n  uint64_t value;\n} mach_nlist_64;\ntypedef struct\n{\n  uint32_t magic, nfat_arch;\n} mach_fat_header;\ntypedef struct\n{\n  uint32_t cputype, cpusubtype, offset, size, align;\n} mach_fat_arch;\ntypedef struct {\n  struct {\n    mach_header hdr;\n    mach_segment_command seg;\n    mach_section sec;\n    mach_symtab_command sym;\n  } arch[1];\n  mach_nlist sym_entry;\n  uint8_t space[4096];\n} mach_obj;\ntypedef struct {\n  struct {\n    mach_header_64 hdr;\n    mach_segment_command_64 seg;\n    mach_section_64 sec;\n    mach_symtab_command sym;\n  } arch[1];\n  mach_nlist_64 sym_entry;\n  uint8_t space[4096];\n} mach_obj_64;\ntypedef struct {\n  mach_fat_header fat;\n  mach_fat_arch fat_arch[2];\n  struct {\n    mach_header hdr;\n    mach_segment_command seg;\n    mach_section sec;\n    mach_symtab_command sym;\n  } arch[2];\n  mach_nlist sym_entry;\n  uint8_t space[4096];\n} mach_fat_obj;\n]]\n  local symname = '_'..LJBC_PREFIX..ctx.modname\n  local isfat, is64, align, mobj = false, false, 4, \"mach_obj\"\n  if ctx.arch == \"x64\" then\n    is64, align, mobj = true, 8, \"mach_obj_64\"\n  elseif ctx.arch == \"arm\" then\n    isfat, mobj = true, \"mach_fat_obj\"\n  elseif ctx.arch == \"arm64\" then\n    is64, align, isfat, mobj = true, 8, true, \"mach_fat_obj\"\n  else\n    check(ctx.arch == \"x86\", \"unsupported architecture for OSX\")\n  end\n  local function aligned(v, a) return bit.band(v+a-1, -a) end\n  local be32 = bit.bswap -- Mach-O FAT is BE, supported archs are LE.\n\n  -- Create Mach-O object and fill in header.\n  local o = ffi.new(mobj)\n  local mach_size = aligned(ffi.offsetof(o, \"space\")+#symname+2, align)\n  local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12}, arm64={0x01000007,0x0100000c} })[ctx.arch]\n  local cpusubtype = ({ x86={3}, x64={3}, arm={3,9}, arm64={3,0} })[ctx.arch]\n  if isfat then\n    o.fat.magic = be32(0xcafebabe)\n    o.fat.nfat_arch = be32(#cpusubtype)\n  end\n\n  -- Fill in sections and symbols.\n  for i=0,#cpusubtype-1 do\n    local ofs = 0\n    if isfat then\n      local a = o.fat_arch[i]\n      a.cputype = be32(cputype[i+1])\n      a.cpusubtype = be32(cpusubtype[i+1])\n      -- Subsequent slices overlap each other to share data.\n      ofs = ffi.offsetof(o, \"arch\") + i*ffi.sizeof(o.arch[0])\n      a.offset = be32(ofs)\n      a.size = be32(mach_size-ofs+#s)\n    end\n    local a = o.arch[i]\n    a.hdr.magic = is64 and 0xfeedfacf or 0xfeedface\n    a.hdr.cputype = cputype[i+1]\n    a.hdr.cpusubtype = cpusubtype[i+1]\n    a.hdr.filetype = 1\n    a.hdr.ncmds = 2\n    a.hdr.sizeofcmds = ffi.sizeof(a.seg)+ffi.sizeof(a.sec)+ffi.sizeof(a.sym)\n    a.seg.cmd = is64 and 0x19 or 0x1\n    a.seg.cmdsize = ffi.sizeof(a.seg)+ffi.sizeof(a.sec)\n    a.seg.vmsize = #s\n    a.seg.fileoff = mach_size-ofs\n    a.seg.filesize = #s\n    a.seg.maxprot = 1\n    a.seg.initprot = 1\n    a.seg.nsects = 1\n    ffi.copy(a.sec.sectname, \"__data\")\n    ffi.copy(a.sec.segname, \"__DATA\")\n    a.sec.size = #s\n    a.sec.offset = mach_size-ofs\n    a.sym.cmd = 2\n    a.sym.cmdsize = ffi.sizeof(a.sym)\n    a.sym.symoff = ffi.offsetof(o, \"sym_entry\")-ofs\n    a.sym.nsyms = 1\n    a.sym.stroff = ffi.offsetof(o, \"sym_entry\")+ffi.sizeof(o.sym_entry)-ofs\n    a.sym.strsize = aligned(#symname+2, align)\n  end\n  o.sym_entry.type = 0xf\n  o.sym_entry.sect = 1\n  o.sym_entry.strx = 1\n  ffi.copy(o.space+1, symname)\n\n  -- Write Macho-O object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, mach_size))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_obj(ctx, output, s)\n  local ok, ffi = pcall(require, \"ffi\")\n  check(ok, \"FFI library required to write this file type\")\n  if ctx.os == \"windows\" then\n    return bcsave_peobj(ctx, output, s, ffi)\n  elseif ctx.os == \"osx\" then\n    return bcsave_machobj(ctx, output, s, ffi)\n  else\n    return bcsave_elfobj(ctx, output, s, ffi)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal function bclist(input, output, lineinfo)\n  local f = readfile(input)\n  require(\"jit.bc\").dump(f, savefile(output, \"w\"), true, lineinfo)\nend\n\nlocal function bcsave(ctx, input, output)\n  local f = readfile(input)\n  local s = string.dump(f, ctx.strip)\n  local t = ctx.type\n  if not t then\n    t = detecttype(output)\n    ctx.type = t\n  end\n  if t == \"raw\" then\n    bcsave_raw(output, s)\n  else\n    if not ctx.modname then ctx.modname = detectmodname(input) end\n    if t == \"obj\" then\n      bcsave_obj(ctx, output, s)\n    else\n      bcsave_c(ctx, output, s)\n    end\n  end\nend\n\nlocal function docmd(...)\n  local arg = {...}\n  local n = 1\n  local list = false\n  local lineinfo = false\n  local ctx = {\n    strip = true, arch = jit.arch, os = string.lower(jit.os),\n    type = false, modname = false,\n  }\n  while n <= #arg do\n    local a = arg[n]\n    if type(a) == \"string\" and string.sub(a, 1, 1) == \"-\" and a ~= \"-\" then\n      table.remove(arg, n)\n      if a == \"--\" then break end\n      for m=2,#a do\n\tlocal opt = string.sub(a, m, m)\n\tif opt == \"l\" then\n\t  list = true\n\telseif opt == \"L\" then\n\t  list = true\n\t  lineinfo = true\n\telseif opt == \"s\" then\n\t  ctx.strip = true\n\telseif opt == \"g\" then\n\t  ctx.strip = false\n\telse\n\t  if arg[n] == nil or m ~= #a then usage() end\n\t  if opt == \"e\" then\n\t    if n ~= 1 then usage() end\n\t    arg[1] = check(loadstring(arg[1]))\n\t  elseif opt == \"n\" then\n\t    ctx.modname = checkmodname(table.remove(arg, n))\n\t  elseif opt == \"t\" then\n\t    ctx.type = checkarg(table.remove(arg, n), map_type, \"file type\")\n\t  elseif opt == \"a\" then\n\t    ctx.arch = checkarg(table.remove(arg, n), map_arch, \"architecture\")\n\t  elseif opt == \"o\" then\n\t    ctx.os = checkarg(table.remove(arg, n), map_os, \"OS name\")\n\t  else\n\t    usage()\n\t  end\n\tend\n      end\n    else\n      n = n + 1\n    end\n  end\n  if list then\n    if #arg == 0 or #arg > 2 then usage() end\n    bclist(arg[1], arg[2] or \"-\", lineinfo)\n  else\n    if #arg ~= 2 then usage() end\n    bcsave(ctx, arg[1], arg[2])\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Public module functions.\nreturn {\n  start = docmd -- Process -b command line option.\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/bcsave.lua.meta",
    "content": "fileFormatVersion: 2\nguid: c57519f5e4f846c459de1f2eaa13da69\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_arm.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles most user-mode ARMv7 instructions\n-- NYI: Advanced SIMD and VFP instructions.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch = string.match, string.gmatch\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, ror, tohex = bit.band, bit.bor, bit.ror, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Opcode maps\n------------------------------------------------------------------------------\n\nlocal map_loadc = {\n  shift = 8, mask = 15,\n  [10] = {\n    shift = 20, mask = 1,\n    [0] = {\n      shift = 23, mask = 3,\n      [0] = \"vmovFmDN\", \"vstmFNdr\",\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vstrFdl\",\n\t{ shift = 16, mask = 15, [13] = \"vpushFdr\", _ = \"vstmdbFNdr\", }\n      },\n    },\n    {\n      shift = 23, mask = 3,\n      [0] = \"vmovFDNm\",\n      { shift = 16, mask = 15, [13] = \"vpopFdr\", _ = \"vldmFNdr\", },\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vldrFdl\", \"vldmdbFNdr\",\n      },\n    },\n  },\n  [11] = {\n    shift = 20, mask = 1,\n    [0] = {\n      shift = 23, mask = 3,\n      [0] = \"vmovGmDN\", \"vstmGNdr\",\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vstrGdl\",\n\t{ shift = 16, mask = 15, [13] = \"vpushGdr\", _ = \"vstmdbGNdr\", }\n      },\n    },\n    {\n      shift = 23, mask = 3,\n      [0] = \"vmovGDNm\",\n      { shift = 16, mask = 15, [13] = \"vpopGdr\", _ = \"vldmGNdr\", },\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vldrGdl\", \"vldmdbGNdr\",\n      },\n    },\n  },\n  _ = {\n    shift = 0, mask = 0 -- NYI ldc, mcrr, mrrc.\n  },\n}\n\nlocal map_vfps = {\n  shift = 6, mask = 0x2c001,\n  [0] = \"vmlaF.dnm\", \"vmlsF.dnm\",\n  [0x04000] = \"vnmlsF.dnm\", [0x04001] = \"vnmlaF.dnm\",\n  [0x08000] = \"vmulF.dnm\", [0x08001] = \"vnmulF.dnm\",\n  [0x0c000] = \"vaddF.dnm\", [0x0c001] = \"vsubF.dnm\",\n  [0x20000] = \"vdivF.dnm\",\n  [0x24000] = \"vfnmsF.dnm\", [0x24001] = \"vfnmaF.dnm\",\n  [0x28000] = \"vfmaF.dnm\", [0x28001] = \"vfmsF.dnm\",\n  [0x2c000] = \"vmovF.dY\",\n  [0x2c001] = {\n    shift = 7, mask = 0x1e01,\n    [0] = \"vmovF.dm\", \"vabsF.dm\",\n    [0x0200] = \"vnegF.dm\", [0x0201] = \"vsqrtF.dm\",\n    [0x0800] = \"vcmpF.dm\", [0x0801] = \"vcmpeF.dm\",\n    [0x0a00] = \"vcmpzF.d\", [0x0a01] = \"vcmpzeF.d\",\n    [0x0e01] = \"vcvtG.dF.m\",\n    [0x1000] = \"vcvt.f32.u32Fdm\", [0x1001] = \"vcvt.f32.s32Fdm\",\n    [0x1800] = \"vcvtr.u32F.dm\", [0x1801] = \"vcvt.u32F.dm\",\n    [0x1a00] = \"vcvtr.s32F.dm\", [0x1a01] = \"vcvt.s32F.dm\",\n  },\n}\n\nlocal map_vfpd = {\n  shift = 6, mask = 0x2c001,\n  [0] = \"vmlaG.dnm\", \"vmlsG.dnm\",\n  [0x04000] = \"vnmlsG.dnm\", [0x04001] = \"vnmlaG.dnm\",\n  [0x08000] = \"vmulG.dnm\", [0x08001] = \"vnmulG.dnm\",\n  [0x0c000] = \"vaddG.dnm\", [0x0c001] = \"vsubG.dnm\",\n  [0x20000] = \"vdivG.dnm\",\n  [0x24000] = \"vfnmsG.dnm\", [0x24001] = \"vfnmaG.dnm\",\n  [0x28000] = \"vfmaG.dnm\", [0x28001] = \"vfmsG.dnm\",\n  [0x2c000] = \"vmovG.dY\",\n  [0x2c001] = {\n    shift = 7, mask = 0x1e01,\n    [0] = \"vmovG.dm\", \"vabsG.dm\",\n    [0x0200] = \"vnegG.dm\", [0x0201] = \"vsqrtG.dm\",\n    [0x0800] = \"vcmpG.dm\", [0x0801] = \"vcmpeG.dm\",\n    [0x0a00] = \"vcmpzG.d\", [0x0a01] = \"vcmpzeG.d\",\n    [0x0e01] = \"vcvtF.dG.m\",\n    [0x1000] = \"vcvt.f64.u32GdFm\", [0x1001] = \"vcvt.f64.s32GdFm\",\n    [0x1800] = \"vcvtr.u32FdG.m\", [0x1801] = \"vcvt.u32FdG.m\",\n    [0x1a00] = \"vcvtr.s32FdG.m\", [0x1a01] = \"vcvt.s32FdG.m\",\n  },\n}\n\nlocal map_datac = {\n  shift = 24, mask = 1,\n  [0] = {\n    shift = 4, mask = 1,\n    [0] = {\n      shift = 8, mask = 15,\n      [10] = map_vfps,\n      [11] = map_vfpd,\n      -- NYI cdp, mcr, mrc.\n    },\n    {\n      shift = 8, mask = 15,\n      [10] = {\n\tshift = 20, mask = 15,\n\t[0] = \"vmovFnD\", \"vmovFDn\",\n\t[14] = \"vmsrD\",\n\t[15] = { shift = 12, mask = 15, [15] = \"vmrs\", _ = \"vmrsD\", },\n      },\n    },\n  },\n  \"svcT\",\n}\n\nlocal map_loadcu = {\n  shift = 0, mask = 0, -- NYI unconditional CP load/store.\n}\n\nlocal map_datacu = {\n  shift = 0, mask = 0, -- NYI unconditional CP data.\n}\n\nlocal map_simddata = {\n  shift = 0, mask = 0, -- NYI SIMD data.\n}\n\nlocal map_simdload = {\n  shift = 0, mask = 0, -- NYI SIMD load/store, preload.\n}\n\nlocal map_preload = {\n  shift = 0, mask = 0, -- NYI preload.\n}\n\nlocal map_media = {\n  shift = 20, mask = 31,\n  [0] = false,\n  { --01\n    shift = 5, mask = 7,\n    [0] = \"sadd16DNM\", \"sasxDNM\", \"ssaxDNM\", \"ssub16DNM\",\n    \"sadd8DNM\", false, false, \"ssub8DNM\",\n  },\n  { --02\n    shift = 5, mask = 7,\n    [0] = \"qadd16DNM\", \"qasxDNM\", \"qsaxDNM\", \"qsub16DNM\",\n    \"qadd8DNM\", false, false, \"qsub8DNM\",\n  },\n  { --03\n    shift = 5, mask = 7,\n    [0] = \"shadd16DNM\", \"shasxDNM\", \"shsaxDNM\", \"shsub16DNM\",\n    \"shadd8DNM\", false, false, \"shsub8DNM\",\n  },\n  false,\n  { --05\n    shift = 5, mask = 7,\n    [0] = \"uadd16DNM\", \"uasxDNM\", \"usaxDNM\", \"usub16DNM\",\n    \"uadd8DNM\", false, false, \"usub8DNM\",\n  },\n  { --06\n    shift = 5, mask = 7,\n    [0] = \"uqadd16DNM\", \"uqasxDNM\", \"uqsaxDNM\", \"uqsub16DNM\",\n    \"uqadd8DNM\", false, false, \"uqsub8DNM\",\n  },\n  { --07\n    shift = 5, mask = 7,\n    [0] = \"uhadd16DNM\", \"uhasxDNM\", \"uhsaxDNM\", \"uhsub16DNM\",\n    \"uhadd8DNM\", false, false, \"uhsub8DNM\",\n  },\n  { --08\n    shift = 5, mask = 7,\n    [0] = \"pkhbtDNMU\", false, \"pkhtbDNMU\",\n    { shift = 16, mask = 15, [15] = \"sxtb16DMU\", _ = \"sxtab16DNMU\", },\n    \"pkhbtDNMU\", \"selDNM\", \"pkhtbDNMU\",\n  },\n  false,\n  { --0a\n    shift = 5, mask = 7,\n    [0] = \"ssatDxMu\", \"ssat16DxM\", \"ssatDxMu\",\n    { shift = 16, mask = 15, [15] = \"sxtbDMU\", _ = \"sxtabDNMU\", },\n    \"ssatDxMu\", false, \"ssatDxMu\",\n  },\n  { --0b\n    shift = 5, mask = 7,\n    [0] = \"ssatDxMu\", \"revDM\", \"ssatDxMu\",\n    { shift = 16, mask = 15, [15] = \"sxthDMU\", _ = \"sxtahDNMU\", },\n    \"ssatDxMu\", \"rev16DM\", \"ssatDxMu\",\n  },\n  { --0c\n    shift = 5, mask = 7,\n    [3] = { shift = 16, mask = 15, [15] = \"uxtb16DMU\", _ = \"uxtab16DNMU\", },\n  },\n  false,\n  { --0e\n    shift = 5, mask = 7,\n    [0] = \"usatDwMu\", \"usat16DwM\", \"usatDwMu\",\n    { shift = 16, mask = 15, [15] = \"uxtbDMU\", _ = \"uxtabDNMU\", },\n    \"usatDwMu\", false, \"usatDwMu\",\n  },\n  { --0f\n    shift = 5, mask = 7,\n    [0] = \"usatDwMu\", \"rbitDM\", \"usatDwMu\",\n    { shift = 16, mask = 15, [15] = \"uxthDMU\", _ = \"uxtahDNMU\", },\n    \"usatDwMu\", \"revshDM\", \"usatDwMu\",\n  },\n  { --10\n    shift = 12, mask = 15,\n    [15] = {\n      shift = 5, mask = 7,\n      \"smuadNMS\", \"smuadxNMS\", \"smusdNMS\", \"smusdxNMS\",\n    },\n    _ = {\n      shift = 5, mask = 7,\n      [0] = \"smladNMSD\", \"smladxNMSD\", \"smlsdNMSD\", \"smlsdxNMSD\",\n    },\n  },\n  false, false, false,\n  { --14\n    shift = 5, mask = 7,\n    [0] = \"smlaldDNMS\", \"smlaldxDNMS\", \"smlsldDNMS\", \"smlsldxDNMS\",\n  },\n  { --15\n    shift = 5, mask = 7,\n    [0] = { shift = 12, mask = 15, [15] = \"smmulNMS\", _ = \"smmlaNMSD\", },\n    { shift = 12, mask = 15, [15] = \"smmulrNMS\", _ = \"smmlarNMSD\", },\n    false, false, false, false,\n    \"smmlsNMSD\", \"smmlsrNMSD\",\n  },\n  false, false,\n  { --18\n    shift = 5, mask = 7,\n    [0] = { shift = 12, mask = 15, [15] = \"usad8NMS\", _ = \"usada8NMSD\", },\n  },\n  false,\n  { --1a\n    shift = 5, mask = 3, [2] = \"sbfxDMvw\",\n  },\n  { --1b\n    shift = 5, mask = 3, [2] = \"sbfxDMvw\",\n  },\n  { --1c\n    shift = 5, mask = 3,\n    [0] = { shift = 0, mask = 15, [15] = \"bfcDvX\", _ = \"bfiDMvX\", },\n  },\n  { --1d\n    shift = 5, mask = 3,\n    [0] = { shift = 0, mask = 15, [15] = \"bfcDvX\", _ = \"bfiDMvX\", },\n  },\n  { --1e\n    shift = 5, mask = 3, [2] = \"ubfxDMvw\",\n  },\n  { --1f\n    shift = 5, mask = 3, [2] = \"ubfxDMvw\",\n  },\n}\n\nlocal map_load = {\n  shift = 21, mask = 9,\n  {\n    shift = 20, mask = 5,\n    [0] = \"strtDL\", \"ldrtDL\", [4] = \"strbtDL\", [5] = \"ldrbtDL\",\n  },\n  _ = {\n    shift = 20, mask = 5,\n    [0] = \"strDL\", \"ldrDL\", [4] = \"strbDL\", [5] = \"ldrbDL\",\n  }\n}\n\nlocal map_load1 = {\n  shift = 4, mask = 1,\n  [0] = map_load, map_media,\n}\n\nlocal map_loadm = {\n  shift = 20, mask = 1,\n  [0] = {\n    shift = 23, mask = 3,\n    [0] = \"stmdaNR\", \"stmNR\",\n    { shift = 16, mask = 63, [45] = \"pushR\", _ = \"stmdbNR\", }, \"stmibNR\",\n  },\n  {\n    shift = 23, mask = 3,\n    [0] = \"ldmdaNR\", { shift = 16, mask = 63, [61] = \"popR\", _ = \"ldmNR\", },\n    \"ldmdbNR\", \"ldmibNR\",\n  },\n}\n\nlocal map_data = {\n  shift = 21, mask = 15,\n  [0] = \"andDNPs\", \"eorDNPs\", \"subDNPs\", \"rsbDNPs\",\n  \"addDNPs\", \"adcDNPs\", \"sbcDNPs\", \"rscDNPs\",\n  \"tstNP\", \"teqNP\", \"cmpNP\", \"cmnNP\",\n  \"orrDNPs\", \"movDPs\", \"bicDNPs\", \"mvnDPs\",\n}\n\nlocal map_mul = {\n  shift = 21, mask = 7,\n  [0] = \"mulNMSs\", \"mlaNMSDs\", \"umaalDNMS\", \"mlsDNMS\",\n  \"umullDNMSs\", \"umlalDNMSs\", \"smullDNMSs\", \"smlalDNMSs\",\n}\n\nlocal map_sync = {\n  shift = 20, mask = 15, -- NYI: brackets around N. R(D+1) for ldrexd/strexd.\n  [0] = \"swpDMN\", false, false, false,\n  \"swpbDMN\", false, false, false,\n  \"strexDMN\", \"ldrexDN\", \"strexdDN\", \"ldrexdDN\",\n  \"strexbDMN\", \"ldrexbDN\", \"strexhDN\", \"ldrexhDN\",\n}\n\nlocal map_mulh = {\n  shift = 21, mask = 3,\n  [0] = { shift = 5, mask = 3,\n    [0] = \"smlabbNMSD\", \"smlatbNMSD\", \"smlabtNMSD\", \"smlattNMSD\", },\n  { shift = 5, mask = 3,\n    [0] = \"smlawbNMSD\", \"smulwbNMS\", \"smlawtNMSD\", \"smulwtNMS\", },\n  { shift = 5, mask = 3,\n    [0] = \"smlalbbDNMS\", \"smlaltbDNMS\", \"smlalbtDNMS\", \"smlalttDNMS\", },\n  { shift = 5, mask = 3,\n    [0] = \"smulbbNMS\", \"smultbNMS\", \"smulbtNMS\", \"smulttNMS\", },\n}\n\nlocal map_misc = {\n  shift = 4, mask = 7,\n  -- NYI: decode PSR bits of msr.\n  [0] = { shift = 21, mask = 1, [0] = \"mrsD\", \"msrM\", },\n  { shift = 21, mask = 3, \"bxM\", false, \"clzDM\", },\n  { shift = 21, mask = 3, \"bxjM\", },\n  { shift = 21, mask = 3, \"blxM\", },\n  false,\n  { shift = 21, mask = 3, [0] = \"qaddDMN\", \"qsubDMN\", \"qdaddDMN\", \"qdsubDMN\", },\n  false,\n  { shift = 21, mask = 3, \"bkptK\", },\n}\n\nlocal map_datar = {\n  shift = 4, mask = 9,\n  [9] = {\n    shift = 5, mask = 3,\n    [0] = { shift = 24, mask = 1, [0] = map_mul, map_sync, },\n    { shift = 20, mask = 1, [0] = \"strhDL\", \"ldrhDL\", },\n    { shift = 20, mask = 1, [0] = \"ldrdDL\", \"ldrsbDL\", },\n    { shift = 20, mask = 1, [0] = \"strdDL\", \"ldrshDL\", },\n  },\n  _ = {\n    shift = 20, mask = 25,\n    [16] = { shift = 7, mask = 1, [0] = map_misc, map_mulh, },\n    _ = {\n      shift = 0, mask = 0xffffffff,\n      [bor(0xe1a00000)] = \"nop\",\n      _ = map_data,\n    }\n  },\n}\n\nlocal map_datai = {\n  shift = 20, mask = 31, -- NYI: decode PSR bits of msr. Decode imm12.\n  [16] = \"movwDW\", [20] = \"movtDW\",\n  [18] = { shift = 0, mask = 0xf00ff, [0] = \"nopv6\", _ = \"msrNW\", },\n  [22] = \"msrNW\",\n  _ = map_data,\n}\n\nlocal map_branch = {\n  shift = 24, mask = 1,\n  [0] = \"bB\", \"blB\"\n}\n\nlocal map_condins = {\n  [0] = map_datar, map_datai, map_load, map_load1,\n  map_loadm, map_branch, map_loadc, map_datac\n}\n\n-- NYI: setend.\nlocal map_uncondins = {\n  [0] = false, map_simddata, map_simdload, map_preload,\n  false, \"blxB\", map_loadcu, map_datacu,\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"r1\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"sp\", \"lr\", \"pc\",\n}\n\nlocal map_cond = {\n  [0] = \"eq\", \"ne\", \"hs\", \"lo\", \"mi\", \"pl\", \"vs\", \"vc\",\n  \"hi\", \"ls\", \"ge\", \"lt\", \"gt\", \"le\", \"al\",\n}\n\nlocal map_shift = { [0] = \"lsl\", \"lsr\", \"asr\", \"ror\", }\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then\n      extra = \"\\t->\"..sym\n    elseif band(ctx.op, 0x0e000000) ~= 0x0a000000 then\n      extra = \"\\t; 0x\"..tohex(ctx.rel)\n    end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-5s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-5s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\n-- Format operand 2 of load/store opcodes.\nlocal function fmtload(ctx, op, pos)\n  local base = map_gpr[band(rshift(op, 16), 15)]\n  local x, ofs\n  local ext = (band(op, 0x04000000) == 0)\n  if not ext and band(op, 0x02000000) == 0 then\n    ofs = band(op, 4095)\n    if band(op, 0x00800000) == 0 then ofs = -ofs end\n    if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n    ofs = \"#\"..ofs\n  elseif ext and band(op, 0x00400000) ~= 0 then\n    ofs = band(op, 15) + band(rshift(op, 4), 0xf0)\n    if band(op, 0x00800000) == 0 then ofs = -ofs end\n    if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n    ofs = \"#\"..ofs\n  else\n    ofs = map_gpr[band(op, 15)]\n    if ext or band(op, 0xfe0) == 0 then\n    elseif band(op, 0xfe0) == 0x60 then\n      ofs = format(\"%s, rrx\", ofs)\n    else\n      local sh = band(rshift(op, 7), 31)\n      if sh == 0 then sh = 32 end\n      ofs = format(\"%s, %s #%d\", ofs, map_shift[band(rshift(op, 5), 3)], sh)\n    end\n    if band(op, 0x00800000) == 0 then ofs = \"-\"..ofs end\n  end\n  if ofs == \"#0\" then\n    x = format(\"[%s]\", base)\n  elseif band(op, 0x01000000) == 0 then\n    x = format(\"[%s], %s\", base, ofs)\n  else\n    x = format(\"[%s, %s]\", base, ofs)\n  end\n  if band(op, 0x01200000) == 0x01200000 then x = x..\"!\" end\n  return x\nend\n\n-- Format operand 2 of vector load/store opcodes.\nlocal function fmtvload(ctx, op, pos)\n  local base = map_gpr[band(rshift(op, 16), 15)]\n  local ofs = band(op, 255)*4\n  if band(op, 0x00800000) == 0 then ofs = -ofs end\n  if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n  if ofs == 0 then\n    return format(\"[%s]\", base)\n  else\n    return format(\"[%s, #%d]\", base, ofs)\n  end\nend\n\nlocal function fmtvr(op, vr, sh0, sh1)\n  if vr == \"s\" then\n    return format(\"s%d\", 2*band(rshift(op, sh0), 15)+band(rshift(op, sh1), 1))\n  else\n    return format(\"d%d\", band(rshift(op, sh0), 15)+band(rshift(op, sh1-4), 16))\n  end\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\n  local operands = {}\n  local suffix = \"\"\n  local last, name, pat\n  local vr\n  ctx.op = op\n  ctx.rel = nil\n\n  local cond = rshift(op, 28)\n  local opat\n  if cond == 15 then\n    opat = map_uncondins[band(rshift(op, 25), 7)]\n  else\n    if cond ~= 14 then suffix = map_cond[cond] end\n    opat = map_condins[band(rshift(op, 25), 7)]\n  end\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  name, pat = match(opat, \"^([a-z0-9]*)(.*)\")\n  if sub(pat, 1, 1) == \".\" then\n    local s2, p2 = match(pat, \"^([a-z0-9.]*)(.*)\")\n    suffix = suffix..s2\n    pat = p2\n  end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"D\" then\n      x = map_gpr[band(rshift(op, 12), 15)]\n    elseif p == \"N\" then\n      x = map_gpr[band(rshift(op, 16), 15)]\n    elseif p == \"S\" then\n      x = map_gpr[band(rshift(op, 8), 15)]\n    elseif p == \"M\" then\n      x = map_gpr[band(op, 15)]\n    elseif p == \"d\" then\n      x = fmtvr(op, vr, 12, 22)\n    elseif p == \"n\" then\n      x = fmtvr(op, vr, 16, 7)\n    elseif p == \"m\" then\n      x = fmtvr(op, vr, 0, 5)\n    elseif p == \"P\" then\n      if band(op, 0x02000000) ~= 0 then\n\tx = ror(band(op, 255), 2*band(rshift(op, 8), 15))\n      else\n\tx = map_gpr[band(op, 15)]\n\tif band(op, 0xff0) ~= 0 then\n\t  operands[#operands+1] = x\n\t  local s = map_shift[band(rshift(op, 5), 3)]\n\t  local r = nil\n\t  if band(op, 0xf90) == 0 then\n\t    if s == \"ror\" then s = \"rrx\" else r = \"#32\" end\n\t  elseif band(op, 0x10) == 0 then\n\t    r = \"#\"..band(rshift(op, 7), 31)\n\t  else\n\t    r = map_gpr[band(rshift(op, 8), 15)]\n\t  end\n\t  if name == \"mov\" then name = s; x = r\n\t  elseif r then x = format(\"%s %s\", s, r)\n\t  else x = s end\n\tend\n      end\n    elseif p == \"L\" then\n      x = fmtload(ctx, op, pos)\n    elseif p == \"l\" then\n      x = fmtvload(ctx, op, pos)\n    elseif p == \"B\" then\n      local addr = ctx.addr + pos + 8 + arshift(lshift(op, 8), 6)\n      if cond == 15 then addr = addr + band(rshift(op, 23), 2) end\n      ctx.rel = addr\n      x = \"0x\"..tohex(addr)\n    elseif p == \"F\" then\n      vr = \"s\"\n    elseif p == \"G\" then\n      vr = \"d\"\n    elseif p == \".\" then\n      suffix = suffix..(vr == \"s\" and \".f32\" or \".f64\")\n    elseif p == \"R\" then\n      if band(op, 0x00200000) ~= 0 and #operands == 1 then\n\toperands[1] = operands[1]..\"!\"\n      end\n      local t = {}\n      for i=0,15 do\n\tif band(rshift(op, i), 1) == 1 then t[#t+1] = map_gpr[i] end\n      end\n      x = \"{\"..concat(t, \", \")..\"}\"\n    elseif p == \"r\" then\n      if band(op, 0x00200000) ~= 0 and #operands == 2 then\n\toperands[1] = operands[1]..\"!\"\n      end\n      local s = tonumber(sub(last, 2))\n      local n = band(op, 255)\n      if vr == \"d\" then n = rshift(n, 1) end\n      operands[#operands] = format(\"{%s-%s%d}\", last, vr, s+n-1)\n    elseif p == \"W\" then\n      x = band(op, 0x0fff) + band(rshift(op, 4), 0xf000)\n    elseif p == \"T\" then\n      x = \"#0x\"..tohex(band(op, 0x00ffffff), 6)\n    elseif p == \"U\" then\n      x = band(rshift(op, 7), 31)\n      if x == 0 then x = nil end\n    elseif p == \"u\" then\n      x = band(rshift(op, 7), 31)\n      if band(op, 0x40) == 0 then\n\tif x == 0 then x = nil else x = \"lsl #\"..x end\n      else\n\tif x == 0 then x = \"asr #32\" else x = \"asr #\"..x end\n      end\n    elseif p == \"v\" then\n      x = band(rshift(op, 7), 31)\n    elseif p == \"w\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"x\" then\n      x = band(rshift(op, 16), 31) + 1\n    elseif p == \"X\" then\n      x = band(rshift(op, 16), 31) - last + 1\n    elseif p == \"Y\" then\n      x = band(rshift(op, 12), 0xf0) + band(op, 0x0f)\n    elseif p == \"K\" then\n      x = \"#0x\"..tohex(band(rshift(op, 4), 0x0000fff0) + band(op, 15), 4)\n    elseif p == \"s\" then\n      if band(op, 0x00100000) ~= 0 then suffix = \"s\"..suffix end\n    else\n      assert(false)\n    end\n    if x then\n      last = x\n      if type(x) == \"number\" then x = \"#\"..x end\n      operands[#operands+1] = x\n    end\n  end\n\n  return putop(ctx, name..suffix, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ctx.pos = ofs\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 16 then return map_gpr[r] end\n  return \"d\"..(r-16)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_arm.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 0ca08f899c4b9e9468fe93edcef60270\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_arm64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM64 disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n--\n-- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com.\n-- Sponsored by Cisco Systems, Inc.\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles most user-mode AArch64 instructions.\n-- NYI: Advanced SIMD and VFP instructions.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, bxor, tohex = bit.band, bit.bor, bit.bxor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\nlocal ror = bit.ror\n\n------------------------------------------------------------------------------\n-- Opcode maps\n------------------------------------------------------------------------------\n\nlocal map_adr = { -- PC-relative addressing.\n  shift = 31, mask = 1,\n  [0] = \"adrDBx\", \"adrpDBx\"\n}\n\nlocal map_addsubi = { -- Add/subtract immediate.\n  shift = 29, mask = 3,\n  [0] = \"add|movDNIg\", \"adds|cmnD0NIg\", \"subDNIg\", \"subs|cmpD0NIg\",\n}\n\nlocal map_logi = { -- Logical immediate.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"andDNig\", \"orr|movDN0ig\", \"eorDNig\", \"ands|tstD0Nig\"\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = \"andDNig\", \"orr|movDN0ig\", \"eorDNig\", \"ands|tstD0Nig\"\n  }\n}\n\nlocal map_movwi = { -- Move wide immediate.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"movnDWRg\", false, \"movz|movDYRg\", \"movkDWRg\"\n    }, false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = \"movnDWRg\", false, \"movz|movDYRg\", \"movkDWRg\"\n  },\n}\n\nlocal map_bitf = { -- Bitfield.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"sbfm|sbfiz|sbfx|asr|sxtw|sxth|sxtbDN12w\",\n      \"bfm|bfi|bfxilDN13w\",\n      \"ubfm|ubfiz|ubfx|lsr|lsl|uxth|uxtbDN12w\"\n    }\n  },\n  {\n    shift = 22, mask = 1,\n    {\n      shift = 29, mask = 3,\n      [0] = \"sbfm|sbfiz|sbfx|asr|sxtw|sxth|sxtbDN12x\",\n      \"bfm|bfi|bfxilDN13x\",\n      \"ubfm|ubfiz|ubfx|lsr|lsl|uxth|uxtbDN12x\"\n    }\n  }\n}\n\nlocal map_datai = { -- Data processing - immediate.\n  shift = 23, mask = 7,\n  [0] = map_adr, map_adr, map_addsubi, false,\n  map_logi, map_movwi, map_bitf,\n  {\n    shift = 15, mask = 0x1c0c1,\n    [0] = \"extr|rorDNM4w\", [0x10080] = \"extr|rorDNM4x\",\n    [0x10081] = \"extr|rorDNM4x\"\n  }\n}\n\nlocal map_logsr = { -- Logical, shifted register.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = {\n\tshift = 21, mask = 7,\n\t[0] = \"andDNMSg\", \"bicDNMSg\", \"andDNMSg\", \"bicDNMSg\",\n\t\"andDNMSg\", \"bicDNMSg\", \"andDNMg\", \"bicDNMg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] =\"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0MSg\", \"orn|mvnDN0MSg\",\n\t     \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0Mg\", \"orn|mvnDN0Mg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] = \"eorDNMSg\", \"eonDNMSg\", \"eorDNMSg\", \"eonDNMSg\",\n\t\"eorDNMSg\", \"eonDNMSg\", \"eorDNMg\", \"eonDNMg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] = \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMSg\", \"bicsDNMSg\",\n\t\"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMg\", \"bicsDNMg\"\n      }\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = {\n      shift = 21, mask = 7,\n      [0] = \"andDNMSg\", \"bicDNMSg\", \"andDNMSg\", \"bicDNMSg\",\n      \"andDNMSg\", \"bicDNMSg\", \"andDNMg\", \"bicDNMg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0MSg\", \"orn|mvnDN0MSg\",\n      \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0Mg\", \"orn|mvnDN0Mg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"eorDNMSg\", \"eonDNMSg\", \"eorDNMSg\", \"eonDNMSg\",\n      \"eorDNMSg\", \"eonDNMSg\", \"eorDNMg\", \"eonDNMg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMSg\", \"bicsDNMSg\",\n      \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMg\", \"bicsDNMg\"\n    }\n  }\n}\n\nlocal map_assh = {\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = {\n\tshift = 22, mask = 3,\n\t[0] = \"addDNMSg\", \"addDNMSg\", \"addDNMSg\", \"addDNMg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\",\n\t      \"adds|cmnD0NMSg\", \"adds|cmnD0NMg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0Mg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0MzSg\",\n\t      \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0Mzg\"\n      },\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"addDNMSg\", \"addDNMSg\", \"addDNMSg\", \"addDNMg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\",\n\t    \"adds|cmnD0NMg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0Mg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0MzSg\",\n\t    \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0Mzg\"\n    }\n  }\n}\n\nlocal map_addsubsh = { -- Add/subtract, shifted register.\n  shift = 22, mask = 3,\n  [0] = map_assh, map_assh, map_assh\n}\n\nlocal map_addsubex = { -- Add/subtract, extended register.\n  shift = 22, mask = 3,\n  [0] = {\n    shift = 29, mask = 3,\n    [0] = \"addDNMXg\", \"adds|cmnD0NMXg\", \"subDNMXg\", \"subs|cmpD0NMzXg\",\n  }\n}\n\nlocal map_addsubc = { -- Add/subtract, with carry.\n  shift = 10, mask = 63,\n  [0] = {\n    shift = 29, mask = 3,\n    [0] = \"adcDNMg\", \"adcsDNMg\", \"sbc|ngcDN0Mg\", \"sbcs|ngcsDN0Mg\",\n  }\n}\n\nlocal map_ccomp = {\n  shift = 4, mask = 1,\n  [0] = {\n    shift = 10, mask = 3,\n    [0] = { -- Conditional compare register.\n      shift = 29, mask = 3,\n      \"ccmnNMVCg\", false, \"ccmpNMVCg\",\n    },\n    [2] = {  -- Conditional compare immediate.\n      shift = 29, mask = 3,\n      \"ccmnN5VCg\", false, \"ccmpN5VCg\",\n    }\n  }\n}\n\nlocal map_csel = { -- Conditional select.\n  shift = 11, mask = 1,\n  [0] = {\n    shift = 10, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"cselDNMzCg\", false, \"csinv|cinv|csetmDNMcg\", false,\n    },\n    {\n      shift = 29, mask = 3,\n      [0] = \"csinc|cinc|csetDNMcg\", false, \"csneg|cnegDNMcg\", false,\n    }\n  }\n}\n\nlocal map_data1s = { -- Data processing, 1 source.\n  shift = 29, mask = 1,\n  [0] = {\n    shift = 31, mask = 1,\n    [0] = {\n      shift = 10, mask = 0x7ff,\n      [0] = \"rbitDNg\", \"rev16DNg\", \"revDNw\", false, \"clzDNg\", \"clsDNg\"\n    },\n    {\n      shift = 10, mask = 0x7ff,\n      [0] = \"rbitDNg\", \"rev16DNg\", \"rev32DNx\", \"revDNx\", \"clzDNg\", \"clsDNg\"\n    }\n  }\n}\n\nlocal map_data2s = { -- Data processing, 2 sources.\n  shift = 29, mask = 1,\n  [0] = {\n    shift = 10, mask = 63,\n    false, \"udivDNMg\", \"sdivDNMg\", false, false, false, false, \"lslDNMg\",\n    \"lsrDNMg\", \"asrDNMg\", \"rorDNMg\"\n  }\n}\n\nlocal map_data3s = { -- Data processing, 3 sources.\n  shift = 29, mask = 7,\n  [0] = {\n    shift = 21, mask = 7,\n    [0] = {\n      shift = 15, mask = 1,\n      [0] = \"madd|mulDNMA0g\", \"msub|mnegDNMA0g\"\n    }\n  }, false, false, false,\n  {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 21, mask = 7,\n      [0] = \"madd|mulDNMA0g\", \"smaddl|smullDxNMwA0x\", \"smulhDNMx\", false,\n      false, \"umaddl|umullDxNMwA0x\", \"umulhDNMx\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"msub|mnegDNMA0g\", \"smsubl|smneglDxNMwA0x\", false, false,\n      false, \"umsubl|umneglDxNMwA0x\"\n    }\n  }\n}\n\nlocal map_datar = { -- Data processing, register.\n  shift = 28, mask = 1,\n  [0] = {\n    shift = 24, mask = 1,\n    [0] = map_logsr,\n    {\n      shift = 21, mask = 1,\n      [0] = map_addsubsh, map_addsubex\n    }\n  },\n  {\n    shift = 21, mask = 15,\n    [0] = map_addsubc, false, map_ccomp, false, map_csel, false,\n    {\n      shift = 30, mask = 1,\n      [0] = map_data2s, map_data1s\n    },\n    false, map_data3s, map_data3s, map_data3s, map_data3s, map_data3s,\n    map_data3s, map_data3s, map_data3s\n  }\n}\n\nlocal map_lrl = { -- Load register, literal.\n  shift = 26, mask = 1,\n  [0] = {\n    shift = 30, mask = 3,\n    [0] = \"ldrDwB\", \"ldrDxB\", \"ldrswDxB\"\n  },\n  {\n    shift = 30, mask = 3,\n    [0] = \"ldrDsB\", \"ldrDdB\"\n  }\n}\n\nlocal map_lsriind = { -- Load/store register, immediate pre/post-indexed.\n  shift = 30, mask = 3,\n  [0] = {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strbDwzL\", \"ldrbDwzL\", \"ldrsbDxzL\", \"ldrsbDwzL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strhDwzL\", \"ldrhDwzL\", \"ldrshDxzL\", \"ldrshDwzL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strDwzL\", \"ldrDwzL\", \"ldrswDxzL\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"strDszL\", \"ldrDszL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strDxzL\", \"ldrDxzL\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"strDdzL\", \"ldrDdzL\"\n    }\n  }\n}\n\nlocal map_lsriro = {\n  shift = 21, mask = 1,\n  [0] = {  -- Load/store register immediate.\n    shift = 10, mask = 3,\n    [0] = { -- Unscaled immediate.\n      shift = 26, mask = 1,\n      [0] = {\n\tshift = 30, mask = 3,\n\t[0] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturbDwK\", \"ldurbDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturhDwK\", \"ldurhDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturDwK\", \"ldurDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturDxK\", \"ldurDxK\"\n\t}\n      }\n    }, map_lsriind, false, map_lsriind\n  },\n  {  -- Load/store register, register offset.\n    shift = 10, mask = 3,\n    [2] = {\n      shift = 26, mask = 1,\n      [0] = {\n\tshift = 30, mask = 3,\n\t[0] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strbDwO\", \"ldrbDwO\", \"ldrsbDxO\", \"ldrsbDwO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strhDwO\", \"ldrhDwO\", \"ldrshDxO\", \"ldrshDwO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDwO\", \"ldrDwO\", \"ldrswDxO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDxO\", \"ldrDxO\"\n\t}\n      },\n      {\n\tshift = 30, mask = 3,\n\t[2] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDsO\", \"ldrDsO\"\n\t},\n\t[3] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDdO\", \"ldrDdO\"\n\t}\n      }\n    }\n  }\n}\n\nlocal map_lsp = { -- Load/store register pair, offset.\n  shift = 22, mask = 1,\n  [0] = {\n    shift = 30, mask = 3,\n    [0] = {\n      shift = 26, mask = 1,\n      [0] = \"stpDzAzwP\", \"stpDzAzsP\",\n    },\n    {\n      shift = 26, mask = 1,\n      \"stpDzAzdP\"\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"stpDzAzxP\"\n    }\n  },\n  {\n    shift = 30, mask = 3,\n    [0] = {\n      shift = 26, mask = 1,\n      [0] = \"ldpDzAzwP\", \"ldpDzAzsP\",\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"ldpswDAxP\", \"ldpDzAzdP\"\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"ldpDzAzxP\"\n    }\n  }\n}\n\nlocal map_ls = { -- Loads and stores.\n  shift = 24, mask = 0x31,\n  [0x10] = map_lrl, [0x30] = map_lsriro,\n  [0x20] = {\n    shift = 23, mask = 3,\n    map_lsp, map_lsp, map_lsp\n  },\n  [0x21] = {\n    shift = 23, mask = 3,\n    map_lsp, map_lsp, map_lsp\n  },\n  [0x31] = {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 30, mask = 3,\n      [0] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strbDwzU\", \"ldrbDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strhDwzU\", \"ldrhDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strDwzU\", \"ldrDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strDxzU\", \"ldrDxzU\"\n      }\n    },\n    {\n      shift = 30, mask = 3,\n      [2] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strDszU\", \"ldrDszU\"\n      },\n      [3] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strDdzU\", \"ldrDdzU\"\n      }\n    }\n  },\n}\n\nlocal map_datafp = { -- Data processing, SIMD and FP.\n  shift = 28, mask = 7,\n  { -- 001\n    shift = 24, mask = 1,\n    [0] = {\n      shift = 21, mask = 1,\n      {\n\tshift = 10, mask = 3,\n\t[0] = {\n\t  shift = 12, mask = 1,\n\t  [0] = {\n\t    shift = 13, mask = 1,\n\t    [0] = {\n\t      shift = 14, mask = 1,\n\t      [0] = {\n\t\tshift = 15, mask = 1,\n\t\t[0] = { -- FP/int conversion.\n\t\t  shift = 31, mask = 1,\n\t\t  [0] = {\n\t\t    shift = 16, mask = 0xff,\n\t\t    [0x20] = \"fcvtnsDwNs\", [0x21] = \"fcvtnuDwNs\",\n\t\t    [0x22] = \"scvtfDsNw\", [0x23] = \"ucvtfDsNw\",\n\t\t    [0x24] = \"fcvtasDwNs\", [0x25] = \"fcvtauDwNs\",\n\t\t    [0x26] = \"fmovDwNs\", [0x27] = \"fmovDsNw\",\n\t\t    [0x28] = \"fcvtpsDwNs\", [0x29] = \"fcvtpuDwNs\",\n\t\t    [0x30] = \"fcvtmsDwNs\", [0x31] = \"fcvtmuDwNs\",\n\t\t    [0x38] = \"fcvtzsDwNs\", [0x39] = \"fcvtzuDwNs\",\n\t\t    [0x60] = \"fcvtnsDwNd\", [0x61] = \"fcvtnuDwNd\",\n\t\t    [0x62] = \"scvtfDdNw\", [0x63] = \"ucvtfDdNw\",\n\t\t    [0x64] = \"fcvtasDwNd\", [0x65] = \"fcvtauDwNd\",\n\t\t    [0x68] = \"fcvtpsDwNd\", [0x69] = \"fcvtpuDwNd\",\n\t\t    [0x70] = \"fcvtmsDwNd\", [0x71] = \"fcvtmuDwNd\",\n\t\t    [0x78] = \"fcvtzsDwNd\", [0x79] = \"fcvtzuDwNd\"\n\t\t  },\n\t\t  {\n\t\t    shift = 16, mask = 0xff,\n\t\t    [0x20] = \"fcvtnsDxNs\", [0x21] = \"fcvtnuDxNs\",\n\t\t    [0x22] = \"scvtfDsNx\", [0x23] = \"ucvtfDsNx\",\n\t\t    [0x24] = \"fcvtasDxNs\", [0x25] = \"fcvtauDxNs\",\n\t\t    [0x28] = \"fcvtpsDxNs\", [0x29] = \"fcvtpuDxNs\",\n\t\t    [0x30] = \"fcvtmsDxNs\", [0x31] = \"fcvtmuDxNs\",\n\t\t    [0x38] = \"fcvtzsDxNs\", [0x39] = \"fcvtzuDxNs\",\n\t\t    [0x60] = \"fcvtnsDxNd\", [0x61] = \"fcvtnuDxNd\",\n\t\t    [0x62] = \"scvtfDdNx\", [0x63] = \"ucvtfDdNx\",\n\t\t    [0x64] = \"fcvtasDxNd\", [0x65] = \"fcvtauDxNd\",\n\t\t    [0x66] = \"fmovDxNd\", [0x67] = \"fmovDdNx\",\n\t\t    [0x68] = \"fcvtpsDxNd\", [0x69] = \"fcvtpuDxNd\",\n\t\t    [0x70] = \"fcvtmsDxNd\", [0x71] = \"fcvtmuDxNd\",\n\t\t    [0x78] = \"fcvtzsDxNd\", [0x79] = \"fcvtzuDxNd\"\n\t\t  }\n\t\t}\n\t      },\n\t      { -- FP data-processing, 1 source.\n\t\tshift = 31, mask = 1,\n\t\t[0] = {\n\t\t  shift = 22, mask = 3,\n\t\t  [0] = {\n\t\t    shift = 15, mask = 63,\n\t\t    [0] = \"fmovDNf\", \"fabsDNf\", \"fnegDNf\",\n\t\t    \"fsqrtDNf\", false, \"fcvtDdNs\", false, false,\n\t\t    \"frintnDNf\", \"frintpDNf\", \"frintmDNf\", \"frintzDNf\",\n\t\t    \"frintaDNf\", false, \"frintxDNf\", \"frintiDNf\",\n\t\t  },\n\t\t  {\n\t\t    shift = 15, mask = 63,\n\t\t    [0] = \"fmovDNf\", \"fabsDNf\", \"fnegDNf\",\n\t\t    \"fsqrtDNf\", \"fcvtDsNd\", false, false, false,\n\t\t    \"frintnDNf\", \"frintpDNf\", \"frintmDNf\", \"frintzDNf\",\n\t\t    \"frintaDNf\", false, \"frintxDNf\", \"frintiDNf\",\n\t\t  }\n\t\t}\n\t      }\n\t    },\n\t    { -- FP compare.\n\t      shift = 31, mask = 1,\n\t      [0] = {\n\t\tshift = 14, mask = 3,\n\t\t[0] = {\n\t\t  shift = 23, mask = 1,\n\t\t  [0] = {\n\t\t    shift = 0, mask = 31,\n\t\t    [0] = \"fcmpNMf\", [8] = \"fcmpNZf\",\n\t\t    [16] = \"fcmpeNMf\", [24] = \"fcmpeNZf\",\n\t\t  }\n\t\t}\n\t      }\n\t    }\n\t  },\n\t  { -- FP immediate.\n\t    shift = 31, mask = 1,\n\t    [0] = {\n\t      shift = 5, mask = 31,\n\t      [0] = {\n\t\tshift = 23, mask = 1,\n\t\t[0] = \"fmovDFf\"\n\t      }\n\t    }\n\t  }\n\t},\n\t{ -- FP conditional compare.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = {\n\t      shift = 4, mask = 1,\n\t      [0] = \"fccmpNMVCf\", \"fccmpeNMVCf\"\n\t    }\n\t  }\n\t},\n\t{ -- FP data-processing, 2 sources.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = {\n\t      shift = 12, mask = 15,\n\t      [0] = \"fmulDNMf\", \"fdivDNMf\", \"faddDNMf\", \"fsubDNMf\",\n\t      \"fmaxDNMf\", \"fminDNMf\", \"fmaxnmDNMf\", \"fminnmDNMf\",\n\t      \"fnmulDNMf\"\n\t    }\n\t  }\n\t},\n\t{ -- FP conditional select.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = \"fcselDNMCf\"\n\t  }\n\t}\n      }\n    },\n    { -- FP data-processing, 3 sources.\n      shift = 31, mask = 1,\n      [0] = {\n\tshift = 15, mask = 1,\n\t[0] = {\n\t  shift = 21, mask = 5,\n\t  [0] = \"fmaddDNMAf\", \"fnmaddDNMAf\"\n\t},\n\t{\n\t  shift = 21, mask = 5,\n\t  [0] = \"fmsubDNMAf\", \"fnmsubDNMAf\"\n\t}\n      }\n    }\n  }\n}\n\nlocal map_br = { -- Branches, exception generating and system instructions.\n  shift = 29, mask = 7,\n  [0] = \"bB\",\n  { -- Compare & branch, immediate.\n    shift = 24, mask = 3,\n    [0] = \"cbzDBg\", \"cbnzDBg\", \"tbzDTBw\", \"tbnzDTBw\"\n  },\n  { -- Conditional branch, immediate.\n    shift = 24, mask = 3,\n    [0] = {\n      shift = 4, mask = 1,\n      [0] = {\n\tshift = 0, mask = 15,\n\t[0] = \"beqB\", \"bneB\", \"bhsB\", \"bloB\", \"bmiB\", \"bplB\", \"bvsB\", \"bvcB\",\n\t\"bhiB\", \"blsB\", \"bgeB\", \"bltB\", \"bgtB\", \"bleB\", \"balB\"\n      }\n    }\n  }, false, \"blB\",\n  { -- Compare & branch, immediate.\n    shift = 24, mask = 3,\n    [0] = \"cbzDBg\", \"cbnzDBg\", \"tbzDTBx\", \"tbnzDTBx\"\n  },\n  {\n    shift = 24, mask = 3,\n    [0] = { -- Exception generation.\n      shift = 0, mask = 0xe0001f,\n      [0x200000] = \"brkW\"\n    },\n    { -- System instructions.\n      shift = 0, mask = 0x3fffff,\n      [0x03201f] = \"nop\"\n    },\n    { -- Unconditional branch, register.\n      shift = 0, mask = 0xfffc1f,\n      [0x1f0000] = \"brNx\", [0x3f0000] = \"blrNx\",\n      [0x5f0000] = \"retNx\"\n    },\n  }\n}\n\nlocal map_init = {\n  shift = 25, mask = 15,\n  [0] = false, false, false, false, map_ls, map_datar, map_ls, map_datafp,\n  map_datai, map_datai, map_br, map_br, map_ls, map_datar, map_ls, map_datafp\n}\n\n------------------------------------------------------------------------------\n\nlocal map_regs = { x = {}, w = {}, d = {}, s = {} }\n\nfor i=0,30 do\n  map_regs.x[i] = \"x\"..i\n  map_regs.w[i] = \"w\"..i\n  map_regs.d[i] = \"d\"..i\n  map_regs.s[i] = \"s\"..i\nend\nmap_regs.x[31] = \"sp\"\nmap_regs.w[31] = \"wsp\"\nmap_regs.d[31] = \"d31\"\nmap_regs.s[31] = \"s31\"\n\nlocal map_cond = {\n  [0] = \"eq\", \"ne\", \"cs\", \"cc\", \"mi\", \"pl\", \"vs\", \"vc\",\n  \"hi\", \"ls\", \"ge\", \"lt\", \"gt\", \"le\", \"al\",\n}\n\nlocal map_shift = { [0] = \"lsl\", \"lsr\", \"asr\", }\n\nlocal map_extend = {\n  [0] = \"uxtb\", \"uxth\", \"uxtw\", \"uxtx\", \"sxtb\", \"sxth\", \"sxtw\", \"sxtx\",\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then\n      extra = \"\\t->\"..sym\n    end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-5s %s%s\\n\",\n      ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-5s %s%s\\n\",\n      ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\nlocal function match_reg(p, pat, regnum)\n  return map_regs[match(pat, p..\"%w-([xwds])\")][regnum]\nend\n\nlocal function fmt_hex32(x)\n  if x < 0 then\n    return tohex(x)\n  else\n    return format(\"%x\", x)\n  end\nend\n\nlocal imm13_rep = { 0x55555555, 0x11111111, 0x01010101, 0x00010001, 0x00000001 }\n\nlocal function decode_imm13(op)\n  local imms = band(rshift(op, 10), 63)\n  local immr = band(rshift(op, 16), 63)\n  if band(op, 0x00400000) == 0 then\n    local len = 5\n    if imms >= 56 then\n      if imms >= 60 then len = 1 else len = 2 end\n    elseif imms >= 48 then len = 3 elseif imms >= 32 then len = 4 end\n    local l = lshift(1, len)-1\n    local s = band(imms, l)\n    local r = band(immr, l)\n    local imm = ror(rshift(-1, 31-s), r)\n    if len ~= 5 then imm = band(imm, lshift(1, l)-1) + rshift(imm, 31-l) end\n    imm = imm * imm13_rep[len]\n    local ix = fmt_hex32(imm)\n    if rshift(op, 31) ~= 0 then\n      return ix..tohex(imm)\n    else\n      return ix\n    end\n  else\n    local lo, hi = -1, 0\n    if imms < 32 then lo = rshift(-1, 31-imms) else hi = rshift(-1, 63-imms) end\n    if immr ~= 0 then\n      lo, hi = ror(lo, immr), ror(hi, immr)\n      local x = immr == 32 and 0 or band(bxor(lo, hi), lshift(-1, 32-immr))\n      lo, hi = bxor(lo, x), bxor(hi, x)\n      if immr >= 32 then lo, hi = hi, lo end\n    end\n    if hi ~= 0 then\n      return fmt_hex32(hi)..tohex(lo)\n    else\n      return fmt_hex32(lo)\n    end\n  end\nend\n\nlocal function parse_immpc(op, name)\n  if name == \"b\" or name == \"bl\" then\n    return arshift(lshift(op, 6), 4)\n  elseif name == \"adr\" or name == \"adrp\" then\n    local immlo = band(rshift(op, 29), 3)\n    local immhi = lshift(arshift(lshift(op, 8), 13), 2)\n    return bor(immhi, immlo)\n  elseif name == \"tbz\" or name == \"tbnz\" then\n    return lshift(arshift(lshift(op, 13), 18), 2)\n  else\n    return lshift(arshift(lshift(op, 8), 13), 2)\n  end\nend\n\nlocal function parse_fpimm8(op)\n  local sign = band(op, 0x100000) == 0 and 1 or -1\n  local exp = bxor(rshift(arshift(lshift(op, 12), 5), 24), 0x80) - 131\n  local frac = 16+band(rshift(op, 13), 15)\n  return sign * frac * 2^exp\nend\n\nlocal function prefer_bfx(sf, uns, imms, immr)\n  if imms < immr or imms == 31 or imms == 63 then\n    return false\n  end\n  if immr == 0 then\n    if sf == 0 and (imms == 7 or imms == 15) then\n      return false\n    end\n    if sf ~= 0 and uns == 0 and (imms == 7 or imms == 15 or imms == 31) then\n      return false\n    end\n  end\n  return true\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\n  local operands = {}\n  local suffix = \"\"\n  local last, name, pat\n  local map_reg\n  ctx.op = op\n  ctx.rel = nil\n  last = nil\n  local opat\n  opat = map_init[band(rshift(op, 25), 15)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  name, pat = match(opat, \"^([a-z0-9]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.|]*)(.*)\")\n  if altname then pat = pat2 end\n  if sub(pat, 1, 1) == \".\" then\n    local s2, p2 = match(pat, \"^([a-z0-9.]*)(.*)\")\n    suffix = suffix..s2\n    pat = p2\n  end\n\n  local rt = match(pat, \"[gf]\")\n  if rt then\n    if rt == \"g\" then\n      map_reg = band(op, 0x80000000) ~= 0 and map_regs.x or map_regs.w\n    else\n      map_reg = band(op, 0x400000) ~= 0 and map_regs.d or map_regs.s\n    end\n  end\n\n  local second0, immr\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"D\" then\n      local regnum = band(op, 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"N\" then\n      local regnum = band(rshift(op, 5), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"M\" then\n      local regnum = band(rshift(op, 16), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"A\" then\n      local regnum = band(rshift(op, 10), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"B\" then\n      local addr = ctx.addr + pos + parse_immpc(op, name)\n      ctx.rel = addr\n      x = \"0x\"..tohex(addr)\n    elseif p == \"T\" then\n      x = bor(band(rshift(op, 26), 32), band(rshift(op, 19), 31))\n    elseif p == \"V\" then\n      x = band(op, 15)\n    elseif p == \"C\" then\n      x = map_cond[band(rshift(op, 12), 15)]\n    elseif p == \"c\" then\n      local rn = band(rshift(op, 5), 31)\n      local rm = band(rshift(op, 16), 31)\n      local cond = band(rshift(op, 12), 15)\n      local invc = bxor(cond, 1)\n      x = map_cond[cond]\n      if altname and cond ~= 14 and cond ~= 15 then\n\tlocal a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\tif rn == rm then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  x = map_cond[invc]\n\t  if rn ~= 31 then\n\t    if a1 then name = a1 else name = altname end\n\t  else\n\t    operands[n-1] = nil\n\t    name = a2\n\t  end\n\tend\n      end\n    elseif p == \"W\" then\n      x = band(rshift(op, 5), 0xffff)\n    elseif p == \"Y\" then\n      x = band(rshift(op, 5), 0xffff)\n      local hw = band(rshift(op, 21), 3)\n      if altname and (hw == 0 or x ~= 0) then\n\tname = altname\n      end\n    elseif p == \"L\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local imm9 = arshift(lshift(op, 11), 23)\n      if band(op, 0x800) ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm9..\"]!\"\n      else\n\tx = \"[\"..rn..\"], #\"..imm9\n      end\n    elseif p == \"U\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local sz = band(rshift(op, 30), 3)\n      local imm12 = lshift(arshift(lshift(op, 10), 20), sz)\n      if imm12 ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm12..\"]\"\n      else\n\tx = \"[\"..rn..\"]\"\n      end\n    elseif p == \"K\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local imm9 = arshift(lshift(op, 11), 23)\n      if imm9 ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm9..\"]\"\n      else\n\tx = \"[\"..rn..\"]\"\n      end\n    elseif p == \"O\" then\n      local rn, rm = map_regs.x[band(rshift(op, 5), 31)]\n      local m = band(rshift(op, 13), 1)\n      if m == 0 then\n\trm = map_regs.w[band(rshift(op, 16), 31)]\n      else\n\trm = map_regs.x[band(rshift(op, 16), 31)]\n      end\n      x = \"[\"..rn..\", \"..rm\n      local opt = band(rshift(op, 13), 7)\n      local s = band(rshift(op, 12), 1)\n      local sz = band(rshift(op, 30), 3)\n      -- extension to be applied\n      if opt == 3 then\n       if s == 0 then x = x..\"]\"\n       else x = x..\", lsl #\"..sz..\"]\" end\n      elseif opt == 2 or opt == 6 or opt == 7 then\n\tif s == 0 then x = x..\", \"..map_extend[opt]..\"]\"\n\telse x = x..\", \"..map_extend[opt]..\" #\"..sz..\"]\" end\n      else\n\tx = x..\"]\"\n      end\n    elseif p == \"P\" then\n      local opcv, sh = rshift(op, 26), 2\n      if opcv >= 0x2a then sh = 4 elseif opcv >= 0x1b then sh = 3 end\n      local imm7 = lshift(arshift(lshift(op, 10), 25), sh)\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local ind = band(rshift(op, 23), 3)\n      if ind == 1 then\n\tx = \"[\"..rn..\"], #\"..imm7\n      elseif ind == 2 then\n\tif imm7 == 0 then\n\t  x = \"[\"..rn..\"]\"\n\telse\n\t  x = \"[\"..rn..\", #\"..imm7..\"]\"\n\tend\n      elseif ind == 3 then\n\tx = \"[\"..rn..\", #\"..imm7..\"]!\"\n      end\n    elseif p == \"I\" then\n      local shf = band(rshift(op, 22), 3)\n      local imm12 = band(rshift(op, 10), 0x0fff)\n      local rn, rd = band(rshift(op, 5), 31), band(op, 31)\n      if altname == \"mov\" and shf == 0 and imm12 == 0 and (rn == 31 or rd == 31) then\n\tname = altname\n\tx = nil\n      elseif shf == 0 then\n\tx = imm12\n      elseif shf == 1 then\n\tx = imm12..\", lsl #12\"\n      end\n    elseif p == \"i\" then\n      x = \"#0x\"..decode_imm13(op)\n    elseif p == \"1\" then\n      immr = band(rshift(op, 16), 63)\n      x = immr\n    elseif p == \"2\" then\n      x = band(rshift(op, 10), 63)\n      if altname then\n\tlocal a1, a2, a3, a4, a5, a6 =\n\t  match(altname, \"([^|]*)|([^|]*)|([^|]*)|([^|]*)|([^|]*)|(.*)\")\n\tlocal sf = band(rshift(op, 26), 32)\n\tlocal uns = band(rshift(op, 30), 1)\n\tif prefer_bfx(sf, uns, x, immr) then\n\t  name = a2\n\t  x = x - immr + 1\n\telseif immr == 0 and x == 7 then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  if sf ~= 0 then\n\t    operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t  end\n\t  last = operands[n-1]\n\t  name = a6\n\t  x = nil\n\telseif immr == 0 and x == 15 then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  if sf ~= 0 then\n\t    operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t  end\n\t  last = operands[n-1]\n\t  name = a5\n\t  x = nil\n\telseif x == 31 or x == 63 then\n\t  if x == 31 and immr == 0 and name == \"sbfm\" then\n\t    name = a4\n\t    local n = #operands\n\t    operands[n] = nil\n\t    if sf ~= 0 then\n\t      operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t    end\n\t    last = operands[n-1]\n\t  else\n\t    name = a3\n\t  end\n\t  x = nil\n\telseif band(x, 31) ~= 31 and immr == x+1 and name == \"ubfm\" then\n\t  name = a4\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = nil\n\telseif x < immr then\n\t  name = a1\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = x + 1\n\tend\n      end\n    elseif p == \"3\" then\n      x = band(rshift(op, 10), 63)\n      if altname then\n\tlocal a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\tif x < immr then\n\t  name = a1\n\t  local sf = band(rshift(op, 26), 32)\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = x + 1\n\telseif x >= immr then\n\t  name = a2\n\t  x = x - immr + 1\n\tend\n      end\n    elseif p == \"4\" then\n      x = band(rshift(op, 10), 63)\n      local rn = band(rshift(op, 5), 31)\n      local rm = band(rshift(op, 16), 31)\n      if altname and rn == rm then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tname = altname\n      end\n    elseif p == \"5\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"S\" then\n      x = band(rshift(op, 10), 63)\n      if x == 0 then x = nil\n      else x = map_shift[band(rshift(op, 22), 3)]..\" #\"..x end\n    elseif p == \"X\" then\n      local opt = band(rshift(op, 13), 7)\n      -- Width specifier <R>.\n      if opt ~= 3 and opt ~= 7 then\n\tlast = map_regs.w[band(rshift(op, 16), 31)]\n\toperands[#operands] = last\n      end\n      x = band(rshift(op, 10), 7)\n      -- Extension.\n      if opt == 2 + band(rshift(op, 31), 1) and\n\t band(rshift(op, second0 and 5 or 0), 31) == 31 then\n\tif x == 0 then x = nil\n\telse x = \"lsl #\"..x end\n      else\n\tif x == 0 then x = map_extend[band(rshift(op, 13), 7)]\n\telse x = map_extend[band(rshift(op, 13), 7)]..\" #\"..x end\n      end\n    elseif p == \"R\" then\n      x = band(rshift(op,21), 3)\n      if x == 0 then x = nil\n      else x = \"lsl #\"..x*16 end\n    elseif p == \"z\" then\n      local n = #operands\n      if operands[n] == \"sp\" then operands[n] = \"xzr\"\n      elseif operands[n] == \"wsp\" then operands[n] = \"wzr\"\n      end\n    elseif p == \"Z\" then\n      x = 0\n    elseif p == \"F\" then\n      x = parse_fpimm8(op)\n    elseif p == \"g\" or p == \"f\" or p == \"x\" or p == \"w\" or\n\t   p == \"d\" or p == \"s\" then\n      -- These are handled in D/N/M/A.\n    elseif p == \"0\" then\n      if last == \"sp\" or last == \"wsp\" then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tif altname then\n\t  local a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\t  if not a1 then\n\t    name = altname\n\t  elseif second0 then\n\t    name, altname = a2, a1\n\t  else\n\t    name, altname = a1, a2\n\t  end\n\tend\n      end\n      second0 = true\n    else\n      assert(false)\n    end\n    if x then\n      last = x\n      if type(x) == \"number\" then x = \"#\"..x end\n      operands[#operands+1] = x\n    end\n  end\n\n  return putop(ctx, name..suffix, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ctx.pos = ofs\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_regs.x[r] end\n  return map_regs.d[r-32]\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_arm64.lua.meta",
    "content": "fileFormatVersion: 2\nguid: b4d4c9abbcac24849b38a339a3bf4529\ntimeCreated: 1494052836\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_arm64be.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM64BE disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- ARM64 instructions are always little-endian. So just forward to the\n-- common ARM64 disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nreturn require((string.match(..., \".*%.\") or \"\")..\"dis_arm64\")\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_arm64be.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 9743f232842733e4c9e3b478b8adbffd\ntimeCreated: 1494052836\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_mips.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT/X license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles all standard MIPS32R1/R2 instructions.\n-- Default mode is big-endian, but see: dis_mipsel.lua\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal byte, format = string.byte, string.format\nlocal match, gmatch = string.match, string.gmatch\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, tohex = bit.band, bit.bor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Primary and extended opcode maps\n------------------------------------------------------------------------------\n\nlocal map_movci = { shift = 16, mask = 1, [0] = \"movfDSC\", \"movtDSC\", }\nlocal map_srl = { shift = 21, mask = 1, [0] = \"srlDTA\", \"rotrDTA\", }\nlocal map_srlv = { shift = 6, mask = 1, [0] = \"srlvDTS\", \"rotrvDTS\", }\n\nlocal map_special = {\n  shift = 0, mask = 63,\n  [0] = { shift = 0, mask = -1, [0] = \"nop\", _ = \"sllDTA\" },\n  map_movci,\tmap_srl,\t\"sraDTA\",\n  \"sllvDTS\",\tfalse,\t\tmap_srlv,\t\"sravDTS\",\n  \"jrS\",\t\"jalrD1S\",\t\"movzDST\",\t\"movnDST\",\n  \"syscallY\",\t\"breakY\",\tfalse,\t\t\"sync\",\n  \"mfhiD\",\t\"mthiS\",\t\"mfloD\",\t\"mtloS\",\n  \"dsllvDST\",\tfalse,\t\t\"dsrlvDST\",\t\"dsravDST\",\n  \"multST\",\t\"multuST\",\t\"divST\",\t\"divuST\",\n  \"dmultST\",\t\"dmultuST\",\t\"ddivST\",\t\"ddivuST\",\n  \"addDST\",\t\"addu|moveDST0\", \"subDST\",\t\"subu|neguDS0T\",\n  \"andDST\",\t\"or|moveDST0\",\t\"xorDST\",\t\"nor|notDST0\",\n  false,\tfalse,\t\t\"sltDST\",\t\"sltuDST\",\n  \"daddDST\",\t\"dadduDST\",\t\"dsubDST\",\t\"dsubuDST\",\n  \"tgeSTZ\",\t\"tgeuSTZ\",\t\"tltSTZ\",\t\"tltuSTZ\",\n  \"teqSTZ\",\tfalse,\t\t\"tneSTZ\",\tfalse,\n  \"dsllDTA\",\tfalse,\t\t\"dsrlDTA\",\t\"dsraDTA\",\n  \"dsll32DTA\",\tfalse,\t\t\"dsrl32DTA\",\t\"dsra32DTA\",\n}\n\nlocal map_special2 = {\n  shift = 0, mask = 63,\n  [0] = \"maddST\", \"madduST\",\t\"mulDST\",\tfalse,\n  \"msubST\",\t\"msubuST\",\n  [32] = \"clzDS\", [33] = \"cloDS\",\n  [63] = \"sdbbpY\",\n}\n\nlocal map_bshfl = {\n  shift = 6, mask = 31,\n  [2] = \"wsbhDT\",\n  [16] = \"sebDT\",\n  [24] = \"sehDT\",\n}\n\nlocal map_dbshfl = {\n  shift = 6, mask = 31,\n  [2] = \"dsbhDT\",\n  [5] = \"dshdDT\",\n}\n\nlocal map_special3 = {\n  shift = 0, mask = 63,\n  [0]  = \"extTSAK\", [1]  = \"dextmTSAP\", [3]  = \"dextTSAK\",\n  [4]  = \"insTSAL\", [6]  = \"dinsuTSEQ\", [7]  = \"dinsTSAL\",\n  [32] = map_bshfl, [36] = map_dbshfl,  [59] = \"rdhwrTD\",\n}\n\nlocal map_regimm = {\n  shift = 16, mask = 31,\n  [0] = \"bltzSB\",\t\"bgezSB\",\t\"bltzlSB\",\t\"bgezlSB\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"tgeiSI\",\t\"tgeiuSI\",\t\"tltiSI\",\t\"tltiuSI\",\n  \"teqiSI\",\tfalse,\t\t\"tneiSI\",\tfalse,\n  \"bltzalSB\",\t\"bgezalSB\",\t\"bltzallSB\",\t\"bgezallSB\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\t\"synciSO\",\n}\n\nlocal map_cop0 = {\n  shift = 25, mask = 1,\n  [0] = {\n    shift = 21, mask = 15,\n    [0] = \"mfc0TDW\", [4] = \"mtc0TDW\",\n    [10] = \"rdpgprDT\",\n    [11] = { shift = 5, mask = 1, [0] = \"diT0\", \"eiT0\", },\n    [14] = \"wrpgprDT\",\n  }, {\n    shift = 0, mask = 63,\n    [1] = \"tlbr\", [2] = \"tlbwi\", [6] = \"tlbwr\", [8] = \"tlbp\",\n    [24] = \"eret\", [31] = \"deret\",\n    [32] = \"wait\",\n  },\n}\n\nlocal map_cop1s = {\n  shift = 0, mask = 63,\n  [0] = \"add.sFGH\",\t\"sub.sFGH\",\t\"mul.sFGH\",\t\"div.sFGH\",\n  \"sqrt.sFG\",\t\t\"abs.sFG\",\t\"mov.sFG\",\t\"neg.sFG\",\n  \"round.l.sFG\",\t\"trunc.l.sFG\",\t\"ceil.l.sFG\",\t\"floor.l.sFG\",\n  \"round.w.sFG\",\t\"trunc.w.sFG\",\t\"ceil.w.sFG\",\t\"floor.w.sFG\",\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.sFGC\", \"movt.sFGC\" },\n  \"movz.sFGT\",\t\"movn.sFGT\",\n  false,\t\"recip.sFG\",\t\"rsqrt.sFG\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\t\"cvt.d.sFG\",\tfalse,\t\tfalse,\n  \"cvt.w.sFG\",\t\"cvt.l.sFG\",\t\"cvt.ps.sFGH\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"c.f.sVGH\",\t\"c.un.sVGH\",\t\"c.eq.sVGH\",\t\"c.ueq.sVGH\",\n  \"c.olt.sVGH\",\t\"c.ult.sVGH\",\t\"c.ole.sVGH\",\t\"c.ule.sVGH\",\n  \"c.sf.sVGH\",\t\"c.ngle.sVGH\",\t\"c.seq.sVGH\",\t\"c.ngl.sVGH\",\n  \"c.lt.sVGH\",\t\"c.nge.sVGH\",\t\"c.le.sVGH\",\t\"c.ngt.sVGH\",\n}\n\nlocal map_cop1d = {\n  shift = 0, mask = 63,\n  [0] = \"add.dFGH\",\t\"sub.dFGH\",\t\"mul.dFGH\",\t\"div.dFGH\",\n  \"sqrt.dFG\",\t\t\"abs.dFG\",\t\"mov.dFG\",\t\"neg.dFG\",\n  \"round.l.dFG\",\t\"trunc.l.dFG\",\t\"ceil.l.dFG\",\t\"floor.l.dFG\",\n  \"round.w.dFG\",\t\"trunc.w.dFG\",\t\"ceil.w.dFG\",\t\"floor.w.dFG\",\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.dFGC\", \"movt.dFGC\" },\n  \"movz.dFGT\",\t\"movn.dFGT\",\n  false,\t\"recip.dFG\",\t\"rsqrt.dFG\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.dFG\",\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.w.dFG\",\t\"cvt.l.dFG\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"c.f.dVGH\",\t\"c.un.dVGH\",\t\"c.eq.dVGH\",\t\"c.ueq.dVGH\",\n  \"c.olt.dVGH\",\t\"c.ult.dVGH\",\t\"c.ole.dVGH\",\t\"c.ule.dVGH\",\n  \"c.df.dVGH\",\t\"c.ngle.dVGH\",\t\"c.deq.dVGH\",\t\"c.ngl.dVGH\",\n  \"c.lt.dVGH\",\t\"c.nge.dVGH\",\t\"c.le.dVGH\",\t\"c.ngt.dVGH\",\n}\n\nlocal map_cop1ps = {\n  shift = 0, mask = 63,\n  [0] = \"add.psFGH\",\t\"sub.psFGH\",\t\"mul.psFGH\",\tfalse,\n  false,\t\t\"abs.psFG\",\t\"mov.psFG\",\t\"neg.psFG\",\n  false,\t\tfalse,\t\tfalse,\t\tfalse,\n  false,\t\tfalse,\t\tfalse,\t\tfalse,\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.psFGC\", \"movt.psFGC\" },\n  \"movz.psFGT\",\t\"movn.psFGT\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.puFG\",\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.plFG\",\tfalse,\t\tfalse,\t\tfalse,\n  \"pll.psFGH\",\t\"plu.psFGH\",\t\"pul.psFGH\",\t\"puu.psFGH\",\n  \"c.f.psVGH\",\t\"c.un.psVGH\",\t\"c.eq.psVGH\",\t\"c.ueq.psVGH\",\n  \"c.olt.psVGH\", \"c.ult.psVGH\",\t\"c.ole.psVGH\",\t\"c.ule.psVGH\",\n  \"c.psf.psVGH\", \"c.ngle.psVGH\", \"c.pseq.psVGH\", \"c.ngl.psVGH\",\n  \"c.lt.psVGH\",\t\"c.nge.psVGH\",\t\"c.le.psVGH\",\t\"c.ngt.psVGH\",\n}\n\nlocal map_cop1w = {\n  shift = 0, mask = 63,\n  [32] = \"cvt.s.wFG\", [33] = \"cvt.d.wFG\",\n}\n\nlocal map_cop1l = {\n  shift = 0, mask = 63,\n  [32] = \"cvt.s.lFG\", [33] = \"cvt.d.lFG\",\n}\n\nlocal map_cop1bc = {\n  shift = 16, mask = 3,\n  [0] = \"bc1fCB\", \"bc1tCB\",\t\"bc1flCB\",\t\"bc1tlCB\",\n}\n\nlocal map_cop1 = {\n  shift = 21, mask = 31,\n  [0] = \"mfc1TG\", \"dmfc1TG\",\t\"cfc1TG\",\t\"mfhc1TG\",\n  \"mtc1TG\",\t\"dmtc1TG\",\t\"ctc1TG\",\t\"mthc1TG\",\n  map_cop1bc,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  map_cop1s,\tmap_cop1d,\tfalse,\t\tfalse,\n  map_cop1w,\tmap_cop1l,\tmap_cop1ps,\n}\n\nlocal map_cop1x = {\n  shift = 0, mask = 63,\n  [0] = \"lwxc1FSX\",\t\"ldxc1FSX\",\tfalse,\t\tfalse,\n  false,\t\"luxc1FSX\",\tfalse,\t\tfalse,\n  \"swxc1FSX\",\t\"sdxc1FSX\",\tfalse,\t\tfalse,\n  false,\t\"suxc1FSX\",\tfalse,\t\t\"prefxMSX\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"alnv.psFGHS\",\tfalse,\n  \"madd.sFRGH\",\t\"madd.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"madd.psFRGH\",\tfalse,\n  \"msub.sFRGH\",\t\"msub.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"msub.psFRGH\",\tfalse,\n  \"nmadd.sFRGH\", \"nmadd.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"nmadd.psFRGH\",\tfalse,\n  \"nmsub.sFRGH\", \"nmsub.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"nmsub.psFRGH\",\tfalse,\n}\n\nlocal map_pri = {\n  [0] = map_special,\tmap_regimm,\t\"jJ\",\t\"jalJ\",\n  \"beq|beqz|bST00B\",\t\"bne|bnezST0B\",\t\t\"blezSB\",\t\"bgtzSB\",\n  \"addiTSI\",\t\"addiu|liTS0I\",\t\"sltiTSI\",\t\"sltiuTSI\",\n  \"andiTSU\",\t\"ori|liTS0U\",\t\"xoriTSU\",\t\"luiTU\",\n  map_cop0,\tmap_cop1,\tfalse,\t\tmap_cop1x,\n  \"beql|beqzlST0B\",\t\"bnel|bnezlST0B\",\t\"blezlSB\",\t\"bgtzlSB\",\n  \"daddiTSI\",\t\"daddiuTSI\",\tfalse,\t\tfalse,\n  map_special2,\t\"jalxJ\",\tfalse,\t\tmap_special3,\n  \"lbTSO\",\t\"lhTSO\",\t\"lwlTSO\",\t\"lwTSO\",\n  \"lbuTSO\",\t\"lhuTSO\",\t\"lwrTSO\",\tfalse,\n  \"sbTSO\",\t\"shTSO\",\t\"swlTSO\",\t\"swTSO\",\n  false,\tfalse,\t\t\"swrTSO\",\t\"cacheNSO\",\n  \"llTSO\",\t\"lwc1HSO\",\t\"lwc2TSO\",\t\"prefNSO\",\n  false,\t\"ldc1HSO\",\t\"ldc2TSO\",\t\"ldTSO\",\n  \"scTSO\",\t\"swc1HSO\",\t\"swc2TSO\",\tfalse,\n  false,\t\"sdc1HSO\",\t\"sdc2TSO\",\t\"sdTSO\",\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"r1\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\",\n  \"r16\", \"r17\", \"r18\", \"r19\", \"r20\", \"r21\", \"r22\", \"r23\",\n  \"r24\", \"r25\", \"r26\", \"r27\", \"r28\", \"sp\", \"r30\", \"ra\",\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then extra = \"\\t->\"..sym end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-7s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-7s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\nlocal function get_be(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  return bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3)\nend\n\nlocal function get_le(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  return bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local op = ctx:get()\n  local operands = {}\n  local last = nil\n  ctx.op = op\n  ctx.rel = nil\n\n  local opat = map_pri[rshift(op, 26)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  local name, pat = match(opat, \"^([a-z0-9_.]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.|]*)(.*)\")\n  if altname then pat = pat2 end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"S\" then\n      x = map_gpr[band(rshift(op, 21), 31)]\n    elseif p == \"T\" then\n      x = map_gpr[band(rshift(op, 16), 31)]\n    elseif p == \"D\" then\n      x = map_gpr[band(rshift(op, 11), 31)]\n    elseif p == \"F\" then\n      x = \"f\"..band(rshift(op, 6), 31)\n    elseif p == \"G\" then\n      x = \"f\"..band(rshift(op, 11), 31)\n    elseif p == \"H\" then\n      x = \"f\"..band(rshift(op, 16), 31)\n    elseif p == \"R\" then\n      x = \"f\"..band(rshift(op, 21), 31)\n    elseif p == \"A\" then\n      x = band(rshift(op, 6), 31)\n    elseif p == \"E\" then\n      x = band(rshift(op, 6), 31) + 32\n    elseif p == \"M\" then\n      x = band(rshift(op, 11), 31)\n    elseif p == \"N\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"C\" then\n      x = band(rshift(op, 18), 7)\n      if x == 0 then x = nil end\n    elseif p == \"K\" then\n      x = band(rshift(op, 11), 31) + 1\n    elseif p == \"P\" then\n      x = band(rshift(op, 11), 31) + 33\n    elseif p == \"L\" then\n      x = band(rshift(op, 11), 31) - last + 1\n    elseif p == \"Q\" then\n      x = band(rshift(op, 11), 31) - last + 33\n    elseif p == \"I\" then\n      x = arshift(lshift(op, 16), 16)\n    elseif p == \"U\" then\n      x = band(op, 0xffff)\n    elseif p == \"O\" then\n      local disp = arshift(lshift(op, 16), 16)\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p == \"X\" then\n      local index = map_gpr[band(rshift(op, 16), 31)]\n      operands[#operands] = format(\"%s(%s)\", index, last)\n    elseif p == \"B\" then\n      x = ctx.addr + ctx.pos + arshift(lshift(op, 16), 16)*4 + 4\n      ctx.rel = x\n      x = format(\"0x%08x\", x)\n    elseif p == \"J\" then\n      local a = ctx.addr + ctx.pos\n      x = a - band(a, 0x0fffffff) + band(op, 0x03ffffff)*4\n      ctx.rel = x\n      x = format(\"0x%08x\", x)\n    elseif p == \"V\" then\n      x = band(rshift(op, 8), 7)\n      if x == 0 then x = nil end\n    elseif p == \"W\" then\n      x = band(op, 7)\n      if x == 0 then x = nil end\n    elseif p == \"Y\" then\n      x = band(rshift(op, 6), 0x000fffff)\n      if x == 0 then x = nil end\n    elseif p == \"Z\" then\n      x = band(rshift(op, 6), 1023)\n      if x == 0 then x = nil end\n    elseif p == \"0\" then\n      if last == \"r0\" or last == 0 then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tif altname then\n\t  local a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\t  if a1 then name, altname = a1, a2\n\t  else name = altname end\n\tend\n      end\n    elseif p == \"1\" then\n      if last == \"ra\" then\n\toperands[#operands] = nil\n      end\n    else\n      assert(false)\n    end\n    if x then operands[#operands+1] = x; last = x end\n  end\n\n  return putop(ctx, name, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  stop = stop - stop % 4\n  ctx.pos = ofs - ofs % 4\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  ctx.get = get_be\n  return ctx\nend\n\nlocal function create_el(code, addr, out)\n  local ctx = create(code, addr, out)\n  ctx.get = get_le\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\nlocal function disass_el(code, addr, out)\n  create_el(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_gpr[r] end\n  return \"f\"..(r-32)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  create_el = create_el,\n  disass = disass,\n  disass_el = disass_el,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_mips.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 24d7d1c35dd3f7b4e8b37409571d4a8d\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_mips64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS64 disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the big-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create,\n  disass = dis_mips.disass,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_mips64.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 45cd531eacd4e694585cb017ffc7df14\ntimeCreated: 1494052836\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_mips64el.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS64EL disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the little-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create_el,\n  disass = dis_mips.disass_el,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_mips64el.lua.meta",
    "content": "fileFormatVersion: 2\nguid: c933838018073f44d8b9cb738c3ef6f8\ntimeCreated: 1494052836\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_mipsel.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPSEL disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the little-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create_el,\n  disass = dis_mips.disass_el,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_mipsel.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 7b8e829ec84bb8e4f8b56474c9812d02\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_ppc.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT PPC disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT/X license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles all common, non-privileged 32/64 bit PowerPC instructions\n-- plus the e500 SPE instructions and some Cell/Xenon extensions.\n--\n-- NYI: VMX, VMX128\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal byte, format = string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, tohex = bit.band, bit.bor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Primary and extended opcode maps\n------------------------------------------------------------------------------\n\nlocal map_crops = {\n  shift = 1, mask = 1023,\n  [0] = \"mcrfXX\",\n  [33] = \"crnor|crnotCCC=\", [129] = \"crandcCCC\",\n  [193] = \"crxor|crclrCCC%\", [225] = \"crnandCCC\",\n  [257] = \"crandCCC\", [289] = \"creqv|crsetCCC%\",\n  [417] = \"crorcCCC\", [449] = \"cror|crmoveCCC=\",\n  [16] = \"b_lrKB\", [528] = \"b_ctrKB\",\n  [150] = \"isync\",\n}\n\nlocal map_rlwinm = setmetatable({\n  shift = 0, mask = -1,\n},\n{ __index = function(t, x)\n    local rot = band(rshift(x, 11), 31)\n    local mb = band(rshift(x, 6), 31)\n    local me = band(rshift(x, 1), 31)\n    if mb == 0 and me == 31-rot then\n      return \"slwiRR~A.\"\n    elseif me == 31 and mb == 32-rot then\n      return \"srwiRR~-A.\"\n    else\n      return \"rlwinmRR~AAA.\"\n    end\n  end\n})\n\nlocal map_rld = {\n  shift = 2, mask = 7,\n  [0] = \"rldiclRR~HM.\", \"rldicrRR~HM.\", \"rldicRR~HM.\", \"rldimiRR~HM.\",\n  {\n    shift = 1, mask = 1,\n    [0] = \"rldclRR~RM.\", \"rldcrRR~RM.\",\n  },\n}\n\nlocal map_ext = setmetatable({\n  shift = 1, mask = 1023,\n\n  [0] = \"cmp_YLRR\", [32] = \"cmpl_YLRR\",\n  [4] = \"twARR\", [68] = \"tdARR\",\n\n  [8] = \"subfcRRR.\", [40] = \"subfRRR.\",\n  [104] = \"negRR.\", [136] = \"subfeRRR.\",\n  [200] = \"subfzeRR.\", [232] = \"subfmeRR.\",\n  [520] = \"subfcoRRR.\", [552] = \"subfoRRR.\",\n  [616] = \"negoRR.\", [648] = \"subfeoRRR.\",\n  [712] = \"subfzeoRR.\", [744] = \"subfmeoRR.\",\n\n  [9] = \"mulhduRRR.\", [73] = \"mulhdRRR.\", [233] = \"mulldRRR.\",\n  [457] = \"divduRRR.\", [489] = \"divdRRR.\",\n  [745] = \"mulldoRRR.\",\n  [969] = \"divduoRRR.\", [1001] = \"divdoRRR.\",\n\n  [10] = \"addcRRR.\", [138] = \"addeRRR.\",\n  [202] = \"addzeRR.\", [234] = \"addmeRR.\", [266] = \"addRRR.\",\n  [522] = \"addcoRRR.\", [650] = \"addeoRRR.\",\n  [714] = \"addzeoRR.\", [746] = \"addmeoRR.\", [778] = \"addoRRR.\",\n\n  [11] = \"mulhwuRRR.\", [75] = \"mulhwRRR.\", [235] = \"mullwRRR.\",\n  [459] = \"divwuRRR.\", [491] = \"divwRRR.\",\n  [747] = \"mullwoRRR.\",\n  [971] = \"divwouRRR.\", [1003] = \"divwoRRR.\",\n\n  [15] = \"iselltRRR\", [47] = \"iselgtRRR\", [79] = \"iseleqRRR\",\n\n  [144] = { shift = 20, mask = 1, [0] = \"mtcrfRZ~\", \"mtocrfRZ~\", },\n  [19] = { shift = 20, mask = 1, [0] = \"mfcrR\", \"mfocrfRZ\", },\n  [371] = { shift = 11, mask = 1023, [392] = \"mftbR\", [424] = \"mftbuR\", },\n  [339] = {\n    shift = 11, mask = 1023,\n    [32] = \"mferR\", [256] = \"mflrR\", [288] = \"mfctrR\", [16] = \"mfspefscrR\",\n  },\n  [467] = {\n    shift = 11, mask = 1023,\n    [32] = \"mtxerR\", [256] = \"mtlrR\", [288] = \"mtctrR\", [16] = \"mtspefscrR\",\n  },\n\n  [20] = \"lwarxRR0R\", [84] = \"ldarxRR0R\",\n\n  [21] = \"ldxRR0R\", [53] = \"lduxRRR\",\n  [149] = \"stdxRR0R\", [181] = \"stduxRRR\",\n  [341] = \"lwaxRR0R\", [373] = \"lwauxRRR\",\n\n  [23] = \"lwzxRR0R\", [55] = \"lwzuxRRR\",\n  [87] = \"lbzxRR0R\", [119] = \"lbzuxRRR\",\n  [151] = \"stwxRR0R\", [183] = \"stwuxRRR\",\n  [215] = \"stbxRR0R\", [247] = \"stbuxRRR\",\n  [279] = \"lhzxRR0R\", [311] = \"lhzuxRRR\",\n  [343] = \"lhaxRR0R\", [375] = \"lhauxRRR\",\n  [407] = \"sthxRR0R\", [439] = \"sthuxRRR\",\n\n  [54] = \"dcbst-R0R\", [86] = \"dcbf-R0R\",\n  [150] = \"stwcxRR0R.\", [214] = \"stdcxRR0R.\",\n  [246] = \"dcbtst-R0R\", [278] = \"dcbt-R0R\",\n  [310] = \"eciwxRR0R\", [438] = \"ecowxRR0R\",\n  [470] = \"dcbi-RR\",\n\n  [598] = {\n    shift = 21, mask = 3,\n    [0] = \"sync\", \"lwsync\", \"ptesync\",\n  },\n  [758] = \"dcba-RR\",\n  [854] = \"eieio\", [982] = \"icbi-R0R\", [1014] = \"dcbz-R0R\",\n\n  [26] = \"cntlzwRR~\", [58] = \"cntlzdRR~\",\n  [122] = \"popcntbRR~\",\n  [154] = \"prtywRR~\", [186] = \"prtydRR~\",\n\n  [28] = \"andRR~R.\", [60] = \"andcRR~R.\", [124] = \"nor|notRR~R=.\",\n  [284] = \"eqvRR~R.\", [316] = \"xorRR~R.\",\n  [412] = \"orcRR~R.\", [444] = \"or|mrRR~R=.\", [476] = \"nandRR~R.\",\n  [508] = \"cmpbRR~R\",\n\n  [512] = \"mcrxrX\",\n\n  [532] = \"ldbrxRR0R\", [660] = \"stdbrxRR0R\",\n\n  [533] = \"lswxRR0R\", [597] = \"lswiRR0A\",\n  [661] = \"stswxRR0R\", [725] = \"stswiRR0A\",\n\n  [534] = \"lwbrxRR0R\", [662] = \"stwbrxRR0R\",\n  [790] = \"lhbrxRR0R\", [918] = \"sthbrxRR0R\",\n\n  [535] = \"lfsxFR0R\", [567] = \"lfsuxFRR\",\n  [599] = \"lfdxFR0R\", [631] = \"lfduxFRR\",\n  [663] = \"stfsxFR0R\", [695] = \"stfsuxFRR\",\n  [727] = \"stfdxFR0R\", [759] = \"stfduxFR0R\",\n  [855] = \"lfiwaxFR0R\",\n  [983] = \"stfiwxFR0R\",\n\n  [24] = \"slwRR~R.\",\n\n  [27] = \"sldRR~R.\", [536] = \"srwRR~R.\",\n  [792] = \"srawRR~R.\", [824] = \"srawiRR~A.\",\n\n  [794] = \"sradRR~R.\", [826] = \"sradiRR~H.\", [827] = \"sradiRR~H.\",\n  [922] = \"extshRR~.\", [954] = \"extsbRR~.\", [986] = \"extswRR~.\",\n\n  [539] = \"srdRR~R.\",\n},\n{ __index = function(t, x)\n    if band(x, 31) == 15 then return \"iselRRRC\" end\n  end\n})\n\nlocal map_ld = {\n  shift = 0, mask = 3,\n  [0] = \"ldRRE\", \"lduRRE\", \"lwaRRE\",\n}\n\nlocal map_std = {\n  shift = 0, mask = 3,\n  [0] = \"stdRRE\", \"stduRRE\",\n}\n\nlocal map_fps = {\n  shift = 5, mask = 1,\n  {\n    shift = 1, mask = 15,\n    [0] = false, false, \"fdivsFFF.\", false,\n    \"fsubsFFF.\", \"faddsFFF.\", \"fsqrtsF-F.\", false,\n    \"fresF-F.\", \"fmulsFF-F.\", \"frsqrtesF-F.\", false,\n    \"fmsubsFFFF~.\", \"fmaddsFFFF~.\", \"fnmsubsFFFF~.\", \"fnmaddsFFFF~.\",\n  }\n}\n\nlocal map_fpd = {\n  shift = 5, mask = 1,\n  [0] = {\n    shift = 1, mask = 1023,\n    [0] = \"fcmpuXFF\", [32] = \"fcmpoXFF\", [64] = \"mcrfsXX\",\n    [38] = \"mtfsb1A.\", [70] = \"mtfsb0A.\", [134] = \"mtfsfiA>>-A>\",\n    [8] = \"fcpsgnFFF.\", [40] = \"fnegF-F.\", [72] = \"fmrF-F.\",\n    [136] = \"fnabsF-F.\", [264] = \"fabsF-F.\",\n    [12] = \"frspF-F.\",\n    [14] = \"fctiwF-F.\", [15] = \"fctiwzF-F.\",\n    [583] = \"mffsF.\", [711] = \"mtfsfZF.\",\n    [392] = \"frinF-F.\", [424] = \"frizF-F.\",\n    [456] = \"fripF-F.\", [488] = \"frimF-F.\",\n    [814] = \"fctidF-F.\", [815] = \"fctidzF-F.\", [846] = \"fcfidF-F.\",\n  },\n  {\n    shift = 1, mask = 15,\n    [0] = false, false, \"fdivFFF.\", false,\n    \"fsubFFF.\", \"faddFFF.\", \"fsqrtF-F.\", \"fselFFFF~.\",\n    \"freF-F.\", \"fmulFF-F.\", \"frsqrteF-F.\", false,\n    \"fmsubFFFF~.\", \"fmaddFFFF~.\", \"fnmsubFFFF~.\", \"fnmaddFFFF~.\",\n  }\n}\n\nlocal map_spe = {\n  shift = 0, mask = 2047,\n\n  [512] = \"evaddwRRR\", [514] = \"evaddiwRAR~\",\n  [516] = \"evsubwRRR~\", [518] = \"evsubiwRAR~\",\n  [520] = \"evabsRR\", [521] = \"evnegRR\",\n  [522] = \"evextsbRR\", [523] = \"evextshRR\", [524] = \"evrndwRR\",\n  [525] = \"evcntlzwRR\", [526] = \"evcntlswRR\",\n\n  [527] = \"brincRRR\",\n\n  [529] = \"evandRRR\", [530] = \"evandcRRR\", [534] = \"evxorRRR\",\n  [535] = \"evor|evmrRRR=\", [536] = \"evnor|evnotRRR=\",\n  [537] = \"eveqvRRR\", [539] = \"evorcRRR\", [542] = \"evnandRRR\",\n\n  [544] = \"evsrwuRRR\", [545] = \"evsrwsRRR\",\n  [546] = \"evsrwiuRRA\", [547] = \"evsrwisRRA\",\n  [548] = \"evslwRRR\", [550] = \"evslwiRRA\",\n  [552] = \"evrlwRRR\", [553] = \"evsplatiRS\",\n  [554] = \"evrlwiRRA\", [555] = \"evsplatfiRS\",\n  [556] = \"evmergehiRRR\", [557] = \"evmergeloRRR\",\n  [558] = \"evmergehiloRRR\", [559] = \"evmergelohiRRR\",\n\n  [560] = \"evcmpgtuYRR\", [561] = \"evcmpgtsYRR\",\n  [562] = \"evcmpltuYRR\", [563] = \"evcmpltsYRR\",\n  [564] = \"evcmpeqYRR\",\n\n  [632] = \"evselRRR\", [633] = \"evselRRRW\",\n  [634] = \"evselRRRW\", [635] = \"evselRRRW\",\n  [636] = \"evselRRRW\", [637] = \"evselRRRW\",\n  [638] = \"evselRRRW\", [639] = \"evselRRRW\",\n\n  [640] = \"evfsaddRRR\", [641] = \"evfssubRRR\",\n  [644] = \"evfsabsRR\", [645] = \"evfsnabsRR\", [646] = \"evfsnegRR\",\n  [648] = \"evfsmulRRR\", [649] = \"evfsdivRRR\",\n  [652] = \"evfscmpgtYRR\", [653] = \"evfscmpltYRR\", [654] = \"evfscmpeqYRR\",\n  [656] = \"evfscfuiR-R\", [657] = \"evfscfsiR-R\",\n  [658] = \"evfscfufR-R\", [659] = \"evfscfsfR-R\",\n  [660] = \"evfsctuiR-R\", [661] = \"evfsctsiR-R\",\n  [662] = \"evfsctufR-R\", [663] = \"evfsctsfR-R\",\n  [664] = \"evfsctuizR-R\", [666] = \"evfsctsizR-R\",\n  [668] = \"evfststgtYRR\", [669] = \"evfststltYRR\", [670] = \"evfststeqYRR\",\n\n  [704] = \"efsaddRRR\", [705] = \"efssubRRR\",\n  [708] = \"efsabsRR\", [709] = \"efsnabsRR\", [710] = \"efsnegRR\",\n  [712] = \"efsmulRRR\", [713] = \"efsdivRRR\",\n  [716] = \"efscmpgtYRR\", [717] = \"efscmpltYRR\", [718] = \"efscmpeqYRR\",\n  [719] = \"efscfdR-R\",\n  [720] = \"efscfuiR-R\", [721] = \"efscfsiR-R\",\n  [722] = \"efscfufR-R\", [723] = \"efscfsfR-R\",\n  [724] = \"efsctuiR-R\", [725] = \"efsctsiR-R\",\n  [726] = \"efsctufR-R\", [727] = \"efsctsfR-R\",\n  [728] = \"efsctuizR-R\", [730] = \"efsctsizR-R\",\n  [732] = \"efststgtYRR\", [733] = \"efststltYRR\", [734] = \"efststeqYRR\",\n\n  [736] = \"efdaddRRR\", [737] = \"efdsubRRR\",\n  [738] = \"efdcfuidR-R\", [739] = \"efdcfsidR-R\",\n  [740] = \"efdabsRR\", [741] = \"efdnabsRR\", [742] = \"efdnegRR\",\n  [744] = \"efdmulRRR\", [745] = \"efddivRRR\",\n  [746] = \"efdctuidzR-R\", [747] = \"efdctsidzR-R\",\n  [748] = \"efdcmpgtYRR\", [749] = \"efdcmpltYRR\", [750] = \"efdcmpeqYRR\",\n  [751] = \"efdcfsR-R\",\n  [752] = \"efdcfuiR-R\", [753] = \"efdcfsiR-R\",\n  [754] = \"efdcfufR-R\", [755] = \"efdcfsfR-R\",\n  [756] = \"efdctuiR-R\", [757] = \"efdctsiR-R\",\n  [758] = \"efdctufR-R\", [759] = \"efdctsfR-R\",\n  [760] = \"efdctuizR-R\", [762] = \"efdctsizR-R\",\n  [764] = \"efdtstgtYRR\", [765] = \"efdtstltYRR\", [766] = \"efdtsteqYRR\",\n\n  [768] = \"evlddxRR0R\", [769] = \"evlddRR8\",\n  [770] = \"evldwxRR0R\", [771] = \"evldwRR8\",\n  [772] = \"evldhxRR0R\", [773] = \"evldhRR8\",\n  [776] = \"evlhhesplatxRR0R\", [777] = \"evlhhesplatRR2\",\n  [780] = \"evlhhousplatxRR0R\", [781] = \"evlhhousplatRR2\",\n  [782] = \"evlhhossplatxRR0R\", [783] = \"evlhhossplatRR2\",\n  [784] = \"evlwhexRR0R\", [785] = \"evlwheRR4\",\n  [788] = \"evlwhouxRR0R\", [789] = \"evlwhouRR4\",\n  [790] = \"evlwhosxRR0R\", [791] = \"evlwhosRR4\",\n  [792] = \"evlwwsplatxRR0R\", [793] = \"evlwwsplatRR4\",\n  [796] = \"evlwhsplatxRR0R\", [797] = \"evlwhsplatRR4\",\n\n  [800] = \"evstddxRR0R\", [801] = \"evstddRR8\",\n  [802] = \"evstdwxRR0R\", [803] = \"evstdwRR8\",\n  [804] = \"evstdhxRR0R\", [805] = \"evstdhRR8\",\n  [816] = \"evstwhexRR0R\", [817] = \"evstwheRR4\",\n  [820] = \"evstwhoxRR0R\", [821] = \"evstwhoRR4\",\n  [824] = \"evstwwexRR0R\", [825] = \"evstwweRR4\",\n  [828] = \"evstwwoxRR0R\", [829] = \"evstwwoRR4\",\n\n  [1027] = \"evmhessfRRR\", [1031] = \"evmhossfRRR\", [1032] = \"evmheumiRRR\",\n  [1033] = \"evmhesmiRRR\", [1035] = \"evmhesmfRRR\", [1036] = \"evmhoumiRRR\",\n  [1037] = \"evmhosmiRRR\", [1039] = \"evmhosmfRRR\", [1059] = \"evmhessfaRRR\",\n  [1063] = \"evmhossfaRRR\", [1064] = \"evmheumiaRRR\", [1065] = \"evmhesmiaRRR\",\n  [1067] = \"evmhesmfaRRR\", [1068] = \"evmhoumiaRRR\", [1069] = \"evmhosmiaRRR\",\n  [1071] = \"evmhosmfaRRR\", [1095] = \"evmwhssfRRR\", [1096] = \"evmwlumiRRR\",\n  [1100] = \"evmwhumiRRR\", [1101] = \"evmwhsmiRRR\", [1103] = \"evmwhsmfRRR\",\n  [1107] = \"evmwssfRRR\", [1112] = \"evmwumiRRR\", [1113] = \"evmwsmiRRR\",\n  [1115] = \"evmwsmfRRR\", [1127] = \"evmwhssfaRRR\", [1128] = \"evmwlumiaRRR\",\n  [1132] = \"evmwhumiaRRR\", [1133] = \"evmwhsmiaRRR\", [1135] = \"evmwhsmfaRRR\",\n  [1139] = \"evmwssfaRRR\", [1144] = \"evmwumiaRRR\", [1145] = \"evmwsmiaRRR\",\n  [1147] = \"evmwsmfaRRR\",\n\n  [1216] = \"evaddusiaawRR\", [1217] = \"evaddssiaawRR\",\n  [1218] = \"evsubfusiaawRR\", [1219] = \"evsubfssiaawRR\",\n  [1220] = \"evmraRR\",\n  [1222] = \"evdivwsRRR\", [1223] = \"evdivwuRRR\",\n  [1224] = \"evaddumiaawRR\", [1225] = \"evaddsmiaawRR\",\n  [1226] = \"evsubfumiaawRR\", [1227] = \"evsubfsmiaawRR\",\n\n  [1280] = \"evmheusiaawRRR\", [1281] = \"evmhessiaawRRR\",\n  [1283] = \"evmhessfaawRRR\", [1284] = \"evmhousiaawRRR\",\n  [1285] = \"evmhossiaawRRR\", [1287] = \"evmhossfaawRRR\",\n  [1288] = \"evmheumiaawRRR\", [1289] = \"evmhesmiaawRRR\",\n  [1291] = \"evmhesmfaawRRR\", [1292] = \"evmhoumiaawRRR\",\n  [1293] = \"evmhosmiaawRRR\", [1295] = \"evmhosmfaawRRR\",\n  [1320] = \"evmhegumiaaRRR\", [1321] = \"evmhegsmiaaRRR\",\n  [1323] = \"evmhegsmfaaRRR\", [1324] = \"evmhogumiaaRRR\",\n  [1325] = \"evmhogsmiaaRRR\", [1327] = \"evmhogsmfaaRRR\",\n  [1344] = \"evmwlusiaawRRR\", [1345] = \"evmwlssiaawRRR\",\n  [1352] = \"evmwlumiaawRRR\", [1353] = \"evmwlsmiaawRRR\",\n  [1363] = \"evmwssfaaRRR\", [1368] = \"evmwumiaaRRR\",\n  [1369] = \"evmwsmiaaRRR\", [1371] = \"evmwsmfaaRRR\",\n  [1408] = \"evmheusianwRRR\", [1409] = \"evmhessianwRRR\",\n  [1411] = \"evmhessfanwRRR\", [1412] = \"evmhousianwRRR\",\n  [1413] = \"evmhossianwRRR\", [1415] = \"evmhossfanwRRR\",\n  [1416] = \"evmheumianwRRR\", [1417] = \"evmhesmianwRRR\",\n  [1419] = \"evmhesmfanwRRR\", [1420] = \"evmhoumianwRRR\",\n  [1421] = \"evmhosmianwRRR\", [1423] = \"evmhosmfanwRRR\",\n  [1448] = \"evmhegumianRRR\", [1449] = \"evmhegsmianRRR\",\n  [1451] = \"evmhegsmfanRRR\", [1452] = \"evmhogumianRRR\",\n  [1453] = \"evmhogsmianRRR\", [1455] = \"evmhogsmfanRRR\",\n  [1472] = \"evmwlusianwRRR\", [1473] = \"evmwlssianwRRR\",\n  [1480] = \"evmwlumianwRRR\", [1481] = \"evmwlsmianwRRR\",\n  [1491] = \"evmwssfanRRR\", [1496] = \"evmwumianRRR\",\n  [1497] = \"evmwsmianRRR\", [1499] = \"evmwsmfanRRR\",\n}\n\nlocal map_pri = {\n  [0] = false,\tfalse,\t\t\"tdiARI\",\t\"twiARI\",\n  map_spe,\tfalse,\t\tfalse,\t\t\"mulliRRI\",\n  \"subficRRI\",\tfalse,\t\t\"cmpl_iYLRU\",\t\"cmp_iYLRI\",\n  \"addicRRI\",\t\"addic.RRI\",\t\"addi|liRR0I\",\t\"addis|lisRR0I\",\n  \"b_KBJ\",\t\"sc\",\t\t \"bKJ\",\t\tmap_crops,\n  \"rlwimiRR~AAA.\", map_rlwinm,\tfalse,\t\t\"rlwnmRR~RAA.\",\n  \"oriNRR~U\",\t\"orisRR~U\",\t\"xoriRR~U\",\t\"xorisRR~U\",\n  \"andi.RR~U\",\t\"andis.RR~U\",\tmap_rld,\tmap_ext,\n  \"lwzRRD\",\t\"lwzuRRD\",\t\"lbzRRD\",\t\"lbzuRRD\",\n  \"stwRRD\",\t\"stwuRRD\",\t\"stbRRD\",\t\"stbuRRD\",\n  \"lhzRRD\",\t\"lhzuRRD\",\t\"lhaRRD\",\t\"lhauRRD\",\n  \"sthRRD\",\t\"sthuRRD\",\t\"lmwRRD\",\t\"stmwRRD\",\n  \"lfsFRD\",\t\"lfsuFRD\",\t\"lfdFRD\",\t\"lfduFRD\",\n  \"stfsFRD\",\t\"stfsuFRD\",\t\"stfdFRD\",\t\"stfduFRD\",\n  false,\tfalse,\t\tmap_ld,\t\tmap_fps,\n  false,\tfalse,\t\tmap_std,\tmap_fpd,\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"sp\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\",\n  \"r16\", \"r17\", \"r18\", \"r19\", \"r20\", \"r21\", \"r22\", \"r23\",\n  \"r24\", \"r25\", \"r26\", \"r27\", \"r28\", \"r29\", \"r30\", \"r31\",\n}\n\nlocal map_cond = { [0] = \"lt\", \"gt\", \"eq\", \"so\", \"ge\", \"le\", \"ne\", \"ns\", }\n\n-- Format a condition bit.\nlocal function condfmt(cond)\n  if cond <= 3 then\n    return map_cond[band(cond, 3)]\n  else\n    return format(\"4*cr%d+%s\", rshift(cond, 2), map_cond[band(cond, 3)])\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then extra = \"\\t->\"..sym end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-7s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-7s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3)\n  local operands = {}\n  local last = nil\n  local rs = 21\n  ctx.op = op\n  ctx.rel = nil\n\n  local opat = map_pri[rshift(b0, 2)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)]\n  end\n  local name, pat = match(opat, \"^([a-z0-9_.]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.]*)(.*)\")\n  if altname then pat = pat2 end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"R\" then\n      x = map_gpr[band(rshift(op, rs), 31)]\n      rs = rs - 5\n    elseif p == \"F\" then\n      x = \"f\"..band(rshift(op, rs), 31)\n      rs = rs - 5\n    elseif p == \"A\" then\n      x = band(rshift(op, rs), 31)\n      rs = rs - 5\n    elseif p == \"S\" then\n      x = arshift(lshift(op, 27-rs), 27)\n      rs = rs - 5\n    elseif p == \"I\" then\n      x = arshift(lshift(op, 16), 16)\n    elseif p == \"U\" then\n      x = band(op, 0xffff)\n    elseif p == \"D\" or p == \"E\" then\n      local disp = arshift(lshift(op, 16), 16)\n      if p == \"E\" then disp = band(disp, -4) end\n      if last == \"r0\" then last = \"0\" end\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p >= \"2\" and p <= \"8\" then\n      local disp = band(rshift(op, rs), 31) * p\n      if last == \"r0\" then last = \"0\" end\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p == \"H\" then\n      x = band(rshift(op, rs), 31) + lshift(band(op, 2), 4)\n      rs = rs - 5\n    elseif p == \"M\" then\n      x = band(rshift(op, rs), 31) + band(op, 0x20)\n    elseif p == \"C\" then\n      x = condfmt(band(rshift(op, rs), 31))\n      rs = rs - 5\n    elseif p == \"B\" then\n      local bo = rshift(op, 21)\n      local cond = band(rshift(op, 16), 31)\n      local cn = \"\"\n      rs = rs - 10\n      if band(bo, 4) == 0 then\n\tcn = band(bo, 2) == 0 and \"dnz\" or \"dz\"\n\tif band(bo, 0x10) == 0 then\n\t  cn = cn..(band(bo, 8) == 0 and \"f\" or \"t\")\n\tend\n\tif band(bo, 0x10) == 0 then x = condfmt(cond) end\n\tname = name..(band(bo, 1) == band(rshift(op, 15), 1) and \"-\" or \"+\")\n      elseif band(bo, 0x10) == 0 then\n\tcn = map_cond[band(cond, 3) + (band(bo, 8) == 0 and 4 or 0)]\n\tif cond > 3 then x = \"cr\"..rshift(cond, 2) end\n\tname = name..(band(bo, 1) == band(rshift(op, 15), 1) and \"-\" or \"+\")\n      end\n      name = gsub(name, \"_\", cn)\n    elseif p == \"J\" then\n      x = arshift(lshift(op, 27-rs), 29-rs)*4\n      if band(op, 2) == 0 then x = ctx.addr + pos + x end\n      ctx.rel = x\n      x = \"0x\"..tohex(x)\n    elseif p == \"K\" then\n      if band(op, 1) ~= 0 then name = name..\"l\" end\n      if band(op, 2) ~= 0 then name = name..\"a\" end\n    elseif p == \"X\" or p == \"Y\" then\n      x = band(rshift(op, rs+2), 7)\n      if x == 0 and p == \"Y\" then x = nil else x = \"cr\"..x end\n      rs = rs - 5\n    elseif p == \"W\" then\n      x = \"cr\"..band(op, 7)\n    elseif p == \"Z\" then\n      x = band(rshift(op, rs-4), 255)\n      rs = rs - 10\n    elseif p == \">\" then\n      operands[#operands] = rshift(operands[#operands], 1)\n    elseif p == \"0\" then\n      if last == \"r0\" then\n\toperands[#operands] = nil\n\tif altname then name = altname end\n      end\n    elseif p == \"L\" then\n      name = gsub(name, \"_\", band(op, 0x00200000) ~= 0 and \"d\" or \"w\")\n    elseif p == \".\" then\n      if band(op, 1) == 1 then name = name..\".\" end\n    elseif p == \"N\" then\n      if op == 0x60000000 then name = \"nop\"; break end\n    elseif p == \"~\" then\n      local n = #operands\n      operands[n-1],  operands[n] = operands[n], operands[n-1]\n    elseif p == \"=\" then\n      local n = #operands\n      if last == operands[n-1] then\n\toperands[n] = nil\n\tname = altname\n      end\n    elseif p == \"%\" then\n      local n = #operands\n      if last == operands[n-1] and last == operands[n-2] then\n\toperands[n] = nil\n\toperands[n-1] = nil\n\tname = altname\n      end\n    elseif p == \"-\" then\n      rs = rs - 5\n    else\n      assert(false)\n    end\n    if x then operands[#operands+1] = x; last = x end\n  end\n\n  return putop(ctx, name, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  stop = stop - stop % 4\n  ctx.pos = ofs - ofs % 4\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_gpr[r] end\n  return \"f\"..(r-32)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_ppc.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 1231975d3fb5f1b4995c9112ea3537f4\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_x64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT x64 disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the 64 bit functions from the combined\n-- x86/x64 disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_x86 = require((string.match(..., \".*%.\") or \"\")..\"dis_x86\")\nreturn {\n  create = dis_x86.create64,\n  disass = dis_x86.disass64,\n  regname = dis_x86.regname64\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_x64.lua.meta",
    "content": "fileFormatVersion: 2\nguid: b9997149317d8a6458002e31b320c212\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_x86.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT x86/x64 disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- Sending small code snippets to an external disassembler and mixing the\n-- output with our own stuff was too fragile. So I had to bite the bullet\n-- and write yet another x86 disassembler. Oh well ...\n--\n-- The output format is very similar to what ndisasm generates. But it has\n-- been developed independently by looking at the opcode tables from the\n-- Intel and AMD manuals. The supported instruction set is quite extensive\n-- and reflects what a current generation Intel or AMD CPU implements in\n-- 32 bit and 64 bit mode. Yes, this includes MMX, SSE, SSE2, SSE3, SSSE3,\n-- SSE4.1, SSE4.2, SSE4a, AVX, AVX2 and even privileged and hypervisor\n-- (VMX/SVM) instructions.\n--\n-- Notes:\n-- * The (useless) a16 prefix, 3DNow and pre-586 opcodes are unsupported.\n-- * No attempt at optimization has been made -- it's fast enough for my needs.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal lower, rep = string.lower, string.rep\nlocal bit = require(\"bit\")\nlocal tohex = bit.tohex\n\n-- Map for 1st opcode byte in 32 bit mode. Ugly? Well ... read on.\nlocal map_opc1_32 = {\n--0x\n[0]=\"addBmr\",\"addVmr\",\"addBrm\",\"addVrm\",\"addBai\",\"addVai\",\"push es\",\"pop es\",\n\"orBmr\",\"orVmr\",\"orBrm\",\"orVrm\",\"orBai\",\"orVai\",\"push cs\",\"opc2*\",\n--1x\n\"adcBmr\",\"adcVmr\",\"adcBrm\",\"adcVrm\",\"adcBai\",\"adcVai\",\"push ss\",\"pop ss\",\n\"sbbBmr\",\"sbbVmr\",\"sbbBrm\",\"sbbVrm\",\"sbbBai\",\"sbbVai\",\"push ds\",\"pop ds\",\n--2x\n\"andBmr\",\"andVmr\",\"andBrm\",\"andVrm\",\"andBai\",\"andVai\",\"es:seg\",\"daa\",\n\"subBmr\",\"subVmr\",\"subBrm\",\"subVrm\",\"subBai\",\"subVai\",\"cs:seg\",\"das\",\n--3x\n\"xorBmr\",\"xorVmr\",\"xorBrm\",\"xorVrm\",\"xorBai\",\"xorVai\",\"ss:seg\",\"aaa\",\n\"cmpBmr\",\"cmpVmr\",\"cmpBrm\",\"cmpVrm\",\"cmpBai\",\"cmpVai\",\"ds:seg\",\"aas\",\n--4x\n\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\n\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\n--5x\n\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\n\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\n--6x\n\"sz*pushaw,pusha\",\"sz*popaw,popa\",\"boundVrm\",\"arplWmr\",\n\"fs:seg\",\"gs:seg\",\"o16:\",\"a16\",\n\"pushUi\",\"imulVrmi\",\"pushBs\",\"imulVrms\",\n\"insb\",\"insVS\",\"outsb\",\"outsVS\",\n--7x\n\"joBj\",\"jnoBj\",\"jbBj\",\"jnbBj\",\"jzBj\",\"jnzBj\",\"jbeBj\",\"jaBj\",\n\"jsBj\",\"jnsBj\",\"jpeBj\",\"jpoBj\",\"jlBj\",\"jgeBj\",\"jleBj\",\"jgBj\",\n--8x\n\"arith!Bmi\",\"arith!Vmi\",\"arith!Bmi\",\"arith!Vms\",\n\"testBmr\",\"testVmr\",\"xchgBrm\",\"xchgVrm\",\n\"movBmr\",\"movVmr\",\"movBrm\",\"movVrm\",\n\"movVmg\",\"leaVrm\",\"movWgm\",\"popUm\",\n--9x\n\"nop*xchgVaR|pause|xchgWaR|repne nop\",\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\n\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\n\"sz*cbw,cwde,cdqe\",\"sz*cwd,cdq,cqo\",\"call farViw\",\"wait\",\n\"sz*pushfw,pushf\",\"sz*popfw,popf\",\"sahf\",\"lahf\",\n--Ax\n\"movBao\",\"movVao\",\"movBoa\",\"movVoa\",\n\"movsb\",\"movsVS\",\"cmpsb\",\"cmpsVS\",\n\"testBai\",\"testVai\",\"stosb\",\"stosVS\",\n\"lodsb\",\"lodsVS\",\"scasb\",\"scasVS\",\n--Bx\n\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\n\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\n--Cx\n\"shift!Bmu\",\"shift!Vmu\",\"retBw\",\"ret\",\"vex*3$lesVrm\",\"vex*2$ldsVrm\",\"movBmi\",\"movVmi\",\n\"enterBwu\",\"leave\",\"retfBw\",\"retf\",\"int3\",\"intBu\",\"into\",\"iretVS\",\n--Dx\n\"shift!Bm1\",\"shift!Vm1\",\"shift!Bmc\",\"shift!Vmc\",\"aamBu\",\"aadBu\",\"salc\",\"xlatb\",\n\"fp*0\",\"fp*1\",\"fp*2\",\"fp*3\",\"fp*4\",\"fp*5\",\"fp*6\",\"fp*7\",\n--Ex\n\"loopneBj\",\"loopeBj\",\"loopBj\",\"sz*jcxzBj,jecxzBj,jrcxzBj\",\n\"inBau\",\"inVau\",\"outBua\",\"outVua\",\n\"callVj\",\"jmpVj\",\"jmp farViw\",\"jmpBj\",\"inBad\",\"inVad\",\"outBda\",\"outVda\",\n--Fx\n\"lock:\",\"int1\",\"repne:rep\",\"rep:\",\"hlt\",\"cmc\",\"testb!Bm\",\"testv!Vm\",\n\"clc\",\"stc\",\"cli\",\"sti\",\"cld\",\"std\",\"incb!Bm\",\"incd!Vm\",\n}\nassert(#map_opc1_32 == 255)\n\n-- Map for 1st opcode byte in 64 bit mode (overrides only).\nlocal map_opc1_64 = setmetatable({\n  [0x06]=false, [0x07]=false, [0x0e]=false,\n  [0x16]=false, [0x17]=false, [0x1e]=false, [0x1f]=false,\n  [0x27]=false, [0x2f]=false, [0x37]=false, [0x3f]=false,\n  [0x60]=false, [0x61]=false, [0x62]=false, [0x63]=\"movsxdVrDmt\", [0x67]=\"a32:\",\n  [0x40]=\"rex*\",   [0x41]=\"rex*b\",   [0x42]=\"rex*x\",   [0x43]=\"rex*xb\",\n  [0x44]=\"rex*r\",  [0x45]=\"rex*rb\",  [0x46]=\"rex*rx\",  [0x47]=\"rex*rxb\",\n  [0x48]=\"rex*w\",  [0x49]=\"rex*wb\",  [0x4a]=\"rex*wx\",  [0x4b]=\"rex*wxb\",\n  [0x4c]=\"rex*wr\", [0x4d]=\"rex*wrb\", [0x4e]=\"rex*wrx\", [0x4f]=\"rex*wrxb\",\n  [0x82]=false, [0x9a]=false, [0xc4]=\"vex*3\", [0xc5]=\"vex*2\", [0xce]=false,\n  [0xd4]=false, [0xd5]=false, [0xd6]=false, [0xea]=false,\n}, { __index = map_opc1_32 })\n\n-- Map for 2nd opcode byte (0F xx). True CISC hell. Hey, I told you.\n-- Prefix dependent MMX/SSE opcodes: (none)|rep|o16|repne, -|F3|66|F2\nlocal map_opc2 = {\n--0x\n[0]=\"sldt!Dmp\",\"sgdt!Ump\",\"larVrm\",\"lslVrm\",nil,\"syscall\",\"clts\",\"sysret\",\n\"invd\",\"wbinvd\",nil,\"ud1\",nil,\"$prefetch!Bm\",\"femms\",\"3dnowMrmu\",\n--1x\n\"movupsXrm|movssXrvm|movupdXrm|movsdXrvm\",\n\"movupsXmr|movssXmvr|movupdXmr|movsdXmvr\",\n\"movhlpsXrm$movlpsXrm|movsldupXrm|movlpdXrm|movddupXrm\",\n\"movlpsXmr||movlpdXmr\",\n\"unpcklpsXrvm||unpcklpdXrvm\",\n\"unpckhpsXrvm||unpckhpdXrvm\",\n\"movlhpsXrm$movhpsXrm|movshdupXrm|movhpdXrm\",\n\"movhpsXmr||movhpdXmr\",\n\"$prefetcht!Bm\",\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\n\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\n--2x\n\"movUmx$\",\"movUmy$\",\"movUxm$\",\"movUym$\",\"movUmz$\",nil,\"movUzm$\",nil,\n\"movapsXrm||movapdXrm\",\n\"movapsXmr||movapdXmr\",\n\"cvtpi2psXrMm|cvtsi2ssXrvVmt|cvtpi2pdXrMm|cvtsi2sdXrvVmt\",\n\"movntpsXmr|movntssXmr|movntpdXmr|movntsdXmr\",\n\"cvttps2piMrXm|cvttss2siVrXm|cvttpd2piMrXm|cvttsd2siVrXm\",\n\"cvtps2piMrXm|cvtss2siVrXm|cvtpd2piMrXm|cvtsd2siVrXm\",\n\"ucomissXrm||ucomisdXrm\",\n\"comissXrm||comisdXrm\",\n--3x\n\"wrmsr\",\"rdtsc\",\"rdmsr\",\"rdpmc\",\"sysenter\",\"sysexit\",nil,\"getsec\",\n\"opc3*38\",nil,\"opc3*3a\",nil,nil,nil,nil,nil,\n--4x\n\"cmovoVrm\",\"cmovnoVrm\",\"cmovbVrm\",\"cmovnbVrm\",\n\"cmovzVrm\",\"cmovnzVrm\",\"cmovbeVrm\",\"cmovaVrm\",\n\"cmovsVrm\",\"cmovnsVrm\",\"cmovpeVrm\",\"cmovpoVrm\",\n\"cmovlVrm\",\"cmovgeVrm\",\"cmovleVrm\",\"cmovgVrm\",\n--5x\n\"movmskpsVrXm$||movmskpdVrXm$\",\"sqrtpsXrm|sqrtssXrm|sqrtpdXrm|sqrtsdXrm\",\n\"rsqrtpsXrm|rsqrtssXrvm\",\"rcppsXrm|rcpssXrvm\",\n\"andpsXrvm||andpdXrvm\",\"andnpsXrvm||andnpdXrvm\",\n\"orpsXrvm||orpdXrvm\",\"xorpsXrvm||xorpdXrvm\",\n\"addpsXrvm|addssXrvm|addpdXrvm|addsdXrvm\",\"mulpsXrvm|mulssXrvm|mulpdXrvm|mulsdXrvm\",\n\"cvtps2pdXrm|cvtss2sdXrvm|cvtpd2psXrm|cvtsd2ssXrvm\",\n\"cvtdq2psXrm|cvttps2dqXrm|cvtps2dqXrm\",\n\"subpsXrvm|subssXrvm|subpdXrvm|subsdXrvm\",\"minpsXrvm|minssXrvm|minpdXrvm|minsdXrvm\",\n\"divpsXrvm|divssXrvm|divpdXrvm|divsdXrvm\",\"maxpsXrvm|maxssXrvm|maxpdXrvm|maxsdXrvm\",\n--6x\n\"punpcklbwPrvm\",\"punpcklwdPrvm\",\"punpckldqPrvm\",\"packsswbPrvm\",\n\"pcmpgtbPrvm\",\"pcmpgtwPrvm\",\"pcmpgtdPrvm\",\"packuswbPrvm\",\n\"punpckhbwPrvm\",\"punpckhwdPrvm\",\"punpckhdqPrvm\",\"packssdwPrvm\",\n\"||punpcklqdqXrvm\",\"||punpckhqdqXrvm\",\n\"movPrVSm\",\"movqMrm|movdquXrm|movdqaXrm\",\n--7x\n\"pshufwMrmu|pshufhwXrmu|pshufdXrmu|pshuflwXrmu\",\"pshiftw!Pvmu\",\n\"pshiftd!Pvmu\",\"pshiftq!Mvmu||pshiftdq!Xvmu\",\n\"pcmpeqbPrvm\",\"pcmpeqwPrvm\",\"pcmpeqdPrvm\",\"emms*|\",\n\"vmreadUmr||extrqXmuu$|insertqXrmuu$\",\"vmwriteUrm||extrqXrm$|insertqXrm$\",\nnil,nil,\n\"||haddpdXrvm|haddpsXrvm\",\"||hsubpdXrvm|hsubpsXrvm\",\n\"movVSmMr|movqXrm|movVSmXr\",\"movqMmr|movdquXmr|movdqaXmr\",\n--8x\n\"joVj\",\"jnoVj\",\"jbVj\",\"jnbVj\",\"jzVj\",\"jnzVj\",\"jbeVj\",\"jaVj\",\n\"jsVj\",\"jnsVj\",\"jpeVj\",\"jpoVj\",\"jlVj\",\"jgeVj\",\"jleVj\",\"jgVj\",\n--9x\n\"setoBm\",\"setnoBm\",\"setbBm\",\"setnbBm\",\"setzBm\",\"setnzBm\",\"setbeBm\",\"setaBm\",\n\"setsBm\",\"setnsBm\",\"setpeBm\",\"setpoBm\",\"setlBm\",\"setgeBm\",\"setleBm\",\"setgBm\",\n--Ax\n\"push fs\",\"pop fs\",\"cpuid\",\"btVmr\",\"shldVmru\",\"shldVmrc\",nil,nil,\n\"push gs\",\"pop gs\",\"rsm\",\"btsVmr\",\"shrdVmru\",\"shrdVmrc\",\"fxsave!Dmp\",\"imulVrm\",\n--Bx\n\"cmpxchgBmr\",\"cmpxchgVmr\",\"$lssVrm\",\"btrVmr\",\n\"$lfsVrm\",\"$lgsVrm\",\"movzxVrBmt\",\"movzxVrWmt\",\n\"|popcntVrm\",\"ud2Dp\",\"bt!Vmu\",\"btcVmr\",\n\"bsfVrm\",\"bsrVrm|lzcntVrm|bsrWrm\",\"movsxVrBmt\",\"movsxVrWmt\",\n--Cx\n\"xaddBmr\",\"xaddVmr\",\n\"cmppsXrvmu|cmpssXrvmu|cmppdXrvmu|cmpsdXrvmu\",\"$movntiVmr|\",\n\"pinsrwPrvWmu\",\"pextrwDrPmu\",\n\"shufpsXrvmu||shufpdXrvmu\",\"$cmpxchg!Qmp\",\n\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\n--Dx\n\"||addsubpdXrvm|addsubpsXrvm\",\"psrlwPrvm\",\"psrldPrvm\",\"psrlqPrvm\",\n\"paddqPrvm\",\"pmullwPrvm\",\n\"|movq2dqXrMm|movqXmr|movdq2qMrXm$\",\"pmovmskbVrMm||pmovmskbVrXm\",\n\"psubusbPrvm\",\"psubuswPrvm\",\"pminubPrvm\",\"pandPrvm\",\n\"paddusbPrvm\",\"padduswPrvm\",\"pmaxubPrvm\",\"pandnPrvm\",\n--Ex\n\"pavgbPrvm\",\"psrawPrvm\",\"psradPrvm\",\"pavgwPrvm\",\n\"pmulhuwPrvm\",\"pmulhwPrvm\",\n\"|cvtdq2pdXrm|cvttpd2dqXrm|cvtpd2dqXrm\",\"$movntqMmr||$movntdqXmr\",\n\"psubsbPrvm\",\"psubswPrvm\",\"pminswPrvm\",\"porPrvm\",\n\"paddsbPrvm\",\"paddswPrvm\",\"pmaxswPrvm\",\"pxorPrvm\",\n--Fx\n\"|||lddquXrm\",\"psllwPrvm\",\"pslldPrvm\",\"psllqPrvm\",\n\"pmuludqPrvm\",\"pmaddwdPrvm\",\"psadbwPrvm\",\"maskmovqMrm||maskmovdquXrm$\",\n\"psubbPrvm\",\"psubwPrvm\",\"psubdPrvm\",\"psubqPrvm\",\n\"paddbPrvm\",\"paddwPrvm\",\"padddPrvm\",\"ud\",\n}\nassert(map_opc2[255] == \"ud\")\n\n-- Map for three-byte opcodes. Can't wait for their next invention.\nlocal map_opc3 = {\n[\"38\"] = { -- [66] 0f 38 xx\n--0x\n[0]=\"pshufbPrvm\",\"phaddwPrvm\",\"phadddPrvm\",\"phaddswPrvm\",\n\"pmaddubswPrvm\",\"phsubwPrvm\",\"phsubdPrvm\",\"phsubswPrvm\",\n\"psignbPrvm\",\"psignwPrvm\",\"psigndPrvm\",\"pmulhrswPrvm\",\n\"||permilpsXrvm\",\"||permilpdXrvm\",nil,nil,\n--1x\n\"||pblendvbXrma\",nil,nil,nil,\n\"||blendvpsXrma\",\"||blendvpdXrma\",\"||permpsXrvm\",\"||ptestXrm\",\n\"||broadcastssXrm\",\"||broadcastsdXrm\",\"||broadcastf128XrlXm\",nil,\n\"pabsbPrm\",\"pabswPrm\",\"pabsdPrm\",nil,\n--2x\n\"||pmovsxbwXrm\",\"||pmovsxbdXrm\",\"||pmovsxbqXrm\",\"||pmovsxwdXrm\",\n\"||pmovsxwqXrm\",\"||pmovsxdqXrm\",nil,nil,\n\"||pmuldqXrvm\",\"||pcmpeqqXrvm\",\"||$movntdqaXrm\",\"||packusdwXrvm\",\n\"||maskmovpsXrvm\",\"||maskmovpdXrvm\",\"||maskmovpsXmvr\",\"||maskmovpdXmvr\",\n--3x\n\"||pmovzxbwXrm\",\"||pmovzxbdXrm\",\"||pmovzxbqXrm\",\"||pmovzxwdXrm\",\n\"||pmovzxwqXrm\",\"||pmovzxdqXrm\",\"||permdXrvm\",\"||pcmpgtqXrvm\",\n\"||pminsbXrvm\",\"||pminsdXrvm\",\"||pminuwXrvm\",\"||pminudXrvm\",\n\"||pmaxsbXrvm\",\"||pmaxsdXrvm\",\"||pmaxuwXrvm\",\"||pmaxudXrvm\",\n--4x\n\"||pmulddXrvm\",\"||phminposuwXrm\",nil,nil,\nnil,\"||psrlvVSXrvm\",\"||psravdXrvm\",\"||psllvVSXrvm\",\n--5x\n[0x58] = \"||pbroadcastdXrlXm\",[0x59] = \"||pbroadcastqXrlXm\",\n[0x5a] = \"||broadcasti128XrlXm\",\n--7x\n[0x78] = \"||pbroadcastbXrlXm\",[0x79] = \"||pbroadcastwXrlXm\",\n--8x\n[0x8c] = \"||pmaskmovXrvVSm\",\n[0x8e] = \"||pmaskmovVSmXvr\",\n--9x\n[0x96] = \"||fmaddsub132pHXrvm\",[0x97] = \"||fmsubadd132pHXrvm\",\n[0x98] = \"||fmadd132pHXrvm\",[0x99] = \"||fmadd132sHXrvm\",\n[0x9a] = \"||fmsub132pHXrvm\",[0x9b] = \"||fmsub132sHXrvm\",\n[0x9c] = \"||fnmadd132pHXrvm\",[0x9d] = \"||fnmadd132sHXrvm\",\n[0x9e] = \"||fnmsub132pHXrvm\",[0x9f] = \"||fnmsub132sHXrvm\",\n--Ax\n[0xa6] = \"||fmaddsub213pHXrvm\",[0xa7] = \"||fmsubadd213pHXrvm\",\n[0xa8] = \"||fmadd213pHXrvm\",[0xa9] = \"||fmadd213sHXrvm\",\n[0xaa] = \"||fmsub213pHXrvm\",[0xab] = \"||fmsub213sHXrvm\",\n[0xac] = \"||fnmadd213pHXrvm\",[0xad] = \"||fnmadd213sHXrvm\",\n[0xae] = \"||fnmsub213pHXrvm\",[0xaf] = \"||fnmsub213sHXrvm\",\n--Bx\n[0xb6] = \"||fmaddsub231pHXrvm\",[0xb7] = \"||fmsubadd231pHXrvm\",\n[0xb8] = \"||fmadd231pHXrvm\",[0xb9] = \"||fmadd231sHXrvm\",\n[0xba] = \"||fmsub231pHXrvm\",[0xbb] = \"||fmsub231sHXrvm\",\n[0xbc] = \"||fnmadd231pHXrvm\",[0xbd] = \"||fnmadd231sHXrvm\",\n[0xbe] = \"||fnmsub231pHXrvm\",[0xbf] = \"||fnmsub231sHXrvm\",\n--Dx\n[0xdc] = \"||aesencXrvm\", [0xdd] = \"||aesenclastXrvm\",\n[0xde] = \"||aesdecXrvm\", [0xdf] = \"||aesdeclastXrvm\",\n--Fx\n[0xf0] = \"|||crc32TrBmt\",[0xf1] = \"|||crc32TrVmt\",\n[0xf7] = \"| sarxVrmv| shlxVrmv| shrxVrmv\",\n},\n\n[\"3a\"] = { -- [66] 0f 3a xx\n--0x\n[0x00]=\"||permqXrmu\",\"||permpdXrmu\",\"||pblenddXrvmu\",nil,\n\"||permilpsXrmu\",\"||permilpdXrmu\",\"||perm2f128Xrvmu\",nil,\n\"||roundpsXrmu\",\"||roundpdXrmu\",\"||roundssXrvmu\",\"||roundsdXrvmu\",\n\"||blendpsXrvmu\",\"||blendpdXrvmu\",\"||pblendwXrvmu\",\"palignrPrvmu\",\n--1x\nnil,nil,nil,nil,\n\"||pextrbVmXru\",\"||pextrwVmXru\",\"||pextrVmSXru\",\"||extractpsVmXru\",\n\"||insertf128XrvlXmu\",\"||extractf128XlXmYru\",nil,nil,\nnil,nil,nil,nil,\n--2x\n\"||pinsrbXrvVmu\",\"||insertpsXrvmu\",\"||pinsrXrvVmuS\",nil,\n--3x\n[0x38] = \"||inserti128Xrvmu\",[0x39] = \"||extracti128XlXmYru\",\n--4x\n[0x40] = \"||dppsXrvmu\",\n[0x41] = \"||dppdXrvmu\",\n[0x42] = \"||mpsadbwXrvmu\",\n[0x44] = \"||pclmulqdqXrvmu\",\n[0x46] = \"||perm2i128Xrvmu\",\n[0x4a] = \"||blendvpsXrvmb\",[0x4b] = \"||blendvpdXrvmb\",\n[0x4c] = \"||pblendvbXrvmb\",\n--6x\n[0x60] = \"||pcmpestrmXrmu\",[0x61] = \"||pcmpestriXrmu\",\n[0x62] = \"||pcmpistrmXrmu\",[0x63] = \"||pcmpistriXrmu\",\n[0xdf] = \"||aeskeygenassistXrmu\",\n--Fx\n[0xf0] = \"||| rorxVrmu\",\n},\n}\n\n-- Map for VMX/SVM opcodes 0F 01 C0-FF (sgdt group with register operands).\nlocal map_opcvm = {\n[0xc1]=\"vmcall\",[0xc2]=\"vmlaunch\",[0xc3]=\"vmresume\",[0xc4]=\"vmxoff\",\n[0xc8]=\"monitor\",[0xc9]=\"mwait\",\n[0xd8]=\"vmrun\",[0xd9]=\"vmmcall\",[0xda]=\"vmload\",[0xdb]=\"vmsave\",\n[0xdc]=\"stgi\",[0xdd]=\"clgi\",[0xde]=\"skinit\",[0xdf]=\"invlpga\",\n[0xf8]=\"swapgs\",[0xf9]=\"rdtscp\",\n}\n\n-- Map for FP opcodes. And you thought stack machines are simple?\nlocal map_opcfp = {\n-- D8-DF 00-BF: opcodes with a memory operand.\n-- D8\n[0]=\"faddFm\",\"fmulFm\",\"fcomFm\",\"fcompFm\",\"fsubFm\",\"fsubrFm\",\"fdivFm\",\"fdivrFm\",\n\"fldFm\",nil,\"fstFm\",\"fstpFm\",\"fldenvVm\",\"fldcwWm\",\"fnstenvVm\",\"fnstcwWm\",\n-- DA\n\"fiaddDm\",\"fimulDm\",\"ficomDm\",\"ficompDm\",\n\"fisubDm\",\"fisubrDm\",\"fidivDm\",\"fidivrDm\",\n-- DB\n\"fildDm\",\"fisttpDm\",\"fistDm\",\"fistpDm\",nil,\"fld twordFmp\",nil,\"fstp twordFmp\",\n-- DC\n\"faddGm\",\"fmulGm\",\"fcomGm\",\"fcompGm\",\"fsubGm\",\"fsubrGm\",\"fdivGm\",\"fdivrGm\",\n-- DD\n\"fldGm\",\"fisttpQm\",\"fstGm\",\"fstpGm\",\"frstorDmp\",nil,\"fnsaveDmp\",\"fnstswWm\",\n-- DE\n\"fiaddWm\",\"fimulWm\",\"ficomWm\",\"ficompWm\",\n\"fisubWm\",\"fisubrWm\",\"fidivWm\",\"fidivrWm\",\n-- DF\n\"fildWm\",\"fisttpWm\",\"fistWm\",\"fistpWm\",\n\"fbld twordFmp\",\"fildQm\",\"fbstp twordFmp\",\"fistpQm\",\n-- xx C0-FF: opcodes with a pseudo-register operand.\n-- D8\n\"faddFf\",\"fmulFf\",\"fcomFf\",\"fcompFf\",\"fsubFf\",\"fsubrFf\",\"fdivFf\",\"fdivrFf\",\n-- D9\n\"fldFf\",\"fxchFf\",{\"fnop\"},nil,\n{\"fchs\",\"fabs\",nil,nil,\"ftst\",\"fxam\"},\n{\"fld1\",\"fldl2t\",\"fldl2e\",\"fldpi\",\"fldlg2\",\"fldln2\",\"fldz\"},\n{\"f2xm1\",\"fyl2x\",\"fptan\",\"fpatan\",\"fxtract\",\"fprem1\",\"fdecstp\",\"fincstp\"},\n{\"fprem\",\"fyl2xp1\",\"fsqrt\",\"fsincos\",\"frndint\",\"fscale\",\"fsin\",\"fcos\"},\n-- DA\n\"fcmovbFf\",\"fcmoveFf\",\"fcmovbeFf\",\"fcmovuFf\",nil,{nil,\"fucompp\"},nil,nil,\n-- DB\n\"fcmovnbFf\",\"fcmovneFf\",\"fcmovnbeFf\",\"fcmovnuFf\",\n{nil,nil,\"fnclex\",\"fninit\"},\"fucomiFf\",\"fcomiFf\",nil,\n-- DC\n\"fadd toFf\",\"fmul toFf\",nil,nil,\n\"fsub toFf\",\"fsubr toFf\",\"fdivr toFf\",\"fdiv toFf\",\n-- DD\n\"ffreeFf\",nil,\"fstFf\",\"fstpFf\",\"fucomFf\",\"fucompFf\",nil,nil,\n-- DE\n\"faddpFf\",\"fmulpFf\",nil,{nil,\"fcompp\"},\n\"fsubrpFf\",\"fsubpFf\",\"fdivrpFf\",\"fdivpFf\",\n-- DF\nnil,nil,nil,nil,{\"fnstsw ax\"},\"fucomipFf\",\"fcomipFf\",nil,\n}\nassert(map_opcfp[126] == \"fcomipFf\")\n\n-- Map for opcode groups. The subkey is sp from the ModRM byte.\nlocal map_opcgroup = {\n  arith = { \"add\", \"or\", \"adc\", \"sbb\", \"and\", \"sub\", \"xor\", \"cmp\" },\n  shift = { \"rol\", \"ror\", \"rcl\", \"rcr\", \"shl\", \"shr\", \"sal\", \"sar\" },\n  testb = { \"testBmi\", \"testBmi\", \"not\", \"neg\", \"mul\", \"imul\", \"div\", \"idiv\" },\n  testv = { \"testVmi\", \"testVmi\", \"not\", \"neg\", \"mul\", \"imul\", \"div\", \"idiv\" },\n  incb = { \"inc\", \"dec\" },\n  incd = { \"inc\", \"dec\", \"callUmp\", \"$call farDmp\",\n\t   \"jmpUmp\", \"$jmp farDmp\", \"pushUm\" },\n  sldt = { \"sldt\", \"str\", \"lldt\", \"ltr\", \"verr\", \"verw\" },\n  sgdt = { \"vm*$sgdt\", \"vm*$sidt\", \"$lgdt\", \"vm*$lidt\",\n\t   \"smsw\", nil, \"lmsw\", \"vm*$invlpg\" },\n  bt = { nil, nil, nil, nil, \"bt\", \"bts\", \"btr\", \"btc\" },\n  cmpxchg = { nil, \"sz*,cmpxchg8bQmp,cmpxchg16bXmp\", nil, nil,\n\t      nil, nil, \"vmptrld|vmxon|vmclear\", \"vmptrst\" },\n  pshiftw = { nil, nil, \"psrlw\", nil, \"psraw\", nil, \"psllw\" },\n  pshiftd = { nil, nil, \"psrld\", nil, \"psrad\", nil, \"pslld\" },\n  pshiftq = { nil, nil, \"psrlq\", nil, nil, nil, \"psllq\" },\n  pshiftdq = { nil, nil, \"psrlq\", \"psrldq\", nil, nil, \"psllq\", \"pslldq\" },\n  fxsave = { \"$fxsave\", \"$fxrstor\", \"$ldmxcsr\", \"$stmxcsr\",\n\t     nil, \"lfenceDp$\", \"mfenceDp$\", \"sfenceDp$clflush\" },\n  prefetch = { \"prefetch\", \"prefetchw\" },\n  prefetcht = { \"prefetchnta\", \"prefetcht0\", \"prefetcht1\", \"prefetcht2\" },\n}\n\n------------------------------------------------------------------------------\n\n-- Maps for register names.\nlocal map_regs = {\n  B = { \"al\", \"cl\", \"dl\", \"bl\", \"ah\", \"ch\", \"dh\", \"bh\",\n\t\"r8b\", \"r9b\", \"r10b\", \"r11b\", \"r12b\", \"r13b\", \"r14b\", \"r15b\" },\n  B64 = { \"al\", \"cl\", \"dl\", \"bl\", \"spl\", \"bpl\", \"sil\", \"dil\",\n\t  \"r8b\", \"r9b\", \"r10b\", \"r11b\", \"r12b\", \"r13b\", \"r14b\", \"r15b\" },\n  W = { \"ax\", \"cx\", \"dx\", \"bx\", \"sp\", \"bp\", \"si\", \"di\",\n\t\"r8w\", \"r9w\", \"r10w\", \"r11w\", \"r12w\", \"r13w\", \"r14w\", \"r15w\" },\n  D = { \"eax\", \"ecx\", \"edx\", \"ebx\", \"esp\", \"ebp\", \"esi\", \"edi\",\n\t\"r8d\", \"r9d\", \"r10d\", \"r11d\", \"r12d\", \"r13d\", \"r14d\", \"r15d\" },\n  Q = { \"rax\", \"rcx\", \"rdx\", \"rbx\", \"rsp\", \"rbp\", \"rsi\", \"rdi\",\n\t\"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\" },\n  M = { \"mm0\", \"mm1\", \"mm2\", \"mm3\", \"mm4\", \"mm5\", \"mm6\", \"mm7\",\n\t\"mm0\", \"mm1\", \"mm2\", \"mm3\", \"mm4\", \"mm5\", \"mm6\", \"mm7\" }, -- No x64 ext!\n  X = { \"xmm0\", \"xmm1\", \"xmm2\", \"xmm3\", \"xmm4\", \"xmm5\", \"xmm6\", \"xmm7\",\n\t\"xmm8\", \"xmm9\", \"xmm10\", \"xmm11\", \"xmm12\", \"xmm13\", \"xmm14\", \"xmm15\" },\n  Y = { \"ymm0\", \"ymm1\", \"ymm2\", \"ymm3\", \"ymm4\", \"ymm5\", \"ymm6\", \"ymm7\",\n\t\"ymm8\", \"ymm9\", \"ymm10\", \"ymm11\", \"ymm12\", \"ymm13\", \"ymm14\", \"ymm15\" },\n}\nlocal map_segregs = { \"es\", \"cs\", \"ss\", \"ds\", \"fs\", \"gs\", \"segr6\", \"segr7\" }\n\n-- Maps for size names.\nlocal map_sz2n = {\n  B = 1, W = 2, D = 4, Q = 8, M = 8, X = 16, Y = 32,\n}\nlocal map_sz2prefix = {\n  B = \"byte\", W = \"word\", D = \"dword\",\n  Q = \"qword\",\n  M = \"qword\", X = \"xword\", Y = \"yword\",\n  F = \"dword\", G = \"qword\", -- No need for sizes/register names for these two.\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local code, pos, hex = ctx.code, ctx.pos, \"\"\n  local hmax = ctx.hexdump\n  if hmax > 0 then\n    for i=ctx.start,pos-1 do\n      hex = hex..format(\"%02X\", byte(code, i, i))\n    end\n    if #hex > hmax then hex = sub(hex, 1, hmax)..\". \"\n    else hex = hex..rep(\" \", hmax-#hex+2) end\n  end\n  if operands then text = text..\" \"..operands end\n  if ctx.o16 then text = \"o16 \"..text; ctx.o16 = false end\n  if ctx.a32 then text = \"a32 \"..text; ctx.a32 = false end\n  if ctx.rep then text = ctx.rep..\" \"..text; ctx.rep = false end\n  if ctx.rex then\n    local t = (ctx.rexw and \"w\" or \"\")..(ctx.rexr and \"r\" or \"\")..\n\t      (ctx.rexx and \"x\" or \"\")..(ctx.rexb and \"b\" or \"\")..\n\t      (ctx.vexl and \"l\" or \"\")\n    if ctx.vexv and ctx.vexv ~= 0 then t = t..\"v\"..ctx.vexv end\n    if t ~= \"\" then text = ctx.rex..\".\"..t..\" \"..gsub(text, \"^ \", \"\")\n    elseif ctx.rex == \"vex\" then text = gsub(\"v\"..text, \"^v \", \"\") end\n    ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false\n    ctx.rex = false; ctx.vexl = false; ctx.vexv = false\n  end\n  if ctx.seg then\n    local text2, n = gsub(text, \"%[\", \"[\"..ctx.seg..\":\")\n    if n == 0 then text = ctx.seg..\" \"..text else text = text2 end\n    ctx.seg = false\n  end\n  if ctx.lock then text = \"lock \"..text; ctx.lock = false end\n  local imm = ctx.imm\n  if imm then\n    local sym = ctx.symtab[imm]\n    if sym then text = text..\"\\t->\"..sym end\n  end\n  ctx.out(format(\"%08x  %s%s\\n\", ctx.addr+ctx.start, hex, text))\n  ctx.mrm = false\n  ctx.vexv = false\n  ctx.start = pos\n  ctx.imm = nil\nend\n\n-- Clear all prefix flags.\nlocal function clearprefixes(ctx)\n  ctx.o16 = false; ctx.seg = false; ctx.lock = false; ctx.rep = false\n  ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false\n  ctx.rex = false; ctx.a32 = false; ctx.vexl = false\nend\n\n-- Fallback for incomplete opcodes at the end.\nlocal function incomplete(ctx)\n  ctx.pos = ctx.stop+1\n  clearprefixes(ctx)\n  return putop(ctx, \"(incomplete)\")\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  clearprefixes(ctx)\n  return putop(ctx, \"(unknown)\")\nend\n\n-- Return an immediate of the specified size.\nlocal function getimm(ctx, pos, n)\n  if pos+n-1 > ctx.stop then return incomplete(ctx) end\n  local code = ctx.code\n  if n == 1 then\n    local b1 = byte(code, pos, pos)\n    return b1\n  elseif n == 2 then\n    local b1, b2 = byte(code, pos, pos+1)\n    return b1+b2*256\n  else\n    local b1, b2, b3, b4 = byte(code, pos, pos+3)\n    local imm = b1+b2*256+b3*65536+b4*16777216\n    ctx.imm = imm\n    return imm\n  end\nend\n\n-- Process pattern string and generate the operands.\nlocal function putpat(ctx, name, pat)\n  local operands, regs, sz, mode, sp, rm, sc, rx, sdisp\n  local code, pos, stop, vexl = ctx.code, ctx.pos, ctx.stop, ctx.vexl\n\n  -- Chars used: 1DFGHIMPQRSTUVWXYabcdfgijlmoprstuvwxyz\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"V\" or p == \"U\" then\n      if ctx.rexw then sz = \"Q\"; ctx.rexw = false\n      elseif ctx.o16 then sz = \"W\"; ctx.o16 = false\n      elseif p == \"U\" and ctx.x64 then sz = \"Q\"\n      else sz = \"D\" end\n      regs = map_regs[sz]\n    elseif p == \"T\" then\n      if ctx.rexw then sz = \"Q\"; ctx.rexw = false else sz = \"D\" end\n      regs = map_regs[sz]\n    elseif p == \"B\" then\n      sz = \"B\"\n      regs = ctx.rex and map_regs.B64 or map_regs.B\n    elseif match(p, \"[WDQMXYFG]\") then\n      sz = p\n      if sz == \"X\" and vexl then sz = \"Y\"; ctx.vexl = false end\n      regs = map_regs[sz]\n    elseif p == \"P\" then\n      sz = ctx.o16 and \"X\" or \"M\"; ctx.o16 = false\n      if sz == \"X\" and vexl then sz = \"Y\"; ctx.vexl = false end\n      regs = map_regs[sz]\n    elseif p == \"H\" then\n      name = name..(ctx.rexw and \"d\" or \"s\")\n      ctx.rexw = false\n    elseif p == \"S\" then\n      name = name..lower(sz)\n    elseif p == \"s\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = imm <= 127 and format(\"+0x%02x\", imm)\n\t\t     or format(\"-0x%02x\", 256-imm)\n      pos = pos+1\n    elseif p == \"u\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = format(\"0x%02x\", imm)\n      pos = pos+1\n    elseif p == \"b\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = regs[imm/16+1]\n      pos = pos+1\n    elseif p == \"w\" then\n      local imm = getimm(ctx, pos, 2); if not imm then return end\n      x = format(\"0x%x\", imm)\n      pos = pos+2\n    elseif p == \"o\" then -- [offset]\n      if ctx.x64 then\n\tlocal imm1 = getimm(ctx, pos, 4); if not imm1 then return end\n\tlocal imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end\n\tx = format(\"[0x%08x%08x]\", imm2, imm1)\n\tpos = pos+8\n      else\n\tlocal imm = getimm(ctx, pos, 4); if not imm then return end\n\tx = format(\"[0x%08x]\", imm)\n\tpos = pos+4\n      end\n    elseif p == \"i\" or p == \"I\" then\n      local n = map_sz2n[sz]\n      if n == 8 and ctx.x64 and p == \"I\" then\n\tlocal imm1 = getimm(ctx, pos, 4); if not imm1 then return end\n\tlocal imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end\n\tx = format(\"0x%08x%08x\", imm2, imm1)\n      else\n\tif n == 8 then n = 4 end\n\tlocal imm = getimm(ctx, pos, n); if not imm then return end\n\tif sz == \"Q\" and (imm < 0 or imm > 0x7fffffff) then\n\t  imm = (0xffffffff+1)-imm\n\t  x = format(imm > 65535 and \"-0x%08x\" or \"-0x%x\", imm)\n\telse\n\t  x = format(imm > 65535 and \"0x%08x\" or \"0x%x\", imm)\n\tend\n      end\n      pos = pos+n\n    elseif p == \"j\" then\n      local n = map_sz2n[sz]\n      if n == 8 then n = 4 end\n      local imm = getimm(ctx, pos, n); if not imm then return end\n      if sz == \"B\" and imm > 127 then imm = imm-256\n      elseif imm > 2147483647 then imm = imm-4294967296 end\n      pos = pos+n\n      imm = imm + pos + ctx.addr\n      if imm > 4294967295 and not ctx.x64 then imm = imm-4294967296 end\n      ctx.imm = imm\n      if sz == \"W\" then\n\tx = format(\"word 0x%04x\", imm%65536)\n      elseif ctx.x64 then\n\tlocal lo = imm % 0x1000000\n\tx = format(\"0x%02x%06x\", (imm-lo) / 0x1000000, lo)\n      else\n\tx = \"0x\"..tohex(imm)\n      end\n    elseif p == \"R\" then\n      local r = byte(code, pos-1, pos-1)%8\n      if ctx.rexb then r = r + 8; ctx.rexb = false end\n      x = regs[r+1]\n    elseif p == \"a\" then x = regs[1]\n    elseif p == \"c\" then x = \"cl\"\n    elseif p == \"d\" then x = \"dx\"\n    elseif p == \"1\" then x = \"1\"\n    else\n      if not mode then\n\tmode = ctx.mrm\n\tif not mode then\n\t  if pos > stop then return incomplete(ctx) end\n\t  mode = byte(code, pos, pos)\n\t  pos = pos+1\n\tend\n\trm = mode%8; mode = (mode-rm)/8\n\tsp = mode%8; mode = (mode-sp)/8\n\tsdisp = \"\"\n\tif mode < 3 then\n\t  if rm == 4 then\n\t    if pos > stop then return incomplete(ctx) end\n\t    sc = byte(code, pos, pos)\n\t    pos = pos+1\n\t    rm = sc%8; sc = (sc-rm)/8\n\t    rx = sc%8; sc = (sc-rx)/8\n\t    if ctx.rexx then rx = rx + 8; ctx.rexx = false end\n\t    if rx == 4 then rx = nil end\n\t  end\n\t  if mode > 0 or rm == 5 then\n\t    local dsz = mode\n\t    if dsz ~= 1 then dsz = 4 end\n\t    local disp = getimm(ctx, pos, dsz); if not disp then return end\n\t    if mode == 0 then rm = nil end\n\t    if rm or rx or (not sc and ctx.x64 and not ctx.a32) then\n\t      if dsz == 1 and disp > 127 then\n\t\tsdisp = format(\"-0x%x\", 256-disp)\n\t      elseif disp >= 0 and disp <= 0x7fffffff then\n\t\tsdisp = format(\"+0x%x\", disp)\n\t      else\n\t\tsdisp = format(\"-0x%x\", (0xffffffff+1)-disp)\n\t      end\n\t    else\n\t      sdisp = format(ctx.x64 and not ctx.a32 and\n\t\tnot (disp >= 0 and disp <= 0x7fffffff)\n\t\tand \"0xffffffff%08x\" or \"0x%08x\", disp)\n\t    end\n\t    pos = pos+dsz\n\t  end\n\tend\n\tif rm and ctx.rexb then rm = rm + 8; ctx.rexb = false end\n\tif ctx.rexr then sp = sp + 8; ctx.rexr = false end\n      end\n      if p == \"m\" then\n\tif mode == 3 then x = regs[rm+1]\n\telse\n\t  local aregs = ctx.a32 and map_regs.D or ctx.aregs\n\t  local srm, srx = \"\", \"\"\n\t  if rm then srm = aregs[rm+1]\n\t  elseif not sc and ctx.x64 and not ctx.a32 then srm = \"rip\" end\n\t  ctx.a32 = false\n\t  if rx then\n\t    if rm then srm = srm..\"+\" end\n\t    srx = aregs[rx+1]\n\t    if sc > 0 then srx = srx..\"*\"..(2^sc) end\n\t  end\n\t  x = format(\"[%s%s%s]\", srm, srx, sdisp)\n\tend\n\tif mode < 3 and\n\t   (not match(pat, \"[aRrgp]\") or match(pat, \"t\")) then -- Yuck.\n\t  x = map_sz2prefix[sz]..\" \"..x\n\tend\n      elseif p == \"r\" then x = regs[sp+1]\n      elseif p == \"g\" then x = map_segregs[sp+1]\n      elseif p == \"p\" then -- Suppress prefix.\n      elseif p == \"f\" then x = \"st\"..rm\n      elseif p == \"x\" then\n\tif sp == 0 and ctx.lock and not ctx.x64 then\n\t  x = \"CR8\"; ctx.lock = false\n\telse\n\t  x = \"CR\"..sp\n\tend\n      elseif p == \"v\" then\n\tif ctx.vexv then\n\t  x = regs[ctx.vexv+1]; ctx.vexv = false\n\tend\n      elseif p == \"y\" then x = \"DR\"..sp\n      elseif p == \"z\" then x = \"TR\"..sp\n      elseif p == \"l\" then vexl = false\n      elseif p == \"t\" then\n      else\n\terror(\"bad pattern `\"..pat..\"'\")\n      end\n    end\n    if x then operands = operands and operands..\", \"..x or x end\n  end\n  ctx.pos = pos\n  return putop(ctx, name, operands)\nend\n\n-- Forward declaration.\nlocal map_act\n\n-- Fetch and cache MRM byte.\nlocal function getmrm(ctx)\n  local mrm = ctx.mrm\n  if not mrm then\n    local pos = ctx.pos\n    if pos > ctx.stop then return nil end\n    mrm = byte(ctx.code, pos, pos)\n    ctx.pos = pos+1\n    ctx.mrm = mrm\n  end\n  return mrm\nend\n\n-- Dispatch to handler depending on pattern.\nlocal function dispatch(ctx, opat, patgrp)\n  if not opat then return unknown(ctx) end\n  if match(opat, \"%|\") then -- MMX/SSE variants depending on prefix.\n    local p\n    if ctx.rep then\n      p = ctx.rep==\"rep\" and \"%|([^%|]*)\" or \"%|[^%|]*%|[^%|]*%|([^%|]*)\"\n      ctx.rep = false\n    elseif ctx.o16 then p = \"%|[^%|]*%|([^%|]*)\"; ctx.o16 = false\n    else p = \"^[^%|]*\" end\n    opat = match(opat, p)\n    if not opat then return unknown(ctx) end\n--    ctx.rep = false; ctx.o16 = false\n    --XXX fails for 66 f2 0f 38 f1 06  crc32 eax,WORD PTR [esi]\n    --XXX remove in branches?\n  end\n  if match(opat, \"%$\") then -- reg$mem variants.\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    opat = match(opat, mrm >= 192 and \"^[^%$]*\" or \"%$(.*)\")\n    if opat == \"\" then return unknown(ctx) end\n  end\n  if opat == \"\" then return unknown(ctx) end\n  local name, pat = match(opat, \"^([a-z0-9 ]*)(.*)\")\n  if pat == \"\" and patgrp then pat = patgrp end\n  return map_act[sub(pat, 1, 1)](ctx, name, pat)\nend\n\n-- Get a pattern from an opcode map and dispatch to handler.\nlocal function dispatchmap(ctx, opcmap)\n  local pos = ctx.pos\n  local opat = opcmap[byte(ctx.code, pos, pos)]\n  pos = pos + 1\n  ctx.pos = pos\n  return dispatch(ctx, opat)\nend\n\n-- Map for action codes. The key is the first char after the name.\nmap_act = {\n  -- Simple opcodes without operands.\n  [\"\"] = function(ctx, name, pat)\n    return putop(ctx, name)\n  end,\n\n  -- Operand size chars fall right through.\n  B = putpat, W = putpat, D = putpat, Q = putpat,\n  V = putpat, U = putpat, T = putpat,\n  M = putpat, X = putpat, P = putpat,\n  F = putpat, G = putpat, Y = putpat,\n  H = putpat,\n\n  -- Collect prefixes.\n  [\":\"] = function(ctx, name, pat)\n    ctx[pat == \":\" and name or sub(pat, 2)] = name\n    if ctx.pos - ctx.start > 5 then return unknown(ctx) end -- Limit #prefixes.\n  end,\n\n  -- Chain to special handler specified by name.\n  [\"*\"] = function(ctx, name, pat)\n    return map_act[name](ctx, name, sub(pat, 2))\n  end,\n\n  -- Use named subtable for opcode group.\n  [\"!\"] = function(ctx, name, pat)\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    return dispatch(ctx, map_opcgroup[name][((mrm-(mrm%8))/8)%8+1], sub(pat, 2))\n  end,\n\n  -- o16,o32[,o64] variants.\n  sz = function(ctx, name, pat)\n    if ctx.o16 then ctx.o16 = false\n    else\n      pat = match(pat, \",(.*)\")\n      if ctx.rexw then\n\tlocal p = match(pat, \",(.*)\")\n\tif p then pat = p; ctx.rexw = false end\n      end\n    end\n    pat = match(pat, \"^[^,]*\")\n    return dispatch(ctx, pat)\n  end,\n\n  -- Two-byte opcode dispatch.\n  opc2 = function(ctx, name, pat)\n    return dispatchmap(ctx, map_opc2)\n  end,\n\n  -- Three-byte opcode dispatch.\n  opc3 = function(ctx, name, pat)\n    return dispatchmap(ctx, map_opc3[pat])\n  end,\n\n  -- VMX/SVM dispatch.\n  vm = function(ctx, name, pat)\n    return dispatch(ctx, map_opcvm[ctx.mrm])\n  end,\n\n  -- Floating point opcode dispatch.\n  fp = function(ctx, name, pat)\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    local rm = mrm%8\n    local idx = pat*8 + ((mrm-rm)/8)%8\n    if mrm >= 192 then idx = idx + 64 end\n    local opat = map_opcfp[idx]\n    if type(opat) == \"table\" then opat = opat[rm+1] end\n    return dispatch(ctx, opat)\n  end,\n\n  -- REX prefix.\n  rex = function(ctx, name, pat)\n    if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed.\n    for p in gmatch(pat, \".\") do ctx[\"rex\"..p] = true end\n    ctx.rex = \"rex\"\n  end,\n\n  -- VEX prefix.\n  vex = function(ctx, name, pat)\n    if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed.\n    ctx.rex = \"vex\"\n    local pos = ctx.pos\n    if ctx.mrm then\n      ctx.mrm = nil\n      pos = pos-1\n    end\n    local b = byte(ctx.code, pos, pos)\n    if not b then return incomplete(ctx) end\n    pos = pos+1\n    if b < 128 then ctx.rexr = true end\n    local m = 1\n    if pat == \"3\" then\n      m = b%32; b = (b-m)/32\n      local nb = b%2; b = (b-nb)/2\n      if nb == 0 then ctx.rexb = true end\n      local nx = b%2\n      if nx == 0 then ctx.rexx = true end\n      b = byte(ctx.code, pos, pos)\n      if not b then return incomplete(ctx) end\n      pos = pos+1\n      if b >= 128 then ctx.rexw = true end\n    end\n    ctx.pos = pos\n    local map\n    if m == 1 then map = map_opc2\n    elseif m == 2 then map = map_opc3[\"38\"]\n    elseif m == 3 then map = map_opc3[\"3a\"]\n    else return unknown(ctx) end\n    local p = b%4; b = (b-p)/4\n    if p == 1 then ctx.o16 = \"o16\"\n    elseif p == 2 then ctx.rep = \"rep\"\n    elseif p == 3 then ctx.rep = \"repne\" end\n    local l = b%2; b = (b-l)/2\n    if l ~= 0 then ctx.vexl = true end\n    ctx.vexv = (-1-b)%16\n    return dispatchmap(ctx, map)\n  end,\n\n  -- Special case for nop with REX prefix.\n  nop = function(ctx, name, pat)\n    return dispatch(ctx, ctx.rex and pat or \"nop\")\n  end,\n\n  -- Special case for 0F 77.\n  emms = function(ctx, name, pat)\n    if ctx.rex ~= \"vex\" then\n      return putop(ctx, \"emms\")\n    elseif ctx.vexl then\n      ctx.vexl = false\n      return putop(ctx, \"zeroall\")\n    else\n      return putop(ctx, \"zeroupper\")\n    end\n  end,\n}\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ofs = ofs + 1\n  ctx.start = ofs\n  ctx.pos = ofs\n  ctx.stop = stop\n  ctx.imm = nil\n  ctx.mrm = false\n  clearprefixes(ctx)\n  while ctx.pos <= stop do dispatchmap(ctx, ctx.map1) end\n  if ctx.pos ~= ctx.start then incomplete(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = (addr or 0) - 1\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 16\n  ctx.x64 = false\n  ctx.map1 = map_opc1_32\n  ctx.aregs = map_regs.D\n  return ctx\nend\n\nlocal function create64(code, addr, out)\n  local ctx = create(code, addr, out)\n  ctx.x64 = true\n  ctx.map1 = map_opc1_64\n  ctx.aregs = map_regs.Q\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\nlocal function disass64(code, addr, out)\n  create64(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 8 then return map_regs.D[r+1] end\n  return map_regs.X[r-7]\nend\n\nlocal function regname64(r)\n  if r < 16 then return map_regs.Q[r+1] end\n  return map_regs.X[r-15]\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  create64 = create64,\n  disass = disass,\n  disass64 = disass64,\n  regname = regname,\n  regname64 = regname64\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dis_x86.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 3244c54564aeae24daa6a81b810b9d3f\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dump.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT compiler dump module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module can be used to debug the JIT compiler itself. It dumps the\n-- code representations and structures used in various compiler stages.\n--\n-- Example usage:\n--\n--   luajit -jdump -e \"local x=0; for i=1,1e6 do x=x+i end; print(x)\"\n--   luajit -jdump=im -e \"for i=1,1000 do for j=1,1000 do end end\" | less -R\n--   luajit -jdump=is myapp.lua | less -R\n--   luajit -jdump=-b myapp.lua\n--   luajit -jdump=+aH,myapp.html myapp.lua\n--   luajit -jdump=ixT,myapp.dump myapp.lua\n--\n-- The first argument specifies the dump mode. The second argument gives\n-- the output file name. Default output is to stdout, unless the environment\n-- variable LUAJIT_DUMPFILE is set. The file is overwritten every time the\n-- module is started.\n--\n-- Different features can be turned on or off with the dump mode. If the\n-- mode starts with a '+', the following features are added to the default\n-- set of features; a '-' removes them. Otherwise the features are replaced.\n--\n-- The following dump features are available (* marks the default):\n--\n--  * t  Print a line for each started, ended or aborted trace (see also -jv).\n--  * b  Dump the traced bytecode.\n--  * i  Dump the IR (intermediate representation).\n--    r  Augment the IR with register/stack slots.\n--    s  Dump the snapshot map.\n--  * m  Dump the generated machine code.\n--    x  Print each taken trace exit.\n--    X  Print each taken trace exit and the contents of all registers.\n--    a  Print the IR of aborted traces, too.\n--\n-- The output format can be set with the following characters:\n--\n--    T  Plain text output.\n--    A  ANSI-colored text output\n--    H  Colorized HTML + CSS output.\n--\n-- The default output format is plain text. It's set to ANSI-colored text\n-- if the COLORTERM variable is set. Note: this is independent of any output\n-- redirection, which is actually considered a feature.\n--\n-- You probably want to use less -R to enjoy viewing ANSI-colored text from\n-- a pipe or a file. Add this to your ~/.bashrc: export LESS=\"-R\"\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal funcinfo, funcbc = jutil.funcinfo, jutil.funcbc\nlocal traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek\nlocal tracemc, tracesnap = jutil.tracemc, jutil.tracesnap\nlocal traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr\nlocal bit = require(\"bit\")\nlocal band, shr, tohex = bit.band, bit.rshift, bit.tohex\nlocal sub, gsub, format = string.sub, string.gsub, string.format\nlocal byte, rep = string.byte, string.rep\nlocal type, tostring = type, tostring\nlocal stdout, stderr = io.stdout, io.stderr\n\n-- Load other modules on-demand.\nlocal bcline, disass\n\n-- Active flag, output file handle and dump mode.\nlocal active, out, dumpmode\n\n------------------------------------------------------------------------------\n\nlocal symtabmt = { __index = false }\nlocal symtab = {}\nlocal nexitsym = 0\n\n-- Fill nested symbol table with per-trace exit stub addresses.\nlocal function fillsymtab_tr(tr, nexit)\n  local t = {}\n  symtabmt.__index = t\n  if jit.arch:sub(1, 4) == \"mips\" then\n    t[traceexitstub(tr, 0)] = \"exit\"\n    return\n  end\n  for i=0,nexit-1 do\n    local addr = traceexitstub(tr, i)\n    if addr < 0 then addr = addr + 2^32 end\n    t[addr] = tostring(i)\n  end\n  local addr = traceexitstub(tr, nexit)\n  if addr then t[addr] = \"stack_check\" end\nend\n\n-- Fill symbol table with trace exit stub addresses.\nlocal function fillsymtab(tr, nexit)\n  local t = symtab\n  if nexitsym == 0 then\n    local ircall = vmdef.ircall\n    for i=0,#ircall do\n      local addr = ircalladdr(i)\n      if addr ~= 0 then\n\tif addr < 0 then addr = addr + 2^32 end\n\tt[addr] = ircall[i]\n      end\n    end\n  end\n  if nexitsym == 1000000 then -- Per-trace exit stubs.\n    fillsymtab_tr(tr, nexit)\n  elseif nexit > nexitsym then -- Shared exit stubs.\n    for i=nexitsym,nexit-1 do\n      local addr = traceexitstub(i)\n      if addr == nil then -- Fall back to per-trace exit stubs.\n\tfillsymtab_tr(tr, nexit)\n\tsetmetatable(symtab, symtabmt)\n\tnexit = 1000000\n\tbreak\n      end\n      if addr < 0 then addr = addr + 2^32 end\n      t[addr] = tostring(i)\n    end\n    nexitsym = nexit\n  end\n  return t\nend\n\nlocal function dumpwrite(s)\n  out:write(s)\nend\n\n-- Disassemble machine code.\nlocal function dump_mcode(tr)\n  local info = traceinfo(tr)\n  if not info then return end\n  local mcode, addr, loop = tracemc(tr)\n  if not mcode then return end\n  if not disass then disass = require(\"jit.dis_\"..jit.arch) end\n  if addr < 0 then addr = addr + 2^32 end\n  out:write(\"---- TRACE \", tr, \" mcode \", #mcode, \"\\n\")\n  local ctx = disass.create(mcode, addr, dumpwrite)\n  ctx.hexdump = 0\n  ctx.symtab = fillsymtab(tr, info.nexit)\n  if loop ~= 0 then\n    symtab[addr+loop] = \"LOOP\"\n    ctx:disass(0, loop)\n    out:write(\"->LOOP:\\n\")\n    ctx:disass(loop, #mcode-loop)\n    symtab[addr+loop] = nil\n  else\n    ctx:disass(0, #mcode)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal irtype_text = {\n  [0] = \"nil\",\n  \"fal\",\n  \"tru\",\n  \"lud\",\n  \"str\",\n  \"p32\",\n  \"thr\",\n  \"pro\",\n  \"fun\",\n  \"p64\",\n  \"cdt\",\n  \"tab\",\n  \"udt\",\n  \"flt\",\n  \"num\",\n  \"i8 \",\n  \"u8 \",\n  \"i16\",\n  \"u16\",\n  \"int\",\n  \"u32\",\n  \"i64\",\n  \"u64\",\n  \"sfp\",\n}\n\nlocal colortype_ansi = {\n  [0] = \"%s\",\n  \"%s\",\n  \"%s\",\n  \"\\027[36m%s\\027[m\",\n  \"\\027[32m%s\\027[m\",\n  \"%s\",\n  \"\\027[1m%s\\027[m\",\n  \"%s\",\n  \"\\027[1m%s\\027[m\",\n  \"%s\",\n  \"\\027[33m%s\\027[m\",\n  \"\\027[31m%s\\027[m\",\n  \"\\027[36m%s\\027[m\",\n  \"\\027[34m%s\\027[m\",\n  \"\\027[34m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n}\n\nlocal function colorize_text(s)\n  return s\nend\n\nlocal function colorize_ansi(s, t)\n  return format(colortype_ansi[t], s)\nend\n\nlocal irtype_ansi = setmetatable({},\n  { __index = function(tab, t)\n      local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end })\n\nlocal html_escape = { [\"<\"] = \"&lt;\", [\">\"] = \"&gt;\", [\"&\"] = \"&amp;\", }\n\nlocal function colorize_html(s, t)\n  s = gsub(s, \"[<>&]\", html_escape)\n  return format('<span class=\"irt_%s\">%s</span>', irtype_text[t], s)\nend\n\nlocal irtype_html = setmetatable({},\n  { __index = function(tab, t)\n      local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end })\n\nlocal header_html = [[\n<style type=\"text/css\">\nbackground { background: #ffffff; color: #000000; }\npre.ljdump {\nfont-size: 10pt;\nbackground: #f0f4ff;\ncolor: #000000;\nborder: 1px solid #bfcfff;\npadding: 0.5em;\nmargin-left: 2em;\nmargin-right: 2em;\n}\nspan.irt_str { color: #00a000; }\nspan.irt_thr, span.irt_fun { color: #404040; font-weight: bold; }\nspan.irt_tab { color: #c00000; }\nspan.irt_udt, span.irt_lud { color: #00c0c0; }\nspan.irt_num { color: #4040c0; }\nspan.irt_int, span.irt_i8, span.irt_u8, span.irt_i16, span.irt_u16 { color: #b040b0; }\n</style>\n]]\n\nlocal colorize, irtype\n\n-- Lookup tables to convert some literals into names.\nlocal litname = {\n  [\"SLOAD \"] = setmetatable({}, { __index = function(t, mode)\n    local s = \"\"\n    if band(mode, 1) ~= 0 then s = s..\"P\" end\n    if band(mode, 2) ~= 0 then s = s..\"F\" end\n    if band(mode, 4) ~= 0 then s = s..\"T\" end\n    if band(mode, 8) ~= 0 then s = s..\"C\" end\n    if band(mode, 16) ~= 0 then s = s..\"R\" end\n    if band(mode, 32) ~= 0 then s = s..\"I\" end\n    t[mode] = s\n    return s\n  end}),\n  [\"XLOAD \"] = { [0] = \"\", \"R\", \"V\", \"RV\", \"U\", \"RU\", \"VU\", \"RVU\", },\n  [\"CONV  \"] = setmetatable({}, { __index = function(t, mode)\n    local s = irtype[band(mode, 31)]\n    s = irtype[band(shr(mode, 5), 31)]..\".\"..s\n    if band(mode, 0x800) ~= 0 then s = s..\" sext\" end\n    local c = shr(mode, 14)\n    if c == 2 then s = s..\" index\" elseif c == 3 then s = s..\" check\" end\n    t[mode] = s\n    return s\n  end}),\n  [\"FLOAD \"] = vmdef.irfield,\n  [\"FREF  \"] = vmdef.irfield,\n  [\"FPMATH\"] = vmdef.irfpm,\n  [\"BUFHDR\"] = { [0] = \"RESET\", \"APPEND\" },\n  [\"TOSTR \"] = { [0] = \"INT\", \"NUM\", \"CHAR\" },\n}\n\nlocal function ctlsub(c)\n  if c == \"\\n\" then return \"\\\\n\"\n  elseif c == \"\\r\" then return \"\\\\r\"\n  elseif c == \"\\t\" then return \"\\\\t\"\n  else return format(\"\\\\%03d\", byte(c))\n  end\nend\n\nlocal function fmtfunc(func, pc)\n  local fi = funcinfo(func, pc)\n  if fi.loc then\n    return fi.loc\n  elseif fi.ffid then\n    return vmdef.ffnames[fi.ffid]\n  elseif fi.addr then\n    return format(\"C:%x\", fi.addr)\n  else\n    return \"(?)\"\n  end\nend\n\nlocal function formatk(tr, idx, sn)\n  local k, t, slot = tracek(tr, idx)\n  local tn = type(k)\n  local s\n  if tn == \"number\" then\n    if band(sn or 0, 0x30000) ~= 0 then\n      s = band(sn, 0x20000) ~= 0 and \"contpc\" or \"ftsz\"\n    elseif k == 2^52+2^51 then\n      s = \"bias\"\n    else\n      s = format(0 < k and k < 0x1p-1026 and \"%+a\" or \"%+.14g\", k)\n    end\n  elseif tn == \"string\" then\n    s = format(#k > 20 and '\"%.20s\"~' or '\"%s\"', gsub(k, \"%c\", ctlsub))\n  elseif tn == \"function\" then\n    s = fmtfunc(k)\n  elseif tn == \"table\" then\n    s = format(\"{%p}\", k)\n  elseif tn == \"userdata\" then\n    if t == 12 then\n      s = format(\"userdata:%p\", k)\n    else\n      s = format(\"[%p]\", k)\n      if s == \"[NULL]\" then s = \"NULL\" end\n    end\n  elseif t == 21 then -- int64_t\n    s = sub(tostring(k), 1, -3)\n    if sub(s, 1, 1) ~= \"-\" then s = \"+\"..s end\n  elseif sn == 0x1057fff then -- SNAP(1, SNAP_FRAME | SNAP_NORESTORE, REF_NIL)\n    return \"----\" -- Special case for LJ_FR2 slot 1.\n  else\n    s = tostring(k) -- For primitives.\n  end\n  s = colorize(format(\"%-4s\", s), t)\n  if slot then\n    s = format(\"%s @%d\", s, slot)\n  end\n  return s\nend\n\nlocal function printsnap(tr, snap)\n  local n = 2\n  for s=0,snap[1]-1 do\n    local sn = snap[n]\n    if shr(sn, 24) == s then\n      n = n + 1\n      local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS\n      if ref < 0 then\n\tout:write(formatk(tr, ref, sn))\n      elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM\n\tout:write(colorize(format(\"%04d/%04d\", ref, ref+1), 14))\n      else\n\tlocal m, ot, op1, op2 = traceir(tr, ref)\n\tout:write(colorize(format(\"%04d\", ref), band(ot, 31)))\n      end\n      out:write(band(sn, 0x10000) == 0 and \" \" or \"|\") -- SNAP_FRAME\n    else\n      out:write(\"---- \")\n    end\n  end\n  out:write(\"]\\n\")\nend\n\n-- Dump snapshots (not interleaved with IR).\nlocal function dump_snap(tr)\n  out:write(\"---- TRACE \", tr, \" snapshots\\n\")\n  for i=0,1000000000 do\n    local snap = tracesnap(tr, i)\n    if not snap then break end\n    out:write(format(\"#%-3d %04d [ \", i, snap[0]))\n    printsnap(tr, snap)\n  end\nend\n\n-- Return a register name or stack slot for a rid/sp location.\nlocal function ridsp_name(ridsp, ins)\n  if not disass then disass = require(\"jit.dis_\"..jit.arch) end\n  local rid, slot = band(ridsp, 0xff), shr(ridsp, 8)\n  if rid == 253 or rid == 254 then\n    return (slot == 0 or slot == 255) and \" {sink\" or format(\" {%04d\", ins-slot)\n  end\n  if ridsp > 255 then return format(\"[%x]\", slot*4) end\n  if rid < 128 then return disass.regname(rid) end\n  return \"\"\nend\n\n-- Dump CALL* function ref and return optional ctype.\nlocal function dumpcallfunc(tr, ins)\n  local ctype\n  if ins > 0 then\n    local m, ot, op1, op2 = traceir(tr, ins)\n    if band(ot, 31) == 0 then -- nil type means CARG(func, ctype).\n      ins = op1\n      ctype = formatk(tr, op2)\n    end\n  end\n  if ins < 0 then\n    out:write(format(\"[0x%x](\", tonumber((tracek(tr, ins)))))\n  else\n    out:write(format(\"%04d (\", ins))\n  end\n  return ctype\nend\n\n-- Recursively gather CALL* args and dump them.\nlocal function dumpcallargs(tr, ins)\n  if ins < 0 then\n    out:write(formatk(tr, ins))\n  else\n    local m, ot, op1, op2 = traceir(tr, ins)\n    local oidx = 6*shr(ot, 8)\n    local op = sub(vmdef.irnames, oidx+1, oidx+6)\n    if op == \"CARG  \" then\n      dumpcallargs(tr, op1)\n      if op2 < 0 then\n\tout:write(\" \", formatk(tr, op2))\n      else\n\tout:write(\" \", format(\"%04d\", op2))\n      end\n    else\n      out:write(format(\"%04d\", ins))\n    end\n  end\nend\n\n-- Dump IR and interleaved snapshots.\nlocal function dump_ir(tr, dumpsnap, dumpreg)\n  local info = traceinfo(tr)\n  if not info then return end\n  local nins = info.nins\n  out:write(\"---- TRACE \", tr, \" IR\\n\")\n  local irnames = vmdef.irnames\n  local snapref = 65536\n  local snap, snapno\n  if dumpsnap then\n    snap = tracesnap(tr, 0)\n    snapref = snap[0]\n    snapno = 0\n  end\n  for ins=1,nins do\n    if ins >= snapref then\n      if dumpreg then\n\tout:write(format(\"....              SNAP   #%-3d [ \", snapno))\n      else\n\tout:write(format(\"....        SNAP   #%-3d [ \", snapno))\n      end\n      printsnap(tr, snap)\n      snapno = snapno + 1\n      snap = tracesnap(tr, snapno)\n      snapref = snap and snap[0] or 65536\n    end\n    local m, ot, op1, op2, ridsp = traceir(tr, ins)\n    local oidx, t = 6*shr(ot, 8), band(ot, 31)\n    local op = sub(irnames, oidx+1, oidx+6)\n    if op == \"LOOP  \" then\n      if dumpreg then\n\tout:write(format(\"%04d ------------ LOOP ------------\\n\", ins))\n      else\n\tout:write(format(\"%04d ------ LOOP ------------\\n\", ins))\n      end\n    elseif op ~= \"NOP   \" and op ~= \"CARG  \" and\n\t   (dumpreg or op ~= \"RENAME\") then\n      local rid = band(ridsp, 255)\n      if dumpreg then\n\tout:write(format(\"%04d %-6s\", ins, ridsp_name(ridsp, ins)))\n      else\n\tout:write(format(\"%04d \", ins))\n      end\n      out:write(format(\"%s%s %s %s \",\n\t\t       (rid == 254 or rid == 253) and \"}\" or\n\t\t       (band(ot, 128) == 0 and \" \" or \">\"),\n\t\t       band(ot, 64) == 0 and \" \" or \"+\",\n\t\t       irtype[t], op))\n      local m1, m2 = band(m, 3), band(m, 3*4)\n      if sub(op, 1, 4) == \"CALL\" then\n\tlocal ctype\n\tif m2 == 1*4 then -- op2 == IRMlit\n\t  out:write(format(\"%-10s  (\", vmdef.ircall[op2]))\n\telse\n\t  ctype = dumpcallfunc(tr, op2)\n\tend\n\tif op1 ~= -1 then dumpcallargs(tr, op1) end\n\tout:write(\")\")\n\tif ctype then out:write(\" ctype \", ctype) end\n      elseif op == \"CNEW  \" and op2 == -1 then\n\tout:write(formatk(tr, op1))\n      elseif m1 ~= 3 then -- op1 != IRMnone\n\tif op1 < 0 then\n\t  out:write(formatk(tr, op1))\n\telse\n\t  out:write(format(m1 == 0 and \"%04d\" or \"#%-3d\", op1))\n\tend\n\tif m2 ~= 3*4 then -- op2 != IRMnone\n\t  if m2 == 1*4 then -- op2 == IRMlit\n\t    local litn = litname[op]\n\t    if litn and litn[op2] then\n\t      out:write(\"  \", litn[op2])\n\t    elseif op == \"UREFO \" or op == \"UREFC \" then\n\t      out:write(format(\"  #%-3d\", shr(op2, 8)))\n\t    else\n\t      out:write(format(\"  #%-3d\", op2))\n\t    end\n\t  elseif op2 < 0 then\n\t    out:write(\"  \", formatk(tr, op2))\n\t  else\n\t    out:write(format(\"  %04d\", op2))\n\t  end\n\tend\n      end\n      out:write(\"\\n\")\n    end\n  end\n  if snap then\n    if dumpreg then\n      out:write(format(\"....              SNAP   #%-3d [ \", snapno))\n    else\n      out:write(format(\"....        SNAP   #%-3d [ \", snapno))\n    end\n    printsnap(tr, snap)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal recprefix = \"\"\nlocal recdepth = 0\n\n-- Format trace error message.\nlocal function fmterr(err, info)\n  if type(err) == \"number\" then\n    if type(info) == \"function\" then info = fmtfunc(info) end\n    err = format(vmdef.traceerr[err], info)\n  end\n  return err\nend\n\n-- Dump trace states.\nlocal function dump_trace(what, tr, func, pc, otr, oex)\n  if what == \"stop\" or (what == \"abort\" and dumpmode.a) then\n    if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == \"stop\")\n    elseif dumpmode.s then dump_snap(tr) end\n    if dumpmode.m then dump_mcode(tr) end\n  end\n  if what == \"start\" then\n    if dumpmode.H then out:write('<pre class=\"ljdump\">\\n') end\n    out:write(\"---- TRACE \", tr, \" \", what)\n    if otr then out:write(\" \", otr, \"/\", oex == -1 and \"stitch\" or oex) end\n    out:write(\" \", fmtfunc(func, pc), \"\\n\")\n  elseif what == \"stop\" or what == \"abort\" then\n    out:write(\"---- TRACE \", tr, \" \", what)\n    if what == \"abort\" then\n      out:write(\" \", fmtfunc(func, pc), \" -- \", fmterr(otr, oex), \"\\n\")\n    else\n      local info = traceinfo(tr)\n      local link, ltype = info.link, info.linktype\n      if link == tr or link == 0 then\n\tout:write(\" -> \", ltype, \"\\n\")\n      elseif ltype == \"root\" then\n\tout:write(\" -> \", link, \"\\n\")\n      else\n\tout:write(\" -> \", link, \" \", ltype, \"\\n\")\n      end\n    end\n    if dumpmode.H then out:write(\"</pre>\\n\\n\") else out:write(\"\\n\") end\n  else\n    if what == \"flush\" then symtab, nexitsym = {}, 0 end\n    out:write(\"---- TRACE \", what, \"\\n\\n\")\n  end\n  out:flush()\nend\n\n-- Dump recorded bytecode.\nlocal function dump_record(tr, func, pc, depth, callee)\n  if depth ~= recdepth then\n    recdepth = depth\n    recprefix = rep(\" .\", depth)\n  end\n  local line\n  if pc >= 0 then\n    line = bcline(func, pc, recprefix)\n    if dumpmode.H then line = gsub(line, \"[<>&]\", html_escape) end\n    if pc > 0 then\n      line = sub(line, 1, -2) .. \"       (\" .. fmtfunc(func, pc) .. \")\\n\"\n    end\n  else\n    line = \"0000 \"..recprefix..\" FUNCC      \\n\"\n    callee = func\n  end\n  if pc <= 0 then\n    out:write(sub(line, 1, -2), \"         ; \", fmtfunc(func), \"\\n\")\n  else\n    out:write(line)\n  end\n  if pc >= 0 and band(funcbc(func, pc), 0xff) < 16 then -- ORDER BC\n    out:write(bcline(func, pc+1, recprefix)) -- Write JMP for cond.\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Dump taken trace exits.\nlocal function dump_texit(tr, ex, ngpr, nfpr, ...)\n  out:write(\"---- TRACE \", tr, \" exit \", ex, \"\\n\")\n  if dumpmode.X then\n    local regs = {...}\n    if jit.arch == \"x64\" then\n      for i=1,ngpr do\n\tout:write(format(\" %016x\", regs[i]))\n\tif i % 4 == 0 then out:write(\"\\n\") end\n      end\n    else\n      for i=1,ngpr do\n\tout:write(\" \", tohex(regs[i]))\n\tif i % 8 == 0 then out:write(\"\\n\") end\n      end\n    end\n    if jit.arch == \"mips\" or jit.arch == \"mipsel\" then\n      for i=1,nfpr,2 do\n\tout:write(format(\" %+17.14g\", regs[ngpr+i]))\n\tif i % 8 == 7 then out:write(\"\\n\") end\n      end\n    else\n      for i=1,nfpr do\n\tout:write(format(\" %+17.14g\", regs[ngpr+i]))\n\tif i % 4 == 0 then out:write(\"\\n\") end\n      end\n    end\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Detach dump handlers.\nlocal function dumpoff()\n  if active then\n    active = false\n    jit.attach(dump_texit)\n    jit.attach(dump_record)\n    jit.attach(dump_trace)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach dump handlers.\nlocal function dumpon(opt, outfile)\n  if active then dumpoff() end\n\n  local term = os.getenv(\"TERM\")\n  local colormode = (term and term:match(\"color\") or os.getenv(\"COLORTERM\")) and \"A\" or \"T\"\n  if opt then\n    opt = gsub(opt, \"[TAH]\", function(mode) colormode = mode; return \"\"; end)\n  end\n\n  local m = { t=true, b=true, i=true, m=true, }\n  if opt and opt ~= \"\" then\n    local o = sub(opt, 1, 1)\n    if o ~= \"+\" and o ~= \"-\" then m = {} end\n    for i=1,#opt do m[sub(opt, i, i)] = (o ~= \"-\") end\n  end\n  dumpmode = m\n\n  if m.t or m.b or m.i or m.s or m.m then\n    jit.attach(dump_trace, \"trace\")\n  end\n  if m.b then\n    jit.attach(dump_record, \"record\")\n    if not bcline then bcline = require(\"jit.bc\").line end\n  end\n  if m.x or m.X then\n    jit.attach(dump_texit, \"texit\")\n  end\n\n  if not outfile then outfile = os.getenv(\"LUAJIT_DUMPFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stdout\n  end\n\n  m[colormode] = true\n  if colormode == \"A\" then\n    colorize = colorize_ansi\n    irtype = irtype_ansi\n  elseif colormode == \"H\" then\n    colorize = colorize_html\n    irtype = irtype_html\n    out:write(header_html)\n  else\n    colorize = colorize_text\n    irtype = irtype_text\n  end\n\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  on = dumpon,\n  off = dumpoff,\n  start = dumpon -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/dump.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 4d03e3137c36cc2468b3fbc7d489f17e\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/p.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT profiler.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module is a simple command line interface to the built-in\n-- low-overhead profiler of LuaJIT.\n--\n-- The lower-level API of the profiler is accessible via the \"jit.profile\"\n-- module or the luaJIT_profile_* C API.\n--\n-- Example usage:\n--\n--   luajit -jp myapp.lua\n--   luajit -jp=s myapp.lua\n--   luajit -jp=-s myapp.lua\n--   luajit -jp=vl myapp.lua\n--   luajit -jp=G,profile.txt myapp.lua\n--\n-- The following dump features are available:\n--\n--   f  Stack dump: function name, otherwise module:line. Default mode.\n--   F  Stack dump: ditto, but always prepend module.\n--   l  Stack dump: module:line.\n--   <number> stack dump depth (callee < caller). Default: 1.\n--   -<number> Inverse stack dump depth (caller > callee).\n--   s  Split stack dump after first stack level. Implies abs(depth) >= 2.\n--   p  Show full path for module names.\n--   v  Show VM states. Can be combined with stack dumps, e.g. vf or fv.\n--   z  Show zones. Can be combined with stack dumps, e.g. zf or fz.\n--   r  Show raw sample counts. Default: show percentages.\n--   a  Annotate excerpts from source code files.\n--   A  Annotate complete source code files.\n--   G  Produce raw output suitable for graphical tools (e.g. flame graphs).\n--   m<number> Minimum sample percentage to be shown. Default: 3.\n--   i<number> Sampling interval in milliseconds. Default: 10.\n--\n----------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal profile = require(\"jit.profile\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal math = math\nlocal pairs, ipairs, tonumber, floor = pairs, ipairs, tonumber, math.floor\nlocal sort, format = table.sort, string.format\nlocal stdout = io.stdout\nlocal zone -- Load jit.zone module on demand.\n\n-- Output file handle.\nlocal out\n\n------------------------------------------------------------------------------\n\nlocal prof_ud\nlocal prof_states, prof_split, prof_min, prof_raw, prof_fmt, prof_depth\nlocal prof_ann, prof_count1, prof_count2, prof_samples\n\nlocal map_vmmode = {\n  N = \"Compiled\",\n  I = \"Interpreted\",\n  C = \"C code\",\n  G = \"Garbage Collector\",\n  J = \"JIT Compiler\",\n}\n\n-- Profiler callback.\nlocal function prof_cb(th, samples, vmmode)\n  prof_samples = prof_samples + samples\n  local key_stack, key_stack2, key_state\n  -- Collect keys for sample.\n  if prof_states then\n    if prof_states == \"v\" then\n      key_state = map_vmmode[vmmode] or vmmode\n    else\n      key_state = zone:get() or \"(none)\"\n    end\n  end\n  if prof_fmt then\n    key_stack = profile.dumpstack(th, prof_fmt, prof_depth)\n    key_stack = key_stack:gsub(\"%[builtin#(%d+)%]\", function(x)\n      return vmdef.ffnames[tonumber(x)]\n    end)\n    if prof_split == 2 then\n      local k1, k2 = key_stack:match(\"(.-) [<>] (.*)\")\n      if k2 then key_stack, key_stack2 = k1, k2 end\n    elseif prof_split == 3 then\n      key_stack2 = profile.dumpstack(th, \"l\", 1)\n    end\n  end\n  -- Order keys.\n  local k1, k2\n  if prof_split == 1 then\n    if key_state then\n      k1 = key_state\n      if key_stack then k2 = key_stack end\n    end\n  elseif key_stack then\n    k1 = key_stack\n    if key_stack2 then k2 = key_stack2 elseif key_state then k2 = key_state end\n  end\n  -- Coalesce samples in one or two levels.\n  if k1 then\n    local t1 = prof_count1\n    t1[k1] = (t1[k1] or 0) + samples\n    if k2 then\n      local t2 = prof_count2\n      local t3 = t2[k1]\n      if not t3 then t3 = {}; t2[k1] = t3 end\n      t3[k2] = (t3[k2] or 0) + samples\n    end\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Show top N list.\nlocal function prof_top(count1, count2, samples, indent)\n  local t, n = {}, 0\n  for k in pairs(count1) do\n    n = n + 1\n    t[n] = k\n  end\n  sort(t, function(a, b) return count1[a] > count1[b] end)\n  for i=1,n do\n    local k = t[i]\n    local v = count1[k]\n    local pct = floor(v*100/samples + 0.5)\n    if pct < prof_min then break end\n    if not prof_raw then\n      out:write(format(\"%s%2d%%  %s\\n\", indent, pct, k))\n    elseif prof_raw == \"r\" then\n      out:write(format(\"%s%5d  %s\\n\", indent, v, k))\n    else\n      out:write(format(\"%s %d\\n\", k, v))\n    end\n    if count2 then\n      local r = count2[k]\n      if r then\n\tprof_top(r, nil, v, (prof_split == 3 or prof_split == 1) and \"  -- \" or\n\t\t\t    (prof_depth < 0 and \"  -> \" or \"  <- \"))\n      end\n    end\n  end\nend\n\n-- Annotate source code\nlocal function prof_annotate(count1, samples)\n  local files = {}\n  local ms = 0\n  for k, v in pairs(count1) do\n    local pct = floor(v*100/samples + 0.5)\n    ms = math.max(ms, v)\n    if pct >= prof_min then\n      local file, line = k:match(\"^(.*):(%d+)$\")\n      if not file then file = k; line = 0 end\n      local fl = files[file]\n      if not fl then fl = {}; files[file] = fl; files[#files+1] = file end\n      line = tonumber(line)\n      fl[line] = prof_raw and v or pct\n    end\n  end\n  sort(files)\n  local fmtv, fmtn = \" %3d%% | %s\\n\", \"      | %s\\n\"\n  if prof_raw then\n    local n = math.max(5, math.ceil(math.log10(ms)))\n    fmtv = \"%\"..n..\"d | %s\\n\"\n    fmtn = (\" \"):rep(n)..\" | %s\\n\"\n  end\n  local ann = prof_ann\n  for _, file in ipairs(files) do\n    local f0 = file:byte()\n    if f0 == 40 or f0 == 91 then\n      out:write(format(\"\\n====== %s ======\\n[Cannot annotate non-file]\\n\", file))\n      break\n    end\n    local fp, err = io.open(file)\n    if not fp then\n      out:write(format(\"====== ERROR: %s: %s\\n\", file, err))\n      break\n    end\n    out:write(format(\"\\n====== %s ======\\n\", file))\n    local fl = files[file]\n    local n, show = 1, false\n    if ann ~= 0 then\n      for i=1,ann do\n\tif fl[i] then show = true; out:write(\"@@ 1 @@\\n\"); break end\n      end\n    end\n    for line in fp:lines() do\n      if line:byte() == 27 then\n\tout:write(\"[Cannot annotate bytecode file]\\n\")\n\tbreak\n      end\n      local v = fl[n]\n      if ann ~= 0 then\n\tlocal v2 = fl[n+ann]\n\tif show then\n\t  if v2 then show = n+ann elseif v then show = n\n\t  elseif show+ann < n then show = false end\n\telseif v2 then\n\t  show = n+ann\n\t  out:write(format(\"@@ %d @@\\n\", n))\n\tend\n\tif not show then goto next end\n      end\n      if v then\n\tout:write(format(fmtv, v, line))\n      else\n\tout:write(format(fmtn, line))\n      end\n    ::next::\n      n = n + 1\n    end\n    fp:close()\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Finish profiling and dump result.\nlocal function prof_finish()\n  if prof_ud then\n    profile.stop()\n    local samples = prof_samples\n    if samples == 0 then\n      if prof_raw ~= true then out:write(\"[No samples collected]\\n\") end\n      return\n    end\n    if prof_ann then\n      prof_annotate(prof_count1, samples)\n    else\n      prof_top(prof_count1, prof_count2, samples, \"\")\n    end\n    prof_count1 = nil\n    prof_count2 = nil\n    prof_ud = nil\n  end\nend\n\n-- Start profiling.\nlocal function prof_start(mode)\n  local interval = \"\"\n  mode = mode:gsub(\"i%d*\", function(s) interval = s; return \"\" end)\n  prof_min = 3\n  mode = mode:gsub(\"m(%d+)\", function(s) prof_min = tonumber(s); return \"\" end)\n  prof_depth = 1\n  mode = mode:gsub(\"%-?%d+\", function(s) prof_depth = tonumber(s); return \"\" end)\n  local m = {}\n  for c in mode:gmatch(\".\") do m[c] = c end\n  prof_states = m.z or m.v\n  if prof_states == \"z\" then zone = require(\"jit.zone\") end\n  local scope = m.l or m.f or m.F or (prof_states and \"\" or \"f\")\n  local flags = (m.p or \"\")\n  prof_raw = m.r\n  if m.s then\n    prof_split = 2\n    if prof_depth == -1 or m[\"-\"] then prof_depth = -2\n    elseif prof_depth == 1 then prof_depth = 2 end\n  elseif mode:find(\"[fF].*l\") then\n    scope = \"l\"\n    prof_split = 3\n  else\n    prof_split = (scope == \"\" or mode:find(\"[zv].*[lfF]\")) and 1 or 0\n  end\n  prof_ann = m.A and 0 or (m.a and 3)\n  if prof_ann then\n    scope = \"l\"\n    prof_fmt = \"pl\"\n    prof_split = 0\n    prof_depth = 1\n  elseif m.G and scope ~= \"\" then\n    prof_fmt = flags..scope..\"Z;\"\n    prof_depth = -100\n    prof_raw = true\n    prof_min = 0\n  elseif scope == \"\" then\n    prof_fmt = false\n  else\n    local sc = prof_split == 3 and m.f or m.F or scope\n    prof_fmt = flags..sc..(prof_depth >= 0 and \"Z < \" or \"Z > \")\n  end\n  prof_count1 = {}\n  prof_count2 = {}\n  prof_samples = 0\n  profile.start(scope:lower()..interval, prof_cb)\n  prof_ud = newproxy(true)\n  getmetatable(prof_ud).__gc = prof_finish\nend\n\n------------------------------------------------------------------------------\n\nlocal function start(mode, outfile)\n  if not outfile then outfile = os.getenv(\"LUAJIT_PROFILEFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stdout\n  end\n  prof_start(mode or \"f\")\nend\n\n-- Public module functions.\nreturn {\n  start = start, -- For -j command line option.\n  stop = prof_finish\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/p.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 413d3a4d59c39ea48b62dbb8f1b361c3\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/v.lua",
    "content": "----------------------------------------------------------------------------\n-- Verbose mode of the LuaJIT compiler.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module shows verbose information about the progress of the\n-- JIT compiler. It prints one line for each generated trace. This module\n-- is useful to see which code has been compiled or where the compiler\n-- punts and falls back to the interpreter.\n--\n-- Example usage:\n--\n--   luajit -jv -e \"for i=1,1000 do for j=1,1000 do end end\"\n--   luajit -jv=myapp.out myapp.lua\n--\n-- Default output is to stderr. To redirect the output to a file, pass a\n-- filename as an argument (use '-' for stdout) or set the environment\n-- variable LUAJIT_VERBOSEFILE. The file is overwritten every time the\n-- module is started.\n--\n-- The output from the first example should look like this:\n--\n-- [TRACE   1 (command line):1 loop]\n-- [TRACE   2 (1/3) (command line):1 -> 1]\n--\n-- The first number in each line is the internal trace number. Next are\n-- the file name ('(command line)') and the line number (':1') where the\n-- trace has started. Side traces also show the parent trace number and\n-- the exit number where they are attached to in parentheses ('(1/3)').\n-- An arrow at the end shows where the trace links to ('-> 1'), unless\n-- it loops to itself.\n--\n-- In this case the inner loop gets hot and is traced first, generating\n-- a root trace. Then the last exit from the 1st trace gets hot, too,\n-- and triggers generation of the 2nd trace. The side trace follows the\n-- path along the outer loop and *around* the inner loop, back to its\n-- start, and then links to the 1st trace. Yes, this may seem unusual,\n-- if you know how traditional compilers work. Trace compilers are full\n-- of surprises like this -- have fun! :-)\n--\n-- Aborted traces are shown like this:\n--\n-- [TRACE --- foo.lua:44 -- leaving loop in root trace at foo:lua:50]\n--\n-- Don't worry -- trace aborts are quite common, even in programs which\n-- can be fully compiled. The compiler may retry several times until it\n-- finds a suitable trace.\n--\n-- Of course this doesn't work with features that are not-yet-implemented\n-- (NYI error messages). The VM simply falls back to the interpreter. This\n-- may not matter at all if the particular trace is not very high up in\n-- the CPU usage profile. Oh, and the interpreter is quite fast, too.\n--\n-- Also check out the -jdump module, which prints all the gory details.\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo\nlocal type, format = type, string.format\nlocal stdout, stderr = io.stdout, io.stderr\n\n-- Active flag and output file handle.\nlocal active, out\n\n------------------------------------------------------------------------------\n\nlocal startloc, startex\n\nlocal function fmtfunc(func, pc)\n  local fi = funcinfo(func, pc)\n  if fi.loc then\n    return fi.loc\n  elseif fi.ffid then\n    return vmdef.ffnames[fi.ffid]\n  elseif fi.addr then\n    return format(\"C:%x\", fi.addr)\n  else\n    return \"(?)\"\n  end\nend\n\n-- Format trace error message.\nlocal function fmterr(err, info)\n  if type(err) == \"number\" then\n    if type(info) == \"function\" then info = fmtfunc(info) end\n    err = format(vmdef.traceerr[err], info)\n  end\n  return err\nend\n\n-- Dump trace states.\nlocal function dump_trace(what, tr, func, pc, otr, oex)\n  if what == \"start\" then\n    startloc = fmtfunc(func, pc)\n    startex = otr and \"(\"..otr..\"/\"..(oex == -1 and \"stitch\" or oex)..\") \" or \"\"\n  else\n    if what == \"abort\" then\n      local loc = fmtfunc(func, pc)\n      if loc ~= startloc then\n\tout:write(format(\"[TRACE --- %s%s -- %s at %s]\\n\",\n\t  startex, startloc, fmterr(otr, oex), loc))\n      else\n\tout:write(format(\"[TRACE --- %s%s -- %s]\\n\",\n\t  startex, startloc, fmterr(otr, oex)))\n      end\n    elseif what == \"stop\" then\n      local info = traceinfo(tr)\n      local link, ltype = info.link, info.linktype\n      if ltype == \"interpreter\" then\n\tout:write(format(\"[TRACE %3s %s%s -- fallback to interpreter]\\n\",\n\t  tr, startex, startloc))\n      elseif ltype == \"stitch\" then\n\tout:write(format(\"[TRACE %3s %s%s %s %s]\\n\",\n\t  tr, startex, startloc, ltype, fmtfunc(func, pc)))\n      elseif link == tr or link == 0 then\n\tout:write(format(\"[TRACE %3s %s%s %s]\\n\",\n\t  tr, startex, startloc, ltype))\n      elseif ltype == \"root\" then\n\tout:write(format(\"[TRACE %3s %s%s -> %d]\\n\",\n\t  tr, startex, startloc, link))\n      else\n\tout:write(format(\"[TRACE %3s %s%s -> %d %s]\\n\",\n\t  tr, startex, startloc, link, ltype))\n      end\n    else\n      out:write(format(\"[TRACE %s]\\n\", what))\n    end\n    out:flush()\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Detach dump handlers.\nlocal function dumpoff()\n  if active then\n    active = false\n    jit.attach(dump_trace)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach dump handlers.\nlocal function dumpon(outfile)\n  if active then dumpoff() end\n  if not outfile then outfile = os.getenv(\"LUAJIT_VERBOSEFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stderr\n  end\n  jit.attach(dump_trace, \"trace\")\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  on = dumpon,\n  off = dumpoff,\n  start = dumpon -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/v.lua.meta",
    "content": "fileFormatVersion: 2\nguid: e83d256a881de8f4ab20afb40ff611f7\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/zone.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT profiler zones.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module implements a simple hierarchical zone model.\n--\n-- Example usage:\n--\n--   local zone = require(\"jit.zone\")\n--   zone(\"AI\")\n--   ...\n--     zone(\"A*\")\n--     ...\n--     print(zone:get()) --> \"A*\"\n--     ...\n--     zone()\n--   ...\n--   print(zone:get()) --> \"AI\"\n--   ...\n--   zone()\n--\n----------------------------------------------------------------------------\n\nlocal remove = table.remove\n\nreturn setmetatable({\n  flush = function(t)\n    for i=#t,1,-1 do t[i] = nil end\n  end,\n  get = function(t)\n    return t[#t]\n  end\n}, {\n  __call = function(t, zone)\n    if zone then\n      t[#t+1] = zone\n    else\n      return (assert(remove(t), \"empty zone stack\"))\n    end\n  end\n})\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/jit/zone.lua.meta",
    "content": "fileFormatVersion: 2\nguid: af44e752354375746813d50c6d26b867\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/jit.meta",
    "content": "fileFormatVersion: 2\nguid: 7b8761c25aba4304482c7fd87688285a\nfolderAsset: yes\ntimeCreated: 1492692752\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/list.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal setmetatable = setmetatable\n\nlocal list = {}\nlist.__index = list\n\nfunction list:new()\n\tlocal t = {length = 0, _prev = 0, _next = 0}\n\tt._prev = t\n\tt._next = t\n\treturn setmetatable(t, list)\nend\n\nfunction list:clear()\n\tself._next = self\n\tself._prev = self\n\tself.length = 0\nend\n\nfunction list:push(value)\n\t--assert(value)\n\tlocal node = {value = value, _prev = 0, _next = 0, removed = false}\n\n\tself._prev._next = node\n\tnode._next = self\n\tnode._prev = self._prev\n\tself._prev = node\n\n\tself.length = self.length + 1\n\treturn node\nend\n\nfunction list:pushnode(node)\n\tif not node.removed then return end\n\n\tself._prev._next = node\n\tnode._next = self\n\tnode._prev = self._prev\n\tself._prev = node\n\tnode.removed = false\n\tself.length = self.length + 1\nend\n\nfunction list:pop()\n\tlocal _prev = self._prev\n\tself:remove(_prev)\n\treturn _prev.value\nend\n\nfunction list:unshift(v)\n\tlocal node = {value = v, _prev = 0, _next = 0, removed = false}\n\n\tself._next._prev = node\n\tnode._prev = self\n\tnode._next = self._next\n\tself._next = node\n\n\tself.length = self.length + 1\n\treturn node\nend\n\nfunction list:shift()\n\tlocal _next = self._next\n\tself:remove(_next)\n\treturn _next.value\nend\n\nfunction list:remove(iter)\n\tif iter.removed then return end\n\n\tlocal _prev = iter._prev\n\tlocal _next = iter._next\n\t_next._prev = _prev\n\t_prev._next = _next\n\t\n\tself.length = math.max(0, self.length - 1)\n\titer.removed = true\nend\n\nfunction list:find(v, iter)\n\titer = iter or self\n\n\trepeat\n\t\tif v == iter.value then\n\t\t\treturn iter\n\t\telse\n\t\t\titer = iter._next\n\t\tend\t\t\n\tuntil iter == self\n\n\treturn nil\nend\n\nfunction list:findlast(v, iter)\n\titer = iter or self\n\n\trepeat\n\t\tif v == iter.value then\n\t\t\treturn iter\n\t\tend\n\n\t\titer = iter._prev\n\tuntil iter == self\n\n\treturn nil\nend\n\nfunction list:next(iter)\n\tlocal _next = iter._next\n\tif _next ~= self then\n\t\treturn _next, _next.value\n\tend\n\n\treturn nil\nend\n\nfunction list:prev(iter)\n\tlocal _prev = iter._prev\n\tif _prev ~= self then\n\t\treturn _prev, _prev.value\n\tend\n\n\treturn nil\nend\n\nfunction list:erase(v)\n\tlocal iter = self:find(v)\n\n\tif iter then\n\t\tself:remove(iter)\t\t\n\tend\nend\n\nfunction list:insert(v, iter)\t\n\tif not iter then\n\t\treturn self:push(v)\n\tend\n\n\tlocal node = {value = v, _next = 0, _prev = 0, removed = false}\n\n\tif iter._next then\n\t\titer._next._prev = node\n\t\tnode._next = iter._next\n\telse\n\t\tself.last = node\n\tend\n\n\tnode._prev = iter\n\titer._next = node\n\tself.length = self.length + 1\n\treturn node\nend\n\nfunction list:head()\n\treturn self._next.value\nend\n\nfunction list:tail()\n\treturn self._prev.value\nend\n\nfunction list:clone()\n\tlocal t = list:new()\n\n\tfor i, v in list.next, self, self do\n\t\tt:push(v)\n\tend\n\n\treturn t\nend\n\nilist = function(_list) return list.next, _list, _list end\nrilist = function(_list) return list.prev, _list, _list end\n\nsetmetatable(list, {__call = list.new})\nreturn list"
  },
  {
    "path": "Assets/ToLua/Lua/list.lua.meta",
    "content": "fileFormatVersion: 2\nguid: f0d0ca55b7df3414aafaf11a39c13378\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/lpeg/re.lua",
    "content": "-- $Id: re.lua,v 1.44 2013/03/26 20:11:40 roberto Exp $\n\n-- imported functions and modules\nlocal tonumber, type, print, error = tonumber, type, print, error\nlocal setmetatable = setmetatable\nlocal m = require\"lpeg\"\n\n-- 'm' will be used to parse expressions, and 'mm' will be used to\n-- create expressions; that is, 're' runs on 'm', creating patterns\n-- on 'mm'\nlocal mm = m\n\n-- pattern's metatable\nlocal mt = getmetatable(mm.P(0))\n\n\n\n-- No more global accesses after this point\nlocal version = _VERSION\nif version == \"Lua 5.2\" then _ENV = nil end\n\n\nlocal any = m.P(1)\n\n\n-- Pre-defined names\nlocal Predef = { nl = m.P\"\\n\" }\n\n\nlocal mem\nlocal fmem\nlocal gmem\n\n\nlocal function updatelocale ()\n  mm.locale(Predef)\n  Predef.a = Predef.alpha\n  Predef.c = Predef.cntrl\n  Predef.d = Predef.digit\n  Predef.g = Predef.graph\n  Predef.l = Predef.lower\n  Predef.p = Predef.punct\n  Predef.s = Predef.space\n  Predef.u = Predef.upper\n  Predef.w = Predef.alnum\n  Predef.x = Predef.xdigit\n  Predef.A = any - Predef.a\n  Predef.C = any - Predef.c\n  Predef.D = any - Predef.d\n  Predef.G = any - Predef.g\n  Predef.L = any - Predef.l\n  Predef.P = any - Predef.p\n  Predef.S = any - Predef.s\n  Predef.U = any - Predef.u\n  Predef.W = any - Predef.w\n  Predef.X = any - Predef.x\n  mem = {}    -- restart memoization\n  fmem = {}\n  gmem = {}\n  local mt = {__mode = \"v\"}\n  setmetatable(mem, mt)\n  setmetatable(fmem, mt)\n  setmetatable(gmem, mt)\nend\n\n\nupdatelocale()\n\n\n\nlocal I = m.P(function (s,i) print(i, s:sub(1, i-1)); return i end)\n\n\nlocal function getdef (id, defs)\n  local c = defs and defs[id]\n  if not c then error(\"undefined name: \" .. id) end\n  return c\nend\n\n\nlocal function patt_error (s, i)\n  local msg = (#s < i + 20) and s:sub(i)\n                             or s:sub(i,i+20) .. \"...\"\n  msg = (\"pattern error near '%s'\"):format(msg)\n  error(msg, 2)\nend\n\nlocal function mult (p, n)\n  local np = mm.P(true)\n  while n >= 1 do\n    if n%2 >= 1 then np = np * p end\n    p = p * p\n    n = n/2\n  end\n  return np\nend\n\nlocal function equalcap (s, i, c)\n  if type(c) ~= \"string\" then return nil end\n  local e = #c + i\n  if s:sub(i, e - 1) == c then return e else return nil end\nend\n\n\nlocal S = (Predef.space + \"--\" * (any - Predef.nl)^0)^0\n\nlocal name = m.R(\"AZ\", \"az\", \"__\") * m.R(\"AZ\", \"az\", \"__\", \"09\")^0\n\nlocal arrow = S * \"<-\"\n\nlocal seq_follow = m.P\"/\" + \")\" + \"}\" + \":}\" + \"~}\" + \"|}\" + (name * arrow) + -1\n\nname = m.C(name)\n\n\n-- a defined name only have meaning in a given environment\nlocal Def = name * m.Carg(1)\n\nlocal num = m.C(m.R\"09\"^1) * S / tonumber\n\nlocal String = \"'\" * m.C((any - \"'\")^0) * \"'\" +\n               '\"' * m.C((any - '\"')^0) * '\"'\n\n\nlocal defined = \"%\" * Def / function (c,Defs)\n  local cat =  Defs and Defs[c] or Predef[c]\n  if not cat then error (\"name '\" .. c .. \"' undefined\") end\n  return cat\nend\n\nlocal Range = m.Cs(any * (m.P\"-\"/\"\") * (any - \"]\")) / mm.R\n\nlocal item = defined + Range + m.C(any)\n\nlocal Class =\n    \"[\"\n  * (m.C(m.P\"^\"^-1))    -- optional complement symbol\n  * m.Cf(item * (item - \"]\")^0, mt.__add) /\n                          function (c, p) return c == \"^\" and any - p or p end\n  * \"]\"\n\nlocal function adddef (t, k, exp)\n  if t[k] then\n    error(\"'\"..k..\"' already defined as a rule\")\n  else\n    t[k] = exp\n  end\n  return t\nend\n\nlocal function firstdef (n, r) return adddef({n}, n, r) end\n\n\nlocal function NT (n, b)\n  if not b then\n    error(\"rule '\"..n..\"' used outside a grammar\")\n  else return mm.V(n)\n  end\nend\n\n\nlocal exp = m.P{ \"Exp\",\n  Exp = S * ( m.V\"Grammar\"\n            + m.Cf(m.V\"Seq\" * (\"/\" * S * m.V\"Seq\")^0, mt.__add) );\n  Seq = m.Cf(m.Cc(m.P\"\") * m.V\"Prefix\"^0 , mt.__mul)\n        * (#seq_follow + patt_error);\n  Prefix = \"&\" * S * m.V\"Prefix\" / mt.__len\n         + \"!\" * S * m.V\"Prefix\" / mt.__unm\n         + m.V\"Suffix\";\n  Suffix = m.Cf(m.V\"Primary\" * S *\n          ( ( m.P\"+\" * m.Cc(1, mt.__pow)\n            + m.P\"*\" * m.Cc(0, mt.__pow)\n            + m.P\"?\" * m.Cc(-1, mt.__pow)\n            + \"^\" * ( m.Cg(num * m.Cc(mult))\n                    + m.Cg(m.C(m.S\"+-\" * m.R\"09\"^1) * m.Cc(mt.__pow))\n                    )\n            + \"->\" * S * ( m.Cg((String + num) * m.Cc(mt.__div))\n                         + m.P\"{}\" * m.Cc(nil, m.Ct)\n                         + m.Cg(Def / getdef * m.Cc(mt.__div))\n                         )\n            + \"=>\" * S * m.Cg(Def / getdef * m.Cc(m.Cmt))\n            ) * S\n          )^0, function (a,b,f) return f(a,b) end );\n  Primary = \"(\" * m.V\"Exp\" * \")\"\n            + String / mm.P\n            + Class\n            + defined\n            + \"{:\" * (name * \":\" + m.Cc(nil)) * m.V\"Exp\" * \":}\" /\n                     function (n, p) return mm.Cg(p, n) end\n            + \"=\" * name / function (n) return mm.Cmt(mm.Cb(n), equalcap) end\n            + m.P\"{}\" / mm.Cp\n            + \"{~\" * m.V\"Exp\" * \"~}\" / mm.Cs\n            + \"{|\" * m.V\"Exp\" * \"|}\" / mm.Ct\n            + \"{\" * m.V\"Exp\" * \"}\" / mm.C\n            + m.P\".\" * m.Cc(any)\n            + (name * -arrow + \"<\" * name * \">\") * m.Cb(\"G\") / NT;\n  Definition = name * arrow * m.V\"Exp\";\n  Grammar = m.Cg(m.Cc(true), \"G\") *\n            m.Cf(m.V\"Definition\" / firstdef * m.Cg(m.V\"Definition\")^0,\n              adddef) / mm.P\n}\n\nlocal pattern = S * m.Cg(m.Cc(false), \"G\") * exp / mm.P * (-any + patt_error)\n\n\nlocal function compile (p, defs)\n  if mm.type(p) == \"pattern\" then return p end   -- already compiled\n  local cp = pattern:match(p, 1, defs)\n  if not cp then error(\"incorrect pattern\", 3) end\n  return cp\nend\n\nlocal function match (s, p, i)\n  local cp = mem[p]\n  if not cp then\n    cp = compile(p)\n    mem[p] = cp\n  end\n  return cp:match(s, i or 1)\nend\n\nlocal function find (s, p, i)\n  local cp = fmem[p]\n  if not cp then\n    cp = compile(p) / 0\n    cp = mm.P{ mm.Cp() * cp * mm.Cp() + 1 * mm.V(1) }\n    fmem[p] = cp\n  end\n  local i, e = cp:match(s, i or 1)\n  if i then return i, e - 1\n  else return i\n  end\nend\n\nlocal function gsub (s, p, rep)\n  local g = gmem[p] or {}   -- ensure gmem[p] is not collected while here\n  gmem[p] = g\n  local cp = g[rep]\n  if not cp then\n    cp = compile(p)\n    cp = mm.Cs((cp / rep + 1)^0)\n    g[rep] = cp\n  end\n  return cp:match(s)\nend\n\n\n-- exported names\nlocal re = {\n  compile = compile,\n  match = match,\n  find = find,\n  gsub = gsub,\n  updatelocale = updatelocale,\n}\n\nif version == \"Lua 5.1\" then\n  --I need this to work with strict.lua, sorry for breaking compatibility.\n  --_G.re = re\nend\n\nreturn re\n"
  },
  {
    "path": "Assets/ToLua/Lua/lpeg/re.lua.meta",
    "content": "fileFormatVersion: 2\nguid: b7e8b1ba4c06a4d4db879ad831cb62f1\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/lpeg.meta",
    "content": "fileFormatVersion: 2\nguid: 58143f62c40fa4143903b5b1abc707fe\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/ltn12.lua",
    "content": "-----------------------------------------------------------------------------\n-- LTN12 - Filters, sources, sinks and pumps.\n-- LuaSocket toolkit.\n-- Author: Diego Nehab\n-----------------------------------------------------------------------------\n\n-----------------------------------------------------------------------------\n-- Declare module\n-----------------------------------------------------------------------------\nlocal string = require(\"string\")\nlocal table = require(\"table\")\nlocal unpack = unpack or table.unpack\nlocal base = _G\nlocal _M = {}\nif module then -- heuristic for exporting a global package table\n    ltn12 = _M\nend\nlocal filter,source,sink,pump = {},{},{},{}\n\n_M.filter = filter\n_M.source = source\n_M.sink = sink\n_M.pump = pump\n\nlocal unpack = unpack or table.unpack\nlocal select = base.select\n\n-- 2048 seems to be better in windows...\n_M.BLOCKSIZE = 2048\n_M._VERSION = \"LTN12 1.0.3\"\n\n-----------------------------------------------------------------------------\n-- Filter stuff\n-----------------------------------------------------------------------------\n-- returns a high level filter that cycles a low-level filter\nfunction filter.cycle(low, ctx, extra)\n    base.assert(low)\n    return function(chunk)\n        local ret\n        ret, ctx = low(ctx, chunk, extra)\n        return ret\n    end\nend\n\n-- chains a bunch of filters together\n-- (thanks to Wim Couwenberg)\nfunction filter.chain(...)\n    local arg = {...}\n    local n = base.select('#',...)\n    local top, index = 1, 1\n    local retry = \"\"\n    return function(chunk)\n        retry = chunk and retry\n        while true do\n            if index == top then\n                chunk = arg[index](chunk)\n                if chunk == \"\" or top == n then return chunk\n                elseif chunk then index = index + 1\n                else\n                    top = top+1\n                    index = top\n                end\n            else\n                chunk = arg[index](chunk or \"\")\n                if chunk == \"\" then\n                    index = index - 1\n                    chunk = retry\n                elseif chunk then\n                    if index == n then return chunk\n                    else index = index + 1 end\n                else base.error(\"filter returned inappropriate nil\") end\n            end\n        end\n    end\nend\n\n-----------------------------------------------------------------------------\n-- Source stuff\n-----------------------------------------------------------------------------\n-- create an empty source\nlocal function empty()\n    return nil\nend\n\nfunction source.empty()\n    return empty\nend\n\n-- returns a source that just outputs an error\nfunction source.error(err)\n    return function()\n        return nil, err\n    end\nend\n\n-- creates a file source\nfunction source.file(handle, io_err)\n    if handle then\n        return function()\n            local chunk = handle:read(_M.BLOCKSIZE)\n            if not chunk then handle:close() end\n            return chunk\n        end\n    else return source.error(io_err or \"unable to open file\") end\nend\n\n-- turns a fancy source into a simple source\nfunction source.simplify(src)\n    base.assert(src)\n    return function()\n        local chunk, err_or_new = src()\n        src = err_or_new or src\n        if not chunk then return nil, err_or_new\n        else return chunk end\n    end\nend\n\n-- creates string source\nfunction source.string(s)\n    if s then\n        local i = 1\n        return function()\n            local chunk = string.sub(s, i, i+_M.BLOCKSIZE-1)\n            i = i + _M.BLOCKSIZE\n            if chunk ~= \"\" then return chunk\n            else return nil end\n        end\n    else return source.empty() end\nend\n\n-- creates rewindable source\nfunction source.rewind(src)\n    base.assert(src)\n    local t = {}\n    return function(chunk)\n        if not chunk then\n            chunk = table.remove(t)\n            if not chunk then return src()\n            else return chunk end\n        else\n            table.insert(t, chunk)\n        end\n    end\nend\n\n-- chains a source with one or several filter(s)\nfunction source.chain(src, f, ...)\n    if ... then f=filter.chain(f, ...) end\n    base.assert(src and f)\n    local last_in, last_out = \"\", \"\"\n    local state = \"feeding\"\n    local err\n    return function()\n        if not last_out then\n            base.error('source is empty!', 2)\n        end\n        while true do\n            if state == \"feeding\" then\n                last_in, err = src()\n                if err then return nil, err end\n                last_out = f(last_in)\n                if not last_out then\n                    if last_in then\n                        base.error('filter returned inappropriate nil')\n                    else\n                        return nil\n                    end\n                elseif last_out ~= \"\" then\n                    state = \"eating\"\n                    if last_in then last_in = \"\" end\n                    return last_out\n                end\n            else\n                last_out = f(last_in)\n                if last_out == \"\" then\n                    if last_in == \"\" then\n                        state = \"feeding\"\n                    else\n                        base.error('filter returned \"\"')\n                    end\n                elseif not last_out then\n                    if last_in then\n                        base.error('filter returned inappropriate nil')\n                    else\n                        return nil\n                    end\n                else\n                    return last_out\n                end\n            end\n        end\n    end\nend\n\n-- creates a source that produces contents of several sources, one after the\n-- other, as if they were concatenated\n-- (thanks to Wim Couwenberg)\nfunction source.cat(...)\n    local arg = {...}\n    local src = table.remove(arg, 1)\n    return function()\n        while src do\n            local chunk, err = src()\n            if chunk then return chunk end\n            if err then return nil, err end\n            src = table.remove(arg, 1)\n        end\n    end\nend\n\n-----------------------------------------------------------------------------\n-- Sink stuff\n-----------------------------------------------------------------------------\n-- creates a sink that stores into a table\nfunction sink.table(t)\n    t = t or {}\n    local f = function(chunk, err)\n        if chunk then table.insert(t, chunk) end\n        return 1\n    end\n    return f, t\nend\n\n-- turns a fancy sink into a simple sink\nfunction sink.simplify(snk)\n    base.assert(snk)\n    return function(chunk, err)\n        local ret, err_or_new = snk(chunk, err)\n        if not ret then return nil, err_or_new end\n        snk = err_or_new or snk\n        return 1\n    end\nend\n\n-- creates a file sink\nfunction sink.file(handle, io_err)\n    if handle then\n        return function(chunk, err)\n            if not chunk then\n                handle:close()\n                return 1\n            else return handle:write(chunk) end\n        end\n    else return sink.error(io_err or \"unable to open file\") end\nend\n\n-- creates a sink that discards data\nlocal function null()\n    return 1\nend\n\nfunction sink.null()\n    return null\nend\n\n-- creates a sink that just returns an error\nfunction sink.error(err)\n    return function()\n        return nil, err\n    end\nend\n\n-- chains a sink with one or several filter(s)\nfunction sink.chain(f, snk, ...)\n    if ... then\n        local args = { f, snk, ... }\n        snk = table.remove(args, #args)\n        f = filter.chain(unpack(args))\n    end\n    base.assert(f and snk)\n    return function(chunk, err)\n        if chunk ~= \"\" then\n            local filtered = f(chunk)\n            local done = chunk and \"\"\n            while true do\n                local ret, snkerr = snk(filtered, err)\n                if not ret then return nil, snkerr end\n                if filtered == done then return 1 end\n                filtered = f(done)\n            end\n        else return 1 end\n    end\nend\n\n-----------------------------------------------------------------------------\n-- Pump stuff\n-----------------------------------------------------------------------------\n-- pumps one chunk from the source to the sink\nfunction pump.step(src, snk)\n    local chunk, src_err = src()\n    local ret, snk_err = snk(chunk, src_err)\n    if chunk and ret then return 1\n    else return nil, src_err or snk_err end\nend\n\n-- pumps all data from a source to a sink, using a step function\nfunction pump.all(src, snk, step)\n    base.assert(src and snk)\n    step = step or pump.step\n    while true do\n        local ret, err = step(src, snk)\n        if not ret then\n            if err then return nil, err\n            else return 1 end\n        end\n    end\nend\n\nreturn _M\n"
  },
  {
    "path": "Assets/ToLua/Lua/ltn12.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 6f6ae256ba8bd244692e687b1b0ece95\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/mime.lua",
    "content": "-----------------------------------------------------------------------------\n-- MIME support for the Lua language.\n-- Author: Diego Nehab\n-- Conforming to RFCs 2045-2049\n-----------------------------------------------------------------------------\n\n-----------------------------------------------------------------------------\n-- Declare module and import dependencies\n-----------------------------------------------------------------------------\nlocal base = _G\nlocal ltn12 = require(\"ltn12\")\nlocal mime = require(\"mime.core\")\nlocal io = require(\"io\")\nlocal string = require(\"string\")\nlocal _M = mime\n\n-- encode, decode and wrap algorithm tables\nlocal encodet, decodet, wrapt = {},{},{}\n\n_M.encodet = encodet\n_M.decodet = decodet\n_M.wrapt   = wrapt  \n\n-- creates a function that chooses a filter by name from a given table\nlocal function choose(table)\n    return function(name, opt1, opt2)\n        if base.type(name) ~= \"string\" then\n            name, opt1, opt2 = \"default\", name, opt1\n        end\n        local f = table[name or \"nil\"]\n        if not f then \n            base.error(\"unknown key (\" .. base.tostring(name) .. \")\", 3)\n        else return f(opt1, opt2) end\n    end\nend\n\n-- define the encoding filters\nencodet['base64'] = function()\n    return ltn12.filter.cycle(_M.b64, \"\")\nend\n\nencodet['quoted-printable'] = function(mode)\n    return ltn12.filter.cycle(_M.qp, \"\",\n        (mode == \"binary\") and \"=0D=0A\" or \"\\r\\n\")\nend\n\n-- define the decoding filters\ndecodet['base64'] = function()\n    return ltn12.filter.cycle(_M.unb64, \"\")\nend\n\ndecodet['quoted-printable'] = function()\n    return ltn12.filter.cycle(_M.unqp, \"\")\nend\n\nlocal function format(chunk)\n    if chunk then\n        if chunk == \"\" then return \"''\"\n        else return string.len(chunk) end\n    else return \"nil\" end\nend\n\n-- define the line-wrap filters\nwrapt['text'] = function(length)\n    length = length or 76\n    return ltn12.filter.cycle(_M.wrp, length, length)\nend\nwrapt['base64'] = wrapt['text']\nwrapt['default'] = wrapt['text']\n\nwrapt['quoted-printable'] = function()\n    return ltn12.filter.cycle(_M.qpwrp, 76, 76)\nend\n\n-- function that choose the encoding, decoding or wrap algorithm\n_M.encode = choose(encodet)\n_M.decode = choose(decodet)\n_M.wrap = choose(wrapt)\n\n-- define the end-of-line normalization filter\nfunction _M.normalize(marker)\n    return ltn12.filter.cycle(_M.eol, 0, marker)\nend\n\n-- high level stuffing filter\nfunction _M.stuff()\n    return ltn12.filter.cycle(_M.dot, 2)\nend\n\nreturn _M"
  },
  {
    "path": "Assets/ToLua/Lua/mime.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 78de065ed4e50984eba196a41070d017\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/misc/functions.lua",
    "content": "local require = require\nlocal string = string\nlocal table = table\n\nint64.zero = int64.new(0,0)\nuint64.zero = uint64.new(0,0)\n\nfunction string.split(input, delimiter)\n    input = tostring(input)\n    delimiter = tostring(delimiter)\n    if (delimiter=='') then return false end\n    local pos,arr = 0, {}\n    -- for each divider found\n    for st,sp in function() return string.find(input, delimiter, pos, true) end do\n        table.insert(arr, string.sub(input, pos, st - 1))\n        pos = sp + 1\n    end\n    table.insert(arr, string.sub(input, pos))\n    return arr\nend\n\nfunction import(moduleName, currentModuleName)\n    local currentModuleNameParts\n    local moduleFullName = moduleName\n    local offset = 1\n\n    while true do\n        if string.byte(moduleName, offset) ~= 46 then -- .\n            moduleFullName = string.sub(moduleName, offset)\n            if currentModuleNameParts and #currentModuleNameParts > 0 then\n                moduleFullName = table.concat(currentModuleNameParts, \".\") .. \".\" .. moduleFullName\n            end\n            break\n        end\n        offset = offset + 1\n\n        if not currentModuleNameParts then\n            if not currentModuleName then\n                local n,v = debug.getlocal(3, 1)\n                currentModuleName = v\n            end\n\n            currentModuleNameParts = string.split(currentModuleName, \".\")\n        end\n        table.remove(currentModuleNameParts, #currentModuleNameParts)\n    end\n\n    return require(moduleFullName)\nend\n\n--重新require一个lua文件，替代系统文件。\nfunction reimport(name)\n    local package = package\n    package.loaded[name] = nil\n    package.preload[name] = nil\n    return require(name)    \nend\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/misc/functions.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 7ad071edc48d0d8469028957a2df9c67\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/misc/strict.lua",
    "content": "--\n-- strict.lua\n-- checks uses of undeclared global variables\n-- All global variables must be 'declared' through a regular assignment\n-- (even assigning nil will do) in a main chunk before being used\n-- anywhere or assigned to inside a function.\n--\n-- modified for better compatibility with LuaJIT, see:\n-- http://www.freelists.org/post/luajit/strictlua-with-stripped-bytecode\n\nlocal getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget\n\nlocal mt = getmetatable(_G)\nif mt == nil then\n  mt = {}\n  setmetatable(_G, mt)\nend\n\nmt.__declared = {}\n\nmt.__newindex = function (t, n, v)\n  if not mt.__declared[n] then\n    local info = getinfo(2, \"S\")\n    if info and info.linedefined > 0 then\n      error(\"assign to undeclared variable '\"..n..\"'\", 2)\n    end\n    mt.__declared[n] = true\n  end\n  rawset(t, n, v)\nend\n\nmt.__index = function (t, n)\n  if not mt.__declared[n] then\n    local info = getinfo(2, \"S\")\n    if info and info.linedefined > 0 then\n      error(\"variable '\"..n..\"' is not declared\", 2)\n    end\n  end\n  return rawget(t, n)\nend\n"
  },
  {
    "path": "Assets/ToLua/Lua/misc/strict.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 4df6e3671aafc8e4d82fee6a2cf5948e\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/misc/utf8.lua",
    "content": "local utf8 = {}\n\n--byte index of the next char after the char at byte index i, followed by a valid flag for the char at byte index i.\n--nil if not found. invalid characters are iterated as 1-byte chars.\nfunction utf8.next_raw(s, i)\n\tif not i then\n\t\tif #s == 0 then return nil end\n\t\treturn 1, true --fake flag (doesn't matter since this flag is not to be taken as full validation)\n\tend\n\tif i > #s then return end\n\tlocal c = s:byte(i)\n\tif c >= 0x00 and c <= 0x7F then\n\t\ti = i + 1\n\telseif c >= 0xC2 and c <= 0xDF then\n\t\ti = i + 2\n\telseif c >= 0xE0 and c <= 0xEF then\n\t\ti = i + 3\n\telseif c >= 0xF0 and c <= 0xF4 then\n\t\ti = i + 4\n\telse --invalid\n\t\treturn i + 1, false\n\tend\n\tif i > #s then return end\n\treturn i, true\nend\n\n--next() is the generic iterator and can be replaced for different semantics. next_raw() must preserve its semantics.\nutf8.next = utf8.next_raw\n\n--iterate chars, returning the byte index where each char starts\nfunction utf8.byte_indices(s, previ)\n\treturn utf8.next, s, previ\nend\n\n--number of chars in string\nfunction utf8.len(s)\n\tassert(s, \"bad argument #1 to 'len' (string expected, got nil)\")\n\tlocal len = 0\n\tfor _ in utf8.byte_indices(s) do\n\t\tlen = len + 1\n\tend\n\treturn len\nend\n\n--byte index given char index. nil if the index is outside the string.\nfunction utf8.byte_index(s, target_ci)\n\tif target_ci < 1 then return end\n\tlocal ci = 0\n\tfor i in utf8.byte_indices(s) do\n\t\tci = ci + 1\n\t\tif ci == target_ci then\n\t\t\treturn i\n\t\tend\n\tend\n\tassert(target_ci > ci, \"invalid index\")\nend\n\n--char index given byte index. nil if the index is outside the string.\nfunction utf8.char_index(s, target_i)\n\tif target_i < 1 or target_i > #s then return end\n\tlocal ci = 0\n\tfor i in utf8.byte_indices(s) do\n\t\tci = ci + 1\n\t\tif i == target_i then\n\t\t\treturn ci\n\t\tend\n\tend\n\terror(\"invalid index\")\nend\n\n--byte index of the prev. char before the char at byte index i, which defaults to #s + 1.\n--nil if the index is outside the 2..#s+1 range.\n--NOTE: unlike next(), this is a O(N) operation!\nfunction utf8.prev(s, nexti)\n\tnexti = nexti or #s + 1\n\tif nexti <= 1 or nexti > #s + 1 then return end\n\tlocal lasti, lastvalid = utf8.next(s)\n\tfor i, valid in utf8.byte_indices(s) do\n\t\tif i == nexti then\n\t\t\treturn lasti, lastvalid\n\t\tend\n\t\tlasti, lastvalid = i, valid\n\tend\n\tif nexti == #s + 1 then\n\t\treturn lasti, lastvalid\n\tend\n\terror(\"invalid index\")\nend\n\n--iterate chars in reverse order, returning the byte index where each char starts.\nfunction utf8.byte_indices_reverse(s, nexti)\n\tif #s < 200 then\n\t\t--using prev() is a O(N^2/2) operation, ok for small strings (200 chars need 40,000 iterations)\n\t\treturn utf8.prev, s, nexti\n\telse\n\t\t--store byte indices in a table and iterate them in reverse.\n\t\t--this is 40x slower than byte_indices() but still fast at 2mil chars/second (but eats RAM and makes garbage).\n\t\tlocal t = {}\n\t\tfor i in utf8.byte_indices(s) do\n\t\t\tif nexti and i >= nexti then break end\n\t\t\ttable.insert(t, i)\n\t\tend\n\t\tlocal i = #t + 1\n\t\treturn function()\n\t\t\ti = i - 1\n\t\t\treturn t[i]\n\t\tend\n\tend\nend\n\n--sub based on char indices, which, unlike with standard string.sub(), can't be negative.\n--start_ci can be 1..inf and end_ci can be 0..inf. end_ci can be nil meaning last char.\n--if start_ci is out of range or end_ci < start_ci, the empty string is returned.\n--if end_ci is out of range, it is considered to be the last position in the string.\nfunction utf8.sub(s, start_ci, end_ci)\n\t--assert for positive indices because we might implement negative indices in the future.\n\tassert(start_ci >= 1)\n\tassert(not end_ci or end_ci >= 0)\n\tlocal ci = 0\n\tlocal start_i, end_i\n\tfor i in utf8.byte_indices(s) do\n\t\tci = ci + 1\n\t\tif ci == start_ci then\n\t\t\tstart_i = i\n\t\tend\n\t\tif ci == end_ci then\n\t\t\tend_i = i\n\t\tend\n\tend\n\tif not start_i then\n\t\tassert(start_ci > ci, 'invalid index')\n\t\treturn ''\n\tend\n\tif end_ci and not end_i then\n\t\tif end_ci < start_ci then\n\t\t\treturn ''\n\t\tend\n\t\tassert(end_ci > ci, 'invalid index')\n\tend\n\treturn s:sub(start_i, end_i and end_i - 1)\nend\n\n--check if a string contains a substring at byte index i without making garbage.\n--nil if the index is out of range. true if searching for the empty string.\nfunction utf8.contains(s, i, sub)\n\tif i < 1 or i > #s then return nil end\n\tfor si = 1, #sub do\n\t\tif s:byte(i + si - 1) ~= sub:byte(si) then\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\nend\n\n--count the number of occurences of a substring in a string. the substring cannot be the empty string.\nfunction utf8.count(s, sub)\n\tassert(#sub > 0)\n\tlocal count = 0\n\tlocal i = 1\n\twhile i do\n\t\tif utf8.contains(s, i, sub) then\n\t\t\tcount = count + 1\n\t\t\ti = i + #sub\n\t\t\tif i > #s then break end\n\t\telse\n\t\t\ti = utf8.next(s, i)\n\t\tend\n\tend\n\treturn count\nend\n\n--utf8 validation and sanitization\n\n--check if there's a valid utf8 codepoint at byte index i. valid ranges for each utf8 byte are:\n-- byte  1          2           3          4\n--------------------------------------------\n-- 00 - 7F\n-- C2 - DF    80 - BF\n-- E0         A0 - BF     80 - BF\n-- E1 - EC    80 - BF     80 - BF\n-- ED         80 - 9F     80 - BF\n-- EE - EF    80 - BF     80 - BF\n-- F0         90 - BF     80 - BF    80 - BF\n-- F1 - F3    80 - BF     80 - BF    80 - BF\n-- F4         80 - 8F     80 - BF    80 - BF\nfunction utf8.isvalid(s, i)\n\tlocal c = s:byte(i)\n\tif not c then\n\t\treturn false\n\telseif c >= 0x00 and c <= 0x7F then\n\t\treturn true\n\telseif c >= 0xC2 and c <= 0xDF then\n\t\tlocal c2 = s:byte(i + 1)\n\t\treturn c2 and c2 >= 0x80 and c2 <= 0xBF\n\telseif c >= 0xE0 and c <= 0xEF then\n\t\tlocal c2 = s:byte(i + 1)\n\t\tlocal c3 = s:byte(i + 2)\n\t\tif c == 0xE0 then\n\t\t\treturn c2 and c3 and\n\t\t\t\tc2 >= 0xA0 and c2 <= 0xBF and\n\t\t\t\tc3 >= 0x80 and c3 <= 0xBF\n\t\telseif c >= 0xE1 and c <= 0xEC then\n\t\t\treturn c2 and c3 and\n\t\t\t\tc2 >= 0x80 and c2 <= 0xBF and\n\t\t\t\tc3 >= 0x80 and c3 <= 0xBF\n\t\telseif c == 0xED then\n\t\t\treturn c2 and c3 and\n\t\t\t\tc2 >= 0x80 and c2 <= 0x9F and\n\t\t\t\tc3 >= 0x80 and c3 <= 0xBF\n\t\telseif c >= 0xEE and c <= 0xEF then\n\t\t\tif c == 0xEF and c2 == 0xBF and (c3 == 0xBE or c3 == 0xBF) then\n\t\t\t\treturn false --uFFFE and uFFFF non-characters\n\t\t\tend\n\t\t\treturn c2 and c3 and\n\t\t\t\tc2 >= 0x80 and c2 <= 0xBF and\n\t\t\t\tc3 >= 0x80 and c3 <= 0xBF\n\t\tend\n\telseif c >= 0xF0 and c <= 0xF4 then\n\t\tlocal c2 = s:byte(i + 1)\n\t\tlocal c3 = s:byte(i + 2)\n\t\tlocal c4 = s:byte(i + 3)\n\t\tif c == 0xF0 then\n\t\t\treturn c2 and c3 and c4 and\n\t\t\t\tc2 >= 0x90 and c2 <= 0xBF and\n\t\t\t\tc3 >= 0x80 and c3 <= 0xBF and\n\t\t\t\tc4 >= 0x80 and c4 <= 0xBF\n\t\telseif c >= 0xF1 and c <= 0xF3 then\n\t\t\treturn c2 and c3 and c4 and\n\t\t\t\tc2 >= 0x80 and c2 <= 0xBF and\n\t\t\t\tc3 >= 0x80 and c3 <= 0xBF and\n\t\t\t\tc4 >= 0x80 and c4 <= 0xBF\n\t\telseif c == 0xF4 then\n\t\t\treturn c2 and c3 and c4 and\n\t\t\t\tc2 >= 0x80 and c2 <= 0x8F and\n\t\t\t\tc3 >= 0x80 and c3 <= 0xBF and\n\t\t\t\tc4 >= 0x80 and c4 <= 0xBF\n\t\tend\n\tend\n\treturn false\nend\n\n--byte index of the next valid utf8 char after the char at byte index i.\n--nil if indices go out of range. invalid characters are skipped.\nfunction utf8.next_valid(s, i)\n\tlocal valid\n\ti, valid = utf8.next_raw(s, i)\n\twhile i and (not valid or not utf8.isvalid(s, i)) do\n\t\ti, valid = utf8.next(s, i)\n\tend\n\treturn i\nend\n\n--iterate valid chars, returning the byte index where each char starts\nfunction utf8.valid_byte_indices(s)\n\treturn utf8.next_valid, s\nend\n\n--assert that a string only contains valid utf8 characters\nfunction utf8.validate(s)\n\tfor i, valid in utf8.byte_indices(s) do\n\t\tif not valid or not utf8.isvalid(s, i) then\n\t\t\terror(string.format('invalid utf8 char at #%d', i))\n\t\tend\n\tend\nend\n\nlocal function table_lookup(s, i, j, t)\n\treturn t[s:sub(i, j)]\nend\n\n--replace characters in string based on a function f(s, i, j, ...) -> replacement_string | nil\nfunction utf8.replace(s, f, ...)\n\tif type(f) == 'table' then\n\t\treturn utf8.replace(s, table_lookup, f)\n\tend\n\tif s == '' then\n\t\treturn s\n\tend\n\tlocal t = {}\n\tlocal lasti = 1\n\tfor i in utf8.byte_indices(s) do\n\t\tlocal nexti = utf8.next(s, i) or #s + 1\n\t\tlocal repl = f(s, i, nexti - 1, ...)\n\t\tif repl then\n\t\t\ttable.insert(t, s:sub(lasti, i - 1))\n\t\t\ttable.insert(t, repl)\n\t\t\tlasti = nexti\n\t\tend\n\tend\n\ttable.insert(t, s:sub(lasti))\n\treturn table.concat(t)\nend\n\nlocal function replace_invalid(s, i, j, repl_char)\n\tif not utf8.isvalid(s, i) then\n\t\treturn repl_char\n\tend\nend\n\n--replace invalid utf8 chars with a replacement char\nfunction utf8.sanitize(s, repl_char)\n\trepl_char = repl_char or '�' --\\uFFFD\n\treturn utf8.replace(s, replace_invalid, repl_char)\nend\n\nreturn utf8\n"
  },
  {
    "path": "Assets/ToLua/Lua/misc/utf8.lua.meta",
    "content": "fileFormatVersion: 2\nguid: c7ac60fc5e653564588e60deb91863ee\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/misc.meta",
    "content": "fileFormatVersion: 2\nguid: 08e54c61aaaa7c545b03c37c12e41df1\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/pbc.meta",
    "content": "fileFormatVersion: 2\nguid: b90e9a8a37d474c4fa8fdcf856eeb7e8\nfolderAsset: yes\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/containers.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  containers.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--\n--  COMPANY:  NetEase\n--  CREATED:  2010年08月02日 16时15分42秒 CST\n--------------------------------------------------------------------------------\n--\nlocal setmetatable = setmetatable\nlocal table = table\nlocal rawset = rawset\nlocal error = error\n\nmodule \"protobuf.containers\"\n\nlocal _RCFC_meta = {\n    add = function(self)\n        local value = self._message_descriptor._concrete_class()\n        local listener = self._listener\n        rawset(self, #self + 1, value)\n        value:_SetListener(listener)\n        if listener.dirty == false then\n            listener:Modified()\n        end\n        return value\n    end,\n    remove = function(self, key)\n        local listener = self._listener\n        table.remove(self, key)\n        listener:Modified()\n    end,\n    __newindex = function(self, key, value)\n        error(\"RepeatedCompositeFieldContainer Can't set value directly\")\n    end\n}\n_RCFC_meta.__index = _RCFC_meta\n\nfunction RepeatedCompositeFieldContainer(listener, message_descriptor)\n    local o = {\n        _listener = listener,\n        _message_descriptor = message_descriptor\n    }\n    return setmetatable(o, _RCFC_meta)\nend\n\nlocal _RSFC_meta = {\n    append = function(self, value)\n        self._type_checker(value)\n        rawset(self, #self + 1, value)\n        self._listener:Modified()\n    end,\n    remove = function(self, key)\n        table.remove(self, key)\n        self._listener:Modified()\n    end,\n    __newindex = function(self, key, value)\n        error(\"RepeatedCompositeFieldContainer Can't set value directly\")\n    end\n}\n_RSFC_meta.__index = _RSFC_meta\n\nfunction RepeatedScalarFieldContainer(listener, type_checker)\n    local o = {}\n    o._listener = listener\n    o._type_checker = type_checker\n    return setmetatable(o, _RSFC_meta)\nend\n\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/containers.lua.meta",
    "content": "fileFormatVersion: 2\nguid: b091e6d28e2ea5b469fa0ef87c372f3a\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/decoder.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  decoder.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--\n--  COMPANY:  NetEase\n--  CREATED:  2010年07月29日 19时30分51秒 CST\n--------------------------------------------------------------------------------\n--\nlocal string = string\nlocal table = table\nlocal assert = assert\nlocal ipairs = ipairs\nlocal error = error\nlocal print = print\n\nlocal pb = require \"pb\"\nlocal encoder = require \"protobuf.encoder\"\nlocal wire_format = require \"protobuf.wire_format\"\nmodule \"protobuf.decoder\"\n\nlocal _DecodeVarint = pb.varint_decoder\nlocal _DecodeSignedVarint = pb.signed_varint_decoder\n\nlocal _DecodeVarint32 = pb.varint_decoder\nlocal _DecodeSignedVarint32 = pb.signed_varint_decoder\n\nlocal _DecodeVarint64 = pb.varint_decoder64\nlocal _DecodeSignedVarint64 = pb.signed_varint_decoder64\n\nReadTag = pb.read_tag\n\nlocal function _SimpleDecoder(wire_type, decode_value)\n    return function(field_number, is_repeated, is_packed, key, new_default)\n        if is_packed then\n            local DecodeVarint = _DecodeVarint\n            return function (buffer, pos, pend, message, field_dict)\n                local value = field_dict[key]\n                if value == nil then\n                    value = new_default(message)\n                    field_dict[key] = value\n                end\n                local endpoint\n                endpoint, pos = DecodeVarint(buffer, pos)\n                endpoint = endpoint + pos\n                if endpoint > pend then\n                    error('Truncated message.')\n                end\n                local element\n                while pos < endpoint do\n                    element, pos = decode_value(buffer, pos)\n                    value[#value + 1] = element\n                end\n                if pos > endpoint then\n                    value:remove(#value)\n                    error('Packed element was truncated.')\n                end\n                return pos\n            end\n        elseif is_repeated then\n            local tag_bytes = encoder.TagBytes(field_number, wire_type)\n            local tag_len = #tag_bytes\n            local sub = string.sub\n            return function(buffer, pos, pend, message, field_dict)\n                local value = field_dict[key]\n                if value == nil then\n                    value = new_default(message)\n                    field_dict[key] = value\n                end\n                while 1 do\n                    local element, new_pos = decode_value(buffer, pos)\n                    value:append(element)\n                    pos = new_pos + tag_len\n                    if sub(buffer, new_pos+1, pos) ~= tag_bytes or new_pos >= pend then\n                        if new_pos > pend then\n                            error('Truncated message.')\n                        end\n                        return new_pos\n                    end\n                end\n            end\n        else\n            return function (buffer, pos, pend, message, field_dict)\n                field_dict[key], pos = decode_value(buffer, pos)\n                if pos > pend then\n                    field_dict[key] = nil\n                    error('Truncated message.')\n                end\n                return pos\n            end\n        end\n    end\nend\n\nlocal function _ModifiedDecoder(wire_type, decode_value, modify_value)\n    local InnerDecode = function (buffer, pos)\n        local result, new_pos = decode_value(buffer, pos)\n        return modify_value(result), new_pos\n    end\n    return _SimpleDecoder(wire_type, InnerDecode)\nend\n\nlocal function _StructPackDecoder(wire_type, value_size, format)\n    local struct_unpack = pb.struct_unpack\n\n    function InnerDecode(buffer, pos)\n        local new_pos = pos + value_size\n        local result = struct_unpack(format, buffer, pos)\n        return result, new_pos\n    end\n    return _SimpleDecoder(wire_type, InnerDecode)\nend\n\nlocal function _Boolean(value)\n    return value ~= 0\nend\n\nInt32Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeSignedVarint32)\nEnumDecoder = Int32Decoder\n\nInt64Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeSignedVarint64)\n\nUInt32Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint32)\nUInt64Decoder = _SimpleDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint64)\n\nSInt32Decoder = _ModifiedDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint32, wire_format.ZigZagDecode32)\nSInt64Decoder = _ModifiedDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint64, wire_format.ZigZagDecode64)\n\nFixed32Decoder  = _StructPackDecoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('I'))\nFixed64Decoder  = _StructPackDecoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('Q'))\nSFixed32Decoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('i'))\nSFixed64Decoder = _StructPackDecoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('q'))\nFloatDecoder    = _StructPackDecoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('f'))\nDoubleDecoder   = _StructPackDecoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('d'))\n\n\nBoolDecoder = _ModifiedDecoder(wire_format.WIRETYPE_VARINT, _DecodeVarint, _Boolean)\n\n\nfunction StringDecoder(field_number, is_repeated, is_packed, key, new_default)\n    local DecodeVarint = _DecodeVarint\n    local sub = string.sub\n    --    local unicode = unicode\n    assert(not is_packed)\n    if is_repeated then\n        local tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n        local tag_len = #tag_bytes\n        return function (buffer, pos, pend, message, field_dict)\n            local value = field_dict[key]\n            if value == nil then\n                value = new_default(message)\n                field_dict[key] = value\n            end\n            while 1 do\n                local size, new_pos\n                size, pos = DecodeVarint(buffer, pos)\n                new_pos = pos + size\n                if new_pos > pend then\n                    error('Truncated string.')\n                end\n                value:append(sub(buffer, pos+1, new_pos))\n                pos = new_pos + tag_len\n                if sub(buffer, new_pos + 1, pos) ~= tag_bytes or new_pos == pend then\n                    return new_pos\n                end\n            end\n        end\n    else\n        return function (buffer, pos, pend, message, field_dict)\n            local size, new_pos\n            size, pos = DecodeVarint(buffer, pos)\n            new_pos = pos + size\n            if new_pos > pend then\n                error('Truncated string.')\n            end\n            field_dict[key] = sub(buffer, pos + 1, new_pos)\n            return new_pos\n        end\n    end\nend\n\nfunction BytesDecoder(field_number, is_repeated, is_packed, key, new_default)\n    local DecodeVarint = _DecodeVarint\n    local sub = string.sub\n    assert(not is_packed)\n    if is_repeated then\n        local tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n        local tag_len = #tag_bytes\n        return function (buffer, pos, pend, message, field_dict)\n            local value = field_dict[key]\n            if value == nil then\n                value = new_default(message)\n                field_dict[key] = value\n            end\n            while 1 do\n                local size, new_pos\n                size, pos = DecodeVarint(buffer, pos)\n                new_pos = pos + size\n                if new_pos > pend then\n                    error('Truncated string.')\n                end\n                value:append(sub(buffer, pos + 1, new_pos))\n                pos = new_pos + tag_len\n                if sub(buffer, new_pos + 1, pos) ~= tag_bytes or new_pos == pend then\n                    return new_pos\n                end\n            end\n        end\n    else\n        return function(buffer, pos, pend, message, field_dict)\n            local size, new_pos\n            size, pos = DecodeVarint(buffer, pos)\n            new_pos = pos + size\n            if new_pos > pend then\n                error('Truncated string.')\n            end\n            field_dict[key] = sub(buffer, pos + 1, new_pos)\n            return new_pos\n        end\n    end\nend\n\nfunction MessageDecoder(field_number, is_repeated, is_packed, key, new_default)\n    local DecodeVarint = _DecodeVarint\n    local sub = string.sub\n\n    assert(not is_packed)\n    if is_repeated then\n        local tag_bytes = encoder.TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n        local tag_len = #tag_bytes\n        return function (buffer, pos, pend, message, field_dict)\n            local value = field_dict[key]\n            if value == nil then\n                value = new_default(message)\n                field_dict[key] = value\n            end\n            while 1 do\n                local size, new_pos\n                size, pos = DecodeVarint(buffer, pos)\n                new_pos = pos + size\n                if new_pos > pend then\n                    error('Truncated message.')\n                end\n                if value:add():_InternalParse(buffer, pos, new_pos) ~= new_pos then\n                    error('Unexpected end-group tag.')\n                end\n                pos = new_pos + tag_len\n                if sub(buffer, new_pos + 1, pos) ~= tag_bytes or new_pos == pend then\n                    return new_pos\n                end\n            end\n        end\n    else\n        return function (buffer, pos, pend, message, field_dict)\n            local value = field_dict[key]\n            if value == nil then\n                value = new_default(message)\n                field_dict[key] = value\n            end\n            local size, new_pos\n            size, pos = DecodeVarint(buffer, pos)\n            new_pos = pos + size\n            if new_pos > pend then\n                error('Truncated message.')\n            end\n            if value:_InternalParse(buffer, pos, new_pos) ~= new_pos then\n                error('Unexpected end-group tag.')\n            end\n            return new_pos\n        end\n    end\nend\n\nfunction _SkipVarint(buffer, pos, pend)\n    local value\n    value, pos = _DecodeVarint(buffer, pos)\n    return pos\nend\n\nfunction _SkipFixed64(buffer, pos, pend)\n    pos = pos + 8\n    if pos > pend then \n        error('Truncated message.')\n    end\n    return pos\nend\n\nfunction _SkipLengthDelimited(buffer, pos, pend)\n    local size\n    size, pos = _DecodeVarint(buffer, pos)\n    pos = pos + size\n    if pos > pend then\n        error('Truncated message.')\n    end\n    return pos\nend\n\nfunction _SkipFixed32(buffer, pos, pend)\n    pos = pos + 4\n    if pos > pend then\n        error('Truncated message.')\n    end\n    return pos\nend\n\nfunction _RaiseInvalidWireType(buffer, pos, pend)\n    error('Tag had invalid wire type.')\nend\n\nfunction _FieldSkipper()\n    WIRETYPE_TO_SKIPPER = {\n        _SkipVarint,\n        _SkipFixed64,\n        _SkipLengthDelimited,\n        _SkipGroup,\n        _EndGroup,\n        _SkipFixed32,\n        _RaiseInvalidWireType,\n        _RaiseInvalidWireType,\n    }\n\n--    wiretype_mask = wire_format.TAG_TYPE_MASK\n    local ord = string.byte\n    local sub = string.sub\n\n    return function (buffer, pos, pend, tag_bytes)\n        local wire_type = ord(sub(tag_bytes, 1, 1)) % 8 + 1\n        return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, pend)\n    end\nend\n\nSkipField = _FieldSkipper()\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/decoder.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 99e0d332d92e1c44ca56267a2b3bdcf9\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/descriptor.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  descriptor.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--\n--  COMPANY:  NetEase\n--  CREATED:  2010年08月11日 18时45分43秒 CST\n--------------------------------------------------------------------------------\n--\n\nmodule \"protobuf.descriptor\"\n\nFieldDescriptor = {\n    TYPE_DOUBLE         = 1,\n    TYPE_FLOAT          = 2,\n    TYPE_INT64          = 3,\n    TYPE_UINT64         = 4,\n    TYPE_INT32          = 5,\n    TYPE_FIXED64        = 6,\n    TYPE_FIXED32        = 7,\n    TYPE_BOOL           = 8,\n    TYPE_STRING         = 9,\n    TYPE_GROUP          = 10,\n    TYPE_MESSAGE        = 11,\n    TYPE_BYTES          = 12,\n    TYPE_UINT32         = 13,\n    TYPE_ENUM           = 14,\n    TYPE_SFIXED32       = 15,\n    TYPE_SFIXED64       = 16,\n    TYPE_SINT32         = 17,\n    TYPE_SINT64         = 18,\n    MAX_TYPE            = 18,\n\n    --   Must be consistent with C++ FieldDescriptor::CppType enum in\n    --   descriptor.h.\n    --  \n    CPPTYPE_INT32       = 1,\n    CPPTYPE_INT64       = 2,\n    CPPTYPE_UINT32      = 3,\n    CPPTYPE_UINT64      = 4,\n    CPPTYPE_DOUBLE      = 5,\n    CPPTYPE_FLOAT       = 6,\n    CPPTYPE_BOOL        = 7,\n    CPPTYPE_ENUM        = 8,\n    CPPTYPE_STRING      = 9,\n    CPPTYPE_MESSAGE     = 10,\n    MAX_CPPTYPE         = 10,\n\n    --   Must be consistent with C++ FieldDescriptor::Label enum in\n    --   descriptor.h.\n    --  \n    LABEL_OPTIONAL      = 1,\n    LABEL_REQUIRED      = 2,\n    LABEL_REPEATED      = 3,\n    MAX_LABEL           = 3\n}\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/descriptor.lua.meta",
    "content": "fileFormatVersion: 2\nguid: ec5270fc0e79e1140be77c303c4874c4\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/encoder.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  encoder.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--\n--  COMPANY:  NetEase\n--  CREATED:  2010年07月29日 19时30分46秒 CST\n--------------------------------------------------------------------------------\n--\nlocal string = string\nlocal table = table\nlocal ipairs = ipairs\nlocal assert =assert\n\nlocal pb = require \"pb\"\nlocal wire_format = require \"protobuf.wire_format\"\nmodule \"protobuf.encoder\"\n\nfunction _VarintSize(value)    \n    if value <= 0x7f then return 1 end\n    if value <= 0x3fff then return 2 end\n    if value <= 0x1fffff then return 3 end\n    if value <= 0xfffffff then return 4 end\n    if value <= 0x7ffffffff then return 5 end\n    if value <= 0x3ffffffffff then return 6 end\n    if value <= 0x1ffffffffffff then return 7 end\n    if value <= 0xffffffffffffff then return 8 end\n    if value <= 0x7fffffffffffffff then return 9 end\n    return 10\nend\n\nfunction _SignedVarintSize(value)    \n    if value < 0 then return 10 end\n    if value <= 0x7f then return 1 end\n    if value <= 0x3fff then return 2 end\n    if value <= 0x1fffff then return 3 end\n    if value <= 0xfffffff then return 4 end\n    if value <= 0x7ffffffff then return 5 end\n    if value <= 0x3ffffffffff then return 6 end\n    if value <= 0x1ffffffffffff then return 7 end\n    if value <= 0xffffffffffffff then return 8 end\n    if value <= 0x7fffffffffffffff then return 9 end\n    return 10\nend\n\nfunction _TagSize(field_number)\n  return _VarintSize(wire_format.PackTag(field_number, 0))\nend\n\nfunction _SimpleSizer(compute_value_size)\n    return function(field_number, is_repeated, is_packed)\n        local tag_size = _TagSize(field_number)\n        if is_packed then\n            local VarintSize = _VarintSize\n            return function(value)\n                local result = 0\n                for _, element in ipairs(value) do\n                    result = result + compute_value_size(element)\n                end\n                return result + VarintSize(result) + tag_size\n            end\n        elseif is_repeated then\n            return function(value)\n                local result = tag_size * #value\n                for _, element in ipairs(value) do\n                    result = result + compute_value_size(element)\n                end\n                return result\n            end\n        else\n            return function (value)\n                return tag_size + compute_value_size(value)\n            end\n        end\n    end\nend\n\nfunction _ModifiedSizer(compute_value_size, modify_value)\n    return function (field_number, is_repeated, is_packed)\n        local tag_size = _TagSize(field_number)\n        if is_packed then\n            local VarintSize = _VarintSize\n            return function (value)\n                local result = 0\n                for _, element in ipairs(value) do\n                    result = result + compute_value_size(modify_value(element))\n                end\n                return result + VarintSize(result) + tag_size\n            end\n        elseif is_repeated then\n            return function (value)\n                local result = tag_size * #value\n                for _, element in ipairs(value) do\n                    result = result + compute_value_size(modify_value(element))\n                end\n                return result\n            end\n        else\n            return function (value)\n                return tag_size + compute_value_size(modify_value(value))\n            end\n        end\n    end\nend\n\nfunction _FixedSizer(value_size)\n    return function (field_number, is_repeated, is_packed)\n        local tag_size = _TagSize(field_number)\n        if is_packed then\n            local VarintSize = _VarintSize\n            return function (value)\n                local result = #value * value_size\n                return result + VarintSize(result) + tag_size\n            end\n        elseif is_repeated then\n            local element_size = value_size + tag_size\n            return function(value)\n                return #value * element_size\n            end\n        else\n            local field_size = value_size + tag_size\n            return function (value)\n                return field_size\n            end\n        end\n    end\nend\n\nInt32Sizer = _SimpleSizer(_SignedVarintSize)\nInt64Sizer = _SimpleSizer(pb.signed_varint_size)\nEnumSizer = Int32Sizer\n\nUInt32Sizer = _SimpleSizer(_VarintSize)\nUInt64Sizer = _SimpleSizer(pb.varint_size) \n\nSInt32Sizer = _ModifiedSizer(_SignedVarintSize, wire_format.ZigZagEncode32)\nSInt64Sizer = SInt32Sizer\n\nFixed32Sizer = _FixedSizer(4) \nSFixed32Sizer = Fixed32Sizer\nFloatSizer = Fixed32Sizer\n\nFixed64Sizer = _FixedSizer(8) \nSFixed64Sizer = Fixed64Sizer\nDoubleSizer = Fixed64Sizer\n\nBoolSizer = _FixedSizer(1)\n\n\nfunction StringSizer(field_number, is_repeated, is_packed)\n    local tag_size = _TagSize(field_number)\n    local VarintSize = _VarintSize\n    assert(not is_packed)\n    if is_repeated then\n        return function(value)\n            local result = tag_size * #value\n            for _, element in ipairs(value) do\n                local l = #element\n                result = result + VarintSize(l) + l\n            end\n            return result\n        end\n    else\n        return function(value)\n            local l = #value\n            return tag_size + VarintSize(l) + l\n        end\n    end\nend\n\nfunction BytesSizer(field_number, is_repeated, is_packed)\n    local tag_size = _TagSize(field_number)\n    local VarintSize = _VarintSize\n    assert(not is_packed)\n    if is_repeated then\n        return function (value)\n            local result = tag_size * #value\n            for _,element in ipairs(value) do\n                local l = #element\n                result = result + VarintSize(l) + l\n            end\n            return result\n        end\n    else\n        return function (value)\n            local l = #value\n            return tag_size + VarintSize(l) + l\n        end\n    end\nend\n\nfunction MessageSizer(field_number, is_repeated, is_packed)\n    local tag_size = _TagSize(field_number)\n    local VarintSize = _VarintSize\n    assert(not is_packed)\n    if is_repeated then\n        return function(value)\n            local result = tag_size * #value\n            for _,element in ipairs(value) do\n                local l = element:ByteSize()\n                result = result + VarintSize(l) + l\n            end\n            return result\n        end\n    else\n        return function (value)\n            local l = value:ByteSize()\n            return tag_size + VarintSize(l) + l\n        end\n    end\nend\n\n\n-- ====================================================================\n--  Encoders!\n\nlocal _EncodeVarint = pb.varint_encoder\nlocal _EncodeSignedVarint = pb.signed_varint_encoder\nlocal _EncodeVarint64 = pb.varint_encoder64\nlocal _EncodeSignedVarint64 = pb.signed_varint_encoder64\n\n\nfunction _VarintBytes(value)\n    local out = {}\n    local write = function(value)\n        out[#out + 1 ] = value\n    end\n    _EncodeSignedVarint(write, value)\n    return table.concat(out)\nend\n\nfunction TagBytes(field_number, wire_type)\n  return _VarintBytes(wire_format.PackTag(field_number, wire_type))\nend\n\nfunction _SimpleEncoder(wire_type, encode_value, compute_value_size)\n    return function(field_number, is_repeated, is_packed)\n        if is_packed then\n            local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n            local EncodeVarint = _EncodeVarint\n            return function(write, value)\n                write(tag_bytes)\n                local size = 0\n                for _, element in ipairs(value) do\n                    size = size + compute_value_size(element)\n                end\n                EncodeVarint(write, size)\n                for element in value do\n                    encode_value(write, element)\n                end\n            end\n        elseif is_repeated then\n            local tag_bytes = TagBytes(field_number, wire_type)\n            return function(write, value)\n                for _, element in ipairs(value) do\n                    write(tag_bytes)\n                    encode_value(write, element)\n                end\n            end\n        else\n            local tag_bytes = TagBytes(field_number, wire_type)\n            return function(write, value)\n                write(tag_bytes)\n                encode_value(write, value)\n            end\n        end\n    end\nend\n\nfunction _ModifiedEncoder(wire_type, encode_value, compute_value_size, modify_value)\n    return function (field_number, is_repeated, is_packed)\n        if is_packed then\n            local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n            local EncodeVarint = _EncodeVarint\n            return function (write, value)\n                write(tag_bytes)\n                local size = 0\n                for _, element in ipairs(value) do\n                    size = size + compute_value_size(modify_value(element))\n                end\n                EncodeVarint(write, size)\n                for _, element in ipairs(value) do\n                    encode_value(write, modify_value(element))\n                end\n            end\n        elseif is_repeated then\n            local tag_bytes = TagBytes(field_number, wire_type)\n            return function (write, value)\n                for _, element in ipairs(value) do\n                    write(tag_bytes)\n                    encode_value(write, modify_value(element))\n                end\n            end\n        else\n            local tag_bytes = TagBytes(field_number, wire_type)\n            return function (write, value)\n                write(tag_bytes)\n                encode_value(write, modify_value(value))\n            end\n        end\n    end\nend\n\nfunction _StructPackEncoder(wire_type, value_size, format)\n    return function(field_number, is_repeated, is_packed)\n        local struct_pack = pb.struct_pack\n        if is_packed then\n            local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n            local EncodeVarint = _EncodeVarint\n            return function (write, value)\n                write(tag_bytes)\n                EncodeVarint(write, #value * value_size)\n                for _, element in ipairs(value) do\n                    struct_pack(write, format, element)\n                end\n            end\n        elseif is_repeated then\n            local tag_bytes = TagBytes(field_number, wire_type)\n            return function (write, value)\n                for _, element in ipairs(value) do\n                    write(tag_bytes)\n                    struct_pack(write, format, element)\n                end\n            end\n        else\n            local tag_bytes = TagBytes(field_number, wire_type)\n            return function (write, value)\n                write(tag_bytes)\n                struct_pack(write, format, value)\n            end\n        end\n\n    end\nend\n\nInt32Encoder = _SimpleEncoder(wire_format.WIRETYPE_VARINT, _EncodeSignedVarint, _SignedVarintSize)\nInt64Encoder = _SimpleEncoder(wire_format.WIRETYPE_VARINT, _EncodeSignedVarint64, _SignedVarintSize)\nEnumEncoder = Int32Encoder\n\nUInt32Encoder = _SimpleEncoder(wire_format.WIRETYPE_VARINT, _EncodeVarint, _VarintSize)\nUInt64Encoder = _SimpleEncoder(wire_format.WIRETYPE_VARINT, _EncodeVarint64, _VarintSize)\n\nSInt32Encoder = _ModifiedEncoder(\n    wire_format.WIRETYPE_VARINT, _EncodeVarint, _VarintSize,\n    wire_format.ZigZagEncode32)\n\nSInt64Encoder = _ModifiedEncoder(\n    wire_format.WIRETYPE_VARINT, _EncodeVarint64, _VarintSize,\n    wire_format.ZigZagEncode64)\n\nFixed32Encoder  = _StructPackEncoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('I'))\nFixed64Encoder  = _StructPackEncoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('Q'))\nSFixed32Encoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('i'))\nSFixed64Encoder = _StructPackEncoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('q'))\nFloatEncoder    = _StructPackEncoder(wire_format.WIRETYPE_FIXED32, 4, string.byte('f'))\nDoubleEncoder   = _StructPackEncoder(wire_format.WIRETYPE_FIXED64, 8, string.byte('d'))\n\n\nfunction BoolEncoder(field_number, is_repeated, is_packed)\n    local false_byte = '\\0'\n    local true_byte = '\\1'\n    if is_packed then\n        local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n        local EncodeVarint = _EncodeVarint\n        return function (write, value)\n            write(tag_bytes)\n            EncodeVarint(write, #value)\n            for _, element in ipairs(value) do\n                if element then\n                    write(true_byte)\n                else\n                    write(false_byte)\n                end\n            end\n        end\n    elseif is_repeated then\n        local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_VARINT)\n        return function(write, value)\n            for _, element in ipairs(value) do\n                write(tag_bytes)\n                if element then\n                    write(true_byte)\n                else\n                    write(false_byte)\n                end\n            end\n        end\n    else\n        local tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_VARINT)\n        return function (write, value)\n            write(tag_bytes)\n            if value then\n                return write(true_byte)\n            end\n            return write(false_byte)\n        end\n    end\nend\n\nfunction StringEncoder(field_number, is_repeated, is_packed)\n    local tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n    local EncodeVarint = _EncodeVarint\n    assert(not is_packed)\n    if is_repeated then\n        return function (write, value)\n            for _, element in ipairs(value) do\n--                encoded = element.encode('utf-8')\n                write(tag)\n                EncodeVarint(write, #element)\n                write(element)\n            end\n        end\n    else\n        return function (write, value)\n--            local encoded = value.encode('utf-8')\n            write(tag)\n            EncodeVarint(write, #value)\n            return write(value)\n        end\n    end\nend\n\nfunction BytesEncoder(field_number, is_repeated, is_packed)\n    local tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n    local EncodeVarint = _EncodeVarint\n    assert(not is_packed)\n    if is_repeated then\n        return function (write, value)\n            for _, element in ipairs(value) do\n                write(tag)\n                EncodeVarint(write, #element)\n                write(element)\n            end\n        end\n    else\n        return function(write, value)\n            write(tag)\n            EncodeVarint(write, #value)\n            return write(value)\n        end\n    end\nend\n\n\nfunction MessageEncoder(field_number, is_repeated, is_packed)\n    local tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)\n    local EncodeVarint = _EncodeVarint\n    assert(not is_packed)\n    if is_repeated then\n        return function(write, value)\n            for _, element in ipairs(value) do\n                write(tag)\n                EncodeVarint(write, element:ByteSize())\n                element:_InternalSerialize(write)\n            end\n        end\n    else\n        return function (write, value)\n            write(tag)\n            EncodeVarint(write, value:ByteSize())\n            return value:_InternalSerialize(write)\n        end\n    end\nend\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/encoder.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 59c27d5459f0dfc4ab1077ce6f391ea9\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/listener.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  listener.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--\n--  COMPANY:  NetEase\n--  CREATED:  2010年08月02日 17时35分25秒 CST\n--------------------------------------------------------------------------------\n--\nlocal setmetatable = setmetatable\n\nmodule \"protobuf.listener\"\n\nlocal _null_listener = {\n    Modified = function()\n    end\n}\n\nfunction NullMessageListener()\n    return _null_listener\nend\n\nlocal _listener_meta = {\n    Modified = function(self)\n        if self.dirty then\n            return\n        end\n        if self._parent_message then\n            self._parent_message:_Modified()\n        end\n    end\n}\n_listener_meta.__index = _listener_meta\n\nfunction Listener(parent_message)\n    local o = {}\n    o.__mode = \"v\"\n    o._parent_message = parent_message\n    o.dirty = false\n    return setmetatable(o, _listener_meta)\nend\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/listener.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 7778f4f6aeddbee43984c5da8cc06953\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/protobuf.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  protobuf.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--\n--  COMPANY:  NetEase\n--  CREATED:  2010年07月29日 14时30分02秒 CST\n--------------------------------------------------------------------------------\n--\n\nlocal setmetatable = setmetatable\nlocal rawset = rawset\nlocal rawget = rawget\nlocal error = error\nlocal ipairs = ipairs\nlocal pairs = pairs\nlocal print = print\nlocal table = table \nlocal string = string\nlocal tostring = tostring\nlocal type = type\n\nlocal pb = require \"pb\"\nlocal wire_format = require \"protobuf.wire_format\"\nlocal type_checkers = require \"protobuf.type_checkers\"\nlocal encoder = require \"protobuf.encoder\"\nlocal decoder = require \"protobuf.decoder\"\nlocal listener_mod = require \"protobuf.listener\"\nlocal containers = require \"protobuf.containers\"\nlocal descriptor = require \"protobuf.descriptor\"\nlocal FieldDescriptor = descriptor.FieldDescriptor\nlocal text_format = require \"protobuf.text_format\"\n\nmodule(\"protobuf.protobuf\")\n\nlocal function make_descriptor(name, descriptor, usable_key)\n    local meta = {\n        __newindex = function(self, key, value)\n            if usable_key[key] then\n                rawset(self, key, value)\n            else\n                error(\"error key: \"..key)\n            end\n        end\n    };\n    meta.__index = meta\n    meta.__call = function()\n        return setmetatable({}, meta)\n    end\n\n    _M[name] = setmetatable(descriptor, meta);\nend\n\n\nmake_descriptor(\"Descriptor\",  {}, {\n    name = true,\n    full_name = true,\n    filename = true,\n    containing_type = true,\n    fields = true,\n    nested_types = true,\n    enum_types = true,\n    extensions = true,\n    options = true,\n    is_extendable = true,\n    extension_ranges = true,\n})\n\nmake_descriptor(\"FieldDescriptor\", FieldDescriptor, {\n    name = true,\n    full_name = true,\n    index = true,\n    number = true,\n    type = true,\n    cpp_type = true,\n    label = true,\n    has_default_value = true,\n    default_value = true,\n    containing_type = true,\n    message_type = true,\n    enum_type = true,\n    is_extension = true,\n    extension_scope = true,\n})\n\nmake_descriptor(\"EnumDescriptor\", {}, {\n    name = true,\n    full_name = true,\n    values = true,\n    containing_type  = true,\n    options = true\n})\n\nmake_descriptor(\"EnumValueDescriptor\", {}, {\n    name = true,\n    index = true,\n    number = true,\n    type = true,\n    options = true\n})\n\n-- Maps from field type to expected wiretype.\nlocal FIELD_TYPE_TO_WIRE_TYPE = {\n    [FieldDescriptor.TYPE_DOUBLE] = wire_format.WIRETYPE_FIXED64,\n    [FieldDescriptor.TYPE_FLOAT] = wire_format.WIRETYPE_FIXED32,\n    [FieldDescriptor.TYPE_INT64] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_UINT64] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_INT32] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_FIXED64] = wire_format.WIRETYPE_FIXED64,\n    [FieldDescriptor.TYPE_FIXED32] = wire_format.WIRETYPE_FIXED32,\n    [FieldDescriptor.TYPE_BOOL] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_STRING] = wire_format.WIRETYPE_LENGTH_DELIMITED,\n    [FieldDescriptor.TYPE_GROUP] = wire_format.WIRETYPE_START_GROUP,\n    [FieldDescriptor.TYPE_MESSAGE] = wire_format.WIRETYPE_LENGTH_DELIMITED,\n    [FieldDescriptor.TYPE_BYTES] = wire_format.WIRETYPE_LENGTH_DELIMITED,\n    [FieldDescriptor.TYPE_UINT32] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_ENUM] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_SFIXED32] = wire_format.WIRETYPE_FIXED32,\n    [FieldDescriptor.TYPE_SFIXED64] = wire_format.WIRETYPE_FIXED64,\n    [FieldDescriptor.TYPE_SINT32] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_SINT64] = wire_format.WIRETYPE_VARINT\n}\n\nlocal NON_PACKABLE_TYPES = {\n    [FieldDescriptor.TYPE_STRING] = true,\n    [FieldDescriptor.TYPE_GROUP] = true,\n    [FieldDescriptor.TYPE_MESSAGE] = true,\n    [FieldDescriptor.TYPE_BYTES] = true\n}\n\nlocal _VALUE_CHECKERS = {\n    [FieldDescriptor.CPPTYPE_INT32] = type_checkers.Int32ValueChecker(),\n    [FieldDescriptor.CPPTYPE_INT64] = type_checkers.TypeChecker({string = true, number = true}),\n    [FieldDescriptor.CPPTYPE_UINT32] = type_checkers.Uint32ValueChecker(),\n    [FieldDescriptor.CPPTYPE_UINT64] = type_checkers.TypeChecker({string = true, number = true}),\n    [FieldDescriptor.CPPTYPE_DOUBLE] = type_checkers.TypeChecker({number = true}),\n    [FieldDescriptor.CPPTYPE_FLOAT] = type_checkers.TypeChecker({number = true}),\n    [FieldDescriptor.CPPTYPE_BOOL] = type_checkers.TypeChecker({boolean = true, bool = true, int=true}),\n    [FieldDescriptor.CPPTYPE_ENUM] = type_checkers.Int32ValueChecker(),\n    [FieldDescriptor.CPPTYPE_STRING] = type_checkers.TypeChecker({string = true})\n}\n\n\nlocal TYPE_TO_BYTE_SIZE_FN = {\n    [FieldDescriptor.TYPE_DOUBLE] = wire_format.DoubleByteSize,\n    [FieldDescriptor.TYPE_FLOAT] = wire_format.FloatByteSize,\n    [FieldDescriptor.TYPE_INT64] = wire_format.Int64ByteSize,\n    [FieldDescriptor.TYPE_UINT64] = wire_format.UInt64ByteSize,\n    [FieldDescriptor.TYPE_INT32] = wire_format.Int32ByteSize,\n    [FieldDescriptor.TYPE_FIXED64] = wire_format.Fixed64ByteSize,\n    [FieldDescriptor.TYPE_FIXED32] = wire_format.Fixed32ByteSize,\n    [FieldDescriptor.TYPE_BOOL] = wire_format.BoolByteSize,\n    [FieldDescriptor.TYPE_STRING] = wire_format.StringByteSize,\n    [FieldDescriptor.TYPE_GROUP] = wire_format.GroupByteSize,\n    [FieldDescriptor.TYPE_MESSAGE] = wire_format.MessageByteSize,\n    [FieldDescriptor.TYPE_BYTES] = wire_format.BytesByteSize,\n    [FieldDescriptor.TYPE_UINT32] = wire_format.UInt32ByteSize,\n    [FieldDescriptor.TYPE_ENUM] = wire_format.EnumByteSize,\n    [FieldDescriptor.TYPE_SFIXED32] = wire_format.SFixed32ByteSize,\n    [FieldDescriptor.TYPE_SFIXED64] = wire_format.SFixed64ByteSize,\n    [FieldDescriptor.TYPE_SINT32] = wire_format.SInt32ByteSize,\n    [FieldDescriptor.TYPE_SINT64] = wire_format.SInt64ByteSize\n}\n\nlocal TYPE_TO_ENCODER = {\n    [FieldDescriptor.TYPE_DOUBLE] = encoder.DoubleEncoder,\n    [FieldDescriptor.TYPE_FLOAT] = encoder.FloatEncoder,\n    [FieldDescriptor.TYPE_INT64] = encoder.Int64Encoder,\n    [FieldDescriptor.TYPE_UINT64] = encoder.UInt64Encoder,\n    [FieldDescriptor.TYPE_INT32] = encoder.Int32Encoder,\n    [FieldDescriptor.TYPE_FIXED64] = encoder.Fixed64Encoder,\n    [FieldDescriptor.TYPE_FIXED32] = encoder.Fixed32Encoder,\n    [FieldDescriptor.TYPE_BOOL] = encoder.BoolEncoder,\n    [FieldDescriptor.TYPE_STRING] = encoder.StringEncoder,\n    [FieldDescriptor.TYPE_GROUP] = encoder.GroupEncoder,\n    [FieldDescriptor.TYPE_MESSAGE] = encoder.MessageEncoder,\n    [FieldDescriptor.TYPE_BYTES] = encoder.BytesEncoder,\n    [FieldDescriptor.TYPE_UINT32] = encoder.UInt32Encoder,\n    [FieldDescriptor.TYPE_ENUM] = encoder.EnumEncoder,\n    [FieldDescriptor.TYPE_SFIXED32] = encoder.SFixed32Encoder,\n    [FieldDescriptor.TYPE_SFIXED64] = encoder.SFixed64Encoder,\n    [FieldDescriptor.TYPE_SINT32] = encoder.SInt32Encoder,\n    [FieldDescriptor.TYPE_SINT64] = encoder.SInt64Encoder\n}\n\nlocal TYPE_TO_SIZER = {\n    [FieldDescriptor.TYPE_DOUBLE] = encoder.DoubleSizer,\n    [FieldDescriptor.TYPE_FLOAT] = encoder.FloatSizer,\n    [FieldDescriptor.TYPE_INT64] = encoder.Int64Sizer,\n    [FieldDescriptor.TYPE_UINT64] = encoder.UInt64Sizer,\n    [FieldDescriptor.TYPE_INT32] = encoder.Int32Sizer,\n    [FieldDescriptor.TYPE_FIXED64] = encoder.Fixed64Sizer,\n    [FieldDescriptor.TYPE_FIXED32] = encoder.Fixed32Sizer,\n    [FieldDescriptor.TYPE_BOOL] = encoder.BoolSizer,\n    [FieldDescriptor.TYPE_STRING] = encoder.StringSizer,\n    [FieldDescriptor.TYPE_GROUP] = encoder.GroupSizer,\n    [FieldDescriptor.TYPE_MESSAGE] = encoder.MessageSizer,\n    [FieldDescriptor.TYPE_BYTES] = encoder.BytesSizer,\n    [FieldDescriptor.TYPE_UINT32] = encoder.UInt32Sizer,\n    [FieldDescriptor.TYPE_ENUM] = encoder.EnumSizer,\n    [FieldDescriptor.TYPE_SFIXED32] = encoder.SFixed32Sizer,\n    [FieldDescriptor.TYPE_SFIXED64] = encoder.SFixed64Sizer,\n    [FieldDescriptor.TYPE_SINT32] = encoder.SInt32Sizer,\n    [FieldDescriptor.TYPE_SINT64] = encoder.SInt64Sizer\n}\n\nlocal TYPE_TO_DECODER = {\n    [FieldDescriptor.TYPE_DOUBLE] = decoder.DoubleDecoder,\n    [FieldDescriptor.TYPE_FLOAT] = decoder.FloatDecoder,\n    [FieldDescriptor.TYPE_INT64] = decoder.Int64Decoder,\n    [FieldDescriptor.TYPE_UINT64] = decoder.UInt64Decoder,\n    [FieldDescriptor.TYPE_INT32] = decoder.Int32Decoder,\n    [FieldDescriptor.TYPE_FIXED64] = decoder.Fixed64Decoder,\n    [FieldDescriptor.TYPE_FIXED32] = decoder.Fixed32Decoder,\n    [FieldDescriptor.TYPE_BOOL] = decoder.BoolDecoder,\n    [FieldDescriptor.TYPE_STRING] = decoder.StringDecoder,\n    [FieldDescriptor.TYPE_GROUP] = decoder.GroupDecoder,\n    [FieldDescriptor.TYPE_MESSAGE] = decoder.MessageDecoder,\n    [FieldDescriptor.TYPE_BYTES] = decoder.BytesDecoder,\n    [FieldDescriptor.TYPE_UINT32] = decoder.UInt32Decoder,\n    [FieldDescriptor.TYPE_ENUM] = decoder.EnumDecoder,\n    [FieldDescriptor.TYPE_SFIXED32] = decoder.SFixed32Decoder,\n    [FieldDescriptor.TYPE_SFIXED64] = decoder.SFixed64Decoder,\n    [FieldDescriptor.TYPE_SINT32] = decoder.SInt32Decoder,\n    [FieldDescriptor.TYPE_SINT64] = decoder.SInt64Decoder\n}\n\nlocal FIELD_TYPE_TO_WIRE_TYPE = {\n    [FieldDescriptor.TYPE_DOUBLE] = wire_format.WIRETYPE_FIXED64,\n    [FieldDescriptor.TYPE_FLOAT] = wire_format.WIRETYPE_FIXED32,\n    [FieldDescriptor.TYPE_INT64] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_UINT64] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_INT32] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_FIXED64] = wire_format.WIRETYPE_FIXED64,\n    [FieldDescriptor.TYPE_FIXED32] = wire_format.WIRETYPE_FIXED32,\n    [FieldDescriptor.TYPE_BOOL] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_STRING] = wire_format.WIRETYPE_LENGTH_DELIMITED,\n    [FieldDescriptor.TYPE_GROUP] = wire_format.WIRETYPE_START_GROUP,\n    [FieldDescriptor.TYPE_MESSAGE] = wire_format.WIRETYPE_LENGTH_DELIMITED,\n    [FieldDescriptor.TYPE_BYTES] = wire_format.WIRETYPE_LENGTH_DELIMITED,\n    [FieldDescriptor.TYPE_UINT32] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_ENUM] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_SFIXED32] = wire_format.WIRETYPE_FIXED32,\n    [FieldDescriptor.TYPE_SFIXED64] = wire_format.WIRETYPE_FIXED64,\n    [FieldDescriptor.TYPE_SINT32] = wire_format.WIRETYPE_VARINT,\n    [FieldDescriptor.TYPE_SINT64] = wire_format.WIRETYPE_VARINT\n}\n\nlocal function IsTypePackable(field_type)\n    return NON_PACKABLE_TYPES[field_type] == nil\nend\n\nlocal function GetTypeChecker(cpp_type, field_type)\n    if (cpp_type == FieldDescriptor.CPPTYPE_STRING and field_type == FieldDescriptor.TYPE_STRING) then\n        return type_checkers.UnicodeValueChecker()\n    end\n    return _VALUE_CHECKERS[cpp_type]\nend\n\nlocal function _DefaultValueConstructorForField(field)\n    if field.label == FieldDescriptor.LABEL_REPEATED then\n        if type(field.default_value) ~= \"table\" or #(field.default_value) ~= 0  then\n            error('Repeated field default value not empty list:' .. tostring(field.default_value))\n        end\n        if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n            local message_type = field.message_type\n            return function (message)\n                return containers.RepeatedCompositeFieldContainer(message._listener_for_children, message_type)\n            end\n        else\n            local type_checker = GetTypeChecker(field.cpp_type, field.type)\n            return function (message)\n                return containers.RepeatedScalarFieldContainer(message._listener_for_children, type_checker)\n            end\n        end\n    end\n    if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n        local message_type = field.message_type\n        return function (message)\n            result = message_type._concrete_class()\n            result._SetListener(message._listener_for_children)\n            return result\n        end\n    end\n    return function (message)\n        return field.default_value\n    end\nend\n\nlocal function _AttachFieldHelpers(message_meta, field_descriptor)\n    local is_repeated = (field_descriptor.label == FieldDescriptor.LABEL_REPEATED)\n    local is_packed = (field_descriptor.has_options and field_descriptor.GetOptions().packed)\n\n    rawset(field_descriptor, \"_encoder\", TYPE_TO_ENCODER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed))\n    rawset(field_descriptor, \"_sizer\", TYPE_TO_SIZER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed))\n    rawset(field_descriptor, \"_default_constructor\", _DefaultValueConstructorForField(field_descriptor))\n\n    local AddDecoder = function(wiretype, is_packed)\n        local tag_bytes = encoder.TagBytes(field_descriptor.number, wiretype)\n        message_meta._decoders_by_tag[tag_bytes] = TYPE_TO_DECODER[field_descriptor.type](field_descriptor.number, is_repeated, is_packed, field_descriptor, field_descriptor._default_constructor)\n    end\n  \n    AddDecoder(FIELD_TYPE_TO_WIRE_TYPE[field_descriptor.type], False)\n    if is_repeated and IsTypePackable(field_descriptor.type) then\n        AddDecoder(wire_format.WIRETYPE_LENGTH_DELIMITED, True)\n    end\nend\n\nlocal function _AddEnumValues(descriptor, message_meta)\n    for _, enum_type in ipairs(descriptor.enum_types) do\n        for _, enum_value in ipairs(enum_type.values) do\n            message_meta._member[enum_value.name] = enum_value.number\n        end\n    end\nend\n\nlocal function _InitMethod(message_meta)\n    return function()\n        local self = {}\n        self._cached_byte_size = 0\n        self._cached_byte_size_dirty = false\n        self._fields = {}\n        self._is_present_in_parent = false\n        self._listener = listener_mod.NullMessageListener()\n        self._listener_for_children = listener_mod.Listener(self) \n        return setmetatable(self, message_meta)\n    end\nend\n\nlocal function _AddPropertiesForRepeatedField(field, message_meta)\n    local property_name = field.name\n\n    message_meta._getter[property_name] = function(self)\n        local field_value = self._fields[field]\n        if field_value == nil then\n            field_value = field._default_constructor(self)\n            self._fields[field] = field_value\n\n            if not self._cached_byte_size_dirty then\n                message_meta._member._Modified(self)\n            end\n        end\n        return field_value\n    end\n\n    message_meta._setter[property_name] = function(self)\n        error('Assignment not allowed to repeated field \"' .. property_name .. '\" in protocol message object.')\n    end\nend\n\nlocal function _AddPropertiesForNonRepeatedCompositeField(field, message_meta)\n    local property_name = field.name\n    local message_type = field.message_type\n\n    message_meta._getter[property_name] = function(self)\n        local field_value = self._fields[field]\n        if field_value == nil then\n            field_value = message_type._concrete_class()\n            field_value:_SetListener(self._listener_for_children)            \n            self._fields[field] = field_value\n\n            if not self._cached_byte_size_dirty then\n                message_meta._member._Modified(self)\n            end\n        end\n        return field_value\n    end\n    message_meta._setter[property_name] = function(self, new_value)\n        error('Assignment not allowed to composite field' .. property_name .. 'in protocol message object.' )\n    end\nend\n\nlocal function _AddPropertiesForNonRepeatedScalarField(field, message)\n    local property_name = field.name\n    local type_checker = GetTypeChecker(field.cpp_type, field.type)\n    local default_value = field.default_value\n\n    message._getter[property_name] = function(self)\n        local value =  self._fields[field] \n        if value ~= nil then\n            return self._fields[field]\n        else\n            return default_value\n        end\n    end\n\n    message._setter[property_name] = function(self, new_value)\n        type_checker(new_value)\n        self._fields[field] = new_value\n        if not self._cached_byte_size_dirty then\n            message._member._Modified(self)\n        end\n    end\nend\n\nlocal function _AddPropertiesForField(field, message_meta)\n    constant_name = field.name:upper() .. \"_FIELD_NUMBER\"\n    message_meta._member[constant_name] = field.number\n\n    if field.label == FieldDescriptor.LABEL_REPEATED then\n        _AddPropertiesForRepeatedField(field, message_meta)\n    elseif field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n        _AddPropertiesForNonRepeatedCompositeField(field, message_meta)\n    else\n        _AddPropertiesForNonRepeatedScalarField(field, message_meta)\n    end\nend\n\nlocal _ED_meta = {\n    __index = function(self, extension_handle)\n        local _extended_message = rawget(self, \"_extended_message\")\n        local value = _extended_message._fields[extension_handle]\n        if value ~= nil then\n            return value\n        end\n        if extension_handle.label == FieldDescriptor.LABEL_REPEATED then\n            value = extension_handle._default_constructor(self._extended_message)\n        elseif extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n            value = extension_handle.message_type._concrete_class()\n            value:_SetListener(_extended_message._listener_for_children)\n        else\n            return extension_handle.default_value\n        end\n        _extended_message._fields[extension_handle] = value\n        return value\n    end,\n    __newindex = function(self, extension_handle, value)\n        local _extended_message = rawget(self, \"_extended_message\")\n        if (extension_handle.label == FieldDescriptor.LABEL_REPEATED or\n            extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE) then\n            error('Cannot assign to extension \"'.. extension_handle.full_name .. '\" because it is a repeated or composite type.')\n        end\n\n        local type_checker = GetTypeChecker(extension_handle.cpp_type, extension_handle.type)\n        type_checker.CheckValue(value)\n        _extended_message._fields[extension_handle] = value\n        _extended_message._Modified()\n    end\n}\n\nlocal function _ExtensionDict(message)\n    local o = {}\n    o._extended_message = message\n    return setmetatable(o, _ED_meta)\nend\n\nlocal function _AddPropertiesForFields(descriptor, message_meta)\n    for _, field in ipairs(descriptor.fields) do\n        _AddPropertiesForField(field, message_meta)\n    end\n    if descriptor.is_extendable then\n        message_meta._getter.Extensions = function(self) return _ExtensionDict(self) end\n    end\nend\n\nlocal function _AddPropertiesForExtensions(descriptor, message_meta)\n  local extension_dict = descriptor._extensions_by_name\n  for extension_name, extension_field in pairs(extension_dict) do\n      local constant_name = string.upper(extension_name) .. \"_FIELD_NUMBER\"\n      message_meta._member[constant_name] = extension_field.number\n  end\nend\n\nlocal function _AddStaticMethods(message_meta)\n    message_meta._member.RegisterExtension = function(extension_handle)\n        extension_handle.containing_type = message_meta._descriptor\n        _AttachFieldHelpers(message_meta, extension_handle)\n\n        if message_meta._extensions_by_number[extension_handle.number] == nil then\n            message_meta._extensions_by_number[extension_handle.number] = extension_handle\n        else\n            error(\n                string.format('Extensions \"%s\" and \"%s\" both try to extend message type \"%s\" with field number %d.',\n                    extension_handle.full_name, actual_handle.full_name,\n                    message_meta._descriptor.full_name, extension_handle.number))\n        end\n        message_meta._extensions_by_name[extension_handle.full_name] = extension_handle\n    end\n\n    message_meta._member.FromString = function(s)\n        local message = message_meta._member.__call()\n        message.MergeFromString(s)\n        return message\n    end\nend\n\nlocal function _IsPresent(descriptor, value)\n    if descriptor.label == FieldDescriptor.LABEL_REPEATED then\n        return value\n    elseif descriptor.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n        return value._is_present_in_parent\n    else\n        return true\n    end\nend\n\nfunction sortFunc(a, b)\n    return a.index < b.index\nend\nfunction pairsByKeys (t, f)\n    local a = {}\n    for n in pairs(t) do table.insert(a, n) end\n    table.sort(a, f)\n    local i = 0                 -- iterator variable\n    local iter = function ()    -- iterator function\n       i = i + 1\n       if a[i] == nil then return nil\n       else return a[i], t[a[i]]\n       end\n    end\n    return iter\nend\n\nlocal function _AddListFieldsMethod(message_descriptor, message_meta)\n    message_meta._member.ListFields = function (self)\n        local list_field = function(fields)\n            --local f, s, v = pairs(self._fields)\n            local f,s,v = pairsByKeys(self._fields, sortFunc)\n            local iter = function(a, i)\n                while true do\n                    local descriptor, value = f(a, i)\n                    if descriptor == nil then\n                        return                     \n                    elseif _IsPresent(descriptor, value) then\n                        return descriptor, value\n                    end\n                end\n            end\n            return iter, s, v\n        end\n        return list_field(self._fields)\n    end\nend\n\nlocal function _AddHasFieldMethod(message_descriptor, message_meta)\n    local singular_fields = {}\n    for _, field in ipairs(message_descriptor.fields) do\n        if field.label ~= FieldDescriptor.LABEL_REPEATED then\n            singular_fields[field.name] = field\n        end\n    end\n    message_meta._member.HasField = function (self, field_name)\n        field = singular_fields[field_name]\n        if field == nil then\n            error('Protocol message has no singular \"'.. field_name.. '\" field.')\n        end\n        if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n            value = self._fields[field]\n            return value ~= nil  and value._is_present_in_parent\n        else\n            local valueTmp =  self._fields[field]\n            return valueTmp ~= nil\n        end\n    end\nend\n\nlocal function _AddClearFieldMethod(message_descriptor, message_meta)\n\tlocal singular_fields = {}\n    for _, field in ipairs(message_descriptor.fields) do\n        if field.label ~= FieldDescriptor.LABEL_REPEATED then\n            singular_fields[field.name] = field\n        end\n    end\n\n    message_meta._member.ClearField = function(self, field_name)\n\t\tfield = singular_fields[field_name]\n\t\tif field == nil then\n\t\t\t\terror('Protocol message has no singular \"'.. field_name.. '\" field.')\n\t\tend\n\n\t\tif self._fields[field] then\n\t\t\t\tself._fields[field] = nil\n\t\tend\n\t\tmessage_meta._member._Modified(self)\n\tend\nend\n\nlocal function _AddClearExtensionMethod(message_meta)\n    message_meta._member.ClearExtension = function(self, extension_handle)\n        if self._fields[extension_handle] == nil then\n            self._fields[extension_handle] = nil\n        end\n        message_meta._member._Modified(self)\n    end\nend\n\nlocal function _AddClearMethod(message_descriptor, message_meta)\n    message_meta._member.Clear = function(self)\n        self._fields = {}\n        message_meta._member._Modified(self)\n    end\nend\n\nlocal function _AddStrMethod(message_meta)\n    local format = text_format.msg_format\n    message_meta.__tostring = function(self)\n        return format(self)    \n    end\nend\n\nlocal function _AddHasExtensionMethod(message_meta)\n    message_meta._member.HasExtension = function(self, extension_handle)\n        if extension_handle.label == FieldDescriptor.LABEL_REPEATED then\n            error(extension_handle.full_name .. ' is repeated.')\n        end\n        if extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n            value = self._fields[extension_handle]\n            return value ~= nil and value._is_present_in_parent\n        else\n            return self._fields[extension_handle]\n        end\n    end\nend\n\nlocal function _AddSetListenerMethod(message_meta)\n    message_meta._member._SetListener = function(self, listener)\n        if listener ~= nil then\n            self._listener = listener_mod.NullMessageListener()\n        else\n            self._listener = listener\n        end\n    end\nend\n\nlocal function _AddByteSizeMethod(message_descriptor, message_meta)\n    message_meta._member.ByteSize = function(self)\n        --kaiser\n        --bug:这里在Repeat字段的结构体如果第一个字段不是int变量会产生_cached_byte_size_dirty为false而导致byte size为0\n        --如果bytesize为0让它强制计算byte size\n        if not self._cached_byte_size_dirty and self._cached_byte_size > 0 then\n            return self._cached_byte_size\n        end\n        local size = 0\n        for field_descriptor, field_value in message_meta._member.ListFields(self) do\n            size = field_descriptor._sizer(field_value) + size\n        end\n        self._cached_byte_size = size\n        self._cached_byte_size_dirty = false\n        self._listener_for_children.dirty = false\n        return size\n    end\nend\n\nlocal function _AddSerializeToStringMethod(message_descriptor, message_meta)\n    message_meta._member.SerializeToString = function(self)\n        if not message_meta._member.IsInitialized(self) then\n            error('Message is missing required fields: ' .. \n                table.concat(message_meta._member.FindInitializationErrors(self), ','))\n        end\n        return message_meta._member.SerializePartialToString(self)\n    end\n    message_meta._member.SerializeToIOString = function(self, iostring)\n        if not message_meta._member.IsInitialized(self) then\n            error('Message is missing required fields: ' .. \n                table.concat(message_meta._member.FindInitializationErrors(self), ','))\n        end\n        return message_meta._member.SerializePartialToIOString(self, iostring)\n    end\nend\n\nlocal function _AddSerializePartialToStringMethod(message_descriptor, message_meta)\n    local concat = table.concat\n    local _internal_serialize = function(self, write_bytes)\n        for field_descriptor, field_value in message_meta._member.ListFields(self) do\n            field_descriptor._encoder(write_bytes, field_value)\n        end\n    end\n\n    local _serialize_partial_to_iostring = function(self, iostring)\n        local w = iostring.write\n        local write = function(value)\n            w(iostring, value) \n        end\n        _internal_serialize(self, write)\n        return \n    end\n\n    local _serialize_partial_to_string = function(self)\n        local out = {}\n        local write = function(value)\n            out[#out + 1] = value\n        end\n        _internal_serialize(self, write)\n        return concat(out)\n    end\n\n    message_meta._member._InternalSerialize = _internal_serialize\n    message_meta._member.SerializePartialToIOString = _serialize_partial_to_iostring\n    message_meta._member.SerializePartialToString = _serialize_partial_to_string\nend\n\n\n\nlocal function _AddMergeFromStringMethod(message_descriptor, message_meta)\n    local ReadTag = decoder.ReadTag\n    local SkipField = decoder.SkipField\n    local decoders_by_tag = message_meta._decoders_by_tag\n\n    local _internal_parse = function(self, buffer, pos, pend)\n        message_meta._member._Modified(self)\n        local field_dict = self._fields\n        local tag_bytes, new_pos \n        local field_decoder\n        while pos ~= pend do\n            tag_bytes, new_pos = ReadTag(buffer, pos)\n            field_decoder = decoders_by_tag[tag_bytes]\n            if field_decoder == nil then\n                new_pos = SkipField(buffer, new_pos, pend, tag_bytes)\n                if new_pos == -1 then\n                    return pos\n                end\n                pos = new_pos\n            else\n                pos = field_decoder(buffer, new_pos, pend, self, field_dict)\n            end\n        end\n        return pos\n    end\n    message_meta._member._InternalParse = _internal_parse \n\n    local merge_from_string = function(self, serialized)\n        local length = #serialized\n        if _internal_parse(self, serialized, 0, length) ~= length then\n            error('Unexpected end-group tag.')\n        end\n        return length \n    end\n    message_meta._member.MergeFromString = merge_from_string\n\n    message_meta._member.ParseFromString = function(self, serialized)\n        message_meta._member.Clear(self)\n        merge_from_string(self, serialized)\n    end\nend\n\nlocal function _AddIsInitializedMethod(message_descriptor, message_meta)\n    local required_fields = {}\n    for _, field in ipairs(message_descriptor.fields) do\n        if field.label == FieldDescriptor.LABEL_REQUIRED then\n            required_fields[#required_fields + 1] = field\n        end\n    end\n\n    message_meta._member.IsInitialized = function(self, errors)\n        for _, field in ipairs(required_fields) do\n            if self._fields[field] == nil or \n                (field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE and not self._fields[field]._is_present_in_parent) then\n                if errors ~= nil then\n                    errors[#errors + 1] = message_meta._member.FindInitializationErrors(self)\n                end\n                return false\n            end\n        end\n\n        for field, value in pairs(self._fields) do\n            if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n                if field.label == FieldDescriptor.LABEL_REPEATED then\n                    for _, element in ipairs(value) do\n                        if not element:IsInitialized() then\n                            if errors ~= nil then\n                                errors[#errors + 1] = message_meta._member.FindInitializationErrors(self)\n                            end\n                            return false\n                        end\n                    end\n                elseif value._is_present_in_parent and not value:IsInitialized() then\n                    if errors ~= nil then\n                        errors[#errors + 1] = message_meta._member.FindInitializationErrors(self)\n                    end\n                    return false\n                end\n            end\n        end\n        return true\n    end\n\n    message_meta._member.FindInitializationErrors = function(self)\n        local errors = {}\n\n        for _,field in ipairs(required_fields) do\n            if not message_meta._member.HasField(self, field.name) then\n                errors[#errors + 1] = field.name\n            end\n        end\n\n        for field, value in message_meta._member.ListFields(self) do\n            if field.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE then\n                if field.is_extension then\n                    name = string.format(\"(%s)\", field.full_name)\n                else\n                    name = field.name\n                end\n                if field.label == FieldDescriptor.LABEL_REPEATED then\n                    for i, element in ipairs(value) do\n                        prefix = string.format(\"%s[%d].\", name, i)\n                        sub_errors = element:FindInitializationErrors()\n                        for _, e in ipairs(sub_errors) do\n                            errors[#errors + 1] = prefix .. e\n                        end\n                    end\n                else\n                    prefix = name .. \".\"\n                    sub_errors = value:FindInitializationErrors()\n                    for _, e in ipairs(sub_errors) do\n                        errors[#errors + 1] = prefix .. e\n                    end\n                end\n            end\n        end\n        return errors\n    end\nend\n\nlocal function _AddMergeFromMethod(message_meta)\n    local LABEL_REPEATED = FieldDescriptor.LABEL_REPEATED\n    local CPPTYPE_MESSAGE = FieldDescriptor.CPPTYPE_MESSAGE\n\n    message_meta._member.MergeFrom = function (self, msg)\n        assert(msg ~= self)\n        message_meta._member._Modified(self)\n\n        local fields = self._fields\n\n        for field, value in pairs(msg._fields) do\n            if field.label == LABEL_REPEATED or field.cpp_type == CPPTYPE_MESSAGE then\n                field_value = fields[field]\n                if field_value == nil then\n                    field_value = field._default_constructor(self)\n                    fields[field] = field_value\n                end\n                field_value:MergeFrom(value)\n            else\n                self._fields[field] = value\n            end\n        end\n    end\nend\n\nlocal function _AddMessageMethods(message_descriptor, message_meta)\n    _AddListFieldsMethod(message_descriptor, message_meta)\n    _AddHasFieldMethod(message_descriptor, message_meta)\n    _AddClearFieldMethod(message_descriptor, message_meta)\n    if message_descriptor.is_extendable then\n        _AddClearExtensionMethod(message_meta)\n        _AddHasExtensionMethod(message_meta)\n    end\n    _AddClearMethod(message_descriptor, message_meta)\n--    _AddEqualsMethod(message_descriptor, message_meta)\n    _AddStrMethod(message_meta)\n    _AddSetListenerMethod(message_meta)\n    _AddByteSizeMethod(message_descriptor, message_meta)\n    _AddSerializeToStringMethod(message_descriptor, message_meta)\n    _AddSerializePartialToStringMethod(message_descriptor, message_meta)\n    _AddMergeFromStringMethod(message_descriptor, message_meta)\n    _AddIsInitializedMethod(message_descriptor, message_meta)\n    _AddMergeFromMethod(message_meta)\nend\n\nlocal function _AddPrivateHelperMethods(message_meta)\n    local Modified = function (self)\n        if not self._cached_byte_size_dirty then\n            self._cached_byte_size_dirty = true\n            self._listener_for_children.dirty = true\n            self._is_present_in_parent = true\n            self._listener:Modified()\n        end\n    end\n    message_meta._member._Modified = Modified\n    message_meta._member.SetInParent = Modified\nend\n\nlocal function property_getter(message_meta)\n    local getter = message_meta._getter\n    local member = message_meta._member\n\t\n    return function (self, property)\n\t\tlocal g = getter[property]\n\t\tif g then\n\t\t    return g(self)\n\t\telse\n\t\t    return member[property]\n\t\tend\n\tend\nend\n\nlocal function property_setter(message_meta)\n\tlocal setter = message_meta._setter\n\n\treturn function (self, property, value)\n\t\tlocal s = setter[property]\n\t\tif s then\n\t\t\ts(self, value)\n\t\telse\n\t\t\terror(property .. \" not found\")\n\t\tend\n\tend\nend\n\nfunction _AddClassAttributesForNestedExtensions(descriptor, message_meta)\n    local extension_dict = descriptor._extensions_by_name\n    for extension_name, extension_field in pairs(extension_dict) do\n        message_meta._member[extension_name] = extension_field\n    end\nend\n\nlocal function Message(descriptor)\n    local message_meta = {}\n    message_meta._decoders_by_tag = {}\n    rawset(descriptor, \"_extensions_by_name\", {})\n    for _, k in ipairs(descriptor.extensions) do\n        descriptor._extensions_by_name[k.name] = k\n    end\n    rawset(descriptor, \"_extensions_by_number\", {})\n    for _, k in ipairs(descriptor.extensions) do\n        descriptor._extensions_by_number[k.number] = k\n    end\n    message_meta._descriptor = descriptor\n    message_meta._extensions_by_name = {}\n    message_meta._extensions_by_number = {}\n\n    message_meta._getter = {}\n    message_meta._setter = {}\n    message_meta._member = {}\n--    message_meta._name = descriptor.full_name\n\n    local ns = setmetatable({}, message_meta._member)\n    message_meta._member.__call = _InitMethod(message_meta)\n    message_meta._member.__index = message_meta._member \n    message_meta._member.type = ns\n\n    if rawget(descriptor, \"_concrete_class\") == nil then\n        rawset(descriptor, \"_concrete_class\", ns)\n        for k, field in ipairs(descriptor.fields) do  \n            _AttachFieldHelpers(message_meta, field)\n        end\n    end\n    _AddEnumValues(descriptor, message_meta)\n    _AddClassAttributesForNestedExtensions(descriptor, message_meta)\n    _AddPropertiesForFields(descriptor, message_meta)\n    _AddPropertiesForExtensions(descriptor, message_meta)\n    _AddStaticMethods(message_meta)\n    _AddMessageMethods(descriptor, message_meta)\n    _AddPrivateHelperMethods(message_meta)\n\n    message_meta.__index = property_getter(message_meta)\n    message_meta.__newindex = property_setter(message_meta) \n\n    return ns \nend\n\n_M.Message = Message\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/protobuf.lua.meta",
    "content": "fileFormatVersion: 2\nguid: afc64cedbe4a843499e187d95d272f06\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/text_format.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  text_format.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--  COMPANY:  NetEase\n--  CREATED:  2010年08月05日 15时14分13秒 CST\n--------------------------------------------------------------------------------\n--\nlocal string = string\nlocal math = math\nlocal print = print\nlocal getmetatable = getmetatable\nlocal table = table\nlocal ipairs = ipairs\nlocal tostring = tostring\n\nlocal descriptor = require \"protobuf.descriptor\"\n\nmodule \"protobuf.text_format\"\n\nfunction format(buffer)\n    local len = string.len( buffer )\t\n    for i = 1, len, 16 do\t\t\n        local text = \"\"\t\n        for j = i, math.min( i + 16 - 1, len ) do\t\n            text = string.format( \"%s  %02x\", text, string.byte( buffer, j ) )\t\t\t\n        end\t\t\t\n        print( text )\t\n    end\nend\n\nlocal FieldDescriptor = descriptor.FieldDescriptor\n\nmsg_format_indent = function(write, msg, indent)\n    for field, value in msg:ListFields() do\n        local print_field = function(field_value)\n            local name = field.name\n            write(string.rep(\" \", indent))\n            if field.type == FieldDescriptor.TYPE_MESSAGE then\n                local extensions = getmetatable(msg)._extensions_by_name\n                if extensions[field.full_name] then\n                    write(\"[\" .. name .. \"] {\\n\")\n                else\n                    write(name .. \" {\\n\")\n                end\n                msg_format_indent(write, field_value, indent + 4)\n                write(string.rep(\" \", indent))\n                write(\"}\\n\")\n            else\n                write(string.format(\"%s: %s\\n\", name, tostring(field_value)))\n            end\n        end\n        if field.label == FieldDescriptor.LABEL_REPEATED then\n            for _, k in ipairs(value) do\n                print_field(k)\n            end\n        else\n            print_field(value)\n        end\n    end\nend\n\nfunction msg_format(msg)\n    local out = {}\n    local write = function(value)\n        out[#out + 1] = value\n    end\n    msg_format_indent(write, msg, 0)\n    return table.concat(out)\nend\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/text_format.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 11ebbcbb210e532448bcc1440a557d8f\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/type_checkers.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  type_checkers.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--\n--  COMPANY:  NetEase\n--  CREATED:  2010年07月29日 19时30分37秒 CST\n--------------------------------------------------------------------------------\n--\n\nlocal type = type\nlocal error = error\nlocal string = string\n\nmodule \"protobuf.type_checkers\"\n\nfunction TypeChecker(acceptable_types)\n    local acceptable_types = acceptable_types\n\n    return function(proposed_value)\n        local t = type(proposed_value)\n        if acceptable_types[type(proposed_value)] == nil then\n            error(string.format('%s has type %s, but expected one of: %s', \n                proposed_value, type(proposed_value), acceptable_types))\n        end\n    end\nend\n\nfunction Int32ValueChecker()\n    local _MIN = -2147483648\n    local _MAX = 2147483647\n    return function(proposed_value)\n        if type(proposed_value) ~= 'number' then\n            error(string.format('%s has type %s, but expected one of: number',\n            proposed_value, type(proposed_value)))\n        end\n        if _MIN > proposed_value or proposed_value > _MAX then\n            error('Value out of range: ' .. proposed_value)\n        end\n    end\nend\n\nfunction Uint32ValueChecker(IntValueChecker)\n    local _MIN = 0\n    local _MAX = 0xffffffff\n\n    return function(proposed_value)\n        if type(proposed_value) ~= 'number' then\n            error(string.format('%s has type %s, but expected one of: number',\n                proposed_value, type(proposed_value)))\n        end\n        if _MIN > proposed_value or proposed_value > _MAX then\n            error('Value out of range: ' .. proposed_value)\n        end\n    end\nend\n\nfunction UnicodeValueChecker()\n    return function (proposed_value)\n        if type(proposed_value) ~= 'string' then\n            error(string.format('%s has type %s, but expected one of: string', proposed_value, type(proposed_value)))\n        end\n    end\nend\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/type_checkers.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 38d553dac9a25c84c9c7d74608783a1b\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/wire_format.lua",
    "content": "--\n--------------------------------------------------------------------------------\n--  FILE:  wire_format.lua\n--  DESCRIPTION:  protoc-gen-lua\n--      Google's Protocol Buffers project, ported to lua.\n--      https://code.google.com/p/protoc-gen-lua/\n--\n--      Copyright (c) 2010 , 林卓毅 (Zhuoyi Lin) netsnail@gmail.com\n--      All rights reserved.\n--\n--      Use, modification and distribution are subject to the \"New BSD License\"\n--      as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.\n--  COMPANY:  NetEase\n--  CREATED:  2010年07月30日 15时59分53秒 CST\n--------------------------------------------------------------------------------\n--\n\nlocal pb = require \"pb\"\nmodule \"protobuf.wire_format\"\n\nWIRETYPE_VARINT = 0\nWIRETYPE_FIXED64 = 1\nWIRETYPE_LENGTH_DELIMITED = 2\nWIRETYPE_START_GROUP = 3\nWIRETYPE_END_GROUP = 4\nWIRETYPE_FIXED32 = 5\n_WIRETYPE_MAX = 5\n\n\n-- yeah, we don't need uint64\nlocal function _VarUInt64ByteSizeNoTag(uint64)\n    if uint64 <= 0x7f then return 1 end\n    if uint64 <= 0x3fff then return 2 end\n    if uint64 <= 0x1fffff then return 3 end\n    if uint64 <= 0xfffffff then return 4 end\n    return 5\nend\n\nfunction PackTag(field_number, wire_type)\n    return field_number * 8 + wire_type\nend\n\nfunction UnpackTag(tag)\n    local wire_type = tag % 8\n    return (tag - wire_type) / 8, wire_type\nend\n\nZigZagEncode32 = pb.zig_zag_encode32\nZigZagDecode32 = pb.zig_zag_decode32\nZigZagEncode64 = pb.zig_zag_encode64\nZigZagDecode64 = pb.zig_zag_decode64\n\nfunction Int32ByteSize(field_number, int32)\n  return Int64ByteSize(field_number, int32)\nend\n\nfunction Int32ByteSizeNoTag(int32)\n  return _VarUInt64ByteSizeNoTag(int32)\nend\n\nfunction Int64ByteSize(field_number, int64)\n  return UInt64ByteSize(field_number, int64)\nend\n\nfunction UInt32ByteSize(field_number, uint32)\n  return UInt64ByteSize(field_number, uint32)\nend\n\nfunction UInt64ByteSize(field_number, uint64)\n  return TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(uint64)\nend\n\nfunction SInt32ByteSize(field_number, int32)\n  return UInt32ByteSize(field_number, ZigZagEncode(int32))\nend\n\nfunction SInt64ByteSize(field_number, int64)\n  return UInt64ByteSize(field_number, ZigZagEncode(int64))\nend\n\nfunction Fixed32ByteSize(field_number, fixed32)\n  return TagByteSize(field_number) + 4\nend\n\nfunction Fixed64ByteSize(field_number, fixed64)\n  return TagByteSize(field_number) + 8\nend\n\nfunction SFixed32ByteSize(field_number, sfixed32)\n  return TagByteSize(field_number) + 4\nend\n\nfunction SFixed64ByteSize(field_number, sfixed64)\n  return TagByteSize(field_number) + 8\nend\n\nfunction FloatByteSize(field_number, flt)\n  return TagByteSize(field_number) + 4\nend\n\nfunction DoubleByteSize(field_number, double)\n  return TagByteSize(field_number) + 8\nend\n\nfunction BoolByteSize(field_number, b)\n  return TagByteSize(field_number) + 1\nend\n\nfunction EnumByteSize(field_number, enum)\n  return UInt32ByteSize(field_number, enum)\nend\n\nfunction StringByteSize(field_number, string)\n  return BytesByteSize(field_number, string)\nend\n\nfunction BytesByteSize(field_number, b)\n    return TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(#b) + #b\nend\n\nfunction MessageByteSize(field_number, message)\n    return TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(message.ByteSize()) + message.ByteSize()\nend\n\nfunction MessageSetItemByteSize(field_number, msg)\n    local total_size = 2 * TagByteSize(1) + TagByteSize(2) + TagByteSize(3) \n    total_size = total_size + _VarUInt64ByteSizeNoTag(field_number)\n    local message_size = msg.ByteSize()\n    total_size = total_size + _VarUInt64ByteSizeNoTag(message_size)\n    total_size = total_size + message_size\n    return total_size\nend\n\nfunction TagByteSize(field_number)\n    return _VarUInt64ByteSizeNoTag(PackTag(field_number, 0))\nend\n\n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf/wire_format.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 02ba9c90e50e89e4da2ee869851300a0\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/protobuf.meta",
    "content": "fileFormatVersion: 2\nguid: 588f81265fa730e41a5371957a46eb61\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/slot.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal setmetatable = setmetatable\n\nlocal _slot = {}\nsetmetatable(_slot, _slot)\t\n\n_slot.__call = function(self, ...)\t\t\t\n\tif nil == self.obj then\n\t\treturn self.func(...)\t\t\t\n\telse\t\t\n\t\treturn self.func(self.obj, ...)\t\t\t\n\tend\nend\n\n_slot.__eq = function (lhs, rhs)\n\treturn lhs.func == rhs.func and lhs.obj == rhs.obj\nend\n\n--可用于 Timer 定时器回调函数. 例如Timer.New(slot(self.func, self))\nfunction slot(func, obj)\t\n\treturn setmetatable({func = func, obj = obj}, _slot)\t\t\t\nend"
  },
  {
    "path": "Assets/ToLua/Lua/slot.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 5040eeedfb5e1bf4b8a5294bba19ca0b\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/ftp.lua",
    "content": "-----------------------------------------------------------------------------\n-- FTP support for the Lua language\n-- LuaSocket toolkit.\n-- Author: Diego Nehab\n-----------------------------------------------------------------------------\n\n-----------------------------------------------------------------------------\n-- Declare module and import dependencies\n-----------------------------------------------------------------------------\nlocal base = _G\nlocal table = require(\"table\")\nlocal string = require(\"string\")\nlocal math = require(\"math\")\nlocal socket = require(\"socket\")\nlocal url = require(\"socket.url\")\nlocal tp = require(\"socket.tp\")\nlocal ltn12 = require(\"ltn12\")\nsocket.ftp = {}\nlocal _M = socket.ftp\n-----------------------------------------------------------------------------\n-- Program constants\n-----------------------------------------------------------------------------\n-- timeout in seconds before the program gives up on a connection\n_M.TIMEOUT = 60\n-- default port for ftp service\nlocal PORT = 21\n-- this is the default anonymous password. used when no password is\n-- provided in url. should be changed to your e-mail.\n_M.USER = \"ftp\"\n_M.PASSWORD = \"anonymous@anonymous.org\"\n\n-----------------------------------------------------------------------------\n-- Low level FTP API\n-----------------------------------------------------------------------------\nlocal metat = { __index = {} }\n\nfunction _M.open(server, port, create)\n    local tp = socket.try(tp.connect(server, port or PORT, _M.TIMEOUT, create))\n    local f = base.setmetatable({ tp = tp }, metat)\n    -- make sure everything gets closed in an exception\n    f.try = socket.newtry(function() f:close() end)\n    return f\nend\n\nfunction metat.__index:portconnect()\n    self.try(self.server:settimeout(_M.TIMEOUT))\n    self.data = self.try(self.server:accept())\n    self.try(self.data:settimeout(_M.TIMEOUT))\nend\n\nfunction metat.__index:pasvconnect()\n    self.data = self.try(socket.tcp())\n    self.try(self.data:settimeout(_M.TIMEOUT))\n    self.try(self.data:connect(self.pasvt.address, self.pasvt.port))\nend\n\nfunction metat.__index:login(user, password)\n    self.try(self.tp:command(\"user\", user or _M.USER))\n    local code, reply = self.try(self.tp:check{\"2..\", 331})\n    if code == 331 then\n        self.try(self.tp:command(\"pass\", password or _M.PASSWORD))\n        self.try(self.tp:check(\"2..\"))\n    end\n    return 1\nend\n\nfunction metat.__index:pasv()\n    self.try(self.tp:command(\"pasv\"))\n    local code, reply = self.try(self.tp:check(\"2..\"))\n    local pattern = \"(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)\"\n    local a, b, c, d, p1, p2 = socket.skip(2, string.find(reply, pattern))\n    self.try(a and b and c and d and p1 and p2, reply)\n    self.pasvt = {\n        address = string.format(\"%d.%d.%d.%d\", a, b, c, d),\n        port = p1*256 + p2\n    }\n    if self.server then\n        self.server:close()\n        self.server = nil\n    end\n    return self.pasvt.address, self.pasvt.port\nend\n\nfunction metat.__index:epsv()\n    self.try(self.tp:command(\"epsv\"))\n    local code, reply = self.try(self.tp:check(\"229\"))\n    local pattern = \"%((.)(.-)%1(.-)%1(.-)%1%)\"\n    local d, prt, address, port = string.match(reply, pattern)\n    self.try(port, \"invalid epsv response\")\n    self.pasvt = {\n        address = self.tp:getpeername(),\n        port = port\n    }\n    if self.server then\n        self.server:close()\n        self.server = nil\n    end\n    return self.pasvt.address, self.pasvt.port\nend\n\n\nfunction metat.__index:port(address, port)\n    self.pasvt = nil\n    if not address then\n        address, port = self.try(self.tp:getsockname())\n        self.server = self.try(socket.bind(address, 0))\n        address, port = self.try(self.server:getsockname())\n        self.try(self.server:settimeout(_M.TIMEOUT))\n    end\n    local pl = port % 256\n    local ph = (port - pl)/256\n    local arg = string.gsub(string.format(\"%s,%d,%d\", address, ph, pl), \"%.\", \",\")\n    self.try(self.tp:command(\"port\", arg))\n    self.try(self.tp:check(\"2..\"))\n    return 1\nend\n\nfunction metat.__index:eprt(family, address, port)\n    self.pasvt = nil\n    if not address then\n        address, port = self.try(self.tp:getsockname())\n        self.server = self.try(socket.bind(address, 0))\n        address, port = self.try(self.server:getsockname())\n        self.try(self.server:settimeout(_M.TIMEOUT))\n    end\n    local arg = string.format(\"|%s|%s|%d|\", family, address, port)\n    self.try(self.tp:command(\"eprt\", arg))\n    self.try(self.tp:check(\"2..\"))\n    return 1\nend\n\n\nfunction metat.__index:send(sendt)\n    self.try(self.pasvt or self.server, \"need port or pasv first\")\n    -- if there is a pasvt table, we already sent a PASV command\n    -- we just get the data connection into self.data\n    if self.pasvt then self:pasvconnect() end\n    -- get the transfer argument and command\n    local argument = sendt.argument or\n        url.unescape(string.gsub(sendt.path or \"\", \"^[/\\\\]\", \"\"))\n    if argument == \"\" then argument = nil end\n    local command = sendt.command or \"stor\"\n    -- send the transfer command and check the reply\n    self.try(self.tp:command(command, argument))\n    local code, reply = self.try(self.tp:check{\"2..\", \"1..\"})\n    -- if there is not a pasvt table, then there is a server\n    -- and we already sent a PORT command\n    if not self.pasvt then self:portconnect() end\n    -- get the sink, source and step for the transfer\n    local step = sendt.step or ltn12.pump.step\n    local readt = { self.tp }\n    local checkstep = function(src, snk)\n        -- check status in control connection while downloading\n        local readyt = socket.select(readt, nil, 0)\n        if readyt[tp] then code = self.try(self.tp:check(\"2..\")) end\n        return step(src, snk)\n    end\n    local sink = socket.sink(\"close-when-done\", self.data)\n    -- transfer all data and check error\n    self.try(ltn12.pump.all(sendt.source, sink, checkstep))\n    if string.find(code, \"1..\") then self.try(self.tp:check(\"2..\")) end\n    -- done with data connection\n    self.data:close()\n    -- find out how many bytes were sent\n    local sent = socket.skip(1, self.data:getstats())\n    self.data = nil\n    return sent\nend\n\nfunction metat.__index:receive(recvt)\n    self.try(self.pasvt or self.server, \"need port or pasv first\")\n    if self.pasvt then self:pasvconnect() end\n    local argument = recvt.argument or\n        url.unescape(string.gsub(recvt.path or \"\", \"^[/\\\\]\", \"\"))\n    if argument == \"\" then argument = nil end\n    local command = recvt.command or \"retr\"\n    self.try(self.tp:command(command, argument))\n    local code,reply = self.try(self.tp:check{\"1..\", \"2..\"})\n    if (code >= 200) and (code <= 299) then\n        recvt.sink(reply)\n        return 1\n    end\n    if not self.pasvt then self:portconnect() end\n    local source = socket.source(\"until-closed\", self.data)\n    local step = recvt.step or ltn12.pump.step\n    self.try(ltn12.pump.all(source, recvt.sink, step))\n    if string.find(code, \"1..\") then self.try(self.tp:check(\"2..\")) end\n    self.data:close()\n    self.data = nil\n    return 1\nend\n\nfunction metat.__index:cwd(dir)\n    self.try(self.tp:command(\"cwd\", dir))\n    self.try(self.tp:check(250))\n    return 1\nend\n\nfunction metat.__index:type(type)\n    self.try(self.tp:command(\"type\", type))\n    self.try(self.tp:check(200))\n    return 1\nend\n\nfunction metat.__index:greet()\n    local code = self.try(self.tp:check{\"1..\", \"2..\"})\n    if string.find(code, \"1..\") then self.try(self.tp:check(\"2..\")) end\n    return 1\nend\n\nfunction metat.__index:quit()\n    self.try(self.tp:command(\"quit\"))\n    self.try(self.tp:check(\"2..\"))\n    return 1\nend\n\nfunction metat.__index:close()\n    if self.data then self.data:close() end\n    if self.server then self.server:close() end\n    return self.tp:close()\nend\n\n-----------------------------------------------------------------------------\n-- High level FTP API\n-----------------------------------------------------------------------------\nlocal function override(t)\n    if t.url then\n        local u = url.parse(t.url)\n        for i,v in base.pairs(t) do\n            u[i] = v\n        end\n        return u\n    else return t end\nend\n\nlocal function tput(putt)\n    putt = override(putt)\n    socket.try(putt.host, \"missing hostname\")\n    local f = _M.open(putt.host, putt.port, putt.create)\n    f:greet()\n    f:login(putt.user, putt.password)\n    if putt.type then f:type(putt.type) end\n    f:epsv()\n    local sent = f:send(putt)\n    f:quit()\n    f:close()\n    return sent\nend\n\nlocal default = {\n    path = \"/\",\n    scheme = \"ftp\"\n}\n\nlocal function genericform(u)\n    local t = socket.try(url.parse(u, default))\n    socket.try(t.scheme == \"ftp\", \"wrong scheme '\" .. t.scheme .. \"'\")\n    socket.try(t.host, \"missing hostname\")\n    local pat = \"^type=(.)$\"\n    if t.params then\n        t.type = socket.skip(2, string.find(t.params, pat))\n        socket.try(t.type == \"a\" or t.type == \"i\",\n            \"invalid type '\" .. t.type .. \"'\")\n    end\n    return t\nend\n\n_M.genericform = genericform\n\nlocal function sput(u, body)\n    local putt = genericform(u)\n    putt.source = ltn12.source.string(body)\n    return tput(putt)\nend\n\n_M.put = socket.protect(function(putt, body)\n    if base.type(putt) == \"string\" then return sput(putt, body)\n    else return tput(putt) end\nend)\n\nlocal function tget(gett)\n    gett = override(gett)\n    socket.try(gett.host, \"missing hostname\")\n    local f = _M.open(gett.host, gett.port, gett.create)\n    f:greet()\n    f:login(gett.user, gett.password)\n    if gett.type then f:type(gett.type) end\n    f:epsv()\n    f:receive(gett)\n    f:quit()\n    return f:close()\nend\n\nlocal function sget(u)\n    local gett = genericform(u)\n    local t = {}\n    gett.sink = ltn12.sink.table(t)\n    tget(gett)\n    return table.concat(t)\nend\n\n_M.command = socket.protect(function(cmdt)\n    cmdt = override(cmdt)\n    socket.try(cmdt.host, \"missing hostname\")\n    socket.try(cmdt.command, \"missing command\")\n    local f = _M.open(cmdt.host, cmdt.port, cmdt.create)\n    f:greet()\n    f:login(cmdt.user, cmdt.password)\n    if type(cmdt.command) == \"table\" then\n        local argument = cmdt.argument or {}\n        local check = cmdt.check or {}\n        for i,cmd in ipairs(cmdt.command) do\n            f.try(f.tp:command(cmd, argument[i]))\n            if check[i] then f.try(f.tp:check(check[i])) end\n        end\n    else\n        f.try(f.tp:command(cmdt.command, cmdt.argument))\n        if cmdt.check then f.try(f.tp:check(cmdt.check)) end\n    end\n    f:quit()\n    return f:close()\nend)\n\n_M.get = socket.protect(function(gett)\n    if base.type(gett) == \"string\" then return sget(gett)\n    else return tget(gett) end\nend)\n\nreturn _M\n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/ftp.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 7d703a862f37cfb42a2937b6f2cc9df6\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/headers.lua",
    "content": "-----------------------------------------------------------------------------\n-- Canonic header field capitalization\n-- LuaSocket toolkit.\n-- Author: Diego Nehab\n-----------------------------------------------------------------------------\nlocal socket = require(\"socket\")\nsocket.headers = {}\nlocal _M = socket.headers\n\n_M.canonic = {\n    [\"accept\"] = \"Accept\",\n    [\"accept-charset\"] = \"Accept-Charset\",\n    [\"accept-encoding\"] = \"Accept-Encoding\",\n    [\"accept-language\"] = \"Accept-Language\",\n    [\"accept-ranges\"] = \"Accept-Ranges\",\n    [\"action\"] = \"Action\",\n    [\"alternate-recipient\"] = \"Alternate-Recipient\",\n    [\"age\"] = \"Age\",\n    [\"allow\"] = \"Allow\",\n    [\"arrival-date\"] = \"Arrival-Date\",\n    [\"authorization\"] = \"Authorization\",\n    [\"bcc\"] = \"Bcc\",\n    [\"cache-control\"] = \"Cache-Control\",\n    [\"cc\"] = \"Cc\",\n    [\"comments\"] = \"Comments\",\n    [\"connection\"] = \"Connection\",\n    [\"content-description\"] = \"Content-Description\",\n    [\"content-disposition\"] = \"Content-Disposition\",\n    [\"content-encoding\"] = \"Content-Encoding\",\n    [\"content-id\"] = \"Content-ID\",\n    [\"content-language\"] = \"Content-Language\",\n    [\"content-length\"] = \"Content-Length\",\n    [\"content-location\"] = \"Content-Location\",\n    [\"content-md5\"] = \"Content-MD5\",\n    [\"content-range\"] = \"Content-Range\",\n    [\"content-transfer-encoding\"] = \"Content-Transfer-Encoding\",\n    [\"content-type\"] = \"Content-Type\",\n    [\"cookie\"] = \"Cookie\",\n    [\"date\"] = \"Date\",\n    [\"diagnostic-code\"] = \"Diagnostic-Code\",\n    [\"dsn-gateway\"] = \"DSN-Gateway\",\n    [\"etag\"] = \"ETag\",\n    [\"expect\"] = \"Expect\",\n    [\"expires\"] = \"Expires\",\n    [\"final-log-id\"] = \"Final-Log-ID\",\n    [\"final-recipient\"] = \"Final-Recipient\",\n    [\"from\"] = \"From\",\n    [\"host\"] = \"Host\",\n    [\"if-match\"] = \"If-Match\",\n    [\"if-modified-since\"] = \"If-Modified-Since\",\n    [\"if-none-match\"] = \"If-None-Match\",\n    [\"if-range\"] = \"If-Range\",\n    [\"if-unmodified-since\"] = \"If-Unmodified-Since\",\n    [\"in-reply-to\"] = \"In-Reply-To\",\n    [\"keywords\"] = \"Keywords\",\n    [\"last-attempt-date\"] = \"Last-Attempt-Date\",\n    [\"last-modified\"] = \"Last-Modified\",\n    [\"location\"] = \"Location\",\n    [\"max-forwards\"] = \"Max-Forwards\",\n    [\"message-id\"] = \"Message-ID\",\n    [\"mime-version\"] = \"MIME-Version\",\n    [\"original-envelope-id\"] = \"Original-Envelope-ID\",\n    [\"original-recipient\"] = \"Original-Recipient\",\n    [\"pragma\"] = \"Pragma\",\n    [\"proxy-authenticate\"] = \"Proxy-Authenticate\",\n    [\"proxy-authorization\"] = \"Proxy-Authorization\",\n    [\"range\"] = \"Range\",\n    [\"received\"] = \"Received\",\n    [\"received-from-mta\"] = \"Received-From-MTA\",\n    [\"references\"] = \"References\",\n    [\"referer\"] = \"Referer\",\n    [\"remote-mta\"] = \"Remote-MTA\",\n    [\"reply-to\"] = \"Reply-To\",\n    [\"reporting-mta\"] = \"Reporting-MTA\",\n    [\"resent-bcc\"] = \"Resent-Bcc\",\n    [\"resent-cc\"] = \"Resent-Cc\",\n    [\"resent-date\"] = \"Resent-Date\",\n    [\"resent-from\"] = \"Resent-From\",\n    [\"resent-message-id\"] = \"Resent-Message-ID\",\n    [\"resent-reply-to\"] = \"Resent-Reply-To\",\n    [\"resent-sender\"] = \"Resent-Sender\",\n    [\"resent-to\"] = \"Resent-To\",\n    [\"retry-after\"] = \"Retry-After\",\n    [\"return-path\"] = \"Return-Path\",\n    [\"sender\"] = \"Sender\",\n    [\"server\"] = \"Server\",\n    [\"smtp-remote-recipient\"] = \"SMTP-Remote-Recipient\",\n    [\"status\"] = \"Status\",\n    [\"subject\"] = \"Subject\",\n    [\"te\"] = \"TE\",\n    [\"to\"] = \"To\",\n    [\"trailer\"] = \"Trailer\",\n    [\"transfer-encoding\"] = \"Transfer-Encoding\",\n    [\"upgrade\"] = \"Upgrade\",\n    [\"user-agent\"] = \"User-Agent\",\n    [\"vary\"] = \"Vary\",\n    [\"via\"] = \"Via\",\n    [\"warning\"] = \"Warning\",\n    [\"will-retry-until\"] = \"Will-Retry-Until\",\n    [\"www-authenticate\"] = \"WWW-Authenticate\",\n    [\"x-mailer\"] = \"X-Mailer\",\n}\n\nreturn _M"
  },
  {
    "path": "Assets/ToLua/Lua/socket/headers.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 62876db61c32bf6499db08ea59ccff1f\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/http.lua",
    "content": "-----------------------------------------------------------------------------\n-- HTTP/1.1 client support for the Lua language.\n-- LuaSocket toolkit.\n-- Author: Diego Nehab\n-----------------------------------------------------------------------------\n\n-----------------------------------------------------------------------------\n-- Declare module and import dependencies\n-------------------------------------------------------------------------------\nlocal socket = require(\"socket\")\nlocal url = require(\"socket.url\")\nlocal ltn12 = require(\"ltn12\")\nlocal mime = require(\"mime\")\nlocal string = require(\"string\")\nlocal headers = require(\"socket.headers\")\nlocal base = _G\nlocal table = require(\"table\")\nsocket.http = {}\nlocal _M = socket.http\n\n-----------------------------------------------------------------------------\n-- Program constants\n-----------------------------------------------------------------------------\n-- connection timeout in seconds\n_M.TIMEOUT = 60\n-- user agent field sent in request\n_M.USERAGENT = socket._VERSION\n\n-- supported schemes\nlocal SCHEMES = { [\"http\"] = true }\n-- default port for document retrieval\nlocal PORT = 80\n\n-----------------------------------------------------------------------------\n-- Reads MIME headers from a connection, unfolding where needed\n-----------------------------------------------------------------------------\nlocal function receiveheaders(sock, headers)\n    local line, name, value, err\n    headers = headers or {}\n    -- get first line\n    line, err = sock:receive()\n    if err then return nil, err end\n    -- headers go until a blank line is found\n    while line ~= \"\" do\n        -- get field-name and value\n        name, value = socket.skip(2, string.find(line, \"^(.-):%s*(.*)\"))\n        if not (name and value) then return nil, \"malformed reponse headers\" end\n        name = string.lower(name)\n        -- get next line (value might be folded)\n        line, err  = sock:receive()\n        if err then return nil, err end\n        -- unfold any folded values\n        while string.find(line, \"^%s\") do\n            value = value .. line\n            line = sock:receive()\n            if err then return nil, err end\n        end\n        -- save pair in table\n        if headers[name] then headers[name] = headers[name] .. \", \" .. value\n        else headers[name] = value end\n    end\n    return headers\nend\n\n-----------------------------------------------------------------------------\n-- Extra sources and sinks\n-----------------------------------------------------------------------------\nsocket.sourcet[\"http-chunked\"] = function(sock, headers)\n    return base.setmetatable({\n        getfd = function() return sock:getfd() end,\n        dirty = function() return sock:dirty() end\n    }, {\n        __call = function()\n            -- get chunk size, skip extention\n            local line, err = sock:receive()\n            if err then return nil, err end\n            local size = base.tonumber(string.gsub(line, \";.*\", \"\"), 16)\n            if not size then return nil, \"invalid chunk size\" end\n            -- was it the last chunk?\n            if size > 0 then\n                -- if not, get chunk and skip terminating CRLF\n                local chunk, err, part = sock:receive(size)\n                if chunk then sock:receive() end\n                return chunk, err\n            else\n                -- if it was, read trailers into headers table\n                headers, err = receiveheaders(sock, headers)\n                if not headers then return nil, err end\n            end\n        end\n    })\nend\n\nsocket.sinkt[\"http-chunked\"] = function(sock)\n    return base.setmetatable({\n        getfd = function() return sock:getfd() end,\n        dirty = function() return sock:dirty() end\n    }, {\n        __call = function(self, chunk, err)\n            if not chunk then return sock:send(\"0\\r\\n\\r\\n\") end\n            local size = string.format(\"%X\\r\\n\", string.len(chunk))\n            return sock:send(size ..  chunk .. \"\\r\\n\")\n        end\n    })\nend\n\n-----------------------------------------------------------------------------\n-- Low level HTTP API\n-----------------------------------------------------------------------------\nlocal metat = { __index = {} }\n\nfunction _M.open(host, port, create)\n    -- create socket with user connect function, or with default\n    local c = socket.try((create or socket.tcp)())\n    local h = base.setmetatable({ c = c }, metat)\n    -- create finalized try\n    h.try = socket.newtry(function() h:close() end)\n    -- set timeout before connecting\n    h.try(c:settimeout(_M.TIMEOUT))\n    h.try(c:connect(host, port or PORT))\n    -- here everything worked\n    return h\nend\n\nfunction metat.__index:sendrequestline(method, uri)\n    local reqline = string.format(\"%s %s HTTP/1.1\\r\\n\", method or \"GET\", uri)\n    return self.try(self.c:send(reqline))\nend\n\nfunction metat.__index:sendheaders(tosend)\n    local canonic = headers.canonic\n    local h = \"\\r\\n\"\n    for f, v in base.pairs(tosend) do\n        h = (canonic[f] or f) .. \": \" .. v .. \"\\r\\n\" .. h\n    end\n    self.try(self.c:send(h))\n    return 1\nend\n\nfunction metat.__index:sendbody(headers, source, step)\n    source = source or ltn12.source.empty()\n    step = step or ltn12.pump.step\n    -- if we don't know the size in advance, send chunked and hope for the best\n    local mode = \"http-chunked\"\n    if headers[\"content-length\"] then mode = \"keep-open\" end\n    return self.try(ltn12.pump.all(source, socket.sink(mode, self.c), step))\nend\n\nfunction metat.__index:receivestatusline()\n    local status = self.try(self.c:receive(5))\n    -- identify HTTP/0.9 responses, which do not contain a status line\n    -- this is just a heuristic, but is what the RFC recommends\n    if status ~= \"HTTP/\" then return nil, status end\n    -- otherwise proceed reading a status line\n    status = self.try(self.c:receive(\"*l\", status))\n    local code = socket.skip(2, string.find(status, \"HTTP/%d*%.%d* (%d%d%d)\"))\n    return self.try(base.tonumber(code), status)\nend\n\nfunction metat.__index:receiveheaders()\n    return self.try(receiveheaders(self.c))\nend\n\nfunction metat.__index:receivebody(headers, sink, step)\n    sink = sink or ltn12.sink.null()\n    step = step or ltn12.pump.step\n    local length = base.tonumber(headers[\"content-length\"])\n    local t = headers[\"transfer-encoding\"] -- shortcut\n    local mode = \"default\" -- connection close\n    if t and t ~= \"identity\" then mode = \"http-chunked\"\n    elseif base.tonumber(headers[\"content-length\"]) then mode = \"by-length\" end\n    return self.try(ltn12.pump.all(socket.source(mode, self.c, length),\n        sink, step))\nend\n\nfunction metat.__index:receive09body(status, sink, step)\n    local source = ltn12.source.rewind(socket.source(\"until-closed\", self.c))\n    source(status)\n    return self.try(ltn12.pump.all(source, sink, step))\nend\n\nfunction metat.__index:close()\n    return self.c:close()\nend\n\n-----------------------------------------------------------------------------\n-- High level HTTP API\n-----------------------------------------------------------------------------\nlocal function adjusturi(reqt)\n    local u = reqt\n    -- if there is a proxy, we need the full url. otherwise, just a part.\n    if not reqt.proxy and not _M.PROXY then\n        u = {\n           path = socket.try(reqt.path, \"invalid path 'nil'\"),\n           params = reqt.params,\n           query = reqt.query,\n           fragment = reqt.fragment\n        }\n    end\n    return url.build(u)\nend\n\nlocal function adjustproxy(reqt)\n    local proxy = reqt.proxy or _M.PROXY\n    if proxy then\n        proxy = url.parse(proxy)\n        return proxy.host, proxy.port or 3128\n    else\n        return reqt.host, reqt.port\n    end\nend\n\nlocal function adjustheaders(reqt)\n    -- default headers\n    local host = string.gsub(reqt.authority, \"^.-@\", \"\")\n    local lower = {\n        [\"user-agent\"] = _M.USERAGENT,\n        [\"host\"] = host,\n        [\"connection\"] = \"close, TE\",\n        [\"te\"] = \"trailers\"\n    }\n    -- if we have authentication information, pass it along\n    if reqt.user and reqt.password then\n        lower[\"authorization\"] =\n            \"Basic \" ..  (mime.b64(reqt.user .. \":\" .. reqt.password))\n    end\n    -- if we have proxy authentication information, pass it along\n    local proxy = reqt.proxy or _M.PROXY\n    if proxy then\n        proxy = url.parse(proxy)\n        if proxy.user and proxy.password then\n            lower[\"proxy-authorization\"] =\n                \"Basic \" ..  (mime.b64(proxy.user .. \":\" .. proxy.password))\n        end\n    end\n    -- override with user headers\n    for i,v in base.pairs(reqt.headers or lower) do\n        lower[string.lower(i)] = v\n    end\n    return lower\nend\n\n-- default url parts\nlocal default = {\n    host = \"\",\n    port = PORT,\n    path =\"/\",\n    scheme = \"http\"\n}\n\nlocal function adjustrequest(reqt)\n    -- parse url if provided\n    local nreqt = reqt.url and url.parse(reqt.url, default) or {}\n    -- explicit components override url\n    for i,v in base.pairs(reqt) do nreqt[i] = v end\n    if nreqt.port == \"\" then nreqt.port = PORT end\n    if not (nreqt.host and nreqt.host ~= \"\") then\n        socket.try(nil, \"invalid host '\" .. base.tostring(nreqt.host) .. \"'\")\n    end\n    -- compute uri if user hasn't overriden\n    nreqt.uri = reqt.uri or adjusturi(nreqt)\n    -- adjust headers in request\n    nreqt.headers = adjustheaders(nreqt)\n    -- ajust host and port if there is a proxy\n    nreqt.host, nreqt.port = adjustproxy(nreqt)\n    return nreqt\nend\n\nlocal function shouldredirect(reqt, code, headers)\n    local location = headers.location\n    if not location then return false end\n    location = string.gsub(location, \"%s\", \"\")\n    if location == \"\" then return false end\n    local scheme = string.match(location, \"^([%w][%w%+%-%.]*)%:\")\n    if scheme and not SCHEMES[scheme] then return false end\n    return (reqt.redirect ~= false) and\n           (code == 301 or code == 302 or code == 303 or code == 307) and\n           (not reqt.method or reqt.method == \"GET\" or reqt.method == \"HEAD\")\n           and (not reqt.nredirects or reqt.nredirects < 5)\nend\n\nlocal function shouldreceivebody(reqt, code)\n    if reqt.method == \"HEAD\" then return nil end\n    if code == 204 or code == 304 then return nil end\n    if code >= 100 and code < 200 then return nil end\n    return 1\nend\n\n-- forward declarations\nlocal trequest, tredirect\n\n--[[local]] function tredirect(reqt, location)\n    local result, code, headers, status = trequest {\n        -- the RFC says the redirect URL has to be absolute, but some\n        -- servers do not respect that\n        url = url.absolute(reqt.url, location),\n        source = reqt.source,\n        sink = reqt.sink,\n        headers = reqt.headers,\n        proxy = reqt.proxy,\n        nredirects = (reqt.nredirects or 0) + 1,\n        create = reqt.create\n    }\n    -- pass location header back as a hint we redirected\n    headers = headers or {}\n    headers.location = headers.location or location\n    return result, code, headers, status\nend\n\n--[[local]] function trequest(reqt)\n    -- we loop until we get what we want, or\n    -- until we are sure there is no way to get it\n    local nreqt = adjustrequest(reqt)\n    local h = _M.open(nreqt.host, nreqt.port, nreqt.create)\n    -- send request line and headers\n    h:sendrequestline(nreqt.method, nreqt.uri)\n    h:sendheaders(nreqt.headers)\n    -- if there is a body, send it\n    if nreqt.source then\n        h:sendbody(nreqt.headers, nreqt.source, nreqt.step)\n    end\n    local code, status = h:receivestatusline()\n    -- if it is an HTTP/0.9 server, simply get the body and we are done\n    if not code then\n        h:receive09body(status, nreqt.sink, nreqt.step)\n        return 1, 200\n    end\n    local headers\n    -- ignore any 100-continue messages\n    while code == 100 do\n        headers = h:receiveheaders()\n        code, status = h:receivestatusline()\n    end\n    headers = h:receiveheaders()\n    -- at this point we should have a honest reply from the server\n    -- we can't redirect if we already used the source, so we report the error\n    if shouldredirect(nreqt, code, headers) and not nreqt.source then\n        h:close()\n        return tredirect(reqt, headers.location)\n    end\n    -- here we are finally done\n    if shouldreceivebody(nreqt, code) then\n        h:receivebody(headers, nreqt.sink, nreqt.step)\n    end\n    h:close()\n    return 1, code, headers, status\nend\n\n-- turns an url and a body into a generic request\nlocal function genericform(u, b)\n    local t = {}\n    local reqt = {\n        url = u,\n        sink = ltn12.sink.table(t),\n        target = t\n    }\n    if b then\n        reqt.source = ltn12.source.string(b)\n        reqt.headers = {\n            [\"content-length\"] = string.len(b),\n            [\"content-type\"] = \"application/x-www-form-urlencoded\"\n        }\n        reqt.method = \"POST\"\n    end\n    return reqt\nend\n\n_M.genericform = genericform\n\nlocal function srequest(u, b)\n    local reqt = genericform(u, b)\n    local _, code, headers, status = trequest(reqt)\n    return table.concat(reqt.target), code, headers, status\nend\n\n_M.request = socket.protect(function(reqt, body)\n    if base.type(reqt) == \"string\" then return srequest(reqt, body)\n    else return trequest(reqt) end\nend)\n\nreturn _M\n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/http.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 209e83764932d974287e82cda5febaf7\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/mbox.lua",
    "content": "local _M = {}\n\nif module then\n    mbox = _M\nend \n\nfunction _M.split_message(message_s)\n    local message = {}\n    message_s = string.gsub(message_s, \"\\r\\n\", \"\\n\")\n    string.gsub(message_s, \"^(.-\\n)\\n\", function (h) message.headers = h end)\n    string.gsub(message_s, \"^.-\\n\\n(.*)\", function (b) message.body = b end)\n    if not message.body then\n        string.gsub(message_s, \"^\\n(.*)\", function (b) message.body = b end)\n    end\n    if not message.headers and not message.body then\n        message.headers = message_s\n    end\n    return message.headers or \"\", message.body or \"\"\nend\n\nfunction _M.split_headers(headers_s)\n    local headers = {}\n    headers_s = string.gsub(headers_s, \"\\r\\n\", \"\\n\")\n    headers_s = string.gsub(headers_s, \"\\n[ ]+\", \" \")\n    string.gsub(\"\\n\" .. headers_s, \"\\n([^\\n]+)\", function (h) table.insert(headers, h) end)\n    return headers\nend\n\nfunction _M.parse_header(header_s)\n    header_s = string.gsub(header_s, \"\\n[ ]+\", \" \")\n    header_s = string.gsub(header_s, \"\\n+\", \"\")\n    local _, __, name, value = string.find(header_s, \"([^%s:]-):%s*(.*)\")\n    return name, value\nend\n\nfunction _M.parse_headers(headers_s)\n    local headers_t = _M.split_headers(headers_s)\n    local headers = {}\n    for i = 1, #headers_t do\n        local name, value = _M.parse_header(headers_t[i])\n        if name then\n            name = string.lower(name)\n            if headers[name] then\n                headers[name] = headers[name] .. \", \" .. value\n            else headers[name] = value end\n        end\n    end\n    return headers\nend\n\nfunction _M.parse_from(from)\n    local _, __, name, address = string.find(from, \"^%s*(.-)%s*%<(.-)%>\")\n    if not address then\n        _, __, address = string.find(from, \"%s*(.+)%s*\")\n    end\n    name = name or \"\"\n    address = address or \"\"\n    if name == \"\" then name = address end\n    name = string.gsub(name, '\"', \"\")\n    return name, address\nend\n\nfunction _M.split_mbox(mbox_s)\n    local mbox = {}\n    mbox_s = string.gsub(mbox_s, \"\\r\\n\", \"\\n\") ..\"\\n\\nFrom \\n\"\n    local nj, i, j = 1, 1, 1\n    while 1 do\n        i, nj = string.find(mbox_s, \"\\n\\nFrom .-\\n\", j)\n        if not i then break end\n        local message = string.sub(mbox_s, j, i-1)\n        table.insert(mbox, message)\n        j = nj+1\n    end\n    return mbox\nend\n\nfunction _M.parse(mbox_s)\n    local mbox = _M.split_mbox(mbox_s)\n    for i = 1, #mbox do\n        mbox[i] = _M.parse_message(mbox[i])\n    end\n    return mbox\nend\n\nfunction _M.parse_message(message_s)\n    local message = {}\n    message.headers, message.body = _M.split_message(message_s)\n    message.headers = _M.parse_headers(message.headers)\n    return message\nend\n\nreturn _M\n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/mbox.lua.meta",
    "content": "fileFormatVersion: 2\nguid: b179323d673f3f04996fc0b22c0817bb\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/smtp.lua",
    "content": "-----------------------------------------------------------------------------\n-- SMTP client support for the Lua language.\n-- LuaSocket toolkit.\n-- Author: Diego Nehab\n-----------------------------------------------------------------------------\n\n-----------------------------------------------------------------------------\n-- Declare module and import dependencies\n-----------------------------------------------------------------------------\nlocal base = _G\nlocal coroutine = require(\"coroutine\")\nlocal string = require(\"string\")\nlocal math = require(\"math\")\nlocal os = require(\"os\")\nlocal socket = require(\"socket\")\nlocal tp = require(\"socket.tp\")\nlocal ltn12 = require(\"ltn12\")\nlocal headers = require(\"socket.headers\")\nlocal mime = require(\"mime\")\n\nsocket.smtp = {}\nlocal _M = socket.smtp\n\n-----------------------------------------------------------------------------\n-- Program constants\n-----------------------------------------------------------------------------\n-- timeout for connection\n_M.TIMEOUT = 60\n-- default server used to send e-mails\n_M.SERVER = \"localhost\"\n-- default port\n_M.PORT = 25\n-- domain used in HELO command and default sendmail\n-- If we are under a CGI, try to get from environment\n_M.DOMAIN = os.getenv(\"SERVER_NAME\") or \"localhost\"\n-- default time zone (means we don't know)\n_M.ZONE = \"-0000\"\n\n---------------------------------------------------------------------------\n-- Low level SMTP API\n-----------------------------------------------------------------------------\nlocal metat = { __index = {} }\n\nfunction metat.__index:greet(domain)\n    self.try(self.tp:check(\"2..\"))\n    self.try(self.tp:command(\"EHLO\", domain or _M.DOMAIN))\n    return socket.skip(1, self.try(self.tp:check(\"2..\")))\nend\n\nfunction metat.__index:mail(from)\n    self.try(self.tp:command(\"MAIL\", \"FROM:\" .. from))\n    return self.try(self.tp:check(\"2..\"))\nend\n\nfunction metat.__index:rcpt(to)\n    self.try(self.tp:command(\"RCPT\", \"TO:\" .. to))\n    return self.try(self.tp:check(\"2..\"))\nend\n\nfunction metat.__index:data(src, step)\n    self.try(self.tp:command(\"DATA\"))\n    self.try(self.tp:check(\"3..\"))\n    self.try(self.tp:source(src, step))\n    self.try(self.tp:send(\"\\r\\n.\\r\\n\"))\n    return self.try(self.tp:check(\"2..\"))\nend\n\nfunction metat.__index:quit()\n    self.try(self.tp:command(\"QUIT\"))\n    return self.try(self.tp:check(\"2..\"))\nend\n\nfunction metat.__index:close()\n    return self.tp:close()\nend\n\nfunction metat.__index:login(user, password)\n    self.try(self.tp:command(\"AUTH\", \"LOGIN\"))\n    self.try(self.tp:check(\"3..\"))\n    self.try(self.tp:send(mime.b64(user) .. \"\\r\\n\"))\n    self.try(self.tp:check(\"3..\"))\n    self.try(self.tp:send(mime.b64(password) .. \"\\r\\n\"))\n    return self.try(self.tp:check(\"2..\"))\nend\n\nfunction metat.__index:plain(user, password)\n    local auth = \"PLAIN \" .. mime.b64(\"\\0\" .. user .. \"\\0\" .. password)\n    self.try(self.tp:command(\"AUTH\", auth))\n    return self.try(self.tp:check(\"2..\"))\nend\n\nfunction metat.__index:auth(user, password, ext)\n    if not user or not password then return 1 end\n    if string.find(ext, \"AUTH[^\\n]+LOGIN\") then\n        return self:login(user, password)\n    elseif string.find(ext, \"AUTH[^\\n]+PLAIN\") then\n        return self:plain(user, password)\n    else\n        self.try(nil, \"authentication not supported\")\n    end\nend\n\n-- send message or throw an exception\nfunction metat.__index:send(mailt)\n    self:mail(mailt.from)\n    if base.type(mailt.rcpt) == \"table\" then\n        for i,v in base.ipairs(mailt.rcpt) do\n            self:rcpt(v)\n        end\n    else\n        self:rcpt(mailt.rcpt)\n    end\n    self:data(ltn12.source.chain(mailt.source, mime.stuff()), mailt.step)\nend\n\nfunction _M.open(server, port, create)\n    local tp = socket.try(tp.connect(server or _M.SERVER, port or _M.PORT,\n        _M.TIMEOUT, create))\n    local s = base.setmetatable({tp = tp}, metat)\n    -- make sure tp is closed if we get an exception\n    s.try = socket.newtry(function()\n        s:close()\n    end)\n    return s\nend\n\n-- convert headers to lowercase\nlocal function lower_headers(headers)\n    local lower = {}\n    for i,v in base.pairs(headers or lower) do\n        lower[string.lower(i)] = v\n    end\n    return lower\nend\n\n---------------------------------------------------------------------------\n-- Multipart message source\n-----------------------------------------------------------------------------\n-- returns a hopefully unique mime boundary\nlocal seqno = 0\nlocal function newboundary()\n    seqno = seqno + 1\n    return string.format('%s%05d==%05u', os.date('%d%m%Y%H%M%S'),\n        math.random(0, 99999), seqno)\nend\n\n-- send_message forward declaration\nlocal send_message\n\n-- yield the headers all at once, it's faster\nlocal function send_headers(tosend)\n    local canonic = headers.canonic\n    local h = \"\\r\\n\"\n    for f,v in base.pairs(tosend) do\n        h = (canonic[f] or f) .. ': ' .. v .. \"\\r\\n\" .. h\n    end\n    coroutine.yield(h)\nend\n\n-- yield multipart message body from a multipart message table\nlocal function send_multipart(mesgt)\n    -- make sure we have our boundary and send headers\n    local bd = newboundary()\n    local headers = lower_headers(mesgt.headers or {})\n    headers['content-type'] = headers['content-type'] or 'multipart/mixed'\n    headers['content-type'] = headers['content-type'] ..\n        '; boundary=\"' ..  bd .. '\"'\n    send_headers(headers)\n    -- send preamble\n    if mesgt.body.preamble then\n        coroutine.yield(mesgt.body.preamble)\n        coroutine.yield(\"\\r\\n\")\n    end\n    -- send each part separated by a boundary\n    for i, m in base.ipairs(mesgt.body) do\n        coroutine.yield(\"\\r\\n--\" .. bd .. \"\\r\\n\")\n        send_message(m)\n    end\n    -- send last boundary\n    coroutine.yield(\"\\r\\n--\" .. bd .. \"--\\r\\n\\r\\n\")\n    -- send epilogue\n    if mesgt.body.epilogue then\n        coroutine.yield(mesgt.body.epilogue)\n        coroutine.yield(\"\\r\\n\")\n    end\nend\n\n-- yield message body from a source\nlocal function send_source(mesgt)\n    -- make sure we have a content-type\n    local headers = lower_headers(mesgt.headers or {})\n    headers['content-type'] = headers['content-type'] or\n        'text/plain; charset=\"iso-8859-1\"'\n    send_headers(headers)\n    -- send body from source\n    while true do\n        local chunk, err = mesgt.body()\n        if err then coroutine.yield(nil, err)\n        elseif chunk then coroutine.yield(chunk)\n        else break end\n    end\nend\n\n-- yield message body from a string\nlocal function send_string(mesgt)\n    -- make sure we have a content-type\n    local headers = lower_headers(mesgt.headers or {})\n    headers['content-type'] = headers['content-type'] or\n        'text/plain; charset=\"iso-8859-1\"'\n    send_headers(headers)\n    -- send body from string\n    coroutine.yield(mesgt.body)\nend\n\n-- message source\nfunction send_message(mesgt)\n    if base.type(mesgt.body) == \"table\" then send_multipart(mesgt)\n    elseif base.type(mesgt.body) == \"function\" then send_source(mesgt)\n    else send_string(mesgt) end\nend\n\n-- set defaul headers\nlocal function adjust_headers(mesgt)\n    local lower = lower_headers(mesgt.headers)\n    lower[\"date\"] = lower[\"date\"] or\n        os.date(\"!%a, %d %b %Y %H:%M:%S \") .. (mesgt.zone or _M.ZONE)\n    lower[\"x-mailer\"] = lower[\"x-mailer\"] or socket._VERSION\n    -- this can't be overriden\n    lower[\"mime-version\"] = \"1.0\"\n    return lower\nend\n\nfunction _M.message(mesgt)\n    mesgt.headers = adjust_headers(mesgt)\n    -- create and return message source\n    local co = coroutine.create(function() send_message(mesgt) end)\n    return function()\n        local ret, a, b = coroutine.resume(co)\n        if ret then return a, b\n        else return nil, a end\n    end\nend\n\n---------------------------------------------------------------------------\n-- High level SMTP API\n-----------------------------------------------------------------------------\n_M.send = socket.protect(function(mailt)\n    local s = _M.open(mailt.server, mailt.port, mailt.create)\n    local ext = s:greet(mailt.domain)\n    s:auth(mailt.user, mailt.password, ext)\n    s:send(mailt)\n    s:quit()\n    return s:close()\nend)\n\nreturn _M"
  },
  {
    "path": "Assets/ToLua/Lua/socket/smtp.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 5fb16f8ece254ef4d9c196242b49a8ae\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/tp.lua",
    "content": "-----------------------------------------------------------------------------\n-- Unified SMTP/FTP subsystem\n-- LuaSocket toolkit.\n-- Author: Diego Nehab\n-----------------------------------------------------------------------------\n\n-----------------------------------------------------------------------------\n-- Declare module and import dependencies\n-----------------------------------------------------------------------------\nlocal base = _G\nlocal string = require(\"string\")\nlocal socket = require(\"socket\")\nlocal ltn12 = require(\"ltn12\")\n\nsocket.tp = {}\nlocal _M = socket.tp\n\n-----------------------------------------------------------------------------\n-- Program constants\n-----------------------------------------------------------------------------\n_M.TIMEOUT = 60\n\n-----------------------------------------------------------------------------\n-- Implementation\n-----------------------------------------------------------------------------\n-- gets server reply (works for SMTP and FTP)\nlocal function get_reply(c)\n    local code, current, sep\n    local line, err = c:receive()\n    local reply = line\n    if err then return nil, err end\n    code, sep = socket.skip(2, string.find(line, \"^(%d%d%d)(.?)\"))\n    if not code then return nil, \"invalid server reply\" end\n    if sep == \"-\" then -- reply is multiline\n        repeat\n            line, err = c:receive()\n            if err then return nil, err end\n            current, sep = socket.skip(2, string.find(line, \"^(%d%d%d)(.?)\"))\n            reply = reply .. \"\\n\" .. line\n        -- reply ends with same code\n        until code == current and sep == \" \"\n    end\n    return code, reply\nend\n\n-- metatable for sock object\nlocal metat = { __index = {} }\n\nfunction metat.__index:getpeername()\n    return self.c:getpeername()\nend\n\nfunction metat.__index:getsockname()\n    return self.c:getpeername()\nend\n\nfunction metat.__index:check(ok)\n    local code, reply = get_reply(self.c)\n    if not code then return nil, reply end\n    if base.type(ok) ~= \"function\" then\n        if base.type(ok) == \"table\" then\n            for i, v in base.ipairs(ok) do\n                if string.find(code, v) then\n                    return base.tonumber(code), reply\n                end\n            end\n            return nil, reply\n        else\n            if string.find(code, ok) then return base.tonumber(code), reply\n            else return nil, reply end\n        end\n    else return ok(base.tonumber(code), reply) end\nend\n\nfunction metat.__index:command(cmd, arg)\n    cmd = string.upper(cmd)\n    if arg then\n        return self.c:send(cmd .. \" \" .. arg.. \"\\r\\n\")\n    else\n        return self.c:send(cmd .. \"\\r\\n\")\n    end\nend\n\nfunction metat.__index:sink(snk, pat)\n    local chunk, err = self.c:receive(pat)\n    return snk(chunk, err)\nend\n\nfunction metat.__index:send(data)\n    return self.c:send(data)\nend\n\nfunction metat.__index:receive(pat)\n    return self.c:receive(pat)\nend\n\nfunction metat.__index:getfd()\n    return self.c:getfd()\nend\n\nfunction metat.__index:dirty()\n    return self.c:dirty()\nend\n\nfunction metat.__index:getcontrol()\n    return self.c\nend\n\nfunction metat.__index:source(source, step)\n    local sink = socket.sink(\"keep-open\", self.c)\n    local ret, err = ltn12.pump.all(source, sink, step or ltn12.pump.step)\n    return ret, err\nend\n\n-- closes the underlying c\nfunction metat.__index:close()\n    self.c:close()\n    return 1\nend\n\n-- connect with server and return c object\nfunction _M.connect(host, port, timeout, create)\n    local c, e = (create or socket.tcp)()\n    if not c then return nil, e end\n    c:settimeout(timeout or _M.TIMEOUT)\n    local r, e = c:connect(host, port)\n    if not r then\n        c:close()\n        return nil, e\n    end\n    return base.setmetatable({c = c}, metat)\nend\n\nreturn _M\n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/tp.lua.meta",
    "content": "fileFormatVersion: 2\nguid: f81b525c8aa6ab6408db2989c91556cc\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/url.lua",
    "content": "-----------------------------------------------------------------------------\n-- URI parsing, composition and relative URL resolution\n-- LuaSocket toolkit.\n-- Author: Diego Nehab\n-----------------------------------------------------------------------------\n\n-----------------------------------------------------------------------------\n-- Declare module\n-----------------------------------------------------------------------------\nlocal string = require(\"string\")\nlocal base = _G\nlocal table = require(\"table\")\nlocal socket = require(\"socket\")\n\nsocket.url = {}\nlocal _M = socket.url\n\n-----------------------------------------------------------------------------\n-- Module version\n-----------------------------------------------------------------------------\n_M._VERSION = \"URL 1.0.3\"\n\n-----------------------------------------------------------------------------\n-- Encodes a string into its escaped hexadecimal representation\n-- Input\n--   s: binary string to be encoded\n-- Returns\n--   escaped representation of string binary\n-----------------------------------------------------------------------------\nfunction _M.escape(s)\n    return (string.gsub(s, \"([^A-Za-z0-9_])\", function(c)\n        return string.format(\"%%%02x\", string.byte(c))\n    end))\nend\n\n-----------------------------------------------------------------------------\n-- Protects a path segment, to prevent it from interfering with the\n-- url parsing.\n-- Input\n--   s: binary string to be encoded\n-- Returns\n--   escaped representation of string binary\n-----------------------------------------------------------------------------\nlocal function make_set(t)\n    local s = {}\n    for i,v in base.ipairs(t) do\n        s[t[i]] = 1\n    end\n    return s\nend\n\n-- these are allowed withing a path segment, along with alphanum\n-- other characters must be escaped\nlocal segment_set = make_set {\n    \"-\", \"_\", \".\", \"!\", \"~\", \"*\", \"'\", \"(\",\n    \")\", \":\", \"@\", \"&\", \"=\", \"+\", \"$\", \",\",\n}\n\nlocal function protect_segment(s)\n    return string.gsub(s, \"([^A-Za-z0-9_])\", function (c)\n        if segment_set[c] then return c\n        else return string.format(\"%%%02x\", string.byte(c)) end\n    end)\nend\n\n-----------------------------------------------------------------------------\n-- Encodes a string into its escaped hexadecimal representation\n-- Input\n--   s: binary string to be encoded\n-- Returns\n--   escaped representation of string binary\n-----------------------------------------------------------------------------\nfunction _M.unescape(s)\n    return (string.gsub(s, \"%%(%x%x)\", function(hex)\n        return string.char(base.tonumber(hex, 16))\n    end))\nend\n\n-----------------------------------------------------------------------------\n-- Builds a path from a base path and a relative path\n-- Input\n--   base_path\n--   relative_path\n-- Returns\n--   corresponding absolute path\n-----------------------------------------------------------------------------\nlocal function absolute_path(base_path, relative_path)\n    if string.sub(relative_path, 1, 1) == \"/\" then return relative_path end\n    local path = string.gsub(base_path, \"[^/]*$\", \"\")\n    path = path .. relative_path\n    path = string.gsub(path, \"([^/]*%./)\", function (s)\n        if s ~= \"./\" then return s else return \"\" end\n    end)\n    path = string.gsub(path, \"/%.$\", \"/\")\n    local reduced\n    while reduced ~= path do\n        reduced = path\n        path = string.gsub(reduced, \"([^/]*/%.%./)\", function (s)\n            if s ~= \"../../\" then return \"\" else return s end\n        end)\n    end\n    path = string.gsub(reduced, \"([^/]*/%.%.)$\", function (s)\n        if s ~= \"../..\" then return \"\" else return s end\n    end)\n    return path\nend\n\n-----------------------------------------------------------------------------\n-- Parses a url and returns a table with all its parts according to RFC 2396\n-- The following grammar describes the names given to the URL parts\n-- <url> ::= <scheme>://<authority>/<path>;<params>?<query>#<fragment>\n-- <authority> ::= <userinfo>@<host>:<port>\n-- <userinfo> ::= <user>[:<password>]\n-- <path> :: = {<segment>/}<segment>\n-- Input\n--   url: uniform resource locator of request\n--   default: table with default values for each field\n-- Returns\n--   table with the following fields, where RFC naming conventions have\n--   been preserved:\n--     scheme, authority, userinfo, user, password, host, port,\n--     path, params, query, fragment\n-- Obs:\n--   the leading '/' in {/<path>} is considered part of <path>\n-----------------------------------------------------------------------------\nfunction _M.parse(url, default)\n    -- initialize default parameters\n    local parsed = {}\n    for i,v in base.pairs(default or parsed) do parsed[i] = v end\n    -- empty url is parsed to nil\n    if not url or url == \"\" then return nil, \"invalid url\" end\n    -- remove whitespace\n    -- url = string.gsub(url, \"%s\", \"\")\n    -- get fragment\n    url = string.gsub(url, \"#(.*)$\", function(f)\n        parsed.fragment = f\n        return \"\"\n    end)\n    -- get scheme\n    url = string.gsub(url, \"^([%w][%w%+%-%.]*)%:\",\n        function(s) parsed.scheme = s; return \"\" end)\n    -- get authority\n    url = string.gsub(url, \"^//([^/]*)\", function(n)\n        parsed.authority = n\n        return \"\"\n    end)\n    -- get query string\n    url = string.gsub(url, \"%?(.*)\", function(q)\n        parsed.query = q\n        return \"\"\n    end)\n    -- get params\n    url = string.gsub(url, \"%;(.*)\", function(p)\n        parsed.params = p\n        return \"\"\n    end)\n    -- path is whatever was left\n    if url ~= \"\" then parsed.path = url end\n    local authority = parsed.authority\n    if not authority then return parsed end\n    authority = string.gsub(authority,\"^([^@]*)@\",\n        function(u) parsed.userinfo = u; return \"\" end)\n    authority = string.gsub(authority, \":([^:%]]*)$\",\n        function(p) parsed.port = p; return \"\" end)\n    if authority ~= \"\" then \n        -- IPv6?\n        parsed.host = string.match(authority, \"^%[(.+)%]$\") or authority \n    end\n    local userinfo = parsed.userinfo\n    if not userinfo then return parsed end\n    userinfo = string.gsub(userinfo, \":([^:]*)$\",\n        function(p) parsed.password = p; return \"\" end)\n    parsed.user = userinfo\n    return parsed\nend\n\n-----------------------------------------------------------------------------\n-- Rebuilds a parsed URL from its components.\n-- Components are protected if any reserved or unallowed characters are found\n-- Input\n--   parsed: parsed URL, as returned by parse\n-- Returns\n--   a stringing with the corresponding URL\n-----------------------------------------------------------------------------\nfunction _M.build(parsed)\n    local ppath = _M.parse_path(parsed.path or \"\")\n    local url = _M.build_path(ppath)\n    if parsed.params then url = url .. \";\" .. parsed.params end\n    if parsed.query then url = url .. \"?\" .. parsed.query end\n    local authority = parsed.authority\n    if parsed.host then\n        authority = parsed.host\n        if string.find(authority, \":\") then -- IPv6?\n            authority = \"[\" .. authority .. \"]\"\n        end\n        if parsed.port then authority = authority .. \":\" .. parsed.port end\n        local userinfo = parsed.userinfo\n        if parsed.user then\n            userinfo = parsed.user\n            if parsed.password then\n                userinfo = userinfo .. \":\" .. parsed.password\n            end\n        end\n        if userinfo then authority = userinfo .. \"@\" .. authority end\n    end\n    if authority then url = \"//\" .. authority .. url end\n    if parsed.scheme then url = parsed.scheme .. \":\" .. url end\n    if parsed.fragment then url = url .. \"#\" .. parsed.fragment end\n    -- url = string.gsub(url, \"%s\", \"\")\n    return url\nend\n\n-----------------------------------------------------------------------------\n-- Builds a absolute URL from a base and a relative URL according to RFC 2396\n-- Input\n--   base_url\n--   relative_url\n-- Returns\n--   corresponding absolute url\n-----------------------------------------------------------------------------\nfunction _M.absolute(base_url, relative_url)\n    local base_parsed\n    if base.type(base_url) == \"table\" then\n        base_parsed = base_url\n        base_url = _M.build(base_parsed)\n    else\n        base_parsed = _M.parse(base_url)\n    end\n    local relative_parsed = _M.parse(relative_url)\n    if not base_parsed then return relative_url\n    elseif not relative_parsed then return base_url\n    elseif relative_parsed.scheme then return relative_url\n    else\n        relative_parsed.scheme = base_parsed.scheme\n        if not relative_parsed.authority then\n            relative_parsed.authority = base_parsed.authority\n            if not relative_parsed.path then\n                relative_parsed.path = base_parsed.path\n                if not relative_parsed.params then\n                    relative_parsed.params = base_parsed.params\n                    if not relative_parsed.query then\n                        relative_parsed.query = base_parsed.query\n                    end\n                end\n            else    \n                relative_parsed.path = absolute_path(base_parsed.path or \"\",\n                    relative_parsed.path)\n            end\n        end\n        return _M.build(relative_parsed)\n    end\nend\n\n-----------------------------------------------------------------------------\n-- Breaks a path into its segments, unescaping the segments\n-- Input\n--   path\n-- Returns\n--   segment: a table with one entry per segment\n-----------------------------------------------------------------------------\nfunction _M.parse_path(path)\n    local parsed = {}\n    path = path or \"\"\n    --path = string.gsub(path, \"%s\", \"\")\n    string.gsub(path, \"([^/]+)\", function (s) table.insert(parsed, s) end)\n    for i = 1, #parsed do\n        parsed[i] = _M.unescape(parsed[i])\n    end\n    if string.sub(path, 1, 1) == \"/\" then parsed.is_absolute = 1 end\n    if string.sub(path, -1, -1) == \"/\" then parsed.is_directory = 1 end\n    return parsed\nend\n\n-----------------------------------------------------------------------------\n-- Builds a path component from its segments, escaping protected characters.\n-- Input\n--   parsed: path segments\n--   unsafe: if true, segments are not protected before path is built\n-- Returns\n--   path: corresponding path stringing\n-----------------------------------------------------------------------------\nfunction _M.build_path(parsed, unsafe)\n    local path = \"\"\n    local n = #parsed\n    if unsafe then\n        for i = 1, n-1 do\n            path = path .. parsed[i]\n            path = path .. \"/\"\n        end\n        if n > 0 then\n            path = path .. parsed[n]\n            if parsed.is_directory then path = path .. \"/\" end\n        end\n    else\n        for i = 1, n-1 do\n            path = path .. protect_segment(parsed[i])\n            path = path .. \"/\"\n        end\n        if n > 0 then\n            path = path .. protect_segment(parsed[n])\n            if parsed.is_directory then path = path .. \"/\" end\n        end\n    end\n    if parsed.is_absolute then path = \"/\" .. path end\n    return path\nend\n\nreturn _M\n"
  },
  {
    "path": "Assets/ToLua/Lua/socket/url.lua.meta",
    "content": "fileFormatVersion: 2\nguid: f52d8d21085d51c42b5e27aca557bcd9\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket.lua",
    "content": "-----------------------------------------------------------------------------\n-- LuaSocket helper module\n-- Author: Diego Nehab\n-----------------------------------------------------------------------------\n\n-----------------------------------------------------------------------------\n-- Declare module and import dependencies\n-----------------------------------------------------------------------------\nlocal base = _G\nlocal string = require(\"string\")\nlocal math = require(\"math\")\nlocal socket = require(\"socket.core\")\n\nlocal _M = socket\n\n-----------------------------------------------------------------------------\n-- Exported auxiliar functions\n-----------------------------------------------------------------------------\nfunction _M.connect4(address, port, laddress, lport)\n    return socket.connect(address, port, laddress, lport, \"inet\")\nend\n\nfunction _M.connect6(address, port, laddress, lport)\n    return socket.connect(address, port, laddress, lport, \"inet6\")\nend\n\nfunction _M.bind(host, port, backlog)\n    if host == \"*\" then host = \"0.0.0.0\" end\n    local addrinfo, err = socket.dns.getaddrinfo(host);\n    if not addrinfo then return nil, err end\n    local sock, res\n    err = \"no info on address\"\n    for i, alt in base.ipairs(addrinfo) do\n        if alt.family == \"inet\" then\n            sock, err = socket.tcp4()\n        else\n            sock, err = socket.tcp6()\n        end\n        if not sock then return nil, err end\n        sock:setoption(\"reuseaddr\", true)\n        res, err = sock:bind(alt.addr, port)\n        if not res then\n            sock:close()\n        else\n            res, err = sock:listen(backlog)\n            if not res then\n                sock:close()\n            else\n                return sock\n            end\n        end\n    end\n    return nil, err\nend\n\n_M.try = _M.newtry()\n\nfunction _M.choose(table)\n    return function(name, opt1, opt2)\n        if base.type(name) ~= \"string\" then\n            name, opt1, opt2 = \"default\", name, opt1\n        end\n        local f = table[name or \"nil\"]\n        if not f then base.error(\"unknown key (\".. base.tostring(name) ..\")\", 3)\n        else return f(opt1, opt2) end\n    end\nend\n\n-----------------------------------------------------------------------------\n-- Socket sources and sinks, conforming to LTN12\n-----------------------------------------------------------------------------\n-- create namespaces inside LuaSocket namespace\nlocal sourcet, sinkt = {}, {}\n_M.sourcet = sourcet\n_M.sinkt = sinkt\n\n_M.BLOCKSIZE = 2048\n\nsinkt[\"close-when-done\"] = function(sock)\n    return base.setmetatable({\n        getfd = function() return sock:getfd() end,\n        dirty = function() return sock:dirty() end\n    }, {\n        __call = function(self, chunk, err)\n            if not chunk then\n                sock:close()\n                return 1\n            else return sock:send(chunk) end\n        end\n    })\nend\n\nsinkt[\"keep-open\"] = function(sock)\n    return base.setmetatable({\n        getfd = function() return sock:getfd() end,\n        dirty = function() return sock:dirty() end\n    }, {\n        __call = function(self, chunk, err)\n            if chunk then return sock:send(chunk)\n            else return 1 end\n        end\n    })\nend\n\nsinkt[\"default\"] = sinkt[\"keep-open\"]\n\n_M.sink = _M.choose(sinkt)\n\nsourcet[\"by-length\"] = function(sock, length)\n    return base.setmetatable({\n        getfd = function() return sock:getfd() end,\n        dirty = function() return sock:dirty() end\n    }, {\n        __call = function()\n            if length <= 0 then return nil end\n            local size = math.min(socket.BLOCKSIZE, length)\n            local chunk, err = sock:receive(size)\n            if err then return nil, err end\n            length = length - string.len(chunk)\n            return chunk\n        end\n    })\nend\n\nsourcet[\"until-closed\"] = function(sock)\n    local done\n    return base.setmetatable({\n        getfd = function() return sock:getfd() end,\n        dirty = function() return sock:dirty() end\n    }, {\n        __call = function()\n            if done then return nil end\n            local chunk, err, partial = sock:receive(socket.BLOCKSIZE)\n            if not err then return chunk\n            elseif err == \"closed\" then\n                sock:close()\n                done = 1\n                return partial\n            else return nil, err end\n        end\n    })\nend\n\n\nsourcet[\"default\"] = sourcet[\"until-closed\"]\n\n_M.source = _M.choose(sourcet)\n\nreturn _M\n"
  },
  {
    "path": "Assets/ToLua/Lua/socket.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 63c3bb6af007b6344af9a86ef0b7e225\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/socket.meta",
    "content": "fileFormatVersion: 2\nguid: d809aad390df7d54a95d719367731993\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/tolua.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nif jit then\t\t\n\tif jit.opt then\t\t\n\t\tjit.opt.start(3)\t\t\t\t\n\tend\t\t\n\t\n\tprint(\"ver\"..jit.version_num..\" jit: \", jit.status())\n\tprint(string.format(\"os: %s, arch: %s\", jit.os, jit.arch))\nend\n\nif DebugServerIp then  \n  require(\"mobdebug\").start(DebugServerIp)\nend\n\nrequire \"misc.functions\"\nMathf\t\t= require \"UnityEngine.Mathf\"\nVector3 \t= require \"UnityEngine.Vector3\"\nQuaternion\t= require \"UnityEngine.Quaternion\"\nVector2\t\t= require \"UnityEngine.Vector2\"\nVector4\t\t= require \"UnityEngine.Vector4\"\nColor\t\t= require \"UnityEngine.Color\"\nColor32\t\t= require \"UnityEngine.Color32\"\nRay\t\t\t= require \"UnityEngine.Ray\"\nBounds\t\t= require \"UnityEngine.Bounds\"\nRaycastHit\t= require \"UnityEngine.RaycastHit\"\nTouch\t\t= require \"UnityEngine.Touch\"\nLayerMask\t= require \"UnityEngine.LayerMask\"\nPlane\t\t= require \"UnityEngine.Plane\"\nTime\t\t= reimport \"UnityEngine.Time\"\n\nlist\t\t= require \"list\"\nutf8\t\t= require \"misc.utf8\"\n\nrequire \"event\"\nrequire \"typeof\"\nrequire \"slot\"\nrequire \"System.Timer\"\nrequire \"System.coroutine\"\nrequire \"System.ValueType\"\nrequire \"System.Reflection.BindingFlags\"\n\n--require \"misc.strict\""
  },
  {
    "path": "Assets/ToLua/Lua/tolua.lua.meta",
    "content": "fileFormatVersion: 2\nguid: 2dab8762e884a1c469dd11f6d2044a0f\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua/typeof.lua",
    "content": "--------------------------------------------------------------------------------\n--      Copyright (c) 2015 - 2016 , 蒙占志(topameng) topameng@gmail.com\n--      All rights reserved.\n--      Use, modification and distribution are subject to the \"MIT License\"\n--------------------------------------------------------------------------------\nlocal type = type\nlocal types = {}\nlocal _typeof = tolua.typeof\nlocal _findtype = tolua.findtype\n\nfunction typeof(obj)\n\tlocal t = type(obj)\n\tlocal ret = nil\n\t\n\tif t == \"table\" then\n\t\tret = types[obj]\n\t\t\n\t\tif ret == nil then\n\t\t\tret = _typeof(obj)\n\t\t\ttypes[obj] = ret\n\t\tend\t\t\n  \telseif t == \"string\" then\n  \t\tret = types[obj]\n\n  \t\tif ret == nil then\n  \t\t\tret = _findtype(obj)\n  \t\t\ttypes[obj] = ret\n  \t\tend\t\n  \telse\n  \t\terror(debug.traceback(\"attemp to call typeof on type \"..t))\n\tend\n\t\n\treturn ret\nend"
  },
  {
    "path": "Assets/ToLua/Lua/typeof.lua.meta",
    "content": "fileFormatVersion: 2\nguid: a7edd4f2975d3f54f8396b61d8b34944\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Lua.meta",
    "content": "fileFormatVersion: 2\nguid: 9b3be0814bb45e640973aea4f6303a33\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaClient.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing System.Collections.Generic;\nusing LuaInterface;\nusing System.Collections;\nusing System.IO;\nusing System;\n#if UNITY_5_4_OR_NEWER\nusing UnityEngine.SceneManagement;\n#endif\n\npublic class LuaClient : MonoBehaviour\n{\n    public static LuaClient Instance\n    {\n        get;\n        protected set;\n    }\n\n    protected LuaState luaState = null;\n    protected LuaLooper loop = null;\n    protected LuaFunction levelLoaded = null;\n\n    protected bool openLuaSocket = false;\n    protected bool beZbStart = false;\n\n    protected virtual LuaFileUtils InitLoader()\n    {\n        return LuaFileUtils.Instance;       \n    }\n\n    protected virtual void LoadLuaFiles()\n    {\n        OnLoadFinished();\n    }\n\n    protected virtual void OpenLibs()\n    {\n        luaState.OpenLibs(LuaDLL.luaopen_pb);\n        luaState.OpenLibs(LuaDLL.luaopen_struct);\n        luaState.OpenLibs(LuaDLL.luaopen_lpeg);\n#if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX\n        luaState.OpenLibs(LuaDLL.luaopen_bit);\n#endif\n\n        if (LuaConst.openLuaSocket)\n        {\n            OpenLuaSocket();            \n        }        \n\n        if (LuaConst.openLuaDebugger)\n        {\n            OpenZbsDebugger();\n        }\n    }\n\n    public void OpenZbsDebugger(string ip = \"localhost\")\n    {\n        if (!Directory.Exists(LuaConst.zbsDir))\n        {\n            Debugger.LogWarning(\"ZeroBraneStudio not install or LuaConst.zbsDir not right\");\n            return;\n        }\n\n        if (!LuaConst.openLuaSocket)\n        {                            \n            OpenLuaSocket();\n        }\n\n        if (!string.IsNullOrEmpty(LuaConst.zbsDir))\n        {\n            luaState.AddSearchPath(LuaConst.zbsDir);\n        }\n\n        luaState.LuaDoString(string.Format(\"DebugServerIp = '{0}'\", ip), \"@LuaClient.cs\");\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int LuaOpen_Socket_Core(IntPtr L)\n    {        \n        return LuaDLL.luaopen_socket_core(L);\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int LuaOpen_Mime_Core(IntPtr L)\n    {\n        return LuaDLL.luaopen_mime_core(L);\n    }\n\n    protected void OpenLuaSocket()\n    {\n        LuaConst.openLuaSocket = true;\n\n        luaState.BeginPreLoad();\n        luaState.RegFunction(\"socket.core\", LuaOpen_Socket_Core);\n        luaState.RegFunction(\"mime.core\", LuaOpen_Mime_Core);                \n        luaState.EndPreLoad();                     \n    }\n\n    //cjson 比较特殊，只new了一个table，没有注册库，这里注册一下\n    protected void OpenCJson()\n    {\n        luaState.LuaGetField(LuaIndexes.LUA_REGISTRYINDEX, \"_LOADED\");\n        luaState.OpenLibs(LuaDLL.luaopen_cjson);\n        luaState.LuaSetField(-2, \"cjson\");\n\n        luaState.OpenLibs(LuaDLL.luaopen_cjson_safe);\n        luaState.LuaSetField(-2, \"cjson.safe\");                               \n    }\n\n    protected virtual void CallMain()\n    {\n        LuaFunction main = luaState.GetFunction(\"Main\");\n        main.Call();\n        main.Dispose();\n        main = null;                \n    }\n\n    protected virtual void StartMain()\n    {\n        luaState.DoFile(\"Main.lua\");\n        levelLoaded = luaState.GetFunction(\"OnLevelWasLoaded\");\n        CallMain();\n    }\n\n    protected void StartLooper()\n    {\n        loop = gameObject.AddComponent<LuaLooper>();\n        loop.luaState = luaState;\n    }\n\n    protected virtual void Bind()\n    {        \n        LuaBinder.Bind(luaState);\n        DelegateFactory.Init();   \n        LuaCoroutine.Register(luaState, this);        \n    }\n\n    protected void Init()\n    {        \n        InitLoader();\n        luaState = new LuaState();\n        OpenLibs();\n        luaState.LuaSetTop(0);\n        Bind();        \n        LoadLuaFiles();        \n    }\n\n    protected void Awake()\n    {\n        Instance = this;\n        Init();\n\n#if UNITY_5_4_OR_NEWER\n        SceneManager.sceneLoaded += OnSceneLoaded;\n#endif        \n    }\n\n    protected virtual void OnLoadFinished()\n    {\n        luaState.Start();\n        StartLooper();\n        StartMain();        \n    }\n\n    void OnLevelLoaded(int level)\n    {\n        if (levelLoaded != null)\n        {\n            levelLoaded.BeginPCall();\n            levelLoaded.Push(level);\n            levelLoaded.PCall();\n            levelLoaded.EndPCall();\n        }\n\n        if (luaState != null)\n        {            \n            luaState.RefreshDelegateMap();\n        }\n    }\n\n#if UNITY_5_4_OR_NEWER\n    void OnSceneLoaded(Scene scene, LoadSceneMode mode)\n    {\n        OnLevelLoaded(scene.buildIndex);\n    }\n#else\n    protected void OnLevelWasLoaded(int level)\n    {\n        OnLevelLoaded(level);\n    }\n#endif\n\n    public virtual void Destroy()\n    {\n        if (luaState != null)\n        {\n#if UNITY_5_4_OR_NEWER\n            SceneManager.sceneLoaded -= OnSceneLoaded;\n#endif    \n            luaState.Call(\"OnApplicationQuit\", false);\n            DetachProfiler();\n            LuaState state = luaState;\n            luaState = null;\n\n            if (levelLoaded != null)\n            {\n                levelLoaded.Dispose();\n                levelLoaded = null;\n            }\n\n            if (loop != null)\n            {\n                loop.Destroy();\n                loop = null;\n            }\n\n            state.Dispose();\n            Instance = null;\n        }\n    }\n\n    protected void OnDestroy()\n    {\n        Destroy();\n    }\n\n    protected void OnApplicationQuit()\n    {\n        Destroy();\n    }\n\n    public static LuaState GetMainState()\n    {\n        return Instance.luaState;\n    }\n\n    public LuaLooper GetLooper()\n    {\n        return loop;\n    }\n\n    LuaTable profiler = null;\n\n    public void AttachProfiler()\n    {\n        if (profiler == null)\n        {\n            profiler = luaState.Require<LuaTable>(\"UnityEngine.Profiler\");\n            profiler.Call(\"start\", profiler);\n        }\n    }\n    public void DetachProfiler()\n    {\n        if (profiler != null)\n        {\n            profiler.Call(\"stop\", profiler);\n            profiler.Dispose();\n            LuaProfiler.Clear();\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaClient.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3d41d4486c02e3e4ca1c1f12f7a48a95\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaCoroutine.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing UnityEngine;\nusing LuaInterface;\nusing System;\nusing System.Collections;\n\npublic static class LuaCoroutine\n{\n\tprivate static MonoBehaviour mb = null;\n\tprivate static string strCo =\n        @\"\n        local _WaitForSeconds, _WaitForFixedUpdate, _WaitForEndOfFrame, _Yield, _StopCoroutine = WaitForSeconds, WaitForFixedUpdate, WaitForEndOfFrame, Yield, StopCoroutine        \n        local error = error\n        local debug = debug\n        local coroutine = coroutine\n        local comap = {}\n        setmetatable(comap, {__mode = 'k'})\n\n        function _resume(co)\n            if comap[co] then\n                comap[co] = nil\n                local flag, msg = coroutine.resume(co)\n                    \n                if not flag then\n                    msg = debug.traceback(co, msg)\n                    error(msg)\n                end\n            end        \n        end\n\n        function WaitForSeconds(t)\n            local co = coroutine.running()\n            local resume = function()                    \n                _resume(co)                     \n            end\n            \n            comap[co] = _WaitForSeconds(t, resume)\n            return coroutine.yield()\n        end\n\n        function WaitForFixedUpdate()\n            local co = coroutine.running()\n            local resume = function()          \n                _resume(co)     \n            end\n        \n            comap[co] = _WaitForFixedUpdate(resume)\n            return coroutine.yield()\n        end\n\n        function WaitForEndOfFrame()\n            local co = coroutine.running()\n            local resume = function()        \n                _resume(co)     \n            end\n        \n            comap[co] = _WaitForEndOfFrame(resume)\n            return coroutine.yield()\n        end\n\n        function Yield(o)\n            local co = coroutine.running()\n            local resume = function()        \n                _resume(co)     \n            end\n        \n            comap[co] = _Yield(o, resume)\n            return coroutine.yield()\n        end\n\n        function StartCoroutine(func)\n            local co = coroutine.create(func)                       \n            local flag, msg = coroutine.resume(co)\n\n            if not flag then\n                msg = debug.traceback(co, msg)\n                error(msg)\n            end\n\n            return co\n        end\n\n        function StopCoroutine(co)\n            local _co = comap[co]\n\n            if _co == nil then\n                return\n            end\n\n            comap[co] = nil\n            _StopCoroutine(_co)\n        end\n        \";\n\n    public static void Register(LuaState state, MonoBehaviour behaviour)\n    {\n        state.BeginModule(null);\n        state.RegFunction(\"WaitForSeconds\", _WaitForSeconds);\n        state.RegFunction(\"WaitForFixedUpdate\", WaitForFixedUpdate);\n        state.RegFunction(\"WaitForEndOfFrame\", WaitForEndOfFrame);\n        state.RegFunction(\"Yield\", Yield);\n        state.RegFunction(\"StopCoroutine\", StopCoroutine);\n        state.RegFunction(\"WrapLuaCoroutine\", WrapLuaCoroutine);\n        state.EndModule();\n\n        state.LuaDoString(strCo, \"LuaCoroutine.cs\");\n        mb = behaviour;\n    }\n\n    //另一种方式，非脚本回调方式(用脚本方式更好，可避免lua_yield异常出现在c#函数中)\n    /*[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    static int WaitForSeconds(IntPtr L)\n    {\n        try\n        {\n            LuaState state = LuaState.Get(L);\n            LuaDLL.lua_pushthread(L);\n            LuaThread thread = ToLua.ToLuaThread(L, -1);\n            float sec = (float)LuaDLL.luaL_checknumber(L, 1);\n            mb.StartCoroutine(CoWaitForSeconds(sec, thread));\n            return LuaDLL.lua_yield(L, 0);\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    static IEnumerator CoWaitForSeconds(float sec, LuaThread thread)\n    {\n        yield return new WaitForSeconds(sec);\n        thread.Resume();\n    }*/\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tprivate static int _WaitForSeconds(IntPtr L)\n    {\n        try\n        {\n            float sec = (float)LuaDLL.luaL_checknumber(L, 1);\n            LuaFunction func = ToLua.ToLuaFunction(L, 2);\n            Coroutine co = mb.StartCoroutine(CoWaitForSeconds(sec, func));\n            ToLua.PushSealed(L, co);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\tprivate static IEnumerator CoWaitForSeconds(float sec, LuaFunction func)\n    {\n        yield return new WaitForSeconds(sec);\n        func.Call();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tprivate static int WaitForFixedUpdate(IntPtr L)\n    {\n        try\n        {\n            LuaFunction func = ToLua.ToLuaFunction(L, 1);\n            Coroutine co = mb.StartCoroutine(CoWaitForFixedUpdate(func));\n            ToLua.PushSealed(L, co);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\tprivate static IEnumerator CoWaitForFixedUpdate(LuaFunction func)\n    {\n        yield return new WaitForFixedUpdate();\n        func.Call();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tprivate static int WaitForEndOfFrame(IntPtr L)\n    {\n        try\n        {\n            LuaFunction func = ToLua.ToLuaFunction(L, 1);\n            Coroutine co = mb.StartCoroutine(CoWaitForEndOfFrame(func));\n            ToLua.PushSealed(L, co);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\tprivate static IEnumerator CoWaitForEndOfFrame(LuaFunction func)\n    {\n        yield return new WaitForEndOfFrame();\n        func.Call();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tprivate static int Yield(IntPtr L)\n    {\n        try\n        {\n            object o = ToLua.ToVarObject(L, 1);\n            LuaFunction func = ToLua.ToLuaFunction(L, 2);\n            Coroutine co = mb.StartCoroutine(CoYield(o, func));\n            ToLua.PushSealed(L, co);\n            return 1;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n\tprivate static IEnumerator CoYield(object o, LuaFunction func)\n    {\n        if (o is IEnumerator)\n        {\n            yield return mb.StartCoroutine((IEnumerator)o);\n        }\n        else\n        {\n            yield return o;\n        }\n\n        func.Call();\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n\tprivate static int StopCoroutine(IntPtr L)\n    {\n        try\n        {\n            Coroutine co = (Coroutine)ToLua.CheckObject(L, 1, typeof(Coroutine));\n            mb.StopCoroutine(co);\n            return 0;\n        }\n        catch (Exception e)\n        {\n            return LuaDLL.toluaL_exception(L, e);\n        }\n    }\n\n    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n    private static int WrapLuaCoroutine(IntPtr L)\n    {\n        LuaFunction func = ToLua.ToLuaFunction(L, 1);\n        IEnumerator enumerator = CoWrap(func);\n        ToLua.Push(L, enumerator);\n        return 1;\n    }\n\n    private static IEnumerator CoWrap(LuaFunction func)\n    {\n        if (func == null)\n        {\n            yield break;\n        }\n\n        while (func.Invoke<bool>())\n        {\n            yield return null;\n        }\n    }\n}\n\n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaCoroutine.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 61c0f3aff91dfbd4097181bfb8c99d7f\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaLooper.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing UnityEngine;\nusing LuaInterface;\n\npublic class LuaLooper : MonoBehaviour \n{    \n    public LuaBeatEvent UpdateEvent\n    {\n        get;\n        private set;\n    }\n\n    public LuaBeatEvent LateUpdateEvent\n    {\n        get;\n        private set;\n    }\n\n    public LuaBeatEvent FixedUpdateEvent\n    {\n        get;\n        private set;\n    }\n\n    public LuaState luaState = null;\n\n    void Start() \n    {\n        try\n        {\n            UpdateEvent = GetEvent(\"UpdateBeat\");\n            LateUpdateEvent = GetEvent(\"LateUpdateBeat\");\n            FixedUpdateEvent = GetEvent(\"FixedUpdateBeat\");\n        }\n        catch (Exception e)\n        {\n            Destroy(this);\n            throw e;\n        }        \n\t}\n\n    LuaBeatEvent GetEvent(string name)\n    {\n        LuaTable table = luaState.GetTable(name);\n\n        if (table == null)\n        {\n            throw new LuaException(string.Format(\"Lua table {0} not exists\", name));\n        }\n\n        LuaBeatEvent e = new LuaBeatEvent(table);\n        table.Dispose();\n        table = null;\n        return e;\n    }\n\n    void ThrowException()\n    {\n        string error = luaState.LuaToString(-1);\n        luaState.LuaPop(2);                \n        throw new LuaException(error, LuaException.GetLastError());\n    }\n\n    void Update()\n    {\n#if UNITY_EDITOR\n        if (luaState == null)\n        {\n            return;\n        }\n#endif\n        if (luaState.LuaUpdate(Time.deltaTime, Time.unscaledDeltaTime) != 0)\n        {\n            ThrowException();\n        }\n\n        luaState.LuaPop(1);\n        luaState.Collect();\n#if UNITY_EDITOR\n        luaState.CheckTop();\n#endif\n    }\n\n    void LateUpdate()\n    {\n#if UNITY_EDITOR\n        if (luaState == null)\n        {\n            return;\n        }\n#endif\n        if (luaState.LuaLateUpdate() != 0)\n        {\n            ThrowException();\n        }\n\n        luaState.StepCollect();\n        luaState.LuaPop(1);\n    }\n\n    void FixedUpdate()\n    {\n#if UNITY_EDITOR\n        if (luaState == null)\n        {\n            return;\n        }\n#endif\n        if (luaState.LuaFixedUpdate(Time.fixedDeltaTime) != 0)\n        {\n            ThrowException();\n        }\n\n        luaState.LuaPop(1);\n    }\n\n    public void Destroy()\n    {\n        if (luaState != null)\n        {\n            if (UpdateEvent != null)\n            {\n                UpdateEvent.Dispose();\n                UpdateEvent = null;\n            }\n\n            if (LateUpdateEvent != null)\n            {\n                LateUpdateEvent.Dispose();\n                LateUpdateEvent = null;\n            }\n\n            if (FixedUpdateEvent != null)\n            {\n                FixedUpdateEvent.Dispose();\n                FixedUpdateEvent = null;\n            }\n\n            luaState = null;\n        }\n    }\n\n    void OnDestroy()\n    {\n        if (luaState != null)\n        {\n            Destroy();\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaLooper.cs.meta",
    "content": "fileFormatVersion: 2\nguid: d56dbfed903b80e498bb872845c17e7e\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: -10\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaProfiler.cs",
    "content": "﻿using System.Collections.Generic;\nusing UnityEngine;\n#if UNITY_5_5_OR_NEWER\nusing UnityEngine.Profiling;\n#endif\n\npublic static class LuaProfiler\n{\n    public static List<string> list = new List<string>();\n\n    public static void Clear()\n    {\n        list.Clear();\n    }\n\n    public static int GetID(string name)\n    {\n        int id = list.Count;\n        list.Add(name);\n        return id;\n    }\n\n    public static void BeginSample(int id)\n    {\n        string name = list[id];\n        Profiler.BeginSample(name);\n    }\n\n    public static void EndSample()\n    {\n        Profiler.EndSample();\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaProfiler.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 29c635f2321c2dc48aea28e8e6accb7e\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaResLoader.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n//优先读取persistentDataPath/系统/Lua 目录下的文件（默认下载目录）\n//未找到文件怎读取 Resources/Lua 目录下文件（仍没有使用LuaFileUtil读取）\nusing UnityEngine;\nusing LuaInterface;\nusing System.IO;\nusing System.Text;\n\npublic class LuaResLoader : LuaFileUtils\n{\n    public LuaResLoader()\n    {\n        instance = this;\n        beZip = false;\n    }\n\n    public override byte[] ReadFile(string fileName)\n    {\n#if !UNITY_EDITOR\n        byte[] buffer = ReadDownLoadFile(fileName);\n\n        if (buffer == null)\n        {\n            buffer = ReadResourceFile(fileName);\n        }        \n        \n        if (buffer == null)\n        {\n            buffer = base.ReadFile(fileName);\n        }        \n#else\n        byte[] buffer = base.ReadFile(fileName);\n\n        if (buffer == null)\n        {\n            buffer = ReadResourceFile(fileName);\n        }\n\n        if (buffer == null)\n        {\n            buffer = ReadDownLoadFile(fileName);\n        }\n#endif\n\n        return buffer;\n    }\n\n    public override string FindFileError(string fileName)\n    {\n        if (Path.IsPathRooted(fileName))\n        {\n            return fileName;\n        }\n\n        if (Path.GetExtension(fileName) == \".lua\")\n        {\n            fileName = fileName.Substring(0, fileName.Length - 4);            \n        }\n\n        using (CString.Block())\n        {\n            CString sb = CString.Alloc(512);\n\n            for (int i = 0; i < searchPaths.Count; i++)\n            {\n                sb.Append(\"\\n\\tno file '\").Append(searchPaths[i]).Append('\\'');\n            }\n\n            sb.Append(\"\\n\\tno file './Resources/\").Append(fileName).Append(\".lua'\")\n              .Append(\"\\n\\tno file '\").Append(LuaConst.luaResDir).Append('/')\n\t\t\t  .Append(fileName).Append(\".lua'\");\n            sb = sb.Replace(\"?\", fileName);\n\n            return sb.ToString();\n        }\n    }\n\n    byte[] ReadResourceFile(string fileName)\n    {\n        if (!fileName.EndsWith(\".lua\"))\n        {\n            fileName += \".lua\";\n        }\n\n        byte[] buffer = null;\n        string path = \"Lua/\" + fileName;\n        TextAsset text = Resources.Load(path, typeof(TextAsset)) as TextAsset;\n\n        if (text != null)\n        {\n            buffer = text.bytes;\n            Resources.UnloadAsset(text);\n        }\n\n        return buffer;\n    }\n\n    byte[] ReadDownLoadFile(string fileName)\n    {\n        if (!fileName.EndsWith(\".lua\"))\n        {\n            fileName += \".lua\";\n        }\n\n        string path = fileName;\n\n        if (!Path.IsPathRooted(fileName))\n        {            \n            path = string.Format(\"{0}/{1}\", LuaConst.luaResDir, fileName);            \n        }\n\n        if (File.Exists(path))\n        {\n#if !UNITY_WEBPLAYER\n            return File.ReadAllBytes(path);\n#else\n            throw new LuaException(\"can't run in web platform, please switch to other platform\");\n#endif\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Misc/LuaResLoader.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 61b6ccc77a2cfc341963b08eb6cb4dfc\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Misc.meta",
    "content": "fileFormatVersion: 2\nguid: 4ec2002202db97649bcdffe1705c0bdc\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaConstructor.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Reflection;\n\nnamespace LuaInterface\n{\n    public sealed class LuaConstructor\n    {\n        ConstructorInfo method = null;\n        List<Type> list = null;\n\n        [NoToLuaAttribute]\n        public LuaConstructor(ConstructorInfo func, Type[] types)\n        {\n            method = func;            \n\n            if (types != null)\n            {\n                list = new List<Type>(types);\n            }\n        }\n\n        public int Call(IntPtr L)\n        {\n            object[] args = null;\n            ToLua.CheckArgsCount(L, list.Count + 1);\n\n            if (list.Count > 0)\n            {\n                args = new object[list.Count];\n\n                for (int i = 0; i < list.Count; i++)\n                {\n                    bool isRef = list[i].IsByRef;\n                    Type t0 = isRef ? list[i].GetElementType() : list[i];\n                    object o = ToLua.CheckVarObject(L, i + 2, t0);\n                    args[i] = o;\n                }\n            }\n\n            object ret = method.Invoke(args);\n            int count = 1;\n            ToLua.Push(L, ret);\n\n            for (int i = 0; i < list.Count; i++)\n            {\n                if (list[i].IsByRef)\n                {\n                    ++count;\n                    ToLua.Push(L, args[i]);\n                }\n            }\n\n            return count;\n        }\n\n        public void Destroy()\n        {\n            method = null;\n            list.Clear();\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaConstructor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5f277531b56c0944fb5d9af67defed02\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaField.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nusing System;\nusing System.Globalization;\nusing System.Reflection;\n\nnamespace LuaInterface\n{    \n    //代表一个反射属性\n    public sealed class LuaField\n    {\n        FieldInfo field = null;\n        Type kclass = null;\n\n        [NoToLuaAttribute]\n        public LuaField(FieldInfo info, Type t)\n        {\n            field = info;\n            kclass = t;            \n        }\n\n        public int Get(IntPtr L)\n        {\n            try\n            {\n                ToLua.CheckArgsCount(L, 2);                \n                object arg0 = ToLua.CheckObject(L, 2, kclass);\n                object o = field.GetValue(arg0);\n\n                if (o == null)\n                {\n                    if (typeof(System.MulticastDelegate).IsAssignableFrom(field.FieldType))\n                    {\n                        o = DelegateFactory.CreateDelegate(field.FieldType, null);\n                        ToLua.Push(L, (Delegate)o);\n                    }\n                    else\n                    {\n                        LuaDLL.lua_pushnil(L);\n                    }\n                }\n                else\n                {\n                    ToLua.Push(L, o);\n                }\n\n                return 1;\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }            \n        }\n\n        public int Set(IntPtr L)\n        {\n            try\n            {\n                int count = LuaDLL.lua_gettop(L);\n\n                if (count == 3)\n                {\n                    object arg0 = ToLua.CheckVarObject(L, 2, kclass);\n                    object arg1 = ToLua.ToVarObject(L, 3);\n                    if (arg1 != null) arg1 = TypeChecker.ChangeType(arg1, field.FieldType);\n                    field.SetValue(arg0, arg1);\n                    return 0;\n                }\n                else if (count == 6)\n                {\n                    object arg0 = ToLua.CheckVarObject(L, 2, kclass);\n                    object arg1 = ToLua.ToVarObject(L, 3);\n                    if (arg1 != null) arg1 = TypeChecker.ChangeType(arg1, field.FieldType);\n                    BindingFlags arg2 = (BindingFlags)LuaDLL.luaL_checknumber(L, 4);\n                    Binder arg3 = (Binder)ToLua.CheckObject(L, 5, typeof(Binder));\n                    CultureInfo arg4 = (CultureInfo)ToLua.CheckObject(L, 6, typeof(CultureInfo));                    \n                    field.SetValue(arg0, arg1, arg2, arg3, arg4);\n                    return 0;\n                }\n                else\n                {\n                    return LuaDLL.luaL_throw(L, \"invalid arguments to method: LuaField.Set\");\n                }\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaField.cs.meta",
    "content": "fileFormatVersion: 2\nguid: ac0dd1f9fec2afa4e96fc2f583688c5a\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaMethod.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Collections.Generic;\nusing System.Reflection;\n\nnamespace LuaInterface\n{\n    //代表一个反射函数\n    public sealed class LuaMethod\n    {        \n        MethodInfo method = null;\n        List<Type> list = new List<Type>();\n        Type kclass = null;\n\n        [NoToLuaAttribute]\n        public LuaMethod(MethodInfo md, Type t, Type[] types)\n        {\n            method = md;\n            kclass = t;            \n\n            if (types != null)\n            {\n                list.AddRange(types);\n            }\n        }\n        \n        public int Call(IntPtr L)\n        {            \n            object[] args = null;\n            object obj = null;\n            int offset = 1;\n\n            if (!method.IsStatic)\n            {\n                offset += 1;\n                obj = ToLua.CheckObject(L, 2, kclass);\n            }\n\n            ToLua.CheckArgsCount(L, list.Count + offset);\n\n            if (list.Count > 0)\n            {\n                args = new object[list.Count];\n                offset += 1;\n\n                for (int i = 0; i < list.Count; i++)\n                {\n                    bool isRef = list[i].IsByRef;\n                    Type t0 = isRef ? list[i].GetElementType() : list[i];\n                    object o = ToLua.CheckVarObject(L, i + offset, t0);                    \n                    args[i] = o;\n                }\n            }\n            \n            object ret = method.Invoke(obj, args);\n            int count = 0;\n\n            if (method.ReturnType != typeof(void))\n            {\n                ++count;\n                ToLua.Push(L, ret);\n            }\n\n            for (int i = 0; i < list.Count; i++)\n            {\n                if (list[i].IsByRef)\n                {\n                    ++count;\n                    ToLua.Push(L, args[i]);\n                }\n            }\n\n            return count;\n        }\n\n        public void Destroy()\n        {\n            method = null;\n            list.Clear();\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaMethod.cs.meta",
    "content": "fileFormatVersion: 2\nguid: e50f0b4cc54866649975adb5d9801a3d\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaProperty.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Globalization;\nusing System.Reflection;\n\nnamespace LuaInterface\n{\n    //代表一个反射属性\n    public sealed class LuaProperty\n    {\n        PropertyInfo property = null;\n        Type kclass = null;        \n\n        [NoToLuaAttribute]\n        public LuaProperty(PropertyInfo prop, Type t)\n        {\n            property = prop;\n            kclass = t;            \n        }\n\n        public int Get(IntPtr L)\n        {\n            int count = LuaDLL.lua_gettop(L);            \n\n            if (count == 3)\n            {\n                object arg0 = ToLua.CheckVarObject(L, 2, kclass);\n                object[] arg1 = ToLua.CheckObjectArray(L, 3);\n                object o = property.GetValue(arg0, arg1);                \n                ToLua.Push(L, o);\n                return 1;\n            }\n            else if (count == 6)\n            {\n                object arg0 = ToLua.CheckVarObject(L, 2, kclass);\n                BindingFlags arg1 = (BindingFlags)LuaDLL.luaL_checknumber(L, 3);\n                Binder arg2 = (Binder)ToLua.CheckObject(L, 4, typeof(Binder));\n                object[] arg3 = ToLua.CheckObjectArray(L, 5);\n                CultureInfo arg4 = (CultureInfo)ToLua.CheckObject(L, 6, typeof(CultureInfo));\n                object o = property.GetValue(arg0, arg1, arg2, arg3, arg4);\n                ToLua.Push(L, o);\n                return 1;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: LuaInterface.LuaProperty.Get\");\n            }\n        }\n\n        public int Set(IntPtr L)\n        {\n            int count = LuaDLL.lua_gettop(L);            \n\n            if (count == 4)\n            {\n                object arg0 = ToLua.CheckVarObject(L, 2, kclass);\n                object arg1 = ToLua.ToVarObject(L, 3);\n                if (arg1 != null) arg1 = TypeChecker.ChangeType(arg1, property.PropertyType);\n                object[] arg2 = ToLua.CheckObjectArray(L, 4);                \n                property.SetValue(arg0, arg1, arg2);\n                return 0;\n            }\n            else if (count == 7)\n            {\n                object arg0 = ToLua.CheckVarObject(L, 2, kclass);\n                object arg1 = ToLua.ToVarObject(L, 3);\n                if (arg1 != null) arg1 = TypeChecker.ChangeType(arg1, property.PropertyType);\n                BindingFlags arg2 = (BindingFlags)LuaDLL.luaL_checknumber(L, 4);\n                Binder arg3 = (Binder)ToLua.CheckObject(L, 5, typeof(Binder));\n                object[] arg4 = ToLua.CheckObjectArray(L, 6);\n                CultureInfo arg5 = (CultureInfo)ToLua.CheckObject(L, 7, typeof(CultureInfo));                \n                property.SetValue(arg0, arg1, arg2, arg3, arg4, arg5);\n                return 0;\n            }\n            else\n            {\n                return LuaDLL.luaL_throw(L, \"invalid arguments to method: LuaInterface.LuaProperty.Set\");\n            }            \n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaProperty.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 26952c90fb22bda4dbe945f2fa2224ff\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaReflection.cs",
    "content": "﻿/*\nCopyright (c) 2015-2017 topameng(topameng@qq.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\nusing System;\nusing System.Collections.Generic;\nusing System.Reflection;\n\nnamespace LuaInterface\n{\n    public class LuaReflection : IDisposable\n    {\n        public List<Assembly> list = new List<Assembly>();\n#if !MULTI_STATE\n        private static LuaReflection _reflection = null;\n#endif\n\n        public LuaReflection()\n        {\n#if !MULTI_STATE\n            _reflection = this;\n#endif\n            LoadAssembly(\"mscorlib\");\n            LoadAssembly(\"UnityEngine\");\n            //注释避免放在插件目录无法加载，需要可从lua代码loadassembly\n            //LoadAssembly(\"Assembly-CSharp\"); \n        }\n\n        public static void OpenLibs(IntPtr L)\n        {\n            LuaDLL.lua_getglobal(L, \"tolua\");\n\n            LuaDLL.lua_pushstring(L, \"findtype\");\n            LuaDLL.lua_pushcfunction(L, FindType);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"loadassembly\");            \n            LuaDLL.tolua_pushcfunction(L, LoadAssembly);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"getmethod\");\n            LuaDLL.tolua_pushcfunction(L, GetMethod);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"getconstructor\");\n            LuaDLL.tolua_pushcfunction(L, GetConstructor);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"gettypemethod\");\n            LuaDLL.tolua_pushcfunction(L, GetTypeMethod);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"getfield\");\n            LuaDLL.tolua_pushcfunction(L, GetField);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"getproperty\");\n            LuaDLL.tolua_pushcfunction(L, GetProperty);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pushstring(L, \"createinstance\");\n            LuaDLL.tolua_pushcfunction(L, CreateInstance);\n            LuaDLL.lua_rawset(L, -3);\n\n            LuaDLL.lua_pop(L, 1);\n\n            LuaState state = LuaState.Get(L);\n            state.BeginPreLoad();\n            state.AddPreLoad(\"tolua.reflection\", OpenReflectionLibs);            \n            state.EndPreLoad();\n        }\n\n        public static LuaReflection Get(IntPtr L)\n        {\n#if !MULTI_STATE\n            return _reflection;\n#else\n            return LuaState.GetReflection(L);\n#endif\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int OpenReflectionLibs(IntPtr L)\n        {\n            try\n            {\n                LuaState state = LuaState.Get(L);\n                state.BeginModule(null);\n                state.BeginModule(\"LuaInterface\");\n                LuaInterface_LuaMethodWrap.Register(state);\n                LuaInterface_LuaPropertyWrap.Register(state);\n                LuaInterface_LuaFieldWrap.Register(state);\n                LuaInterface_LuaConstructorWrap.Register(state);                \n                state.EndModule();\n                state.EndModule();\n                return 0;\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int FindType(IntPtr L)\n        {\n            string name = ToLua.CheckString(L, 1);\n            LuaReflection reflection = LuaReflection.Get(L);            \n            List<Assembly> list = reflection.list;\n            Type t = null;            \n\n            for (int i = 0; i < list.Count; i++)\n            {\n                t = list[i].GetType(name);\n\n                if (t != null)\n                {\n                    break;\n                }\n            }            \n\n            ToLua.Push(L, t);\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int LoadAssembly(IntPtr L)\n        {\n            try\n            {\n                LuaReflection reflection = LuaReflection.Get(L);\n                string name = ToLua.CheckString(L, 1);\n                LuaDLL.lua_pushboolean(L, reflection.LoadAssembly(name));\n            }\n            catch(Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n\n            return 1;\n        }\n\n        static void PushLuaMethod(IntPtr L, MethodInfo md, Type t, Type[] types)\n        {\n            if (md != null)\n            {\n                LuaMethod lm = new LuaMethod(md, t, types);\n                ToLua.PushSealed(L, lm);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetMethod(IntPtr L)\n        {\n            try\n            {\n                int count = LuaDLL.lua_gettop(L);\n                Type t = ToLua.CheckMonoType(L, 1);\n                string name = ToLua.CheckString(L, 2);\n                Type[] types = null;\n\n                if (count > 2)\n                {\n                    types = new Type[count - 2];\n\n                    for (int i = 3; i <= count; i++)\n                    {\n                        Type ti = ToLua.CheckMonoType(L, i);\n                        if (ti == null) LuaDLL.luaL_typerror(L, i, \"Type\");\n                        types[i - 3] = ti;\n                    }                                       \n                }\n\n                MethodInfo md = null;\n\n                if (types == null)\n                {\n                    md = t.GetMethod(name);\n                }\n                else\n                {\n                    md = t.GetMethod(name, types);\n                }\n\n                PushLuaMethod(L, md, t, types);\n            }\n            catch(Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n\n            return 1;\n        }\n\n        static void PushLuaConstructor(IntPtr L, ConstructorInfo func, Type[] types)\n        {\n            if (func != null)\n            {\n                LuaConstructor lm = new LuaConstructor(func, types);\n                ToLua.PushSealed(L, lm);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetConstructor(IntPtr L)\n        {\n            try\n            {\n                int count = LuaDLL.lua_gettop(L);\n                Type t = (Type)ToLua.CheckObject(L, 1, typeof(Type));                \n                Type[] types = null;\n\n                if (count > 1)\n                {\n                    types = new Type[count - 1];\n\n                    for (int i = 2; i <= count; i++)\n                    {\n                        Type ti = ToLua.CheckMonoType(L, i);\n                        if (ti == null) LuaDLL.luaL_typerror(L, i, \"Type\");\n                        types[i - 2] = ti;\n                    }\n                }\n\n                ConstructorInfo ret = t.GetConstructor(types);\n                PushLuaConstructor(L, ret, types);\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n\n            return 1;\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetTypeMethod(IntPtr L)\n        {\n            try\n            {\n                int count = LuaDLL.lua_gettop(L);                \n\n                if (count == 2 && TypeChecker.CheckTypes<Type, string>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    MethodInfo o = obj.GetMethod(arg0);                    \n                    PushLuaMethod(L, o, obj, null);\n                    return 1;\n                }\n                else if (count == 3 && TypeChecker.CheckTypes<Type, string, Type[]>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    Type[] arg1 = ToLua.ToObjectArray<Type>(L, 3);\n                    MethodInfo o = obj.GetMethod(arg0, arg1);\n                    PushLuaMethod(L, o, obj, arg1);\n                    return 1;\n                }\n                else if (count == 3 && TypeChecker.CheckTypes<Type, string, uint>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);\n                    MethodInfo o = obj.GetMethod(arg0, arg1);\n                    PushLuaMethod(L, o, obj, null);\n                    return 1;\n                }\n                else if (count == 4 && TypeChecker.CheckTypes<Type, string, Type[], ParameterModifier[]>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    Type[] arg1 = ToLua.ToObjectArray<System.Type>(L, 3);\n                    ParameterModifier[] arg2 = ToLua.ToStructArray<ParameterModifier>(L, 4);\n                    MethodInfo o = obj.GetMethod(arg0, arg1, arg2);\n                    PushLuaMethod(L, o, obj, arg1);\n                    return 1;\n                }\n                else if (count == 6 && TypeChecker.CheckTypes<Type, string, uint, Binder, Type[], ParameterModifier[]> (L, 1))\n                {\n                    System.Type obj = (System.Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);\n                    Binder arg2 = (Binder)ToLua.ToObject(L, 4);\n                    Type[] arg3 = ToLua.ToObjectArray<Type>(L, 5);\n                    ParameterModifier[] arg4 = ToLua.ToStructArray<ParameterModifier>(L, 6);\n                    MethodInfo o = obj.GetMethod(arg0, arg1, arg2, arg3, arg4);\n                    PushLuaMethod(L, o, obj, arg3);\n                    return 1;\n                }\n                else if (count == 7 && TypeChecker.CheckTypes<Type, string, uint, Binder, CallingConventions, Type[], ParameterModifier[]> (L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);\n                    Binder arg2 = (Binder)ToLua.ToObject(L, 4);\n                    CallingConventions arg3 = (CallingConventions)ToLua.ToObject(L, 5);\n                    Type[] arg4 = ToLua.ToObjectArray<Type>(L, 6);\n                    ParameterModifier[] arg5 = ToLua.ToStructArray<ParameterModifier>(L, 7);\n                    MethodInfo o = obj.GetMethod(arg0, arg1, arg2, arg3, arg4, arg5);\n                    PushLuaMethod(L, o, obj, arg4);\n                    return 1;\n                }\n                else\n                {\n                    return LuaDLL.luaL_throw(L, \"invalid arguments to method: tolua.gettypemethod\");\n                }\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n        }\n\n        static void PushLuaProperty(IntPtr L, PropertyInfo p, Type t)\n        {\n            if (p != null)\n            {\n                LuaProperty lp = new LuaProperty(p, t);\n                ToLua.PushSealed(L, lp);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetProperty(IntPtr L)\n        {\n            try\n            {\n                int count = LuaDLL.lua_gettop(L);                \n\n                if (count == 2 && TypeChecker.CheckTypes<Type, string>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    PropertyInfo o = obj.GetProperty(arg0);                    \n                    PushLuaProperty(L, o, obj);\n                    return 1;\n                }\n                else if (count == 3 && TypeChecker.CheckTypes<Type, string, Type[]>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    Type[] arg1 = ToLua.ToObjectArray<Type>(L, 3);\n                    PropertyInfo o = obj.GetProperty(arg0, arg1);\n                    PushLuaProperty(L, o, obj);\n                    return 1;\n                }\n                else if (count == 3 && TypeChecker.CheckTypes<Type, string, Type>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    Type arg1 = (Type)ToLua.ToObject(L, 3);\n                    PropertyInfo o = obj.GetProperty(arg0, arg1);\n                    PushLuaProperty(L, o, obj);\n                    return 1;\n                }\n                else if (count == 3 && TypeChecker.CheckTypes<Type, string, uint>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);\n                    PropertyInfo o = obj.GetProperty(arg0, arg1);\n                    PushLuaProperty(L, o, obj);\n                    return 1;\n                }\n                else if (count == 4 && TypeChecker.CheckTypes<Type, string, Type, Type[]>(L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    Type arg1 = (Type)ToLua.ToObject(L, 3);\n                    Type[] arg2 = ToLua.ToObjectArray<Type>(L, 4);\n                    PropertyInfo o = obj.GetProperty(arg0, arg1, arg2);\n                    PushLuaProperty(L, o, obj);\n                    return 1;\n                }\n                else if (count == 5 && TypeChecker.CheckTypes<Type, string, Type, Type[], ParameterModifier[]> (L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    Type arg1 = (Type)ToLua.ToObject(L, 3);\n                    Type[] arg2 = ToLua.ToObjectArray<Type>(L, 4);\n                    ParameterModifier[] arg3 = ToLua.ToStructArray<ParameterModifier>(L, 5);\n                    PropertyInfo o = obj.GetProperty(arg0, arg1, arg2, arg3);\n                    PushLuaProperty(L, o, obj);\n                    return 1;\n                }\n                else if (count == 7 && TypeChecker.CheckTypes<Type, string, uint, Binder, Type, Type[], ParameterModifier[]> (L, 1))\n                {\n                    Type obj = (Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);\n                    Binder arg2 = (Binder)ToLua.ToObject(L, 4);\n                    Type arg3 = (Type)ToLua.ToObject(L, 5);\n                    Type[] arg4 = ToLua.ToObjectArray<Type>(L, 6);\n                    ParameterModifier[] arg5 = ToLua.ToStructArray<ParameterModifier>(L, 7);\n                    PropertyInfo o = obj.GetProperty(arg0, arg1, arg2, arg3, arg4, arg5);\n                    PushLuaProperty(L, o, obj);\n                    return 1;\n                }\n                else\n                {\n                    return LuaDLL.luaL_throw(L, \"invalid arguments to method: tolua.getproperty\");\n                }\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }            \n        }\n\n        static void PushLuaField(IntPtr L, FieldInfo f, Type t)\n        {\n            if (f != null)\n            {\n                LuaField lp = new LuaField(f, t);\n                ToLua.PushSealed(L, lp);\n            }\n            else\n            {\n                LuaDLL.lua_pushnil(L);\n            }\n        }\n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int GetField(IntPtr L)\n        {\n            try\n            {\n                int count = LuaDLL.lua_gettop(L);                \n\n                if (count == 2 && TypeChecker.CheckTypes<Type, string>(L, 1))\n                {\n                    Type obj = (System.Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    FieldInfo o = obj.GetField(arg0);\n                    PushLuaField(L, o, obj);\n                    return 1;\n                }\n                else if (count == 3 && TypeChecker.CheckTypes<Type, string, uint>(L, 1))\n                {\n                    Type obj = (System.Type)ToLua.ToObject(L, 1);\n                    string arg0 = ToLua.ToString(L, 2);\n                    BindingFlags arg1 = (BindingFlags)LuaDLL.lua_tonumber(L, 3);\n                    FieldInfo o = obj.GetField(arg0, arg1);\n                    PushLuaField(L, o, obj);\n                    return 1;\n                }\n                else\n                {\n                    return LuaDLL.luaL_throw(L, \"invalid arguments to method: tolua.getfield\");\n                }\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n        }           \n\n        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]\n        static int CreateInstance(IntPtr L)\n        {\n            try\n            {\n                Type t = ToLua.CheckMonoType(L, 1);\n                if (t == null) LuaDLL.luaL_typerror(L, 1, \"Type\");\n                int count = LuaDLL.lua_gettop(L);\n                object obj = null;\n\n                if (count == 1)\n                {\n                    obj = Activator.CreateInstance(t);\n                }\n                else\n                {\n                    object[] args = new object[count - 1];\n\n                    for (int i = 2; i <= count; i++)\n                    {\n                        args[i - 2] = ToLua.ToVarObject(L, i);\n                    }\n\n                    obj = Activator.CreateInstance(t, args);\n                }\n\n                ToLua.Push(L, obj);\n            }\n            catch (Exception e)\n            {\n                return LuaDLL.toluaL_exception(L, e);\n            }\n\n            return 1;\n        }\n\n        bool LoadAssembly(string name)\n        {\n            for (int i = 0; i < list.Count; i++)\n            {\n                if (list[i].GetName().Name == name)\n                {\n                    return true;\n                }\n            }                \n\n            Assembly assembly = Assembly.Load(name);\n\n            if (assembly == null)\n            {\n                assembly = Assembly.Load(AssemblyName.GetAssemblyName(name));\n            }\n\n            if (assembly != null && !list.Contains(assembly))\n            {\n                list.Add(assembly);\n            }\n\n            return assembly != null;\n        }\n\n        public void Dispose()\n        {\n            list.Clear();\n        }\n    }\n}\n"
  },
  {
    "path": "Assets/ToLua/Reflection/LuaReflection.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3faee4f867484814bb3f76d4a798219d\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/Reflection.meta",
    "content": "fileFormatVersion: 2\nguid: fcd2662a23826114e86e7828b55342b7\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua/readme.txt",
    "content": "﻿tolua#\ngit地址: https://github.com/topameng/tolua\nbug 反馈群: 286510803\n\n如果你想在手机上测试，首先点击菜单Lua/Copy lua files to Resources， 之后再build\n如果在mac上发布ios，删除x86和x86_64目录\n更新插件之前，请先执行Lua/Clear wrap files，更新后再重新生成wrap文件。\n\n1.01\n- FIX: 5.x AssetBundle.Load函数废弃问题.\n- FIX: 修正模版类导出命名空间问题\n- FIX: pblua protobuf协议tostring卡死问题\n- FIX: Array index 不再检测null参数\n- FIX: LuaInteger64 重载函数匹配检测问题\n- NEW: 指定RenderSettings为静态类\n- NEW: LuaFunction转委托函数支持可变参数列表\n- NEW: Wrap函数出错同时附加c#异常堆栈\n\n1.02\n- New: c# event +=和-=操作支持\n- New: 添加 mac 和 ios 运行库\n- Opt: 优化list双向链表\n\n1.0.3(需要重新导出Wrap文件)\n- FIX: 在mac unity5 luac协同异常后，unity追踪堆栈(一般是log类函数)不崩溃。(luac与unity配合问题)\n- FIX: ios发布mono版本编译问题\n- FIX: 模拟unity协同在使用过程中发生协同被gc的bug. 加入StartCoroutine 和 StopCoroutine 来启动或者停止这种协同\n- FIX: LuaFunction递归调用自身问题\n- NEW: 出错后能反映两端正确的堆栈（并且格式与unity相同,无论是c#异常还是lua异常！)\n- NEW: 从LuaClient拆分出LuaLooper（负责update驱动分发）\n- NEW: Lua API 接口按照lua头文件方式排序，加入所有的Lua API函数（无法兼容的除非，部分被改写来）\n- NEW: 重写大量可发生异常的Lua API（native异常转换为C#异常）。\n- NEW: lua 全双工协同加入 coroutine.stop 函数，请跟 coroutine.start 配合使用\n- NEW: Event 改为小写 event, 增加 c# 端委托 +- LuaFunction\n- NEW: Add utf-8 libs and examples\n- NEW: Add cjson libs and examples\n- NEW: CustomSettings.cs 加入新的静态类，以及out类链表(默认不在为每个类加.out属性, 除非out列表有这个类型）\n- NEW: 加入LuaConst， 可以自定义Lua文件目录，设置后让例子环境正常运行\n\n1.0.4 (需要重新导出Wrap文件,即使下载过这个版本也要重新导出)\n- FIX: 修复遗漏的TrackedReference问题(导出问题)\n- FIX: 导出wrap文件时当一个ref类型在其他非系统dll中也能正确找到。\n- FIX: abstrace class 作为基类不再自动导出（默认跳过），如果需要导出，请加入到导出列表\n- FIX: 如果函数名字与属性名相同（如get_Name 函数与 Name 属性），可以正确产生重载函数。\n- FIX: char[] 转换问题\n- FIX: int64.tonum2 符号位不对问题，int64加入范围检测\n- NEW: int64 使用字符串赋值时加入溢出检查\n- NEW: 修改proto-gen-lua库，使之支持int64, uint64。fixed64, ufixed64等等\n- NEW: CheckTypes系列函数放入TypeChecker类\n- NEW: 加入预加载库功能，预加载的库通过require类型延迟导入, 比如 require \"UnityEngine.GameObject\"。严格区分.与/。使用目录切勿用.\n- NEW: LuaConst加入ZeroBraneStudio路径设置，可以通过LuaClient.OpenZbsDebugger启动ZeroBraneStudio调试\n- NEW: print 编辑器下可以打印所在的lua文件名和位置\n- NEW: this操作符增加this属性，可以通过get和set操作, 在get_Item有重载函数，并且重载函数折叠掉this属性函数可以使用\n- NEW: 增加LuaByteBufferAttribute, 加上这个标记的委托类型，在压入byte[]时作为lua string压入，而不是System.Array\n- Opt: 优化update系列函数速度\n\n1.0.5 (需要重新生成库文件，重新导出wrap文件)\n- NEW: loader 遵从 lua 方式，c# loader 兼容package path路径方式\n- NEW: 加入静态反射，使用方法见例子22_Reflection\n- NEW: 修改require, module 对于使用.和/不会作为不同文件加载。推荐用.\n- NEW: 支持c# 基础类型out修饰符。需要require 'tolua.out' 来加载。\n- NEW: 加入LuaRenameAttribute元属性， 对于重载折叠掉的函数，可以使用这个属性设置一个新的函数名字从而实现单独导出\n- NEW: 使用一个没有require的preloading库会触发一次警告，push 没有wrap的类型，做为注册过的基类类型存入（最差是System.Object）\n- NEW: 补齐一些极少用到的数组类型(如bool[]极少见)或者param数组(param string[](一般用param object[]))类型参数\n- NEW: 导出支持增加扩展类型导出相应的扩展函数，支持可预知参数类型的模版函数导出。通过配置CustomSetting即可导出DoTween类库\n- NEW: 支持ZeroBrandStudio调试\n- NEW: luajit2.1 beta1 升级为 luajit2.1 beta2\n- New: 打包lua文件名小写和u5.x一致，加入u5.x打包代码。\n- FIX: 修改LuaSocket使用 git 上最新的LuaSocket版本，而不是之前的修改版\n- FIX: 导出的数组支持c#所有数组函数，而不是只有[]和length\n- FIX: 去掉Type类一些无法使用的函数，使用静态反射方案替代\n- FIX: luaref 默认值设置为-1，调用不存在或者未初始化的的函数出错信息同lua一致\n- FIX: 修改AddSearchPath方式，c#查找文件方式与lua相同，并且兼容lua修改package.path，c#与c loader搜索目录不在重叠\n- FIX: 清除LuaFunction 记录堆栈数据的gc alloc\n- FIX: int64作为object push check 问题\n- FIX: LuaTable int key c#不做判断，按照lua标准执行或者报错\n- FIX: 一些小的导出问题\n\n1.0.6 (需要重新生成库文件，需要Clear all, 重新导出wrap)\n- NEW: 加入LuaStatePtr最为LuaDLL函数简单封装层\n- NEW: LuaState ToLuaException 更名为 ThrowLuaException\n- NEW: Debugger 放入到 LuaInterface namespace\n- NEW: module.name 如果.name不存在，可以自动进行preloading操作，相当于 require \"module.name\"\n- NEW: 在控制台窗口点击print打印的lua log, 将会自动打开lua文件，或者跳转到设置的cs文件中\n- NEW: 支持int64和uint64. c# 端long做为int64压入，ulong作为uint64压入\n- NEW: 支持list和dictionary的通用导出\n- NEW: list 支持数组操作符，如果Dictionary key 为int也支持，非int key 继续使用get_Item函数\n- NEW: 支持委托转换LuaFunction函数，附带self。即System.Action(self.func, self)， 这样转换可自动作为:调用\n\n- FIX: tolua_pushcclosure 调整为 tolua_pushcfunction\n- FIX: userdata 访问__newindex不能存在的属性不创建peer表。如需peer表请主动创建\n- FIX: 委托自动适配lua函数时，支持out参数。- 委托操作，支持自动转换函数。 \n- FIX: 部分GetHashCode函数可能潜在的问题\n- FIX: CheckInteger64 更名为 CheckLong\n- FIX: DefaultMember(\"ItemOf\")类导出问题\n- FIX: 5.6部分编辑器函数或参数导出问题\n- FIX：Object新的Instantiate函数导出问题\n- FIX: int64反向计算问题\n- FIX: 枚举唯一性问题\n- Fix: LuaArrayTable LuaDictTable 迭代中break问题\n\n1.0.7 (需要重新生成库文件，需要Clear all, 重新导出wrap)\n- NEW: LuaState增加直接调用一个lua函数，不生成临时的LuaFunction\n- NEW: LuaTable增加直接调用一个lua函数，不生成临时的LuaFunction\n- NEW: 通用模板支持， LuaFunction可以写简短调用方式，LuaTable 增加Get RawGet等无GC获取\n- NEW: LuaFunction可转换为DelegateFactory中注册的委托\n- NEW: CheckType采用模板形式，提高了重载函数匹配速度\n- NEW: 优化了Physics.RayCast调用速度, 以及Check数组优化速度外加扩充\n- NEW: 增加了struct类型自行扩展机制，通过自行扩展注入到tolua系统，快速无GC转换c#类型到lua table\n- NEW: luajit 升级为2.1b3, 并且极大减小在安卓上jit失败情况。\n- NEW: 重载速度提升，相同参数个数，类型相同位置延迟参数类型检查\n- NEW: 支持导出带有默认值的函数\n\n- FIX: luajit不再因64位分配内存地址报not enough memory. 错误函数调用不在此列。参考http://luajit.org/status.html\n- FIX: 安卓上jit失败造成卡机问题\n- FIX: 在系统中Instantis对象上的脚本Awake调用LuaFunction失败，通过LuaState.ThrowLuaException时堆栈错误上报出错问题\n- FIX: 修正一些lua脚本中的书写错误\n- FIX: 作为object PushLayerMask问题\n"
  },
  {
    "path": "Assets/ToLua/readme.txt.meta",
    "content": "fileFormatVersion: 2\nguid: c85b2c9de573bc54881ca0c2427016cd\nTextScriptImporter:\n  userData: \n"
  },
  {
    "path": "Assets/ToLua.meta",
    "content": "fileFormatVersion: 2\nguid: 032822da3092a2543aabbd58c5697222\nfolderAsset: yes\nDefaultImporter:\n  userData: \n"
  },
  {
    "path": "Assets/link.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<linker>\n       <assembly fullname=\"mscorlib\">\n\t       \t<namespace fullname=\"System.Collections.Generic\" preserve=\"all\"/>\n       </assembly>\n</linker>"
  },
  {
    "path": "Assets/link.xml.meta",
    "content": "fileFormatVersion: 2\nguid: c8d0eb461ac328347a86a1727144872e\ntimeCreated: 1498812386\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "LICENSE-tolua",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 topameng\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "Luajit/Build.bat",
    "content": "@echo off\ncd /d %~dp0\n\nif not exist jit (mkdir jit)\nif not exist Out (mkdir Out)\n\nxcopy /Y /D ..\\..\\..\\Luajit\\jit jit\nsetlocal enabledelayedexpansion\n\nfor /r %%i in (*.lua) do (\n set v=%%~dpi  \n call :loop\n set v=!v:%~dp0=!\n if not exist %~dp0out\\!v! (mkdir %~dp0Out\\!v!)\n )\n\nfor /r %%i in (*.lua) do (\n set v=%%i \n set v=!v:%~dp0=! \n call :loop\n ..\\..\\..\\Luajit\\luajit32.exe -b -g !v! Out\\!v!.bytes \n)\n\nrd /s/q jit\nrd /s/q .\\Out\\jit\\\nsetlocal disabledelayedexpansion\n\n:loop \nif \"!v:~-1!\"==\" \" set \"v=!v:~0,-1!\" & goto loop \n\n\n"
  },
  {
    "path": "Luajit/jit/bc.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT bytecode listing module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module lists the bytecode of a Lua function. If it's loaded by -jbc\n-- it hooks into the parser and lists all functions of a chunk as they\n-- are parsed.\n--\n-- Example usage:\n--\n--   luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; print(x)'\n--   luajit -jbc=- foo.lua\n--   luajit -jbc=foo.list foo.lua\n--\n-- Default output is to stderr. To redirect the output to a file, pass a\n-- filename as an argument (use '-' for stdout) or set the environment\n-- variable LUAJIT_LISTFILE. The file is overwritten every time the module\n-- is started.\n--\n-- This module can also be used programmatically:\n--\n--   local bc = require(\"jit.bc\")\n--\n--   local function foo() print(\"hello\") end\n--\n--   bc.dump(foo)           --> -- BYTECODE -- [...]\n--   print(bc.line(foo, 2)) --> 0002    KSTR     1   1      ; \"hello\"\n--\n--   local out = {\n--     -- Do something with each line:\n--     write = function(t, ...) io.write(...) end,\n--     close = function(t) end,\n--     flush = function(t) end,\n--   }\n--   bc.dump(foo, out)\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal bit = require(\"bit\")\nlocal sub, gsub, format = string.sub, string.gsub, string.format\nlocal byte, band, shr = string.byte, bit.band, bit.rshift\nlocal funcinfo, funcbc, funck = jutil.funcinfo, jutil.funcbc, jutil.funck\nlocal funcuvname = jutil.funcuvname\nlocal bcnames = vmdef.bcnames\nlocal stdout, stderr = io.stdout, io.stderr\n\n------------------------------------------------------------------------------\n\nlocal function ctlsub(c)\n  if c == \"\\n\" then return \"\\\\n\"\n  elseif c == \"\\r\" then return \"\\\\r\"\n  elseif c == \"\\t\" then return \"\\\\t\"\n  else return format(\"\\\\%03d\", byte(c))\n  end\nend\n\n-- Return one bytecode line.\nlocal function bcline(func, pc, prefix, lineinfo)\n  local ins, m, l = funcbc(func, pc, lineinfo and 1 or 0)\n  if not ins then return end\n  local ma, mb, mc = band(m, 7), band(m, 15*8), band(m, 15*128)\n  local a = band(shr(ins, 8), 0xff)\n  local oidx = 6*band(ins, 0xff)\n  local op = sub(bcnames, oidx+1, oidx+6)\n  local s\n  if lineinfo then\n    s = format(\"%04d %7s %s %-6s %3s \",\n      pc, \"[\"..l..\"]\", prefix or \"  \", op, ma == 0 and \"\" or a)\n  else\n    s = format(\"%04d %s %-6s %3s \",\n      pc, prefix or \"  \", op, ma == 0 and \"\" or a)\n  end\n  local d = shr(ins, 16)\n  if mc == 13*128 then -- BCMjump\n    return format(\"%s=> %04d\\n\", s, pc+d-0x7fff)\n  end\n  if mb ~= 0 then\n    d = band(d, 0xff)\n  elseif mc == 0 then\n    return s..\"\\n\"\n  end\n  local kc\n  if mc == 10*128 then -- BCMstr\n    kc = funck(func, -d-1)\n    kc = format(#kc > 40 and '\"%.40s\"~' or '\"%s\"', gsub(kc, \"%c\", ctlsub))\n  elseif mc == 9*128 then -- BCMnum\n    kc = funck(func, d)\n    if op == \"TSETM \" then kc = kc - 2^52 end\n  elseif mc == 12*128 then -- BCMfunc\n    local fi = funcinfo(funck(func, -d-1))\n    if fi.ffid then\n      kc = vmdef.ffnames[fi.ffid]\n    else\n      kc = fi.loc\n    end\n  elseif mc == 5*128 then -- BCMuv\n    kc = funcuvname(func, d)\n  end\n  if ma == 5 then -- BCMuv\n    local ka = funcuvname(func, a)\n    if kc then kc = ka..\" ; \"..kc else kc = ka end\n  end\n  if mb ~= 0 then\n    local b = shr(ins, 24)\n    if kc then return format(\"%s%3d %3d  ; %s\\n\", s, b, d, kc) end\n    return format(\"%s%3d %3d\\n\", s, b, d)\n  end\n  if kc then return format(\"%s%3d      ; %s\\n\", s, d, kc) end\n  if mc == 7*128 and d > 32767 then d = d - 65536 end -- BCMlits\n  return format(\"%s%3d\\n\", s, d)\nend\n\n-- Collect branch targets of a function.\nlocal function bctargets(func)\n  local target = {}\n  for pc=1,1000000000 do\n    local ins, m = funcbc(func, pc)\n    if not ins then break end\n    if band(m, 15*128) == 13*128 then target[pc+shr(ins, 16)-0x7fff] = true end\n  end\n  return target\nend\n\n-- Dump bytecode instructions of a function.\nlocal function bcdump(func, out, all, lineinfo)\n  if not out then out = stdout end\n  local fi = funcinfo(func)\n  if all and fi.children then\n    for n=-1,-1000000000,-1 do\n      local k = funck(func, n)\n      if not k then break end\n      if type(k) == \"proto\" then bcdump(k, out, true, lineinfo) end\n    end\n  end\n  out:write(format(\"-- BYTECODE -- %s-%d\\n\", fi.loc, fi.lastlinedefined))\n\n  for n=-1,-1000000000,-1 do\n    local kc = funck(func, n)\n    if not kc then break end\n\n    local typ = type(kc)\n    if typ == \"string\" then\n      kc = format(#kc > 40 and '\"%.40s\"~' or '\"%s\"', gsub(kc, \"%c\", ctlsub))\n      out:write(format(\"KGC    %d    %s\\n\", -(n + 1), kc))\n    elseif typ == \"proto\" then\n      local fi = funcinfo(kc)\n      if fi.ffid then\n\tkc = vmdef.ffnames[fi.ffid]\n      else\n\tkc = fi.loc\n      end\n      out:write(format(\"KGC    %d    %s\\n\", -(n + 1), kc))\n    elseif typ == \"table\" then\n      out:write(format(\"KGC    %d    table\\n\", -(n + 1)))\n    else\n      -- error(\"unknown KGC type: \" .. typ)\n    end\n  end\n\n  for n=1,1000000000 do\n    local kc = funck(func, n)\n    if not kc then break end\n    if type(kc) == \"number\" then\n      out:write(format(\"KN    %d    %s\\n\", n, kc))\n    end\n  end\n\n  local target = bctargets(func)\n  for pc=1,1000000000 do\n    local s = bcline(func, pc, target[pc] and \"=>\", lineinfo)\n    if not s then break end\n    out:write(s)\n  end\n  out:write(\"\\n\")\n  out:flush()\nend\n\n------------------------------------------------------------------------------\n\n-- Active flag and output file handle.\nlocal active, out\n\n-- List handler.\nlocal function h_list(func)\n  return bcdump(func, out)\nend\n\n-- Detach list handler.\nlocal function bclistoff()\n  if active then\n    active = false\n    jit.attach(h_list)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach list handler.\nlocal function bcliston(outfile)\n  if active then bclistoff() end\n  if not outfile then outfile = os.getenv(\"LUAJIT_LISTFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stderr\n  end\n  jit.attach(h_list, \"bc\")\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  line = bcline,\n  dump = bcdump,\n  targets = bctargets,\n  on = bcliston,\n  off = bclistoff,\n  start = bcliston -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Luajit/jit/bcsave.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT module to save/list bytecode.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module saves or lists the bytecode for an input file.\n-- It's run by the -b command line option.\n--\n------------------------------------------------------------------------------\n\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal bit = require(\"bit\")\n\n-- Symbol name prefix for LuaJIT bytecode.\nlocal LJBC_PREFIX = \"luaJIT_BC_\"\n\n------------------------------------------------------------------------------\n\nlocal function usage()\n  io.stderr:write[[\nSave LuaJIT bytecode: luajit -b[options] input output\n  -l        Only list bytecode.\n  -L        Only list bytecode with lineinfo.\n  -s        Strip debug info (default).\n  -g        Keep debug info.\n  -n name   Set module name (default: auto-detect from input name).\n  -t type   Set output file type (default: auto-detect from output name).\n  -a arch   Override architecture for object files (default: native).\n  -o os     Override OS for object files (default: native).\n  -e chunk  Use chunk string as input.\n  --        Stop handling options.\n  -         Use stdin as input and/or stdout as output.\n\nFile types: c h obj o raw (default)\n]]\n  os.exit(1)\nend\n\nlocal function check(ok, ...)\n  if ok then return ok, ... end\n  io.stderr:write(\"luajit: \", ...)\n  io.stderr:write(\"\\n\")\n  os.exit(1)\nend\n\nlocal function readfile(input)\n  if type(input) == \"function\" then return input end\n  if input == \"-\" then input = nil end\n  return check(loadfile(input))\nend\n\nlocal function savefile(name, mode)\n  if name == \"-\" then return io.stdout end\n  return check(io.open(name, mode))\nend\n\n------------------------------------------------------------------------------\n\nlocal map_type = {\n  raw = \"raw\", c = \"c\", h = \"h\", o = \"obj\", obj = \"obj\",\n}\n\nlocal map_arch = {\n  x86 = true, x64 = true, arm = true, arm64 = true, arm64be = true,\n  ppc = true, mips = true, mipsel = true,\n}\n\nlocal map_os = {\n  linux = true, windows = true, osx = true, freebsd = true, netbsd = true,\n  openbsd = true, dragonfly = true, solaris = true,\n}\n\nlocal function checkarg(str, map, err)\n  str = string.lower(str)\n  local s = check(map[str], \"unknown \", err)\n  return s == true and str or s\nend\n\nlocal function detecttype(str)\n  local ext = string.match(string.lower(str), \"%.(%a+)$\")\n  return map_type[ext] or \"raw\"\nend\n\nlocal function checkmodname(str)\n  check(string.match(str, \"^[%w_.%-]+$\"), \"bad module name\")\n  return string.gsub(str, \"[%.%-]\", \"_\")\nend\n\nlocal function detectmodname(str)\n  if type(str) == \"string\" then\n    local tail = string.match(str, \"[^/\\\\]+$\")\n    if tail then str = tail end\n    local head = string.match(str, \"^(.*)%.[^.]*$\")\n    if head then str = head end\n    str = string.match(str, \"^[%w_.%-]+\")\n  else\n    str = nil\n  end\n  check(str, \"cannot derive module name, use -n name\")\n  return string.gsub(str, \"[%.%-]\", \"_\")\nend\n\n------------------------------------------------------------------------------\n\nlocal function bcsave_tail(fp, output, s)\n  local ok, err = fp:write(s)\n  if ok and output ~= \"-\" then ok, err = fp:close() end\n  check(ok, \"cannot write \", output, \": \", err)\nend\n\nlocal function bcsave_raw(output, s)\n  local fp = savefile(output, \"wb\")\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_c(ctx, output, s)\n  local fp = savefile(output, \"w\")\n  if ctx.type == \"c\" then\n    fp:write(string.format([[\n#ifdef _cplusplus\nextern \"C\"\n#endif\n#ifdef _WIN32\n__declspec(dllexport)\n#endif\nconst unsigned char %s%s[] = {\n]], LJBC_PREFIX, ctx.modname))\n  else\n    fp:write(string.format([[\n#define %s%s_SIZE %d\nstatic const unsigned char %s%s[] = {\n]], LJBC_PREFIX, ctx.modname, #s, LJBC_PREFIX, ctx.modname))\n  end\n  local t, n, m = {}, 0, 0\n  for i=1,#s do\n    local b = tostring(string.byte(s, i))\n    m = m + #b + 1\n    if m > 78 then\n      fp:write(table.concat(t, \",\", 1, n), \",\\n\")\n      n, m = 0, #b + 1\n    end\n    n = n + 1\n    t[n] = b\n  end\n  bcsave_tail(fp, output, table.concat(t, \",\", 1, n)..\"\\n};\\n\")\nend\n\nlocal function bcsave_elfobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct {\n  uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7];\n  uint16_t type, machine;\n  uint32_t version;\n  uint32_t entry, phofs, shofs;\n  uint32_t flags;\n  uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx;\n} ELF32header;\ntypedef struct {\n  uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7];\n  uint16_t type, machine;\n  uint32_t version;\n  uint64_t entry, phofs, shofs;\n  uint32_t flags;\n  uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx;\n} ELF64header;\ntypedef struct {\n  uint32_t name, type, flags, addr, ofs, size, link, info, align, entsize;\n} ELF32sectheader;\ntypedef struct {\n  uint32_t name, type;\n  uint64_t flags, addr, ofs, size;\n  uint32_t link, info;\n  uint64_t align, entsize;\n} ELF64sectheader;\ntypedef struct {\n  uint32_t name, value, size;\n  uint8_t info, other;\n  uint16_t sectidx;\n} ELF32symbol;\ntypedef struct {\n  uint32_t name;\n  uint8_t info, other;\n  uint16_t sectidx;\n  uint64_t value, size;\n} ELF64symbol;\ntypedef struct {\n  ELF32header hdr;\n  ELF32sectheader sect[6];\n  ELF32symbol sym[2];\n  uint8_t space[4096];\n} ELF32obj;\ntypedef struct {\n  ELF64header hdr;\n  ELF64sectheader sect[6];\n  ELF64symbol sym[2];\n  uint8_t space[4096];\n} ELF64obj;\n]]\n  local symname = LJBC_PREFIX..ctx.modname\n  local is64, isbe = false, false\n  if ctx.arch == \"x64\" or ctx.arch == \"arm64\" or ctx.arch == \"arm64be\" then\n    is64 = true\n  elseif ctx.arch == \"ppc\" or ctx.arch == \"mips\" then\n    isbe = true\n  end\n\n  -- Handle different host/target endianess.\n  local function f32(x) return x end\n  local f16, fofs = f32, f32\n  if ffi.abi(\"be\") ~= isbe then\n    f32 = bit.bswap\n    function f16(x) return bit.rshift(bit.bswap(x), 16) end\n    if is64 then\n      local two32 = ffi.cast(\"int64_t\", 2^32)\n      function fofs(x) return bit.bswap(x)*two32 end\n    else\n      fofs = f32\n    end\n  end\n\n  -- Create ELF object and fill in header.\n  local o = ffi.new(is64 and \"ELF64obj\" or \"ELF32obj\")\n  local hdr = o.hdr\n  if ctx.os == \"bsd\" or ctx.os == \"other\" then -- Determine native hdr.eosabi.\n    local bf = assert(io.open(\"/bin/ls\", \"rb\"))\n    local bs = bf:read(9)\n    bf:close()\n    ffi.copy(o, bs, 9)\n    check(hdr.emagic[0] == 127, \"no support for writing native object files\")\n  else\n    hdr.emagic = \"\\127ELF\"\n    hdr.eosabi = ({ freebsd=9, netbsd=2, openbsd=12, solaris=6 })[ctx.os] or 0\n  end\n  hdr.eclass = is64 and 2 or 1\n  hdr.eendian = isbe and 2 or 1\n  hdr.eversion = 1\n  hdr.type = f16(1)\n  hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, mips=8, mipsel=8 })[ctx.arch])\n  if ctx.arch == \"mips\" or ctx.arch == \"mipsel\" then\n    hdr.flags = f32(0x50001006)\n  end\n  hdr.version = f32(1)\n  hdr.shofs = fofs(ffi.offsetof(o, \"sect\"))\n  hdr.ehsize = f16(ffi.sizeof(hdr))\n  hdr.shentsize = f16(ffi.sizeof(o.sect[0]))\n  hdr.shnum = f16(6)\n  hdr.shstridx = f16(2)\n\n  -- Fill in sections and symbols.\n  local sofs, ofs = ffi.offsetof(o, \"space\"), 1\n  for i,name in ipairs{\n      \".symtab\", \".shstrtab\", \".strtab\", \".rodata\", \".note.GNU-stack\",\n    } do\n    local sect = o.sect[i]\n    sect.align = fofs(1)\n    sect.name = f32(ofs)\n    ffi.copy(o.space+ofs, name)\n    ofs = ofs + #name+1\n  end\n  o.sect[1].type = f32(2) -- .symtab\n  o.sect[1].link = f32(3)\n  o.sect[1].info = f32(1)\n  o.sect[1].align = fofs(8)\n  o.sect[1].ofs = fofs(ffi.offsetof(o, \"sym\"))\n  o.sect[1].entsize = fofs(ffi.sizeof(o.sym[0]))\n  o.sect[1].size = fofs(ffi.sizeof(o.sym))\n  o.sym[1].name = f32(1)\n  o.sym[1].sectidx = f16(4)\n  o.sym[1].size = fofs(#s)\n  o.sym[1].info = 17\n  o.sect[2].type = f32(3) -- .shstrtab\n  o.sect[2].ofs = fofs(sofs)\n  o.sect[2].size = fofs(ofs)\n  o.sect[3].type = f32(3) -- .strtab\n  o.sect[3].ofs = fofs(sofs + ofs)\n  o.sect[3].size = fofs(#symname+2)\n  ffi.copy(o.space+ofs+1, symname)\n  ofs = ofs + #symname + 2\n  o.sect[4].type = f32(1) -- .rodata\n  o.sect[4].flags = fofs(2)\n  o.sect[4].ofs = fofs(sofs + ofs)\n  o.sect[4].size = fofs(#s)\n  o.sect[5].type = f32(1) -- .note.GNU-stack\n  o.sect[5].ofs = fofs(sofs + ofs + #s)\n\n  -- Write ELF object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_peobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct {\n  uint16_t arch, nsects;\n  uint32_t time, symtabofs, nsyms;\n  uint16_t opthdrsz, flags;\n} PEheader;\ntypedef struct {\n  char name[8];\n  uint32_t vsize, vaddr, size, ofs, relocofs, lineofs;\n  uint16_t nreloc, nline;\n  uint32_t flags;\n} PEsection;\ntypedef struct __attribute((packed)) {\n  union {\n    char name[8];\n    uint32_t nameref[2];\n  };\n  uint32_t value;\n  int16_t sect;\n  uint16_t type;\n  uint8_t scl, naux;\n} PEsym;\ntypedef struct __attribute((packed)) {\n  uint32_t size;\n  uint16_t nreloc, nline;\n  uint32_t cksum;\n  uint16_t assoc;\n  uint8_t comdatsel, unused[3];\n} PEsymaux;\ntypedef struct {\n  PEheader hdr;\n  PEsection sect[2];\n  // Must be an even number of symbol structs.\n  PEsym sym0;\n  PEsymaux sym0aux;\n  PEsym sym1;\n  PEsymaux sym1aux;\n  PEsym sym2;\n  PEsym sym3;\n  uint32_t strtabsize;\n  uint8_t space[4096];\n} PEobj;\n]]\n  local symname = LJBC_PREFIX..ctx.modname\n  local is64 = false\n  if ctx.arch == \"x86\" then\n    symname = \"_\"..symname\n  elseif ctx.arch == \"x64\" then\n    is64 = true\n  end\n  local symexport = \"   /EXPORT:\"..symname..\",DATA \"\n\n  -- The file format is always little-endian. Swap if the host is big-endian.\n  local function f32(x) return x end\n  local f16 = f32\n  if ffi.abi(\"be\") then\n    f32 = bit.bswap\n    function f16(x) return bit.rshift(bit.bswap(x), 16) end\n  end\n\n  -- Create PE object and fill in header.\n  local o = ffi.new(\"PEobj\")\n  local hdr = o.hdr\n  hdr.arch = f16(({ x86=0x14c, x64=0x8664, arm=0x1c0, ppc=0x1f2, mips=0x366, mipsel=0x366 })[ctx.arch])\n  hdr.nsects = f16(2)\n  hdr.symtabofs = f32(ffi.offsetof(o, \"sym0\"))\n  hdr.nsyms = f32(6)\n\n  -- Fill in sections and symbols.\n  o.sect[0].name = \".drectve\"\n  o.sect[0].size = f32(#symexport)\n  o.sect[0].flags = f32(0x00100a00)\n  o.sym0.sect = f16(1)\n  o.sym0.scl = 3\n  o.sym0.name = \".drectve\"\n  o.sym0.naux = 1\n  o.sym0aux.size = f32(#symexport)\n  o.sect[1].name = \".rdata\"\n  o.sect[1].size = f32(#s)\n  o.sect[1].flags = f32(0x40300040)\n  o.sym1.sect = f16(2)\n  o.sym1.scl = 3\n  o.sym1.name = \".rdata\"\n  o.sym1.naux = 1\n  o.sym1aux.size = f32(#s)\n  o.sym2.sect = f16(2)\n  o.sym2.scl = 2\n  o.sym2.nameref[1] = f32(4)\n  o.sym3.sect = f16(-1)\n  o.sym3.scl = 2\n  o.sym3.value = f32(1)\n  o.sym3.name = \"@feat.00\" -- Mark as SafeSEH compliant.\n  ffi.copy(o.space, symname)\n  local ofs = #symname + 1\n  o.strtabsize = f32(ofs + 4)\n  o.sect[0].ofs = f32(ffi.offsetof(o, \"space\") + ofs)\n  ffi.copy(o.space + ofs, symexport)\n  ofs = ofs + #symexport\n  o.sect[1].ofs = f32(ffi.offsetof(o, \"space\") + ofs)\n\n  -- Write PE object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_machobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct\n{\n  uint32_t magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags;\n} mach_header;\ntypedef struct\n{\n  mach_header; uint32_t reserved;\n} mach_header_64;\ntypedef struct {\n  uint32_t cmd, cmdsize;\n  char segname[16];\n  uint32_t vmaddr, vmsize, fileoff, filesize;\n  uint32_t maxprot, initprot, nsects, flags;\n} mach_segment_command;\ntypedef struct {\n  uint32_t cmd, cmdsize;\n  char segname[16];\n  uint64_t vmaddr, vmsize, fileoff, filesize;\n  uint32_t maxprot, initprot, nsects, flags;\n} mach_segment_command_64;\ntypedef struct {\n  char sectname[16], segname[16];\n  uint32_t addr, size;\n  uint32_t offset, align, reloff, nreloc, flags;\n  uint32_t reserved1, reserved2;\n} mach_section;\ntypedef struct {\n  char sectname[16], segname[16];\n  uint64_t addr, size;\n  uint32_t offset, align, reloff, nreloc, flags;\n  uint32_t reserved1, reserved2, reserved3;\n} mach_section_64;\ntypedef struct {\n  uint32_t cmd, cmdsize, symoff, nsyms, stroff, strsize;\n} mach_symtab_command;\ntypedef struct {\n  int32_t strx;\n  uint8_t type, sect;\n  int16_t desc;\n  uint32_t value;\n} mach_nlist;\ntypedef struct {\n  uint32_t strx;\n  uint8_t type, sect;\n  uint16_t desc;\n  uint64_t value;\n} mach_nlist_64;\ntypedef struct\n{\n  uint32_t magic, nfat_arch;\n} mach_fat_header;\ntypedef struct\n{\n  uint32_t cputype, cpusubtype, offset, size, align;\n} mach_fat_arch;\ntypedef struct {\n  struct {\n    mach_header hdr;\n    mach_segment_command seg;\n    mach_section sec;\n    mach_symtab_command sym;\n  } arch[1];\n  mach_nlist sym_entry;\n  uint8_t space[4096];\n} mach_obj;\ntypedef struct {\n  struct {\n    mach_header_64 hdr;\n    mach_segment_command_64 seg;\n    mach_section_64 sec;\n    mach_symtab_command sym;\n  } arch[1];\n  mach_nlist_64 sym_entry;\n  uint8_t space[4096];\n} mach_obj_64;\ntypedef struct {\n  mach_fat_header fat;\n  mach_fat_arch fat_arch[2];\n  struct {\n    mach_header hdr;\n    mach_segment_command seg;\n    mach_section sec;\n    mach_symtab_command sym;\n  } arch[2];\n  mach_nlist sym_entry;\n  uint8_t space[4096];\n} mach_fat_obj;\n]]\n  local symname = '_'..LJBC_PREFIX..ctx.modname\n  local isfat, is64, align, mobj = false, false, 4, \"mach_obj\"\n  if ctx.arch == \"x64\" then\n    is64, align, mobj = true, 8, \"mach_obj_64\"\n  elseif ctx.arch == \"arm\" then\n    isfat, mobj = true, \"mach_fat_obj\"\n  elseif ctx.arch == \"arm64\" then\n    is64, align, isfat, mobj = true, 8, true, \"mach_fat_obj\"\n  else\n    check(ctx.arch == \"x86\", \"unsupported architecture for OSX\")\n  end\n  local function aligned(v, a) return bit.band(v+a-1, -a) end\n  local be32 = bit.bswap -- Mach-O FAT is BE, supported archs are LE.\n\n  -- Create Mach-O object and fill in header.\n  local o = ffi.new(mobj)\n  local mach_size = aligned(ffi.offsetof(o, \"space\")+#symname+2, align)\n  local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12}, arm64={0x01000007,0x0100000c} })[ctx.arch]\n  local cpusubtype = ({ x86={3}, x64={3}, arm={3,9}, arm64={3,0} })[ctx.arch]\n  if isfat then\n    o.fat.magic = be32(0xcafebabe)\n    o.fat.nfat_arch = be32(#cpusubtype)\n  end\n\n  -- Fill in sections and symbols.\n  for i=0,#cpusubtype-1 do\n    local ofs = 0\n    if isfat then\n      local a = o.fat_arch[i]\n      a.cputype = be32(cputype[i+1])\n      a.cpusubtype = be32(cpusubtype[i+1])\n      -- Subsequent slices overlap each other to share data.\n      ofs = ffi.offsetof(o, \"arch\") + i*ffi.sizeof(o.arch[0])\n      a.offset = be32(ofs)\n      a.size = be32(mach_size-ofs+#s)\n    end\n    local a = o.arch[i]\n    a.hdr.magic = is64 and 0xfeedfacf or 0xfeedface\n    a.hdr.cputype = cputype[i+1]\n    a.hdr.cpusubtype = cpusubtype[i+1]\n    a.hdr.filetype = 1\n    a.hdr.ncmds = 2\n    a.hdr.sizeofcmds = ffi.sizeof(a.seg)+ffi.sizeof(a.sec)+ffi.sizeof(a.sym)\n    a.seg.cmd = is64 and 0x19 or 0x1\n    a.seg.cmdsize = ffi.sizeof(a.seg)+ffi.sizeof(a.sec)\n    a.seg.vmsize = #s\n    a.seg.fileoff = mach_size-ofs\n    a.seg.filesize = #s\n    a.seg.maxprot = 1\n    a.seg.initprot = 1\n    a.seg.nsects = 1\n    ffi.copy(a.sec.sectname, \"__data\")\n    ffi.copy(a.sec.segname, \"__DATA\")\n    a.sec.size = #s\n    a.sec.offset = mach_size-ofs\n    a.sym.cmd = 2\n    a.sym.cmdsize = ffi.sizeof(a.sym)\n    a.sym.symoff = ffi.offsetof(o, \"sym_entry\")-ofs\n    a.sym.nsyms = 1\n    a.sym.stroff = ffi.offsetof(o, \"sym_entry\")+ffi.sizeof(o.sym_entry)-ofs\n    a.sym.strsize = aligned(#symname+2, align)\n  end\n  o.sym_entry.type = 0xf\n  o.sym_entry.sect = 1\n  o.sym_entry.strx = 1\n  ffi.copy(o.space+1, symname)\n\n  -- Write Macho-O object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, mach_size))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_obj(ctx, output, s)\n  local ok, ffi = pcall(require, \"ffi\")\n  check(ok, \"FFI library required to write this file type\")\n  if ctx.os == \"windows\" then\n    return bcsave_peobj(ctx, output, s, ffi)\n  elseif ctx.os == \"osx\" then\n    return bcsave_machobj(ctx, output, s, ffi)\n  else\n    return bcsave_elfobj(ctx, output, s, ffi)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal function bclist(input, output, lineinfo)\n  local f = readfile(input)\n  require(\"jit.bc\").dump(f, savefile(output, \"w\"), true, lineinfo)\nend\n\nlocal function bcsave(ctx, input, output)\n  local f = readfile(input)\n  local s = string.dump(f, ctx.strip)\n  local t = ctx.type\n  if not t then\n    t = detecttype(output)\n    ctx.type = t\n  end\n  if t == \"raw\" then\n    bcsave_raw(output, s)\n  else\n    if not ctx.modname then ctx.modname = detectmodname(input) end\n    if t == \"obj\" then\n      bcsave_obj(ctx, output, s)\n    else\n      bcsave_c(ctx, output, s)\n    end\n  end\nend\n\nlocal function docmd(...)\n  local arg = {...}\n  local n = 1\n  local list = false\n  local lineinfo = false\n  local ctx = {\n    strip = true, arch = jit.arch, os = string.lower(jit.os),\n    type = false, modname = false,\n  }\n  while n <= #arg do\n    local a = arg[n]\n    if type(a) == \"string\" and string.sub(a, 1, 1) == \"-\" and a ~= \"-\" then\n      table.remove(arg, n)\n      if a == \"--\" then break end\n      for m=2,#a do\n\tlocal opt = string.sub(a, m, m)\n\tif opt == \"l\" then\n\t  list = true\n\telseif opt == \"L\" then\n\t  list = true\n\t  lineinfo = true\n\telseif opt == \"s\" then\n\t  ctx.strip = true\n\telseif opt == \"g\" then\n\t  ctx.strip = false\n\telse\n\t  if arg[n] == nil or m ~= #a then usage() end\n\t  if opt == \"e\" then\n\t    if n ~= 1 then usage() end\n\t    arg[1] = check(loadstring(arg[1]))\n\t  elseif opt == \"n\" then\n\t    ctx.modname = checkmodname(table.remove(arg, n))\n\t  elseif opt == \"t\" then\n\t    ctx.type = checkarg(table.remove(arg, n), map_type, \"file type\")\n\t  elseif opt == \"a\" then\n\t    ctx.arch = checkarg(table.remove(arg, n), map_arch, \"architecture\")\n\t  elseif opt == \"o\" then\n\t    ctx.os = checkarg(table.remove(arg, n), map_os, \"OS name\")\n\t  else\n\t    usage()\n\t  end\n\tend\n      end\n    else\n      n = n + 1\n    end\n  end\n  if list then\n    if #arg == 0 or #arg > 2 then usage() end\n    bclist(arg[1], arg[2] or \"-\", lineinfo)\n  else\n    if #arg ~= 2 then usage() end\n    bcsave(ctx, arg[1], arg[2])\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Public module functions.\nreturn {\n  start = docmd -- Process -b command line option.\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_arm.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles most user-mode ARMv7 instructions\n-- NYI: Advanced SIMD and VFP instructions.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch = string.match, string.gmatch\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, ror, tohex = bit.band, bit.bor, bit.ror, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Opcode maps\n------------------------------------------------------------------------------\n\nlocal map_loadc = {\n  shift = 8, mask = 15,\n  [10] = {\n    shift = 20, mask = 1,\n    [0] = {\n      shift = 23, mask = 3,\n      [0] = \"vmovFmDN\", \"vstmFNdr\",\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vstrFdl\",\n\t{ shift = 16, mask = 15, [13] = \"vpushFdr\", _ = \"vstmdbFNdr\", }\n      },\n    },\n    {\n      shift = 23, mask = 3,\n      [0] = \"vmovFDNm\",\n      { shift = 16, mask = 15, [13] = \"vpopFdr\", _ = \"vldmFNdr\", },\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vldrFdl\", \"vldmdbFNdr\",\n      },\n    },\n  },\n  [11] = {\n    shift = 20, mask = 1,\n    [0] = {\n      shift = 23, mask = 3,\n      [0] = \"vmovGmDN\", \"vstmGNdr\",\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vstrGdl\",\n\t{ shift = 16, mask = 15, [13] = \"vpushGdr\", _ = \"vstmdbGNdr\", }\n      },\n    },\n    {\n      shift = 23, mask = 3,\n      [0] = \"vmovGDNm\",\n      { shift = 16, mask = 15, [13] = \"vpopGdr\", _ = \"vldmGNdr\", },\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vldrGdl\", \"vldmdbGNdr\",\n      },\n    },\n  },\n  _ = {\n    shift = 0, mask = 0 -- NYI ldc, mcrr, mrrc.\n  },\n}\n\nlocal map_vfps = {\n  shift = 6, mask = 0x2c001,\n  [0] = \"vmlaF.dnm\", \"vmlsF.dnm\",\n  [0x04000] = \"vnmlsF.dnm\", [0x04001] = \"vnmlaF.dnm\",\n  [0x08000] = \"vmulF.dnm\", [0x08001] = \"vnmulF.dnm\",\n  [0x0c000] = \"vaddF.dnm\", [0x0c001] = \"vsubF.dnm\",\n  [0x20000] = \"vdivF.dnm\",\n  [0x24000] = \"vfnmsF.dnm\", [0x24001] = \"vfnmaF.dnm\",\n  [0x28000] = \"vfmaF.dnm\", [0x28001] = \"vfmsF.dnm\",\n  [0x2c000] = \"vmovF.dY\",\n  [0x2c001] = {\n    shift = 7, mask = 0x1e01,\n    [0] = \"vmovF.dm\", \"vabsF.dm\",\n    [0x0200] = \"vnegF.dm\", [0x0201] = \"vsqrtF.dm\",\n    [0x0800] = \"vcmpF.dm\", [0x0801] = \"vcmpeF.dm\",\n    [0x0a00] = \"vcmpzF.d\", [0x0a01] = \"vcmpzeF.d\",\n    [0x0e01] = \"vcvtG.dF.m\",\n    [0x1000] = \"vcvt.f32.u32Fdm\", [0x1001] = \"vcvt.f32.s32Fdm\",\n    [0x1800] = \"vcvtr.u32F.dm\", [0x1801] = \"vcvt.u32F.dm\",\n    [0x1a00] = \"vcvtr.s32F.dm\", [0x1a01] = \"vcvt.s32F.dm\",\n  },\n}\n\nlocal map_vfpd = {\n  shift = 6, mask = 0x2c001,\n  [0] = \"vmlaG.dnm\", \"vmlsG.dnm\",\n  [0x04000] = \"vnmlsG.dnm\", [0x04001] = \"vnmlaG.dnm\",\n  [0x08000] = \"vmulG.dnm\", [0x08001] = \"vnmulG.dnm\",\n  [0x0c000] = \"vaddG.dnm\", [0x0c001] = \"vsubG.dnm\",\n  [0x20000] = \"vdivG.dnm\",\n  [0x24000] = \"vfnmsG.dnm\", [0x24001] = \"vfnmaG.dnm\",\n  [0x28000] = \"vfmaG.dnm\", [0x28001] = \"vfmsG.dnm\",\n  [0x2c000] = \"vmovG.dY\",\n  [0x2c001] = {\n    shift = 7, mask = 0x1e01,\n    [0] = \"vmovG.dm\", \"vabsG.dm\",\n    [0x0200] = \"vnegG.dm\", [0x0201] = \"vsqrtG.dm\",\n    [0x0800] = \"vcmpG.dm\", [0x0801] = \"vcmpeG.dm\",\n    [0x0a00] = \"vcmpzG.d\", [0x0a01] = \"vcmpzeG.d\",\n    [0x0e01] = \"vcvtF.dG.m\",\n    [0x1000] = \"vcvt.f64.u32GdFm\", [0x1001] = \"vcvt.f64.s32GdFm\",\n    [0x1800] = \"vcvtr.u32FdG.m\", [0x1801] = \"vcvt.u32FdG.m\",\n    [0x1a00] = \"vcvtr.s32FdG.m\", [0x1a01] = \"vcvt.s32FdG.m\",\n  },\n}\n\nlocal map_datac = {\n  shift = 24, mask = 1,\n  [0] = {\n    shift = 4, mask = 1,\n    [0] = {\n      shift = 8, mask = 15,\n      [10] = map_vfps,\n      [11] = map_vfpd,\n      -- NYI cdp, mcr, mrc.\n    },\n    {\n      shift = 8, mask = 15,\n      [10] = {\n\tshift = 20, mask = 15,\n\t[0] = \"vmovFnD\", \"vmovFDn\",\n\t[14] = \"vmsrD\",\n\t[15] = { shift = 12, mask = 15, [15] = \"vmrs\", _ = \"vmrsD\", },\n      },\n    },\n  },\n  \"svcT\",\n}\n\nlocal map_loadcu = {\n  shift = 0, mask = 0, -- NYI unconditional CP load/store.\n}\n\nlocal map_datacu = {\n  shift = 0, mask = 0, -- NYI unconditional CP data.\n}\n\nlocal map_simddata = {\n  shift = 0, mask = 0, -- NYI SIMD data.\n}\n\nlocal map_simdload = {\n  shift = 0, mask = 0, -- NYI SIMD load/store, preload.\n}\n\nlocal map_preload = {\n  shift = 0, mask = 0, -- NYI preload.\n}\n\nlocal map_media = {\n  shift = 20, mask = 31,\n  [0] = false,\n  { --01\n    shift = 5, mask = 7,\n    [0] = \"sadd16DNM\", \"sasxDNM\", \"ssaxDNM\", \"ssub16DNM\",\n    \"sadd8DNM\", false, false, \"ssub8DNM\",\n  },\n  { --02\n    shift = 5, mask = 7,\n    [0] = \"qadd16DNM\", \"qasxDNM\", \"qsaxDNM\", \"qsub16DNM\",\n    \"qadd8DNM\", false, false, \"qsub8DNM\",\n  },\n  { --03\n    shift = 5, mask = 7,\n    [0] = \"shadd16DNM\", \"shasxDNM\", \"shsaxDNM\", \"shsub16DNM\",\n    \"shadd8DNM\", false, false, \"shsub8DNM\",\n  },\n  false,\n  { --05\n    shift = 5, mask = 7,\n    [0] = \"uadd16DNM\", \"uasxDNM\", \"usaxDNM\", \"usub16DNM\",\n    \"uadd8DNM\", false, false, \"usub8DNM\",\n  },\n  { --06\n    shift = 5, mask = 7,\n    [0] = \"uqadd16DNM\", \"uqasxDNM\", \"uqsaxDNM\", \"uqsub16DNM\",\n    \"uqadd8DNM\", false, false, \"uqsub8DNM\",\n  },\n  { --07\n    shift = 5, mask = 7,\n    [0] = \"uhadd16DNM\", \"uhasxDNM\", \"uhsaxDNM\", \"uhsub16DNM\",\n    \"uhadd8DNM\", false, false, \"uhsub8DNM\",\n  },\n  { --08\n    shift = 5, mask = 7,\n    [0] = \"pkhbtDNMU\", false, \"pkhtbDNMU\",\n    { shift = 16, mask = 15, [15] = \"sxtb16DMU\", _ = \"sxtab16DNMU\", },\n    \"pkhbtDNMU\", \"selDNM\", \"pkhtbDNMU\",\n  },\n  false,\n  { --0a\n    shift = 5, mask = 7,\n    [0] = \"ssatDxMu\", \"ssat16DxM\", \"ssatDxMu\",\n    { shift = 16, mask = 15, [15] = \"sxtbDMU\", _ = \"sxtabDNMU\", },\n    \"ssatDxMu\", false, \"ssatDxMu\",\n  },\n  { --0b\n    shift = 5, mask = 7,\n    [0] = \"ssatDxMu\", \"revDM\", \"ssatDxMu\",\n    { shift = 16, mask = 15, [15] = \"sxthDMU\", _ = \"sxtahDNMU\", },\n    \"ssatDxMu\", \"rev16DM\", \"ssatDxMu\",\n  },\n  { --0c\n    shift = 5, mask = 7,\n    [3] = { shift = 16, mask = 15, [15] = \"uxtb16DMU\", _ = \"uxtab16DNMU\", },\n  },\n  false,\n  { --0e\n    shift = 5, mask = 7,\n    [0] = \"usatDwMu\", \"usat16DwM\", \"usatDwMu\",\n    { shift = 16, mask = 15, [15] = \"uxtbDMU\", _ = \"uxtabDNMU\", },\n    \"usatDwMu\", false, \"usatDwMu\",\n  },\n  { --0f\n    shift = 5, mask = 7,\n    [0] = \"usatDwMu\", \"rbitDM\", \"usatDwMu\",\n    { shift = 16, mask = 15, [15] = \"uxthDMU\", _ = \"uxtahDNMU\", },\n    \"usatDwMu\", \"revshDM\", \"usatDwMu\",\n  },\n  { --10\n    shift = 12, mask = 15,\n    [15] = {\n      shift = 5, mask = 7,\n      \"smuadNMS\", \"smuadxNMS\", \"smusdNMS\", \"smusdxNMS\",\n    },\n    _ = {\n      shift = 5, mask = 7,\n      [0] = \"smladNMSD\", \"smladxNMSD\", \"smlsdNMSD\", \"smlsdxNMSD\",\n    },\n  },\n  false, false, false,\n  { --14\n    shift = 5, mask = 7,\n    [0] = \"smlaldDNMS\", \"smlaldxDNMS\", \"smlsldDNMS\", \"smlsldxDNMS\",\n  },\n  { --15\n    shift = 5, mask = 7,\n    [0] = { shift = 12, mask = 15, [15] = \"smmulNMS\", _ = \"smmlaNMSD\", },\n    { shift = 12, mask = 15, [15] = \"smmulrNMS\", _ = \"smmlarNMSD\", },\n    false, false, false, false,\n    \"smmlsNMSD\", \"smmlsrNMSD\",\n  },\n  false, false,\n  { --18\n    shift = 5, mask = 7,\n    [0] = { shift = 12, mask = 15, [15] = \"usad8NMS\", _ = \"usada8NMSD\", },\n  },\n  false,\n  { --1a\n    shift = 5, mask = 3, [2] = \"sbfxDMvw\",\n  },\n  { --1b\n    shift = 5, mask = 3, [2] = \"sbfxDMvw\",\n  },\n  { --1c\n    shift = 5, mask = 3,\n    [0] = { shift = 0, mask = 15, [15] = \"bfcDvX\", _ = \"bfiDMvX\", },\n  },\n  { --1d\n    shift = 5, mask = 3,\n    [0] = { shift = 0, mask = 15, [15] = \"bfcDvX\", _ = \"bfiDMvX\", },\n  },\n  { --1e\n    shift = 5, mask = 3, [2] = \"ubfxDMvw\",\n  },\n  { --1f\n    shift = 5, mask = 3, [2] = \"ubfxDMvw\",\n  },\n}\n\nlocal map_load = {\n  shift = 21, mask = 9,\n  {\n    shift = 20, mask = 5,\n    [0] = \"strtDL\", \"ldrtDL\", [4] = \"strbtDL\", [5] = \"ldrbtDL\",\n  },\n  _ = {\n    shift = 20, mask = 5,\n    [0] = \"strDL\", \"ldrDL\", [4] = \"strbDL\", [5] = \"ldrbDL\",\n  }\n}\n\nlocal map_load1 = {\n  shift = 4, mask = 1,\n  [0] = map_load, map_media,\n}\n\nlocal map_loadm = {\n  shift = 20, mask = 1,\n  [0] = {\n    shift = 23, mask = 3,\n    [0] = \"stmdaNR\", \"stmNR\",\n    { shift = 16, mask = 63, [45] = \"pushR\", _ = \"stmdbNR\", }, \"stmibNR\",\n  },\n  {\n    shift = 23, mask = 3,\n    [0] = \"ldmdaNR\", { shift = 16, mask = 63, [61] = \"popR\", _ = \"ldmNR\", },\n    \"ldmdbNR\", \"ldmibNR\",\n  },\n}\n\nlocal map_data = {\n  shift = 21, mask = 15,\n  [0] = \"andDNPs\", \"eorDNPs\", \"subDNPs\", \"rsbDNPs\",\n  \"addDNPs\", \"adcDNPs\", \"sbcDNPs\", \"rscDNPs\",\n  \"tstNP\", \"teqNP\", \"cmpNP\", \"cmnNP\",\n  \"orrDNPs\", \"movDPs\", \"bicDNPs\", \"mvnDPs\",\n}\n\nlocal map_mul = {\n  shift = 21, mask = 7,\n  [0] = \"mulNMSs\", \"mlaNMSDs\", \"umaalDNMS\", \"mlsDNMS\",\n  \"umullDNMSs\", \"umlalDNMSs\", \"smullDNMSs\", \"smlalDNMSs\",\n}\n\nlocal map_sync = {\n  shift = 20, mask = 15, -- NYI: brackets around N. R(D+1) for ldrexd/strexd.\n  [0] = \"swpDMN\", false, false, false,\n  \"swpbDMN\", false, false, false,\n  \"strexDMN\", \"ldrexDN\", \"strexdDN\", \"ldrexdDN\",\n  \"strexbDMN\", \"ldrexbDN\", \"strexhDN\", \"ldrexhDN\",\n}\n\nlocal map_mulh = {\n  shift = 21, mask = 3,\n  [0] = { shift = 5, mask = 3,\n    [0] = \"smlabbNMSD\", \"smlatbNMSD\", \"smlabtNMSD\", \"smlattNMSD\", },\n  { shift = 5, mask = 3,\n    [0] = \"smlawbNMSD\", \"smulwbNMS\", \"smlawtNMSD\", \"smulwtNMS\", },\n  { shift = 5, mask = 3,\n    [0] = \"smlalbbDNMS\", \"smlaltbDNMS\", \"smlalbtDNMS\", \"smlalttDNMS\", },\n  { shift = 5, mask = 3,\n    [0] = \"smulbbNMS\", \"smultbNMS\", \"smulbtNMS\", \"smulttNMS\", },\n}\n\nlocal map_misc = {\n  shift = 4, mask = 7,\n  -- NYI: decode PSR bits of msr.\n  [0] = { shift = 21, mask = 1, [0] = \"mrsD\", \"msrM\", },\n  { shift = 21, mask = 3, \"bxM\", false, \"clzDM\", },\n  { shift = 21, mask = 3, \"bxjM\", },\n  { shift = 21, mask = 3, \"blxM\", },\n  false,\n  { shift = 21, mask = 3, [0] = \"qaddDMN\", \"qsubDMN\", \"qdaddDMN\", \"qdsubDMN\", },\n  false,\n  { shift = 21, mask = 3, \"bkptK\", },\n}\n\nlocal map_datar = {\n  shift = 4, mask = 9,\n  [9] = {\n    shift = 5, mask = 3,\n    [0] = { shift = 24, mask = 1, [0] = map_mul, map_sync, },\n    { shift = 20, mask = 1, [0] = \"strhDL\", \"ldrhDL\", },\n    { shift = 20, mask = 1, [0] = \"ldrdDL\", \"ldrsbDL\", },\n    { shift = 20, mask = 1, [0] = \"strdDL\", \"ldrshDL\", },\n  },\n  _ = {\n    shift = 20, mask = 25,\n    [16] = { shift = 7, mask = 1, [0] = map_misc, map_mulh, },\n    _ = {\n      shift = 0, mask = 0xffffffff,\n      [bor(0xe1a00000)] = \"nop\",\n      _ = map_data,\n    }\n  },\n}\n\nlocal map_datai = {\n  shift = 20, mask = 31, -- NYI: decode PSR bits of msr. Decode imm12.\n  [16] = \"movwDW\", [20] = \"movtDW\",\n  [18] = { shift = 0, mask = 0xf00ff, [0] = \"nopv6\", _ = \"msrNW\", },\n  [22] = \"msrNW\",\n  _ = map_data,\n}\n\nlocal map_branch = {\n  shift = 24, mask = 1,\n  [0] = \"bB\", \"blB\"\n}\n\nlocal map_condins = {\n  [0] = map_datar, map_datai, map_load, map_load1,\n  map_loadm, map_branch, map_loadc, map_datac\n}\n\n-- NYI: setend.\nlocal map_uncondins = {\n  [0] = false, map_simddata, map_simdload, map_preload,\n  false, \"blxB\", map_loadcu, map_datacu,\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"r1\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"sp\", \"lr\", \"pc\",\n}\n\nlocal map_cond = {\n  [0] = \"eq\", \"ne\", \"hs\", \"lo\", \"mi\", \"pl\", \"vs\", \"vc\",\n  \"hi\", \"ls\", \"ge\", \"lt\", \"gt\", \"le\", \"al\",\n}\n\nlocal map_shift = { [0] = \"lsl\", \"lsr\", \"asr\", \"ror\", }\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then\n      extra = \"\\t->\"..sym\n    elseif band(ctx.op, 0x0e000000) ~= 0x0a000000 then\n      extra = \"\\t; 0x\"..tohex(ctx.rel)\n    end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-5s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-5s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\n-- Format operand 2 of load/store opcodes.\nlocal function fmtload(ctx, op, pos)\n  local base = map_gpr[band(rshift(op, 16), 15)]\n  local x, ofs\n  local ext = (band(op, 0x04000000) == 0)\n  if not ext and band(op, 0x02000000) == 0 then\n    ofs = band(op, 4095)\n    if band(op, 0x00800000) == 0 then ofs = -ofs end\n    if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n    ofs = \"#\"..ofs\n  elseif ext and band(op, 0x00400000) ~= 0 then\n    ofs = band(op, 15) + band(rshift(op, 4), 0xf0)\n    if band(op, 0x00800000) == 0 then ofs = -ofs end\n    if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n    ofs = \"#\"..ofs\n  else\n    ofs = map_gpr[band(op, 15)]\n    if ext or band(op, 0xfe0) == 0 then\n    elseif band(op, 0xfe0) == 0x60 then\n      ofs = format(\"%s, rrx\", ofs)\n    else\n      local sh = band(rshift(op, 7), 31)\n      if sh == 0 then sh = 32 end\n      ofs = format(\"%s, %s #%d\", ofs, map_shift[band(rshift(op, 5), 3)], sh)\n    end\n    if band(op, 0x00800000) == 0 then ofs = \"-\"..ofs end\n  end\n  if ofs == \"#0\" then\n    x = format(\"[%s]\", base)\n  elseif band(op, 0x01000000) == 0 then\n    x = format(\"[%s], %s\", base, ofs)\n  else\n    x = format(\"[%s, %s]\", base, ofs)\n  end\n  if band(op, 0x01200000) == 0x01200000 then x = x..\"!\" end\n  return x\nend\n\n-- Format operand 2 of vector load/store opcodes.\nlocal function fmtvload(ctx, op, pos)\n  local base = map_gpr[band(rshift(op, 16), 15)]\n  local ofs = band(op, 255)*4\n  if band(op, 0x00800000) == 0 then ofs = -ofs end\n  if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n  if ofs == 0 then\n    return format(\"[%s]\", base)\n  else\n    return format(\"[%s, #%d]\", base, ofs)\n  end\nend\n\nlocal function fmtvr(op, vr, sh0, sh1)\n  if vr == \"s\" then\n    return format(\"s%d\", 2*band(rshift(op, sh0), 15)+band(rshift(op, sh1), 1))\n  else\n    return format(\"d%d\", band(rshift(op, sh0), 15)+band(rshift(op, sh1-4), 16))\n  end\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\n  local operands = {}\n  local suffix = \"\"\n  local last, name, pat\n  local vr\n  ctx.op = op\n  ctx.rel = nil\n\n  local cond = rshift(op, 28)\n  local opat\n  if cond == 15 then\n    opat = map_uncondins[band(rshift(op, 25), 7)]\n  else\n    if cond ~= 14 then suffix = map_cond[cond] end\n    opat = map_condins[band(rshift(op, 25), 7)]\n  end\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  name, pat = match(opat, \"^([a-z0-9]*)(.*)\")\n  if sub(pat, 1, 1) == \".\" then\n    local s2, p2 = match(pat, \"^([a-z0-9.]*)(.*)\")\n    suffix = suffix..s2\n    pat = p2\n  end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"D\" then\n      x = map_gpr[band(rshift(op, 12), 15)]\n    elseif p == \"N\" then\n      x = map_gpr[band(rshift(op, 16), 15)]\n    elseif p == \"S\" then\n      x = map_gpr[band(rshift(op, 8), 15)]\n    elseif p == \"M\" then\n      x = map_gpr[band(op, 15)]\n    elseif p == \"d\" then\n      x = fmtvr(op, vr, 12, 22)\n    elseif p == \"n\" then\n      x = fmtvr(op, vr, 16, 7)\n    elseif p == \"m\" then\n      x = fmtvr(op, vr, 0, 5)\n    elseif p == \"P\" then\n      if band(op, 0x02000000) ~= 0 then\n\tx = ror(band(op, 255), 2*band(rshift(op, 8), 15))\n      else\n\tx = map_gpr[band(op, 15)]\n\tif band(op, 0xff0) ~= 0 then\n\t  operands[#operands+1] = x\n\t  local s = map_shift[band(rshift(op, 5), 3)]\n\t  local r = nil\n\t  if band(op, 0xf90) == 0 then\n\t    if s == \"ror\" then s = \"rrx\" else r = \"#32\" end\n\t  elseif band(op, 0x10) == 0 then\n\t    r = \"#\"..band(rshift(op, 7), 31)\n\t  else\n\t    r = map_gpr[band(rshift(op, 8), 15)]\n\t  end\n\t  if name == \"mov\" then name = s; x = r\n\t  elseif r then x = format(\"%s %s\", s, r)\n\t  else x = s end\n\tend\n      end\n    elseif p == \"L\" then\n      x = fmtload(ctx, op, pos)\n    elseif p == \"l\" then\n      x = fmtvload(ctx, op, pos)\n    elseif p == \"B\" then\n      local addr = ctx.addr + pos + 8 + arshift(lshift(op, 8), 6)\n      if cond == 15 then addr = addr + band(rshift(op, 23), 2) end\n      ctx.rel = addr\n      x = \"0x\"..tohex(addr)\n    elseif p == \"F\" then\n      vr = \"s\"\n    elseif p == \"G\" then\n      vr = \"d\"\n    elseif p == \".\" then\n      suffix = suffix..(vr == \"s\" and \".f32\" or \".f64\")\n    elseif p == \"R\" then\n      if band(op, 0x00200000) ~= 0 and #operands == 1 then\n\toperands[1] = operands[1]..\"!\"\n      end\n      local t = {}\n      for i=0,15 do\n\tif band(rshift(op, i), 1) == 1 then t[#t+1] = map_gpr[i] end\n      end\n      x = \"{\"..concat(t, \", \")..\"}\"\n    elseif p == \"r\" then\n      if band(op, 0x00200000) ~= 0 and #operands == 2 then\n\toperands[1] = operands[1]..\"!\"\n      end\n      local s = tonumber(sub(last, 2))\n      local n = band(op, 255)\n      if vr == \"d\" then n = rshift(n, 1) end\n      operands[#operands] = format(\"{%s-%s%d}\", last, vr, s+n-1)\n    elseif p == \"W\" then\n      x = band(op, 0x0fff) + band(rshift(op, 4), 0xf000)\n    elseif p == \"T\" then\n      x = \"#0x\"..tohex(band(op, 0x00ffffff), 6)\n    elseif p == \"U\" then\n      x = band(rshift(op, 7), 31)\n      if x == 0 then x = nil end\n    elseif p == \"u\" then\n      x = band(rshift(op, 7), 31)\n      if band(op, 0x40) == 0 then\n\tif x == 0 then x = nil else x = \"lsl #\"..x end\n      else\n\tif x == 0 then x = \"asr #32\" else x = \"asr #\"..x end\n      end\n    elseif p == \"v\" then\n      x = band(rshift(op, 7), 31)\n    elseif p == \"w\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"x\" then\n      x = band(rshift(op, 16), 31) + 1\n    elseif p == \"X\" then\n      x = band(rshift(op, 16), 31) - last + 1\n    elseif p == \"Y\" then\n      x = band(rshift(op, 12), 0xf0) + band(op, 0x0f)\n    elseif p == \"K\" then\n      x = \"#0x\"..tohex(band(rshift(op, 4), 0x0000fff0) + band(op, 15), 4)\n    elseif p == \"s\" then\n      if band(op, 0x00100000) ~= 0 then suffix = \"s\"..suffix end\n    else\n      assert(false)\n    end\n    if x then\n      last = x\n      if type(x) == \"number\" then x = \"#\"..x end\n      operands[#operands+1] = x\n    end\n  end\n\n  return putop(ctx, name..suffix, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ctx.pos = ofs\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 16 then return map_gpr[r] end\n  return \"d\"..(r-16)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_arm64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM64 disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n--\n-- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com.\n-- Sponsored by Cisco Systems, Inc.\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles most user-mode AArch64 instructions.\n-- NYI: Advanced SIMD and VFP instructions.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, bxor, tohex = bit.band, bit.bor, bit.bxor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\nlocal ror = bit.ror\n\n------------------------------------------------------------------------------\n-- Opcode maps\n------------------------------------------------------------------------------\n\nlocal map_adr = { -- PC-relative addressing.\n  shift = 31, mask = 1,\n  [0] = \"adrDBx\", \"adrpDBx\"\n}\n\nlocal map_addsubi = { -- Add/subtract immediate.\n  shift = 29, mask = 3,\n  [0] = \"add|movDNIg\", \"adds|cmnD0NIg\", \"subDNIg\", \"subs|cmpD0NIg\",\n}\n\nlocal map_logi = { -- Logical immediate.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"andDNig\", \"orr|movDN0ig\", \"eorDNig\", \"ands|tstD0Nig\"\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = \"andDNig\", \"orr|movDN0ig\", \"eorDNig\", \"ands|tstD0Nig\"\n  }\n}\n\nlocal map_movwi = { -- Move wide immediate.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"movnDWRg\", false, \"movz|movDYRg\", \"movkDWRg\"\n    }, false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = \"movnDWRg\", false, \"movz|movDYRg\", \"movkDWRg\"\n  },\n}\n\nlocal map_bitf = { -- Bitfield.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"sbfm|sbfiz|sbfx|asr|sxtw|sxth|sxtbDN12w\",\n      \"bfm|bfi|bfxilDN13w\",\n      \"ubfm|ubfiz|ubfx|lsr|lsl|uxth|uxtbDN12w\"\n    }\n  },\n  {\n    shift = 22, mask = 1,\n    {\n      shift = 29, mask = 3,\n      [0] = \"sbfm|sbfiz|sbfx|asr|sxtw|sxth|sxtbDN12x\",\n      \"bfm|bfi|bfxilDN13x\",\n      \"ubfm|ubfiz|ubfx|lsr|lsl|uxth|uxtbDN12x\"\n    }\n  }\n}\n\nlocal map_datai = { -- Data processing - immediate.\n  shift = 23, mask = 7,\n  [0] = map_adr, map_adr, map_addsubi, false,\n  map_logi, map_movwi, map_bitf,\n  {\n    shift = 15, mask = 0x1c0c1,\n    [0] = \"extr|rorDNM4w\", [0x10080] = \"extr|rorDNM4x\",\n    [0x10081] = \"extr|rorDNM4x\"\n  }\n}\n\nlocal map_logsr = { -- Logical, shifted register.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = {\n\tshift = 21, mask = 7,\n\t[0] = \"andDNMSg\", \"bicDNMSg\", \"andDNMSg\", \"bicDNMSg\",\n\t\"andDNMSg\", \"bicDNMSg\", \"andDNMg\", \"bicDNMg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] =\"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0MSg\", \"orn|mvnDN0MSg\",\n\t     \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0Mg\", \"orn|mvnDN0Mg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] = \"eorDNMSg\", \"eonDNMSg\", \"eorDNMSg\", \"eonDNMSg\",\n\t\"eorDNMSg\", \"eonDNMSg\", \"eorDNMg\", \"eonDNMg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] = \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMSg\", \"bicsDNMSg\",\n\t\"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMg\", \"bicsDNMg\"\n      }\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = {\n      shift = 21, mask = 7,\n      [0] = \"andDNMSg\", \"bicDNMSg\", \"andDNMSg\", \"bicDNMSg\",\n      \"andDNMSg\", \"bicDNMSg\", \"andDNMg\", \"bicDNMg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0MSg\", \"orn|mvnDN0MSg\",\n      \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0Mg\", \"orn|mvnDN0Mg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"eorDNMSg\", \"eonDNMSg\", \"eorDNMSg\", \"eonDNMSg\",\n      \"eorDNMSg\", \"eonDNMSg\", \"eorDNMg\", \"eonDNMg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMSg\", \"bicsDNMSg\",\n      \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMg\", \"bicsDNMg\"\n    }\n  }\n}\n\nlocal map_assh = {\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = {\n\tshift = 22, mask = 3,\n\t[0] = \"addDNMSg\", \"addDNMSg\", \"addDNMSg\", \"addDNMg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\",\n\t      \"adds|cmnD0NMSg\", \"adds|cmnD0NMg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0Mg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0MzSg\",\n\t      \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0Mzg\"\n      },\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"addDNMSg\", \"addDNMSg\", \"addDNMSg\", \"addDNMg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\",\n\t    \"adds|cmnD0NMg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0Mg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0MzSg\",\n\t    \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0Mzg\"\n    }\n  }\n}\n\nlocal map_addsubsh = { -- Add/subtract, shifted register.\n  shift = 22, mask = 3,\n  [0] = map_assh, map_assh, map_assh\n}\n\nlocal map_addsubex = { -- Add/subtract, extended register.\n  shift = 22, mask = 3,\n  [0] = {\n    shift = 29, mask = 3,\n    [0] = \"addDNMXg\", \"adds|cmnD0NMXg\", \"subDNMXg\", \"subs|cmpD0NMzXg\",\n  }\n}\n\nlocal map_addsubc = { -- Add/subtract, with carry.\n  shift = 10, mask = 63,\n  [0] = {\n    shift = 29, mask = 3,\n    [0] = \"adcDNMg\", \"adcsDNMg\", \"sbc|ngcDN0Mg\", \"sbcs|ngcsDN0Mg\",\n  }\n}\n\nlocal map_ccomp = {\n  shift = 4, mask = 1,\n  [0] = {\n    shift = 10, mask = 3,\n    [0] = { -- Conditional compare register.\n      shift = 29, mask = 3,\n      \"ccmnNMVCg\", false, \"ccmpNMVCg\",\n    },\n    [2] = {  -- Conditional compare immediate.\n      shift = 29, mask = 3,\n      \"ccmnN5VCg\", false, \"ccmpN5VCg\",\n    }\n  }\n}\n\nlocal map_csel = { -- Conditional select.\n  shift = 11, mask = 1,\n  [0] = {\n    shift = 10, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"cselDNMzCg\", false, \"csinv|cinv|csetmDNMcg\", false,\n    },\n    {\n      shift = 29, mask = 3,\n      [0] = \"csinc|cinc|csetDNMcg\", false, \"csneg|cnegDNMcg\", false,\n    }\n  }\n}\n\nlocal map_data1s = { -- Data processing, 1 source.\n  shift = 29, mask = 1,\n  [0] = {\n    shift = 31, mask = 1,\n    [0] = {\n      shift = 10, mask = 0x7ff,\n      [0] = \"rbitDNg\", \"rev16DNg\", \"revDNw\", false, \"clzDNg\", \"clsDNg\"\n    },\n    {\n      shift = 10, mask = 0x7ff,\n      [0] = \"rbitDNg\", \"rev16DNg\", \"rev32DNx\", \"revDNx\", \"clzDNg\", \"clsDNg\"\n    }\n  }\n}\n\nlocal map_data2s = { -- Data processing, 2 sources.\n  shift = 29, mask = 1,\n  [0] = {\n    shift = 10, mask = 63,\n    false, \"udivDNMg\", \"sdivDNMg\", false, false, false, false, \"lslDNMg\",\n    \"lsrDNMg\", \"asrDNMg\", \"rorDNMg\"\n  }\n}\n\nlocal map_data3s = { -- Data processing, 3 sources.\n  shift = 29, mask = 7,\n  [0] = {\n    shift = 21, mask = 7,\n    [0] = {\n      shift = 15, mask = 1,\n      [0] = \"madd|mulDNMA0g\", \"msub|mnegDNMA0g\"\n    }\n  }, false, false, false,\n  {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 21, mask = 7,\n      [0] = \"madd|mulDNMA0g\", \"smaddl|smullDxNMwA0x\", \"smulhDNMx\", false,\n      false, \"umaddl|umullDxNMwA0x\", \"umulhDNMx\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"msub|mnegDNMA0g\", \"smsubl|smneglDxNMwA0x\", false, false,\n      false, \"umsubl|umneglDxNMwA0x\"\n    }\n  }\n}\n\nlocal map_datar = { -- Data processing, register.\n  shift = 28, mask = 1,\n  [0] = {\n    shift = 24, mask = 1,\n    [0] = map_logsr,\n    {\n      shift = 21, mask = 1,\n      [0] = map_addsubsh, map_addsubex\n    }\n  },\n  {\n    shift = 21, mask = 15,\n    [0] = map_addsubc, false, map_ccomp, false, map_csel, false,\n    {\n      shift = 30, mask = 1,\n      [0] = map_data2s, map_data1s\n    },\n    false, map_data3s, map_data3s, map_data3s, map_data3s, map_data3s,\n    map_data3s, map_data3s, map_data3s\n  }\n}\n\nlocal map_lrl = { -- Load register, literal.\n  shift = 26, mask = 1,\n  [0] = {\n    shift = 30, mask = 3,\n    [0] = \"ldrDwB\", \"ldrDxB\", \"ldrswDxB\"\n  },\n  {\n    shift = 30, mask = 3,\n    [0] = \"ldrDsB\", \"ldrDdB\"\n  }\n}\n\nlocal map_lsriind = { -- Load/store register, immediate pre/post-indexed.\n  shift = 30, mask = 3,\n  [0] = {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strbDwzL\", \"ldrbDwzL\", \"ldrsbDxzL\", \"ldrsbDwzL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strhDwzL\", \"ldrhDwzL\", \"ldrshDxzL\", \"ldrshDwzL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strDwzL\", \"ldrDwzL\", \"ldrswDxzL\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"strDszL\", \"ldrDszL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strDxzL\", \"ldrDxzL\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"strDdzL\", \"ldrDdzL\"\n    }\n  }\n}\n\nlocal map_lsriro = {\n  shift = 21, mask = 1,\n  [0] = {  -- Load/store register immediate.\n    shift = 10, mask = 3,\n    [0] = { -- Unscaled immediate.\n      shift = 26, mask = 1,\n      [0] = {\n\tshift = 30, mask = 3,\n\t[0] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturbDwK\", \"ldurbDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturhDwK\", \"ldurhDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturDwK\", \"ldurDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturDxK\", \"ldurDxK\"\n\t}\n      }\n    }, map_lsriind, false, map_lsriind\n  },\n  {  -- Load/store register, register offset.\n    shift = 10, mask = 3,\n    [2] = {\n      shift = 26, mask = 1,\n      [0] = {\n\tshift = 30, mask = 3,\n\t[0] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strbDwO\", \"ldrbDwO\", \"ldrsbDxO\", \"ldrsbDwO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strhDwO\", \"ldrhDwO\", \"ldrshDxO\", \"ldrshDwO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDwO\", \"ldrDwO\", \"ldrswDxO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDxO\", \"ldrDxO\"\n\t}\n      },\n      {\n\tshift = 30, mask = 3,\n\t[2] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDsO\", \"ldrDsO\"\n\t},\n\t[3] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDdO\", \"ldrDdO\"\n\t}\n      }\n    }\n  }\n}\n\nlocal map_lsp = { -- Load/store register pair, offset.\n  shift = 22, mask = 1,\n  [0] = {\n    shift = 30, mask = 3,\n    [0] = {\n      shift = 26, mask = 1,\n      [0] = \"stpDzAzwP\", \"stpDzAzsP\",\n    },\n    {\n      shift = 26, mask = 1,\n      \"stpDzAzdP\"\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"stpDzAzxP\"\n    }\n  },\n  {\n    shift = 30, mask = 3,\n    [0] = {\n      shift = 26, mask = 1,\n      [0] = \"ldpDzAzwP\", \"ldpDzAzsP\",\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"ldpswDAxP\", \"ldpDzAzdP\"\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"ldpDzAzxP\"\n    }\n  }\n}\n\nlocal map_ls = { -- Loads and stores.\n  shift = 24, mask = 0x31,\n  [0x10] = map_lrl, [0x30] = map_lsriro,\n  [0x20] = {\n    shift = 23, mask = 3,\n    map_lsp, map_lsp, map_lsp\n  },\n  [0x21] = {\n    shift = 23, mask = 3,\n    map_lsp, map_lsp, map_lsp\n  },\n  [0x31] = {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 30, mask = 3,\n      [0] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strbDwzU\", \"ldrbDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strhDwzU\", \"ldrhDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strDwzU\", \"ldrDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strDxzU\", \"ldrDxzU\"\n      }\n    },\n    {\n      shift = 30, mask = 3,\n      [2] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strDszU\", \"ldrDszU\"\n      },\n      [3] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strDdzU\", \"ldrDdzU\"\n      }\n    }\n  },\n}\n\nlocal map_datafp = { -- Data processing, SIMD and FP.\n  shift = 28, mask = 7,\n  { -- 001\n    shift = 24, mask = 1,\n    [0] = {\n      shift = 21, mask = 1,\n      {\n\tshift = 10, mask = 3,\n\t[0] = {\n\t  shift = 12, mask = 1,\n\t  [0] = {\n\t    shift = 13, mask = 1,\n\t    [0] = {\n\t      shift = 14, mask = 1,\n\t      [0] = {\n\t\tshift = 15, mask = 1,\n\t\t[0] = { -- FP/int conversion.\n\t\t  shift = 31, mask = 1,\n\t\t  [0] = {\n\t\t    shift = 16, mask = 0xff,\n\t\t    [0x20] = \"fcvtnsDwNs\", [0x21] = \"fcvtnuDwNs\",\n\t\t    [0x22] = \"scvtfDsNw\", [0x23] = \"ucvtfDsNw\",\n\t\t    [0x24] = \"fcvtasDwNs\", [0x25] = \"fcvtauDwNs\",\n\t\t    [0x26] = \"fmovDwNs\", [0x27] = \"fmovDsNw\",\n\t\t    [0x28] = \"fcvtpsDwNs\", [0x29] = \"fcvtpuDwNs\",\n\t\t    [0x30] = \"fcvtmsDwNs\", [0x31] = \"fcvtmuDwNs\",\n\t\t    [0x38] = \"fcvtzsDwNs\", [0x39] = \"fcvtzuDwNs\",\n\t\t    [0x60] = \"fcvtnsDwNd\", [0x61] = \"fcvtnuDwNd\",\n\t\t    [0x62] = \"scvtfDdNw\", [0x63] = \"ucvtfDdNw\",\n\t\t    [0x64] = \"fcvtasDwNd\", [0x65] = \"fcvtauDwNd\",\n\t\t    [0x68] = \"fcvtpsDwNd\", [0x69] = \"fcvtpuDwNd\",\n\t\t    [0x70] = \"fcvtmsDwNd\", [0x71] = \"fcvtmuDwNd\",\n\t\t    [0x78] = \"fcvtzsDwNd\", [0x79] = \"fcvtzuDwNd\"\n\t\t  },\n\t\t  {\n\t\t    shift = 16, mask = 0xff,\n\t\t    [0x20] = \"fcvtnsDxNs\", [0x21] = \"fcvtnuDxNs\",\n\t\t    [0x22] = \"scvtfDsNx\", [0x23] = \"ucvtfDsNx\",\n\t\t    [0x24] = \"fcvtasDxNs\", [0x25] = \"fcvtauDxNs\",\n\t\t    [0x28] = \"fcvtpsDxNs\", [0x29] = \"fcvtpuDxNs\",\n\t\t    [0x30] = \"fcvtmsDxNs\", [0x31] = \"fcvtmuDxNs\",\n\t\t    [0x38] = \"fcvtzsDxNs\", [0x39] = \"fcvtzuDxNs\",\n\t\t    [0x60] = \"fcvtnsDxNd\", [0x61] = \"fcvtnuDxNd\",\n\t\t    [0x62] = \"scvtfDdNx\", [0x63] = \"ucvtfDdNx\",\n\t\t    [0x64] = \"fcvtasDxNd\", [0x65] = \"fcvtauDxNd\",\n\t\t    [0x66] = \"fmovDxNd\", [0x67] = \"fmovDdNx\",\n\t\t    [0x68] = \"fcvtpsDxNd\", [0x69] = \"fcvtpuDxNd\",\n\t\t    [0x70] = \"fcvtmsDxNd\", [0x71] = \"fcvtmuDxNd\",\n\t\t    [0x78] = \"fcvtzsDxNd\", [0x79] = \"fcvtzuDxNd\"\n\t\t  }\n\t\t}\n\t      },\n\t      { -- FP data-processing, 1 source.\n\t\tshift = 31, mask = 1,\n\t\t[0] = {\n\t\t  shift = 22, mask = 3,\n\t\t  [0] = {\n\t\t    shift = 15, mask = 63,\n\t\t    [0] = \"fmovDNf\", \"fabsDNf\", \"fnegDNf\",\n\t\t    \"fsqrtDNf\", false, \"fcvtDdNs\", false, false,\n\t\t    \"frintnDNf\", \"frintpDNf\", \"frintmDNf\", \"frintzDNf\",\n\t\t    \"frintaDNf\", false, \"frintxDNf\", \"frintiDNf\",\n\t\t  },\n\t\t  {\n\t\t    shift = 15, mask = 63,\n\t\t    [0] = \"fmovDNf\", \"fabsDNf\", \"fnegDNf\",\n\t\t    \"fsqrtDNf\", \"fcvtDsNd\", false, false, false,\n\t\t    \"frintnDNf\", \"frintpDNf\", \"frintmDNf\", \"frintzDNf\",\n\t\t    \"frintaDNf\", false, \"frintxDNf\", \"frintiDNf\",\n\t\t  }\n\t\t}\n\t      }\n\t    },\n\t    { -- FP compare.\n\t      shift = 31, mask = 1,\n\t      [0] = {\n\t\tshift = 14, mask = 3,\n\t\t[0] = {\n\t\t  shift = 23, mask = 1,\n\t\t  [0] = {\n\t\t    shift = 0, mask = 31,\n\t\t    [0] = \"fcmpNMf\", [8] = \"fcmpNZf\",\n\t\t    [16] = \"fcmpeNMf\", [24] = \"fcmpeNZf\",\n\t\t  }\n\t\t}\n\t      }\n\t    }\n\t  },\n\t  { -- FP immediate.\n\t    shift = 31, mask = 1,\n\t    [0] = {\n\t      shift = 5, mask = 31,\n\t      [0] = {\n\t\tshift = 23, mask = 1,\n\t\t[0] = \"fmovDFf\"\n\t      }\n\t    }\n\t  }\n\t},\n\t{ -- FP conditional compare.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = {\n\t      shift = 4, mask = 1,\n\t      [0] = \"fccmpNMVCf\", \"fccmpeNMVCf\"\n\t    }\n\t  }\n\t},\n\t{ -- FP data-processing, 2 sources.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = {\n\t      shift = 12, mask = 15,\n\t      [0] = \"fmulDNMf\", \"fdivDNMf\", \"faddDNMf\", \"fsubDNMf\",\n\t      \"fmaxDNMf\", \"fminDNMf\", \"fmaxnmDNMf\", \"fminnmDNMf\",\n\t      \"fnmulDNMf\"\n\t    }\n\t  }\n\t},\n\t{ -- FP conditional select.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = \"fcselDNMCf\"\n\t  }\n\t}\n      }\n    },\n    { -- FP data-processing, 3 sources.\n      shift = 31, mask = 1,\n      [0] = {\n\tshift = 15, mask = 1,\n\t[0] = {\n\t  shift = 21, mask = 5,\n\t  [0] = \"fmaddDNMAf\", \"fnmaddDNMAf\"\n\t},\n\t{\n\t  shift = 21, mask = 5,\n\t  [0] = \"fmsubDNMAf\", \"fnmsubDNMAf\"\n\t}\n      }\n    }\n  }\n}\n\nlocal map_br = { -- Branches, exception generating and system instructions.\n  shift = 29, mask = 7,\n  [0] = \"bB\",\n  { -- Compare & branch, immediate.\n    shift = 24, mask = 3,\n    [0] = \"cbzDBg\", \"cbnzDBg\", \"tbzDTBw\", \"tbnzDTBw\"\n  },\n  { -- Conditional branch, immediate.\n    shift = 24, mask = 3,\n    [0] = {\n      shift = 4, mask = 1,\n      [0] = {\n\tshift = 0, mask = 15,\n\t[0] = \"beqB\", \"bneB\", \"bhsB\", \"bloB\", \"bmiB\", \"bplB\", \"bvsB\", \"bvcB\",\n\t\"bhiB\", \"blsB\", \"bgeB\", \"bltB\", \"bgtB\", \"bleB\", \"balB\"\n      }\n    }\n  }, false, \"blB\",\n  { -- Compare & branch, immediate.\n    shift = 24, mask = 3,\n    [0] = \"cbzDBg\", \"cbnzDBg\", \"tbzDTBx\", \"tbnzDTBx\"\n  },\n  {\n    shift = 24, mask = 3,\n    [0] = { -- Exception generation.\n      shift = 0, mask = 0xe0001f,\n      [0x200000] = \"brkW\"\n    },\n    { -- System instructions.\n      shift = 0, mask = 0x3fffff,\n      [0x03201f] = \"nop\"\n    },\n    { -- Unconditional branch, register.\n      shift = 0, mask = 0xfffc1f,\n      [0x1f0000] = \"brNx\", [0x3f0000] = \"blrNx\",\n      [0x5f0000] = \"retNx\"\n    },\n  }\n}\n\nlocal map_init = {\n  shift = 25, mask = 15,\n  [0] = false, false, false, false, map_ls, map_datar, map_ls, map_datafp,\n  map_datai, map_datai, map_br, map_br, map_ls, map_datar, map_ls, map_datafp\n}\n\n------------------------------------------------------------------------------\n\nlocal map_regs = { x = {}, w = {}, d = {}, s = {} }\n\nfor i=0,30 do\n  map_regs.x[i] = \"x\"..i\n  map_regs.w[i] = \"w\"..i\n  map_regs.d[i] = \"d\"..i\n  map_regs.s[i] = \"s\"..i\nend\nmap_regs.x[31] = \"sp\"\nmap_regs.w[31] = \"wsp\"\nmap_regs.d[31] = \"d31\"\nmap_regs.s[31] = \"s31\"\n\nlocal map_cond = {\n  [0] = \"eq\", \"ne\", \"cs\", \"cc\", \"mi\", \"pl\", \"vs\", \"vc\",\n  \"hi\", \"ls\", \"ge\", \"lt\", \"gt\", \"le\", \"al\",\n}\n\nlocal map_shift = { [0] = \"lsl\", \"lsr\", \"asr\", }\n\nlocal map_extend = {\n  [0] = \"uxtb\", \"uxth\", \"uxtw\", \"uxtx\", \"sxtb\", \"sxth\", \"sxtw\", \"sxtx\",\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then\n      extra = \"\\t->\"..sym\n    end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-5s %s%s\\n\",\n      ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-5s %s%s\\n\",\n      ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\nlocal function match_reg(p, pat, regnum)\n  return map_regs[match(pat, p..\"%w-([xwds])\")][regnum]\nend\n\nlocal function fmt_hex32(x)\n  if x < 0 then\n    return tohex(x)\n  else\n    return format(\"%x\", x)\n  end\nend\n\nlocal imm13_rep = { 0x55555555, 0x11111111, 0x01010101, 0x00010001, 0x00000001 }\n\nlocal function decode_imm13(op)\n  local imms = band(rshift(op, 10), 63)\n  local immr = band(rshift(op, 16), 63)\n  if band(op, 0x00400000) == 0 then\n    local len = 5\n    if imms >= 56 then\n      if imms >= 60 then len = 1 else len = 2 end\n    elseif imms >= 48 then len = 3 elseif imms >= 32 then len = 4 end\n    local l = lshift(1, len)-1\n    local s = band(imms, l)\n    local r = band(immr, l)\n    local imm = ror(rshift(-1, 31-s), r)\n    if len ~= 5 then imm = band(imm, lshift(1, l)-1) + rshift(imm, 31-l) end\n    imm = imm * imm13_rep[len]\n    local ix = fmt_hex32(imm)\n    if rshift(op, 31) ~= 0 then\n      return ix..tohex(imm)\n    else\n      return ix\n    end\n  else\n    local lo, hi = -1, 0\n    if imms < 32 then lo = rshift(-1, 31-imms) else hi = rshift(-1, 63-imms) end\n    if immr ~= 0 then\n      lo, hi = ror(lo, immr), ror(hi, immr)\n      local x = immr == 32 and 0 or band(bxor(lo, hi), lshift(-1, 32-immr))\n      lo, hi = bxor(lo, x), bxor(hi, x)\n      if immr >= 32 then lo, hi = hi, lo end\n    end\n    if hi ~= 0 then\n      return fmt_hex32(hi)..tohex(lo)\n    else\n      return fmt_hex32(lo)\n    end\n  end\nend\n\nlocal function parse_immpc(op, name)\n  if name == \"b\" or name == \"bl\" then\n    return arshift(lshift(op, 6), 4)\n  elseif name == \"adr\" or name == \"adrp\" then\n    local immlo = band(rshift(op, 29), 3)\n    local immhi = lshift(arshift(lshift(op, 8), 13), 2)\n    return bor(immhi, immlo)\n  elseif name == \"tbz\" or name == \"tbnz\" then\n    return lshift(arshift(lshift(op, 13), 18), 2)\n  else\n    return lshift(arshift(lshift(op, 8), 13), 2)\n  end\nend\n\nlocal function parse_fpimm8(op)\n  local sign = band(op, 0x100000) == 0 and 1 or -1\n  local exp = bxor(rshift(arshift(lshift(op, 12), 5), 24), 0x80) - 131\n  local frac = 16+band(rshift(op, 13), 15)\n  return sign * frac * 2^exp\nend\n\nlocal function prefer_bfx(sf, uns, imms, immr)\n  if imms < immr or imms == 31 or imms == 63 then\n    return false\n  end\n  if immr == 0 then\n    if sf == 0 and (imms == 7 or imms == 15) then\n      return false\n    end\n    if sf ~= 0 and uns == 0 and (imms == 7 or imms == 15 or imms == 31) then\n      return false\n    end\n  end\n  return true\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\n  local operands = {}\n  local suffix = \"\"\n  local last, name, pat\n  local map_reg\n  ctx.op = op\n  ctx.rel = nil\n  last = nil\n  local opat\n  opat = map_init[band(rshift(op, 25), 15)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  name, pat = match(opat, \"^([a-z0-9]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.|]*)(.*)\")\n  if altname then pat = pat2 end\n  if sub(pat, 1, 1) == \".\" then\n    local s2, p2 = match(pat, \"^([a-z0-9.]*)(.*)\")\n    suffix = suffix..s2\n    pat = p2\n  end\n\n  local rt = match(pat, \"[gf]\")\n  if rt then\n    if rt == \"g\" then\n      map_reg = band(op, 0x80000000) ~= 0 and map_regs.x or map_regs.w\n    else\n      map_reg = band(op, 0x400000) ~= 0 and map_regs.d or map_regs.s\n    end\n  end\n\n  local second0, immr\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"D\" then\n      local regnum = band(op, 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"N\" then\n      local regnum = band(rshift(op, 5), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"M\" then\n      local regnum = band(rshift(op, 16), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"A\" then\n      local regnum = band(rshift(op, 10), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"B\" then\n      local addr = ctx.addr + pos + parse_immpc(op, name)\n      ctx.rel = addr\n      x = \"0x\"..tohex(addr)\n    elseif p == \"T\" then\n      x = bor(band(rshift(op, 26), 32), band(rshift(op, 19), 31))\n    elseif p == \"V\" then\n      x = band(op, 15)\n    elseif p == \"C\" then\n      x = map_cond[band(rshift(op, 12), 15)]\n    elseif p == \"c\" then\n      local rn = band(rshift(op, 5), 31)\n      local rm = band(rshift(op, 16), 31)\n      local cond = band(rshift(op, 12), 15)\n      local invc = bxor(cond, 1)\n      x = map_cond[cond]\n      if altname and cond ~= 14 and cond ~= 15 then\n\tlocal a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\tif rn == rm then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  x = map_cond[invc]\n\t  if rn ~= 31 then\n\t    if a1 then name = a1 else name = altname end\n\t  else\n\t    operands[n-1] = nil\n\t    name = a2\n\t  end\n\tend\n      end\n    elseif p == \"W\" then\n      x = band(rshift(op, 5), 0xffff)\n    elseif p == \"Y\" then\n      x = band(rshift(op, 5), 0xffff)\n      local hw = band(rshift(op, 21), 3)\n      if altname and (hw == 0 or x ~= 0) then\n\tname = altname\n      end\n    elseif p == \"L\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local imm9 = arshift(lshift(op, 11), 23)\n      if band(op, 0x800) ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm9..\"]!\"\n      else\n\tx = \"[\"..rn..\"], #\"..imm9\n      end\n    elseif p == \"U\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local sz = band(rshift(op, 30), 3)\n      local imm12 = lshift(arshift(lshift(op, 10), 20), sz)\n      if imm12 ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm12..\"]\"\n      else\n\tx = \"[\"..rn..\"]\"\n      end\n    elseif p == \"K\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local imm9 = arshift(lshift(op, 11), 23)\n      if imm9 ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm9..\"]\"\n      else\n\tx = \"[\"..rn..\"]\"\n      end\n    elseif p == \"O\" then\n      local rn, rm = map_regs.x[band(rshift(op, 5), 31)]\n      local m = band(rshift(op, 13), 1)\n      if m == 0 then\n\trm = map_regs.w[band(rshift(op, 16), 31)]\n      else\n\trm = map_regs.x[band(rshift(op, 16), 31)]\n      end\n      x = \"[\"..rn..\", \"..rm\n      local opt = band(rshift(op, 13), 7)\n      local s = band(rshift(op, 12), 1)\n      local sz = band(rshift(op, 30), 3)\n      -- extension to be applied\n      if opt == 3 then\n       if s == 0 then x = x..\"]\"\n       else x = x..\", lsl #\"..sz..\"]\" end\n      elseif opt == 2 or opt == 6 or opt == 7 then\n\tif s == 0 then x = x..\", \"..map_extend[opt]..\"]\"\n\telse x = x..\", \"..map_extend[opt]..\" #\"..sz..\"]\" end\n      else\n\tx = x..\"]\"\n      end\n    elseif p == \"P\" then\n      local opcv, sh = rshift(op, 26), 2\n      if opcv >= 0x2a then sh = 4 elseif opcv >= 0x1b then sh = 3 end\n      local imm7 = lshift(arshift(lshift(op, 10), 25), sh)\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local ind = band(rshift(op, 23), 3)\n      if ind == 1 then\n\tx = \"[\"..rn..\"], #\"..imm7\n      elseif ind == 2 then\n\tif imm7 == 0 then\n\t  x = \"[\"..rn..\"]\"\n\telse\n\t  x = \"[\"..rn..\", #\"..imm7..\"]\"\n\tend\n      elseif ind == 3 then\n\tx = \"[\"..rn..\", #\"..imm7..\"]!\"\n      end\n    elseif p == \"I\" then\n      local shf = band(rshift(op, 22), 3)\n      local imm12 = band(rshift(op, 10), 0x0fff)\n      local rn, rd = band(rshift(op, 5), 31), band(op, 31)\n      if altname == \"mov\" and shf == 0 and imm12 == 0 and (rn == 31 or rd == 31) then\n\tname = altname\n\tx = nil\n      elseif shf == 0 then\n\tx = imm12\n      elseif shf == 1 then\n\tx = imm12..\", lsl #12\"\n      end\n    elseif p == \"i\" then\n      x = \"#0x\"..decode_imm13(op)\n    elseif p == \"1\" then\n      immr = band(rshift(op, 16), 63)\n      x = immr\n    elseif p == \"2\" then\n      x = band(rshift(op, 10), 63)\n      if altname then\n\tlocal a1, a2, a3, a4, a5, a6 =\n\t  match(altname, \"([^|]*)|([^|]*)|([^|]*)|([^|]*)|([^|]*)|(.*)\")\n\tlocal sf = band(rshift(op, 26), 32)\n\tlocal uns = band(rshift(op, 30), 1)\n\tif prefer_bfx(sf, uns, x, immr) then\n\t  name = a2\n\t  x = x - immr + 1\n\telseif immr == 0 and x == 7 then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  if sf ~= 0 then\n\t    operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t  end\n\t  last = operands[n-1]\n\t  name = a6\n\t  x = nil\n\telseif immr == 0 and x == 15 then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  if sf ~= 0 then\n\t    operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t  end\n\t  last = operands[n-1]\n\t  name = a5\n\t  x = nil\n\telseif x == 31 or x == 63 then\n\t  if x == 31 and immr == 0 and name == \"sbfm\" then\n\t    name = a4\n\t    local n = #operands\n\t    operands[n] = nil\n\t    if sf ~= 0 then\n\t      operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t    end\n\t    last = operands[n-1]\n\t  else\n\t    name = a3\n\t  end\n\t  x = nil\n\telseif band(x, 31) ~= 31 and immr == x+1 and name == \"ubfm\" then\n\t  name = a4\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = nil\n\telseif x < immr then\n\t  name = a1\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = x + 1\n\tend\n      end\n    elseif p == \"3\" then\n      x = band(rshift(op, 10), 63)\n      if altname then\n\tlocal a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\tif x < immr then\n\t  name = a1\n\t  local sf = band(rshift(op, 26), 32)\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = x + 1\n\telseif x >= immr then\n\t  name = a2\n\t  x = x - immr + 1\n\tend\n      end\n    elseif p == \"4\" then\n      x = band(rshift(op, 10), 63)\n      local rn = band(rshift(op, 5), 31)\n      local rm = band(rshift(op, 16), 31)\n      if altname and rn == rm then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tname = altname\n      end\n    elseif p == \"5\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"S\" then\n      x = band(rshift(op, 10), 63)\n      if x == 0 then x = nil\n      else x = map_shift[band(rshift(op, 22), 3)]..\" #\"..x end\n    elseif p == \"X\" then\n      local opt = band(rshift(op, 13), 7)\n      -- Width specifier <R>.\n      if opt ~= 3 and opt ~= 7 then\n\tlast = map_regs.w[band(rshift(op, 16), 31)]\n\toperands[#operands] = last\n      end\n      x = band(rshift(op, 10), 7)\n      -- Extension.\n      if opt == 2 + band(rshift(op, 31), 1) and\n\t band(rshift(op, second0 and 5 or 0), 31) == 31 then\n\tif x == 0 then x = nil\n\telse x = \"lsl #\"..x end\n      else\n\tif x == 0 then x = map_extend[band(rshift(op, 13), 7)]\n\telse x = map_extend[band(rshift(op, 13), 7)]..\" #\"..x end\n      end\n    elseif p == \"R\" then\n      x = band(rshift(op,21), 3)\n      if x == 0 then x = nil\n      else x = \"lsl #\"..x*16 end\n    elseif p == \"z\" then\n      local n = #operands\n      if operands[n] == \"sp\" then operands[n] = \"xzr\"\n      elseif operands[n] == \"wsp\" then operands[n] = \"wzr\"\n      end\n    elseif p == \"Z\" then\n      x = 0\n    elseif p == \"F\" then\n      x = parse_fpimm8(op)\n    elseif p == \"g\" or p == \"f\" or p == \"x\" or p == \"w\" or\n\t   p == \"d\" or p == \"s\" then\n      -- These are handled in D/N/M/A.\n    elseif p == \"0\" then\n      if last == \"sp\" or last == \"wsp\" then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tif altname then\n\t  local a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\t  if not a1 then\n\t    name = altname\n\t  elseif second0 then\n\t    name, altname = a2, a1\n\t  else\n\t    name, altname = a1, a2\n\t  end\n\tend\n      end\n      second0 = true\n    else\n      assert(false)\n    end\n    if x then\n      last = x\n      if type(x) == \"number\" then x = \"#\"..x end\n      operands[#operands+1] = x\n    end\n  end\n\n  return putop(ctx, name..suffix, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ctx.pos = ofs\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_regs.x[r] end\n  return map_regs.d[r-32]\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_arm64be.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM64BE disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- ARM64 instructions are always little-endian. So just forward to the\n-- common ARM64 disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nreturn require((string.match(..., \".*%.\") or \"\")..\"dis_arm64\")\n\n"
  },
  {
    "path": "Luajit/jit/dis_mips.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT/X license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles all standard MIPS32R1/R2 instructions.\n-- Default mode is big-endian, but see: dis_mipsel.lua\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal byte, format = string.byte, string.format\nlocal match, gmatch = string.match, string.gmatch\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, tohex = bit.band, bit.bor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Primary and extended opcode maps\n------------------------------------------------------------------------------\n\nlocal map_movci = { shift = 16, mask = 1, [0] = \"movfDSC\", \"movtDSC\", }\nlocal map_srl = { shift = 21, mask = 1, [0] = \"srlDTA\", \"rotrDTA\", }\nlocal map_srlv = { shift = 6, mask = 1, [0] = \"srlvDTS\", \"rotrvDTS\", }\n\nlocal map_special = {\n  shift = 0, mask = 63,\n  [0] = { shift = 0, mask = -1, [0] = \"nop\", _ = \"sllDTA\" },\n  map_movci,\tmap_srl,\t\"sraDTA\",\n  \"sllvDTS\",\tfalse,\t\tmap_srlv,\t\"sravDTS\",\n  \"jrS\",\t\"jalrD1S\",\t\"movzDST\",\t\"movnDST\",\n  \"syscallY\",\t\"breakY\",\tfalse,\t\t\"sync\",\n  \"mfhiD\",\t\"mthiS\",\t\"mfloD\",\t\"mtloS\",\n  \"dsllvDST\",\tfalse,\t\t\"dsrlvDST\",\t\"dsravDST\",\n  \"multST\",\t\"multuST\",\t\"divST\",\t\"divuST\",\n  \"dmultST\",\t\"dmultuST\",\t\"ddivST\",\t\"ddivuST\",\n  \"addDST\",\t\"addu|moveDST0\", \"subDST\",\t\"subu|neguDS0T\",\n  \"andDST\",\t\"or|moveDST0\",\t\"xorDST\",\t\"nor|notDST0\",\n  false,\tfalse,\t\t\"sltDST\",\t\"sltuDST\",\n  \"daddDST\",\t\"dadduDST\",\t\"dsubDST\",\t\"dsubuDST\",\n  \"tgeSTZ\",\t\"tgeuSTZ\",\t\"tltSTZ\",\t\"tltuSTZ\",\n  \"teqSTZ\",\tfalse,\t\t\"tneSTZ\",\tfalse,\n  \"dsllDTA\",\tfalse,\t\t\"dsrlDTA\",\t\"dsraDTA\",\n  \"dsll32DTA\",\tfalse,\t\t\"dsrl32DTA\",\t\"dsra32DTA\",\n}\n\nlocal map_special2 = {\n  shift = 0, mask = 63,\n  [0] = \"maddST\", \"madduST\",\t\"mulDST\",\tfalse,\n  \"msubST\",\t\"msubuST\",\n  [32] = \"clzDS\", [33] = \"cloDS\",\n  [63] = \"sdbbpY\",\n}\n\nlocal map_bshfl = {\n  shift = 6, mask = 31,\n  [2] = \"wsbhDT\",\n  [16] = \"sebDT\",\n  [24] = \"sehDT\",\n}\n\nlocal map_dbshfl = {\n  shift = 6, mask = 31,\n  [2] = \"dsbhDT\",\n  [5] = \"dshdDT\",\n}\n\nlocal map_special3 = {\n  shift = 0, mask = 63,\n  [0]  = \"extTSAK\", [1]  = \"dextmTSAP\", [3]  = \"dextTSAK\",\n  [4]  = \"insTSAL\", [6]  = \"dinsuTSEQ\", [7]  = \"dinsTSAL\",\n  [32] = map_bshfl, [36] = map_dbshfl,  [59] = \"rdhwrTD\",\n}\n\nlocal map_regimm = {\n  shift = 16, mask = 31,\n  [0] = \"bltzSB\",\t\"bgezSB\",\t\"bltzlSB\",\t\"bgezlSB\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"tgeiSI\",\t\"tgeiuSI\",\t\"tltiSI\",\t\"tltiuSI\",\n  \"teqiSI\",\tfalse,\t\t\"tneiSI\",\tfalse,\n  \"bltzalSB\",\t\"bgezalSB\",\t\"bltzallSB\",\t\"bgezallSB\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\t\"synciSO\",\n}\n\nlocal map_cop0 = {\n  shift = 25, mask = 1,\n  [0] = {\n    shift = 21, mask = 15,\n    [0] = \"mfc0TDW\", [4] = \"mtc0TDW\",\n    [10] = \"rdpgprDT\",\n    [11] = { shift = 5, mask = 1, [0] = \"diT0\", \"eiT0\", },\n    [14] = \"wrpgprDT\",\n  }, {\n    shift = 0, mask = 63,\n    [1] = \"tlbr\", [2] = \"tlbwi\", [6] = \"tlbwr\", [8] = \"tlbp\",\n    [24] = \"eret\", [31] = \"deret\",\n    [32] = \"wait\",\n  },\n}\n\nlocal map_cop1s = {\n  shift = 0, mask = 63,\n  [0] = \"add.sFGH\",\t\"sub.sFGH\",\t\"mul.sFGH\",\t\"div.sFGH\",\n  \"sqrt.sFG\",\t\t\"abs.sFG\",\t\"mov.sFG\",\t\"neg.sFG\",\n  \"round.l.sFG\",\t\"trunc.l.sFG\",\t\"ceil.l.sFG\",\t\"floor.l.sFG\",\n  \"round.w.sFG\",\t\"trunc.w.sFG\",\t\"ceil.w.sFG\",\t\"floor.w.sFG\",\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.sFGC\", \"movt.sFGC\" },\n  \"movz.sFGT\",\t\"movn.sFGT\",\n  false,\t\"recip.sFG\",\t\"rsqrt.sFG\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\t\"cvt.d.sFG\",\tfalse,\t\tfalse,\n  \"cvt.w.sFG\",\t\"cvt.l.sFG\",\t\"cvt.ps.sFGH\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"c.f.sVGH\",\t\"c.un.sVGH\",\t\"c.eq.sVGH\",\t\"c.ueq.sVGH\",\n  \"c.olt.sVGH\",\t\"c.ult.sVGH\",\t\"c.ole.sVGH\",\t\"c.ule.sVGH\",\n  \"c.sf.sVGH\",\t\"c.ngle.sVGH\",\t\"c.seq.sVGH\",\t\"c.ngl.sVGH\",\n  \"c.lt.sVGH\",\t\"c.nge.sVGH\",\t\"c.le.sVGH\",\t\"c.ngt.sVGH\",\n}\n\nlocal map_cop1d = {\n  shift = 0, mask = 63,\n  [0] = \"add.dFGH\",\t\"sub.dFGH\",\t\"mul.dFGH\",\t\"div.dFGH\",\n  \"sqrt.dFG\",\t\t\"abs.dFG\",\t\"mov.dFG\",\t\"neg.dFG\",\n  \"round.l.dFG\",\t\"trunc.l.dFG\",\t\"ceil.l.dFG\",\t\"floor.l.dFG\",\n  \"round.w.dFG\",\t\"trunc.w.dFG\",\t\"ceil.w.dFG\",\t\"floor.w.dFG\",\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.dFGC\", \"movt.dFGC\" },\n  \"movz.dFGT\",\t\"movn.dFGT\",\n  false,\t\"recip.dFG\",\t\"rsqrt.dFG\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.dFG\",\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.w.dFG\",\t\"cvt.l.dFG\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"c.f.dVGH\",\t\"c.un.dVGH\",\t\"c.eq.dVGH\",\t\"c.ueq.dVGH\",\n  \"c.olt.dVGH\",\t\"c.ult.dVGH\",\t\"c.ole.dVGH\",\t\"c.ule.dVGH\",\n  \"c.df.dVGH\",\t\"c.ngle.dVGH\",\t\"c.deq.dVGH\",\t\"c.ngl.dVGH\",\n  \"c.lt.dVGH\",\t\"c.nge.dVGH\",\t\"c.le.dVGH\",\t\"c.ngt.dVGH\",\n}\n\nlocal map_cop1ps = {\n  shift = 0, mask = 63,\n  [0] = \"add.psFGH\",\t\"sub.psFGH\",\t\"mul.psFGH\",\tfalse,\n  false,\t\t\"abs.psFG\",\t\"mov.psFG\",\t\"neg.psFG\",\n  false,\t\tfalse,\t\tfalse,\t\tfalse,\n  false,\t\tfalse,\t\tfalse,\t\tfalse,\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.psFGC\", \"movt.psFGC\" },\n  \"movz.psFGT\",\t\"movn.psFGT\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.puFG\",\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.plFG\",\tfalse,\t\tfalse,\t\tfalse,\n  \"pll.psFGH\",\t\"plu.psFGH\",\t\"pul.psFGH\",\t\"puu.psFGH\",\n  \"c.f.psVGH\",\t\"c.un.psVGH\",\t\"c.eq.psVGH\",\t\"c.ueq.psVGH\",\n  \"c.olt.psVGH\", \"c.ult.psVGH\",\t\"c.ole.psVGH\",\t\"c.ule.psVGH\",\n  \"c.psf.psVGH\", \"c.ngle.psVGH\", \"c.pseq.psVGH\", \"c.ngl.psVGH\",\n  \"c.lt.psVGH\",\t\"c.nge.psVGH\",\t\"c.le.psVGH\",\t\"c.ngt.psVGH\",\n}\n\nlocal map_cop1w = {\n  shift = 0, mask = 63,\n  [32] = \"cvt.s.wFG\", [33] = \"cvt.d.wFG\",\n}\n\nlocal map_cop1l = {\n  shift = 0, mask = 63,\n  [32] = \"cvt.s.lFG\", [33] = \"cvt.d.lFG\",\n}\n\nlocal map_cop1bc = {\n  shift = 16, mask = 3,\n  [0] = \"bc1fCB\", \"bc1tCB\",\t\"bc1flCB\",\t\"bc1tlCB\",\n}\n\nlocal map_cop1 = {\n  shift = 21, mask = 31,\n  [0] = \"mfc1TG\", \"dmfc1TG\",\t\"cfc1TG\",\t\"mfhc1TG\",\n  \"mtc1TG\",\t\"dmtc1TG\",\t\"ctc1TG\",\t\"mthc1TG\",\n  map_cop1bc,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  map_cop1s,\tmap_cop1d,\tfalse,\t\tfalse,\n  map_cop1w,\tmap_cop1l,\tmap_cop1ps,\n}\n\nlocal map_cop1x = {\n  shift = 0, mask = 63,\n  [0] = \"lwxc1FSX\",\t\"ldxc1FSX\",\tfalse,\t\tfalse,\n  false,\t\"luxc1FSX\",\tfalse,\t\tfalse,\n  \"swxc1FSX\",\t\"sdxc1FSX\",\tfalse,\t\tfalse,\n  false,\t\"suxc1FSX\",\tfalse,\t\t\"prefxMSX\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"alnv.psFGHS\",\tfalse,\n  \"madd.sFRGH\",\t\"madd.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"madd.psFRGH\",\tfalse,\n  \"msub.sFRGH\",\t\"msub.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"msub.psFRGH\",\tfalse,\n  \"nmadd.sFRGH\", \"nmadd.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"nmadd.psFRGH\",\tfalse,\n  \"nmsub.sFRGH\", \"nmsub.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"nmsub.psFRGH\",\tfalse,\n}\n\nlocal map_pri = {\n  [0] = map_special,\tmap_regimm,\t\"jJ\",\t\"jalJ\",\n  \"beq|beqz|bST00B\",\t\"bne|bnezST0B\",\t\t\"blezSB\",\t\"bgtzSB\",\n  \"addiTSI\",\t\"addiu|liTS0I\",\t\"sltiTSI\",\t\"sltiuTSI\",\n  \"andiTSU\",\t\"ori|liTS0U\",\t\"xoriTSU\",\t\"luiTU\",\n  map_cop0,\tmap_cop1,\tfalse,\t\tmap_cop1x,\n  \"beql|beqzlST0B\",\t\"bnel|bnezlST0B\",\t\"blezlSB\",\t\"bgtzlSB\",\n  \"daddiTSI\",\t\"daddiuTSI\",\tfalse,\t\tfalse,\n  map_special2,\t\"jalxJ\",\tfalse,\t\tmap_special3,\n  \"lbTSO\",\t\"lhTSO\",\t\"lwlTSO\",\t\"lwTSO\",\n  \"lbuTSO\",\t\"lhuTSO\",\t\"lwrTSO\",\tfalse,\n  \"sbTSO\",\t\"shTSO\",\t\"swlTSO\",\t\"swTSO\",\n  false,\tfalse,\t\t\"swrTSO\",\t\"cacheNSO\",\n  \"llTSO\",\t\"lwc1HSO\",\t\"lwc2TSO\",\t\"prefNSO\",\n  false,\t\"ldc1HSO\",\t\"ldc2TSO\",\t\"ldTSO\",\n  \"scTSO\",\t\"swc1HSO\",\t\"swc2TSO\",\tfalse,\n  false,\t\"sdc1HSO\",\t\"sdc2TSO\",\t\"sdTSO\",\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"r1\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\",\n  \"r16\", \"r17\", \"r18\", \"r19\", \"r20\", \"r21\", \"r22\", \"r23\",\n  \"r24\", \"r25\", \"r26\", \"r27\", \"r28\", \"sp\", \"r30\", \"ra\",\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then extra = \"\\t->\"..sym end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-7s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-7s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\nlocal function get_be(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  return bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3)\nend\n\nlocal function get_le(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  return bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local op = ctx:get()\n  local operands = {}\n  local last = nil\n  ctx.op = op\n  ctx.rel = nil\n\n  local opat = map_pri[rshift(op, 26)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  local name, pat = match(opat, \"^([a-z0-9_.]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.|]*)(.*)\")\n  if altname then pat = pat2 end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"S\" then\n      x = map_gpr[band(rshift(op, 21), 31)]\n    elseif p == \"T\" then\n      x = map_gpr[band(rshift(op, 16), 31)]\n    elseif p == \"D\" then\n      x = map_gpr[band(rshift(op, 11), 31)]\n    elseif p == \"F\" then\n      x = \"f\"..band(rshift(op, 6), 31)\n    elseif p == \"G\" then\n      x = \"f\"..band(rshift(op, 11), 31)\n    elseif p == \"H\" then\n      x = \"f\"..band(rshift(op, 16), 31)\n    elseif p == \"R\" then\n      x = \"f\"..band(rshift(op, 21), 31)\n    elseif p == \"A\" then\n      x = band(rshift(op, 6), 31)\n    elseif p == \"E\" then\n      x = band(rshift(op, 6), 31) + 32\n    elseif p == \"M\" then\n      x = band(rshift(op, 11), 31)\n    elseif p == \"N\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"C\" then\n      x = band(rshift(op, 18), 7)\n      if x == 0 then x = nil end\n    elseif p == \"K\" then\n      x = band(rshift(op, 11), 31) + 1\n    elseif p == \"P\" then\n      x = band(rshift(op, 11), 31) + 33\n    elseif p == \"L\" then\n      x = band(rshift(op, 11), 31) - last + 1\n    elseif p == \"Q\" then\n      x = band(rshift(op, 11), 31) - last + 33\n    elseif p == \"I\" then\n      x = arshift(lshift(op, 16), 16)\n    elseif p == \"U\" then\n      x = band(op, 0xffff)\n    elseif p == \"O\" then\n      local disp = arshift(lshift(op, 16), 16)\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p == \"X\" then\n      local index = map_gpr[band(rshift(op, 16), 31)]\n      operands[#operands] = format(\"%s(%s)\", index, last)\n    elseif p == \"B\" then\n      x = ctx.addr + ctx.pos + arshift(lshift(op, 16), 16)*4 + 4\n      ctx.rel = x\n      x = format(\"0x%08x\", x)\n    elseif p == \"J\" then\n      local a = ctx.addr + ctx.pos\n      x = a - band(a, 0x0fffffff) + band(op, 0x03ffffff)*4\n      ctx.rel = x\n      x = format(\"0x%08x\", x)\n    elseif p == \"V\" then\n      x = band(rshift(op, 8), 7)\n      if x == 0 then x = nil end\n    elseif p == \"W\" then\n      x = band(op, 7)\n      if x == 0 then x = nil end\n    elseif p == \"Y\" then\n      x = band(rshift(op, 6), 0x000fffff)\n      if x == 0 then x = nil end\n    elseif p == \"Z\" then\n      x = band(rshift(op, 6), 1023)\n      if x == 0 then x = nil end\n    elseif p == \"0\" then\n      if last == \"r0\" or last == 0 then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tif altname then\n\t  local a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\t  if a1 then name, altname = a1, a2\n\t  else name = altname end\n\tend\n      end\n    elseif p == \"1\" then\n      if last == \"ra\" then\n\toperands[#operands] = nil\n      end\n    else\n      assert(false)\n    end\n    if x then operands[#operands+1] = x; last = x end\n  end\n\n  return putop(ctx, name, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  stop = stop - stop % 4\n  ctx.pos = ofs - ofs % 4\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  ctx.get = get_be\n  return ctx\nend\n\nlocal function create_el(code, addr, out)\n  local ctx = create(code, addr, out)\n  ctx.get = get_le\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\nlocal function disass_el(code, addr, out)\n  create_el(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_gpr[r] end\n  return \"f\"..(r-32)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  create_el = create_el,\n  disass = disass,\n  disass_el = disass_el,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_mips64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS64 disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the big-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create,\n  disass = dis_mips.disass,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_mips64el.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS64EL disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the little-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create_el,\n  disass = dis_mips.disass_el,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_mipsel.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPSEL disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the little-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create_el,\n  disass = dis_mips.disass_el,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_ppc.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT PPC disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT/X license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles all common, non-privileged 32/64 bit PowerPC instructions\n-- plus the e500 SPE instructions and some Cell/Xenon extensions.\n--\n-- NYI: VMX, VMX128\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal byte, format = string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, tohex = bit.band, bit.bor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Primary and extended opcode maps\n------------------------------------------------------------------------------\n\nlocal map_crops = {\n  shift = 1, mask = 1023,\n  [0] = \"mcrfXX\",\n  [33] = \"crnor|crnotCCC=\", [129] = \"crandcCCC\",\n  [193] = \"crxor|crclrCCC%\", [225] = \"crnandCCC\",\n  [257] = \"crandCCC\", [289] = \"creqv|crsetCCC%\",\n  [417] = \"crorcCCC\", [449] = \"cror|crmoveCCC=\",\n  [16] = \"b_lrKB\", [528] = \"b_ctrKB\",\n  [150] = \"isync\",\n}\n\nlocal map_rlwinm = setmetatable({\n  shift = 0, mask = -1,\n},\n{ __index = function(t, x)\n    local rot = band(rshift(x, 11), 31)\n    local mb = band(rshift(x, 6), 31)\n    local me = band(rshift(x, 1), 31)\n    if mb == 0 and me == 31-rot then\n      return \"slwiRR~A.\"\n    elseif me == 31 and mb == 32-rot then\n      return \"srwiRR~-A.\"\n    else\n      return \"rlwinmRR~AAA.\"\n    end\n  end\n})\n\nlocal map_rld = {\n  shift = 2, mask = 7,\n  [0] = \"rldiclRR~HM.\", \"rldicrRR~HM.\", \"rldicRR~HM.\", \"rldimiRR~HM.\",\n  {\n    shift = 1, mask = 1,\n    [0] = \"rldclRR~RM.\", \"rldcrRR~RM.\",\n  },\n}\n\nlocal map_ext = setmetatable({\n  shift = 1, mask = 1023,\n\n  [0] = \"cmp_YLRR\", [32] = \"cmpl_YLRR\",\n  [4] = \"twARR\", [68] = \"tdARR\",\n\n  [8] = \"subfcRRR.\", [40] = \"subfRRR.\",\n  [104] = \"negRR.\", [136] = \"subfeRRR.\",\n  [200] = \"subfzeRR.\", [232] = \"subfmeRR.\",\n  [520] = \"subfcoRRR.\", [552] = \"subfoRRR.\",\n  [616] = \"negoRR.\", [648] = \"subfeoRRR.\",\n  [712] = \"subfzeoRR.\", [744] = \"subfmeoRR.\",\n\n  [9] = \"mulhduRRR.\", [73] = \"mulhdRRR.\", [233] = \"mulldRRR.\",\n  [457] = \"divduRRR.\", [489] = \"divdRRR.\",\n  [745] = \"mulldoRRR.\",\n  [969] = \"divduoRRR.\", [1001] = \"divdoRRR.\",\n\n  [10] = \"addcRRR.\", [138] = \"addeRRR.\",\n  [202] = \"addzeRR.\", [234] = \"addmeRR.\", [266] = \"addRRR.\",\n  [522] = \"addcoRRR.\", [650] = \"addeoRRR.\",\n  [714] = \"addzeoRR.\", [746] = \"addmeoRR.\", [778] = \"addoRRR.\",\n\n  [11] = \"mulhwuRRR.\", [75] = \"mulhwRRR.\", [235] = \"mullwRRR.\",\n  [459] = \"divwuRRR.\", [491] = \"divwRRR.\",\n  [747] = \"mullwoRRR.\",\n  [971] = \"divwouRRR.\", [1003] = \"divwoRRR.\",\n\n  [15] = \"iselltRRR\", [47] = \"iselgtRRR\", [79] = \"iseleqRRR\",\n\n  [144] = { shift = 20, mask = 1, [0] = \"mtcrfRZ~\", \"mtocrfRZ~\", },\n  [19] = { shift = 20, mask = 1, [0] = \"mfcrR\", \"mfocrfRZ\", },\n  [371] = { shift = 11, mask = 1023, [392] = \"mftbR\", [424] = \"mftbuR\", },\n  [339] = {\n    shift = 11, mask = 1023,\n    [32] = \"mferR\", [256] = \"mflrR\", [288] = \"mfctrR\", [16] = \"mfspefscrR\",\n  },\n  [467] = {\n    shift = 11, mask = 1023,\n    [32] = \"mtxerR\", [256] = \"mtlrR\", [288] = \"mtctrR\", [16] = \"mtspefscrR\",\n  },\n\n  [20] = \"lwarxRR0R\", [84] = \"ldarxRR0R\",\n\n  [21] = \"ldxRR0R\", [53] = \"lduxRRR\",\n  [149] = \"stdxRR0R\", [181] = \"stduxRRR\",\n  [341] = \"lwaxRR0R\", [373] = \"lwauxRRR\",\n\n  [23] = \"lwzxRR0R\", [55] = \"lwzuxRRR\",\n  [87] = \"lbzxRR0R\", [119] = \"lbzuxRRR\",\n  [151] = \"stwxRR0R\", [183] = \"stwuxRRR\",\n  [215] = \"stbxRR0R\", [247] = \"stbuxRRR\",\n  [279] = \"lhzxRR0R\", [311] = \"lhzuxRRR\",\n  [343] = \"lhaxRR0R\", [375] = \"lhauxRRR\",\n  [407] = \"sthxRR0R\", [439] = \"sthuxRRR\",\n\n  [54] = \"dcbst-R0R\", [86] = \"dcbf-R0R\",\n  [150] = \"stwcxRR0R.\", [214] = \"stdcxRR0R.\",\n  [246] = \"dcbtst-R0R\", [278] = \"dcbt-R0R\",\n  [310] = \"eciwxRR0R\", [438] = \"ecowxRR0R\",\n  [470] = \"dcbi-RR\",\n\n  [598] = {\n    shift = 21, mask = 3,\n    [0] = \"sync\", \"lwsync\", \"ptesync\",\n  },\n  [758] = \"dcba-RR\",\n  [854] = \"eieio\", [982] = \"icbi-R0R\", [1014] = \"dcbz-R0R\",\n\n  [26] = \"cntlzwRR~\", [58] = \"cntlzdRR~\",\n  [122] = \"popcntbRR~\",\n  [154] = \"prtywRR~\", [186] = \"prtydRR~\",\n\n  [28] = \"andRR~R.\", [60] = \"andcRR~R.\", [124] = \"nor|notRR~R=.\",\n  [284] = \"eqvRR~R.\", [316] = \"xorRR~R.\",\n  [412] = \"orcRR~R.\", [444] = \"or|mrRR~R=.\", [476] = \"nandRR~R.\",\n  [508] = \"cmpbRR~R\",\n\n  [512] = \"mcrxrX\",\n\n  [532] = \"ldbrxRR0R\", [660] = \"stdbrxRR0R\",\n\n  [533] = \"lswxRR0R\", [597] = \"lswiRR0A\",\n  [661] = \"stswxRR0R\", [725] = \"stswiRR0A\",\n\n  [534] = \"lwbrxRR0R\", [662] = \"stwbrxRR0R\",\n  [790] = \"lhbrxRR0R\", [918] = \"sthbrxRR0R\",\n\n  [535] = \"lfsxFR0R\", [567] = \"lfsuxFRR\",\n  [599] = \"lfdxFR0R\", [631] = \"lfduxFRR\",\n  [663] = \"stfsxFR0R\", [695] = \"stfsuxFRR\",\n  [727] = \"stfdxFR0R\", [759] = \"stfduxFR0R\",\n  [855] = \"lfiwaxFR0R\",\n  [983] = \"stfiwxFR0R\",\n\n  [24] = \"slwRR~R.\",\n\n  [27] = \"sldRR~R.\", [536] = \"srwRR~R.\",\n  [792] = \"srawRR~R.\", [824] = \"srawiRR~A.\",\n\n  [794] = \"sradRR~R.\", [826] = \"sradiRR~H.\", [827] = \"sradiRR~H.\",\n  [922] = \"extshRR~.\", [954] = \"extsbRR~.\", [986] = \"extswRR~.\",\n\n  [539] = \"srdRR~R.\",\n},\n{ __index = function(t, x)\n    if band(x, 31) == 15 then return \"iselRRRC\" end\n  end\n})\n\nlocal map_ld = {\n  shift = 0, mask = 3,\n  [0] = \"ldRRE\", \"lduRRE\", \"lwaRRE\",\n}\n\nlocal map_std = {\n  shift = 0, mask = 3,\n  [0] = \"stdRRE\", \"stduRRE\",\n}\n\nlocal map_fps = {\n  shift = 5, mask = 1,\n  {\n    shift = 1, mask = 15,\n    [0] = false, false, \"fdivsFFF.\", false,\n    \"fsubsFFF.\", \"faddsFFF.\", \"fsqrtsF-F.\", false,\n    \"fresF-F.\", \"fmulsFF-F.\", \"frsqrtesF-F.\", false,\n    \"fmsubsFFFF~.\", \"fmaddsFFFF~.\", \"fnmsubsFFFF~.\", \"fnmaddsFFFF~.\",\n  }\n}\n\nlocal map_fpd = {\n  shift = 5, mask = 1,\n  [0] = {\n    shift = 1, mask = 1023,\n    [0] = \"fcmpuXFF\", [32] = \"fcmpoXFF\", [64] = \"mcrfsXX\",\n    [38] = \"mtfsb1A.\", [70] = \"mtfsb0A.\", [134] = \"mtfsfiA>>-A>\",\n    [8] = \"fcpsgnFFF.\", [40] = \"fnegF-F.\", [72] = \"fmrF-F.\",\n    [136] = \"fnabsF-F.\", [264] = \"fabsF-F.\",\n    [12] = \"frspF-F.\",\n    [14] = \"fctiwF-F.\", [15] = \"fctiwzF-F.\",\n    [583] = \"mffsF.\", [711] = \"mtfsfZF.\",\n    [392] = \"frinF-F.\", [424] = \"frizF-F.\",\n    [456] = \"fripF-F.\", [488] = \"frimF-F.\",\n    [814] = \"fctidF-F.\", [815] = \"fctidzF-F.\", [846] = \"fcfidF-F.\",\n  },\n  {\n    shift = 1, mask = 15,\n    [0] = false, false, \"fdivFFF.\", false,\n    \"fsubFFF.\", \"faddFFF.\", \"fsqrtF-F.\", \"fselFFFF~.\",\n    \"freF-F.\", \"fmulFF-F.\", \"frsqrteF-F.\", false,\n    \"fmsubFFFF~.\", \"fmaddFFFF~.\", \"fnmsubFFFF~.\", \"fnmaddFFFF~.\",\n  }\n}\n\nlocal map_spe = {\n  shift = 0, mask = 2047,\n\n  [512] = \"evaddwRRR\", [514] = \"evaddiwRAR~\",\n  [516] = \"evsubwRRR~\", [518] = \"evsubiwRAR~\",\n  [520] = \"evabsRR\", [521] = \"evnegRR\",\n  [522] = \"evextsbRR\", [523] = \"evextshRR\", [524] = \"evrndwRR\",\n  [525] = \"evcntlzwRR\", [526] = \"evcntlswRR\",\n\n  [527] = \"brincRRR\",\n\n  [529] = \"evandRRR\", [530] = \"evandcRRR\", [534] = \"evxorRRR\",\n  [535] = \"evor|evmrRRR=\", [536] = \"evnor|evnotRRR=\",\n  [537] = \"eveqvRRR\", [539] = \"evorcRRR\", [542] = \"evnandRRR\",\n\n  [544] = \"evsrwuRRR\", [545] = \"evsrwsRRR\",\n  [546] = \"evsrwiuRRA\", [547] = \"evsrwisRRA\",\n  [548] = \"evslwRRR\", [550] = \"evslwiRRA\",\n  [552] = \"evrlwRRR\", [553] = \"evsplatiRS\",\n  [554] = \"evrlwiRRA\", [555] = \"evsplatfiRS\",\n  [556] = \"evmergehiRRR\", [557] = \"evmergeloRRR\",\n  [558] = \"evmergehiloRRR\", [559] = \"evmergelohiRRR\",\n\n  [560] = \"evcmpgtuYRR\", [561] = \"evcmpgtsYRR\",\n  [562] = \"evcmpltuYRR\", [563] = \"evcmpltsYRR\",\n  [564] = \"evcmpeqYRR\",\n\n  [632] = \"evselRRR\", [633] = \"evselRRRW\",\n  [634] = \"evselRRRW\", [635] = \"evselRRRW\",\n  [636] = \"evselRRRW\", [637] = \"evselRRRW\",\n  [638] = \"evselRRRW\", [639] = \"evselRRRW\",\n\n  [640] = \"evfsaddRRR\", [641] = \"evfssubRRR\",\n  [644] = \"evfsabsRR\", [645] = \"evfsnabsRR\", [646] = \"evfsnegRR\",\n  [648] = \"evfsmulRRR\", [649] = \"evfsdivRRR\",\n  [652] = \"evfscmpgtYRR\", [653] = \"evfscmpltYRR\", [654] = \"evfscmpeqYRR\",\n  [656] = \"evfscfuiR-R\", [657] = \"evfscfsiR-R\",\n  [658] = \"evfscfufR-R\", [659] = \"evfscfsfR-R\",\n  [660] = \"evfsctuiR-R\", [661] = \"evfsctsiR-R\",\n  [662] = \"evfsctufR-R\", [663] = \"evfsctsfR-R\",\n  [664] = \"evfsctuizR-R\", [666] = \"evfsctsizR-R\",\n  [668] = \"evfststgtYRR\", [669] = \"evfststltYRR\", [670] = \"evfststeqYRR\",\n\n  [704] = \"efsaddRRR\", [705] = \"efssubRRR\",\n  [708] = \"efsabsRR\", [709] = \"efsnabsRR\", [710] = \"efsnegRR\",\n  [712] = \"efsmulRRR\", [713] = \"efsdivRRR\",\n  [716] = \"efscmpgtYRR\", [717] = \"efscmpltYRR\", [718] = \"efscmpeqYRR\",\n  [719] = \"efscfdR-R\",\n  [720] = \"efscfuiR-R\", [721] = \"efscfsiR-R\",\n  [722] = \"efscfufR-R\", [723] = \"efscfsfR-R\",\n  [724] = \"efsctuiR-R\", [725] = \"efsctsiR-R\",\n  [726] = \"efsctufR-R\", [727] = \"efsctsfR-R\",\n  [728] = \"efsctuizR-R\", [730] = \"efsctsizR-R\",\n  [732] = \"efststgtYRR\", [733] = \"efststltYRR\", [734] = \"efststeqYRR\",\n\n  [736] = \"efdaddRRR\", [737] = \"efdsubRRR\",\n  [738] = \"efdcfuidR-R\", [739] = \"efdcfsidR-R\",\n  [740] = \"efdabsRR\", [741] = \"efdnabsRR\", [742] = \"efdnegRR\",\n  [744] = \"efdmulRRR\", [745] = \"efddivRRR\",\n  [746] = \"efdctuidzR-R\", [747] = \"efdctsidzR-R\",\n  [748] = \"efdcmpgtYRR\", [749] = \"efdcmpltYRR\", [750] = \"efdcmpeqYRR\",\n  [751] = \"efdcfsR-R\",\n  [752] = \"efdcfuiR-R\", [753] = \"efdcfsiR-R\",\n  [754] = \"efdcfufR-R\", [755] = \"efdcfsfR-R\",\n  [756] = \"efdctuiR-R\", [757] = \"efdctsiR-R\",\n  [758] = \"efdctufR-R\", [759] = \"efdctsfR-R\",\n  [760] = \"efdctuizR-R\", [762] = \"efdctsizR-R\",\n  [764] = \"efdtstgtYRR\", [765] = \"efdtstltYRR\", [766] = \"efdtsteqYRR\",\n\n  [768] = \"evlddxRR0R\", [769] = \"evlddRR8\",\n  [770] = \"evldwxRR0R\", [771] = \"evldwRR8\",\n  [772] = \"evldhxRR0R\", [773] = \"evldhRR8\",\n  [776] = \"evlhhesplatxRR0R\", [777] = \"evlhhesplatRR2\",\n  [780] = \"evlhhousplatxRR0R\", [781] = \"evlhhousplatRR2\",\n  [782] = \"evlhhossplatxRR0R\", [783] = \"evlhhossplatRR2\",\n  [784] = \"evlwhexRR0R\", [785] = \"evlwheRR4\",\n  [788] = \"evlwhouxRR0R\", [789] = \"evlwhouRR4\",\n  [790] = \"evlwhosxRR0R\", [791] = \"evlwhosRR4\",\n  [792] = \"evlwwsplatxRR0R\", [793] = \"evlwwsplatRR4\",\n  [796] = \"evlwhsplatxRR0R\", [797] = \"evlwhsplatRR4\",\n\n  [800] = \"evstddxRR0R\", [801] = \"evstddRR8\",\n  [802] = \"evstdwxRR0R\", [803] = \"evstdwRR8\",\n  [804] = \"evstdhxRR0R\", [805] = \"evstdhRR8\",\n  [816] = \"evstwhexRR0R\", [817] = \"evstwheRR4\",\n  [820] = \"evstwhoxRR0R\", [821] = \"evstwhoRR4\",\n  [824] = \"evstwwexRR0R\", [825] = \"evstwweRR4\",\n  [828] = \"evstwwoxRR0R\", [829] = \"evstwwoRR4\",\n\n  [1027] = \"evmhessfRRR\", [1031] = \"evmhossfRRR\", [1032] = \"evmheumiRRR\",\n  [1033] = \"evmhesmiRRR\", [1035] = \"evmhesmfRRR\", [1036] = \"evmhoumiRRR\",\n  [1037] = \"evmhosmiRRR\", [1039] = \"evmhosmfRRR\", [1059] = \"evmhessfaRRR\",\n  [1063] = \"evmhossfaRRR\", [1064] = \"evmheumiaRRR\", [1065] = \"evmhesmiaRRR\",\n  [1067] = \"evmhesmfaRRR\", [1068] = \"evmhoumiaRRR\", [1069] = \"evmhosmiaRRR\",\n  [1071] = \"evmhosmfaRRR\", [1095] = \"evmwhssfRRR\", [1096] = \"evmwlumiRRR\",\n  [1100] = \"evmwhumiRRR\", [1101] = \"evmwhsmiRRR\", [1103] = \"evmwhsmfRRR\",\n  [1107] = \"evmwssfRRR\", [1112] = \"evmwumiRRR\", [1113] = \"evmwsmiRRR\",\n  [1115] = \"evmwsmfRRR\", [1127] = \"evmwhssfaRRR\", [1128] = \"evmwlumiaRRR\",\n  [1132] = \"evmwhumiaRRR\", [1133] = \"evmwhsmiaRRR\", [1135] = \"evmwhsmfaRRR\",\n  [1139] = \"evmwssfaRRR\", [1144] = \"evmwumiaRRR\", [1145] = \"evmwsmiaRRR\",\n  [1147] = \"evmwsmfaRRR\",\n\n  [1216] = \"evaddusiaawRR\", [1217] = \"evaddssiaawRR\",\n  [1218] = \"evsubfusiaawRR\", [1219] = \"evsubfssiaawRR\",\n  [1220] = \"evmraRR\",\n  [1222] = \"evdivwsRRR\", [1223] = \"evdivwuRRR\",\n  [1224] = \"evaddumiaawRR\", [1225] = \"evaddsmiaawRR\",\n  [1226] = \"evsubfumiaawRR\", [1227] = \"evsubfsmiaawRR\",\n\n  [1280] = \"evmheusiaawRRR\", [1281] = \"evmhessiaawRRR\",\n  [1283] = \"evmhessfaawRRR\", [1284] = \"evmhousiaawRRR\",\n  [1285] = \"evmhossiaawRRR\", [1287] = \"evmhossfaawRRR\",\n  [1288] = \"evmheumiaawRRR\", [1289] = \"evmhesmiaawRRR\",\n  [1291] = \"evmhesmfaawRRR\", [1292] = \"evmhoumiaawRRR\",\n  [1293] = \"evmhosmiaawRRR\", [1295] = \"evmhosmfaawRRR\",\n  [1320] = \"evmhegumiaaRRR\", [1321] = \"evmhegsmiaaRRR\",\n  [1323] = \"evmhegsmfaaRRR\", [1324] = \"evmhogumiaaRRR\",\n  [1325] = \"evmhogsmiaaRRR\", [1327] = \"evmhogsmfaaRRR\",\n  [1344] = \"evmwlusiaawRRR\", [1345] = \"evmwlssiaawRRR\",\n  [1352] = \"evmwlumiaawRRR\", [1353] = \"evmwlsmiaawRRR\",\n  [1363] = \"evmwssfaaRRR\", [1368] = \"evmwumiaaRRR\",\n  [1369] = \"evmwsmiaaRRR\", [1371] = \"evmwsmfaaRRR\",\n  [1408] = \"evmheusianwRRR\", [1409] = \"evmhessianwRRR\",\n  [1411] = \"evmhessfanwRRR\", [1412] = \"evmhousianwRRR\",\n  [1413] = \"evmhossianwRRR\", [1415] = \"evmhossfanwRRR\",\n  [1416] = \"evmheumianwRRR\", [1417] = \"evmhesmianwRRR\",\n  [1419] = \"evmhesmfanwRRR\", [1420] = \"evmhoumianwRRR\",\n  [1421] = \"evmhosmianwRRR\", [1423] = \"evmhosmfanwRRR\",\n  [1448] = \"evmhegumianRRR\", [1449] = \"evmhegsmianRRR\",\n  [1451] = \"evmhegsmfanRRR\", [1452] = \"evmhogumianRRR\",\n  [1453] = \"evmhogsmianRRR\", [1455] = \"evmhogsmfanRRR\",\n  [1472] = \"evmwlusianwRRR\", [1473] = \"evmwlssianwRRR\",\n  [1480] = \"evmwlumianwRRR\", [1481] = \"evmwlsmianwRRR\",\n  [1491] = \"evmwssfanRRR\", [1496] = \"evmwumianRRR\",\n  [1497] = \"evmwsmianRRR\", [1499] = \"evmwsmfanRRR\",\n}\n\nlocal map_pri = {\n  [0] = false,\tfalse,\t\t\"tdiARI\",\t\"twiARI\",\n  map_spe,\tfalse,\t\tfalse,\t\t\"mulliRRI\",\n  \"subficRRI\",\tfalse,\t\t\"cmpl_iYLRU\",\t\"cmp_iYLRI\",\n  \"addicRRI\",\t\"addic.RRI\",\t\"addi|liRR0I\",\t\"addis|lisRR0I\",\n  \"b_KBJ\",\t\"sc\",\t\t \"bKJ\",\t\tmap_crops,\n  \"rlwimiRR~AAA.\", map_rlwinm,\tfalse,\t\t\"rlwnmRR~RAA.\",\n  \"oriNRR~U\",\t\"orisRR~U\",\t\"xoriRR~U\",\t\"xorisRR~U\",\n  \"andi.RR~U\",\t\"andis.RR~U\",\tmap_rld,\tmap_ext,\n  \"lwzRRD\",\t\"lwzuRRD\",\t\"lbzRRD\",\t\"lbzuRRD\",\n  \"stwRRD\",\t\"stwuRRD\",\t\"stbRRD\",\t\"stbuRRD\",\n  \"lhzRRD\",\t\"lhzuRRD\",\t\"lhaRRD\",\t\"lhauRRD\",\n  \"sthRRD\",\t\"sthuRRD\",\t\"lmwRRD\",\t\"stmwRRD\",\n  \"lfsFRD\",\t\"lfsuFRD\",\t\"lfdFRD\",\t\"lfduFRD\",\n  \"stfsFRD\",\t\"stfsuFRD\",\t\"stfdFRD\",\t\"stfduFRD\",\n  false,\tfalse,\t\tmap_ld,\t\tmap_fps,\n  false,\tfalse,\t\tmap_std,\tmap_fpd,\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"sp\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\",\n  \"r16\", \"r17\", \"r18\", \"r19\", \"r20\", \"r21\", \"r22\", \"r23\",\n  \"r24\", \"r25\", \"r26\", \"r27\", \"r28\", \"r29\", \"r30\", \"r31\",\n}\n\nlocal map_cond = { [0] = \"lt\", \"gt\", \"eq\", \"so\", \"ge\", \"le\", \"ne\", \"ns\", }\n\n-- Format a condition bit.\nlocal function condfmt(cond)\n  if cond <= 3 then\n    return map_cond[band(cond, 3)]\n  else\n    return format(\"4*cr%d+%s\", rshift(cond, 2), map_cond[band(cond, 3)])\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then extra = \"\\t->\"..sym end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-7s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-7s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3)\n  local operands = {}\n  local last = nil\n  local rs = 21\n  ctx.op = op\n  ctx.rel = nil\n\n  local opat = map_pri[rshift(b0, 2)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)]\n  end\n  local name, pat = match(opat, \"^([a-z0-9_.]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.]*)(.*)\")\n  if altname then pat = pat2 end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"R\" then\n      x = map_gpr[band(rshift(op, rs), 31)]\n      rs = rs - 5\n    elseif p == \"F\" then\n      x = \"f\"..band(rshift(op, rs), 31)\n      rs = rs - 5\n    elseif p == \"A\" then\n      x = band(rshift(op, rs), 31)\n      rs = rs - 5\n    elseif p == \"S\" then\n      x = arshift(lshift(op, 27-rs), 27)\n      rs = rs - 5\n    elseif p == \"I\" then\n      x = arshift(lshift(op, 16), 16)\n    elseif p == \"U\" then\n      x = band(op, 0xffff)\n    elseif p == \"D\" or p == \"E\" then\n      local disp = arshift(lshift(op, 16), 16)\n      if p == \"E\" then disp = band(disp, -4) end\n      if last == \"r0\" then last = \"0\" end\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p >= \"2\" and p <= \"8\" then\n      local disp = band(rshift(op, rs), 31) * p\n      if last == \"r0\" then last = \"0\" end\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p == \"H\" then\n      x = band(rshift(op, rs), 31) + lshift(band(op, 2), 4)\n      rs = rs - 5\n    elseif p == \"M\" then\n      x = band(rshift(op, rs), 31) + band(op, 0x20)\n    elseif p == \"C\" then\n      x = condfmt(band(rshift(op, rs), 31))\n      rs = rs - 5\n    elseif p == \"B\" then\n      local bo = rshift(op, 21)\n      local cond = band(rshift(op, 16), 31)\n      local cn = \"\"\n      rs = rs - 10\n      if band(bo, 4) == 0 then\n\tcn = band(bo, 2) == 0 and \"dnz\" or \"dz\"\n\tif band(bo, 0x10) == 0 then\n\t  cn = cn..(band(bo, 8) == 0 and \"f\" or \"t\")\n\tend\n\tif band(bo, 0x10) == 0 then x = condfmt(cond) end\n\tname = name..(band(bo, 1) == band(rshift(op, 15), 1) and \"-\" or \"+\")\n      elseif band(bo, 0x10) == 0 then\n\tcn = map_cond[band(cond, 3) + (band(bo, 8) == 0 and 4 or 0)]\n\tif cond > 3 then x = \"cr\"..rshift(cond, 2) end\n\tname = name..(band(bo, 1) == band(rshift(op, 15), 1) and \"-\" or \"+\")\n      end\n      name = gsub(name, \"_\", cn)\n    elseif p == \"J\" then\n      x = arshift(lshift(op, 27-rs), 29-rs)*4\n      if band(op, 2) == 0 then x = ctx.addr + pos + x end\n      ctx.rel = x\n      x = \"0x\"..tohex(x)\n    elseif p == \"K\" then\n      if band(op, 1) ~= 0 then name = name..\"l\" end\n      if band(op, 2) ~= 0 then name = name..\"a\" end\n    elseif p == \"X\" or p == \"Y\" then\n      x = band(rshift(op, rs+2), 7)\n      if x == 0 and p == \"Y\" then x = nil else x = \"cr\"..x end\n      rs = rs - 5\n    elseif p == \"W\" then\n      x = \"cr\"..band(op, 7)\n    elseif p == \"Z\" then\n      x = band(rshift(op, rs-4), 255)\n      rs = rs - 10\n    elseif p == \">\" then\n      operands[#operands] = rshift(operands[#operands], 1)\n    elseif p == \"0\" then\n      if last == \"r0\" then\n\toperands[#operands] = nil\n\tif altname then name = altname end\n      end\n    elseif p == \"L\" then\n      name = gsub(name, \"_\", band(op, 0x00200000) ~= 0 and \"d\" or \"w\")\n    elseif p == \".\" then\n      if band(op, 1) == 1 then name = name..\".\" end\n    elseif p == \"N\" then\n      if op == 0x60000000 then name = \"nop\"; break end\n    elseif p == \"~\" then\n      local n = #operands\n      operands[n-1],  operands[n] = operands[n], operands[n-1]\n    elseif p == \"=\" then\n      local n = #operands\n      if last == operands[n-1] then\n\toperands[n] = nil\n\tname = altname\n      end\n    elseif p == \"%\" then\n      local n = #operands\n      if last == operands[n-1] and last == operands[n-2] then\n\toperands[n] = nil\n\toperands[n-1] = nil\n\tname = altname\n      end\n    elseif p == \"-\" then\n      rs = rs - 5\n    else\n      assert(false)\n    end\n    if x then operands[#operands+1] = x; last = x end\n  end\n\n  return putop(ctx, name, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  stop = stop - stop % 4\n  ctx.pos = ofs - ofs % 4\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_gpr[r] end\n  return \"f\"..(r-32)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_x64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT x64 disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the 64 bit functions from the combined\n-- x86/x64 disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_x86 = require((string.match(..., \".*%.\") or \"\")..\"dis_x86\")\nreturn {\n  create = dis_x86.create64,\n  disass = dis_x86.disass64,\n  regname = dis_x86.regname64\n}\n\n"
  },
  {
    "path": "Luajit/jit/dis_x86.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT x86/x64 disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- Sending small code snippets to an external disassembler and mixing the\n-- output with our own stuff was too fragile. So I had to bite the bullet\n-- and write yet another x86 disassembler. Oh well ...\n--\n-- The output format is very similar to what ndisasm generates. But it has\n-- been developed independently by looking at the opcode tables from the\n-- Intel and AMD manuals. The supported instruction set is quite extensive\n-- and reflects what a current generation Intel or AMD CPU implements in\n-- 32 bit and 64 bit mode. Yes, this includes MMX, SSE, SSE2, SSE3, SSSE3,\n-- SSE4.1, SSE4.2, SSE4a, AVX, AVX2 and even privileged and hypervisor\n-- (VMX/SVM) instructions.\n--\n-- Notes:\n-- * The (useless) a16 prefix, 3DNow and pre-586 opcodes are unsupported.\n-- * No attempt at optimization has been made -- it's fast enough for my needs.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal lower, rep = string.lower, string.rep\nlocal bit = require(\"bit\")\nlocal tohex = bit.tohex\n\n-- Map for 1st opcode byte in 32 bit mode. Ugly? Well ... read on.\nlocal map_opc1_32 = {\n--0x\n[0]=\"addBmr\",\"addVmr\",\"addBrm\",\"addVrm\",\"addBai\",\"addVai\",\"push es\",\"pop es\",\n\"orBmr\",\"orVmr\",\"orBrm\",\"orVrm\",\"orBai\",\"orVai\",\"push cs\",\"opc2*\",\n--1x\n\"adcBmr\",\"adcVmr\",\"adcBrm\",\"adcVrm\",\"adcBai\",\"adcVai\",\"push ss\",\"pop ss\",\n\"sbbBmr\",\"sbbVmr\",\"sbbBrm\",\"sbbVrm\",\"sbbBai\",\"sbbVai\",\"push ds\",\"pop ds\",\n--2x\n\"andBmr\",\"andVmr\",\"andBrm\",\"andVrm\",\"andBai\",\"andVai\",\"es:seg\",\"daa\",\n\"subBmr\",\"subVmr\",\"subBrm\",\"subVrm\",\"subBai\",\"subVai\",\"cs:seg\",\"das\",\n--3x\n\"xorBmr\",\"xorVmr\",\"xorBrm\",\"xorVrm\",\"xorBai\",\"xorVai\",\"ss:seg\",\"aaa\",\n\"cmpBmr\",\"cmpVmr\",\"cmpBrm\",\"cmpVrm\",\"cmpBai\",\"cmpVai\",\"ds:seg\",\"aas\",\n--4x\n\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\n\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\n--5x\n\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\n\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\n--6x\n\"sz*pushaw,pusha\",\"sz*popaw,popa\",\"boundVrm\",\"arplWmr\",\n\"fs:seg\",\"gs:seg\",\"o16:\",\"a16\",\n\"pushUi\",\"imulVrmi\",\"pushBs\",\"imulVrms\",\n\"insb\",\"insVS\",\"outsb\",\"outsVS\",\n--7x\n\"joBj\",\"jnoBj\",\"jbBj\",\"jnbBj\",\"jzBj\",\"jnzBj\",\"jbeBj\",\"jaBj\",\n\"jsBj\",\"jnsBj\",\"jpeBj\",\"jpoBj\",\"jlBj\",\"jgeBj\",\"jleBj\",\"jgBj\",\n--8x\n\"arith!Bmi\",\"arith!Vmi\",\"arith!Bmi\",\"arith!Vms\",\n\"testBmr\",\"testVmr\",\"xchgBrm\",\"xchgVrm\",\n\"movBmr\",\"movVmr\",\"movBrm\",\"movVrm\",\n\"movVmg\",\"leaVrm\",\"movWgm\",\"popUm\",\n--9x\n\"nop*xchgVaR|pause|xchgWaR|repne nop\",\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\n\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\n\"sz*cbw,cwde,cdqe\",\"sz*cwd,cdq,cqo\",\"call farViw\",\"wait\",\n\"sz*pushfw,pushf\",\"sz*popfw,popf\",\"sahf\",\"lahf\",\n--Ax\n\"movBao\",\"movVao\",\"movBoa\",\"movVoa\",\n\"movsb\",\"movsVS\",\"cmpsb\",\"cmpsVS\",\n\"testBai\",\"testVai\",\"stosb\",\"stosVS\",\n\"lodsb\",\"lodsVS\",\"scasb\",\"scasVS\",\n--Bx\n\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\n\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\n--Cx\n\"shift!Bmu\",\"shift!Vmu\",\"retBw\",\"ret\",\"vex*3$lesVrm\",\"vex*2$ldsVrm\",\"movBmi\",\"movVmi\",\n\"enterBwu\",\"leave\",\"retfBw\",\"retf\",\"int3\",\"intBu\",\"into\",\"iretVS\",\n--Dx\n\"shift!Bm1\",\"shift!Vm1\",\"shift!Bmc\",\"shift!Vmc\",\"aamBu\",\"aadBu\",\"salc\",\"xlatb\",\n\"fp*0\",\"fp*1\",\"fp*2\",\"fp*3\",\"fp*4\",\"fp*5\",\"fp*6\",\"fp*7\",\n--Ex\n\"loopneBj\",\"loopeBj\",\"loopBj\",\"sz*jcxzBj,jecxzBj,jrcxzBj\",\n\"inBau\",\"inVau\",\"outBua\",\"outVua\",\n\"callVj\",\"jmpVj\",\"jmp farViw\",\"jmpBj\",\"inBad\",\"inVad\",\"outBda\",\"outVda\",\n--Fx\n\"lock:\",\"int1\",\"repne:rep\",\"rep:\",\"hlt\",\"cmc\",\"testb!Bm\",\"testv!Vm\",\n\"clc\",\"stc\",\"cli\",\"sti\",\"cld\",\"std\",\"incb!Bm\",\"incd!Vm\",\n}\nassert(#map_opc1_32 == 255)\n\n-- Map for 1st opcode byte in 64 bit mode (overrides only).\nlocal map_opc1_64 = setmetatable({\n  [0x06]=false, [0x07]=false, [0x0e]=false,\n  [0x16]=false, [0x17]=false, [0x1e]=false, [0x1f]=false,\n  [0x27]=false, [0x2f]=false, [0x37]=false, [0x3f]=false,\n  [0x60]=false, [0x61]=false, [0x62]=false, [0x63]=\"movsxdVrDmt\", [0x67]=\"a32:\",\n  [0x40]=\"rex*\",   [0x41]=\"rex*b\",   [0x42]=\"rex*x\",   [0x43]=\"rex*xb\",\n  [0x44]=\"rex*r\",  [0x45]=\"rex*rb\",  [0x46]=\"rex*rx\",  [0x47]=\"rex*rxb\",\n  [0x48]=\"rex*w\",  [0x49]=\"rex*wb\",  [0x4a]=\"rex*wx\",  [0x4b]=\"rex*wxb\",\n  [0x4c]=\"rex*wr\", [0x4d]=\"rex*wrb\", [0x4e]=\"rex*wrx\", [0x4f]=\"rex*wrxb\",\n  [0x82]=false, [0x9a]=false, [0xc4]=\"vex*3\", [0xc5]=\"vex*2\", [0xce]=false,\n  [0xd4]=false, [0xd5]=false, [0xd6]=false, [0xea]=false,\n}, { __index = map_opc1_32 })\n\n-- Map for 2nd opcode byte (0F xx). True CISC hell. Hey, I told you.\n-- Prefix dependent MMX/SSE opcodes: (none)|rep|o16|repne, -|F3|66|F2\nlocal map_opc2 = {\n--0x\n[0]=\"sldt!Dmp\",\"sgdt!Ump\",\"larVrm\",\"lslVrm\",nil,\"syscall\",\"clts\",\"sysret\",\n\"invd\",\"wbinvd\",nil,\"ud1\",nil,\"$prefetch!Bm\",\"femms\",\"3dnowMrmu\",\n--1x\n\"movupsXrm|movssXrvm|movupdXrm|movsdXrvm\",\n\"movupsXmr|movssXmvr|movupdXmr|movsdXmvr\",\n\"movhlpsXrm$movlpsXrm|movsldupXrm|movlpdXrm|movddupXrm\",\n\"movlpsXmr||movlpdXmr\",\n\"unpcklpsXrvm||unpcklpdXrvm\",\n\"unpckhpsXrvm||unpckhpdXrvm\",\n\"movlhpsXrm$movhpsXrm|movshdupXrm|movhpdXrm\",\n\"movhpsXmr||movhpdXmr\",\n\"$prefetcht!Bm\",\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\n\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\n--2x\n\"movUmx$\",\"movUmy$\",\"movUxm$\",\"movUym$\",\"movUmz$\",nil,\"movUzm$\",nil,\n\"movapsXrm||movapdXrm\",\n\"movapsXmr||movapdXmr\",\n\"cvtpi2psXrMm|cvtsi2ssXrvVmt|cvtpi2pdXrMm|cvtsi2sdXrvVmt\",\n\"movntpsXmr|movntssXmr|movntpdXmr|movntsdXmr\",\n\"cvttps2piMrXm|cvttss2siVrXm|cvttpd2piMrXm|cvttsd2siVrXm\",\n\"cvtps2piMrXm|cvtss2siVrXm|cvtpd2piMrXm|cvtsd2siVrXm\",\n\"ucomissXrm||ucomisdXrm\",\n\"comissXrm||comisdXrm\",\n--3x\n\"wrmsr\",\"rdtsc\",\"rdmsr\",\"rdpmc\",\"sysenter\",\"sysexit\",nil,\"getsec\",\n\"opc3*38\",nil,\"opc3*3a\",nil,nil,nil,nil,nil,\n--4x\n\"cmovoVrm\",\"cmovnoVrm\",\"cmovbVrm\",\"cmovnbVrm\",\n\"cmovzVrm\",\"cmovnzVrm\",\"cmovbeVrm\",\"cmovaVrm\",\n\"cmovsVrm\",\"cmovnsVrm\",\"cmovpeVrm\",\"cmovpoVrm\",\n\"cmovlVrm\",\"cmovgeVrm\",\"cmovleVrm\",\"cmovgVrm\",\n--5x\n\"movmskpsVrXm$||movmskpdVrXm$\",\"sqrtpsXrm|sqrtssXrm|sqrtpdXrm|sqrtsdXrm\",\n\"rsqrtpsXrm|rsqrtssXrvm\",\"rcppsXrm|rcpssXrvm\",\n\"andpsXrvm||andpdXrvm\",\"andnpsXrvm||andnpdXrvm\",\n\"orpsXrvm||orpdXrvm\",\"xorpsXrvm||xorpdXrvm\",\n\"addpsXrvm|addssXrvm|addpdXrvm|addsdXrvm\",\"mulpsXrvm|mulssXrvm|mulpdXrvm|mulsdXrvm\",\n\"cvtps2pdXrm|cvtss2sdXrvm|cvtpd2psXrm|cvtsd2ssXrvm\",\n\"cvtdq2psXrm|cvttps2dqXrm|cvtps2dqXrm\",\n\"subpsXrvm|subssXrvm|subpdXrvm|subsdXrvm\",\"minpsXrvm|minssXrvm|minpdXrvm|minsdXrvm\",\n\"divpsXrvm|divssXrvm|divpdXrvm|divsdXrvm\",\"maxpsXrvm|maxssXrvm|maxpdXrvm|maxsdXrvm\",\n--6x\n\"punpcklbwPrvm\",\"punpcklwdPrvm\",\"punpckldqPrvm\",\"packsswbPrvm\",\n\"pcmpgtbPrvm\",\"pcmpgtwPrvm\",\"pcmpgtdPrvm\",\"packuswbPrvm\",\n\"punpckhbwPrvm\",\"punpckhwdPrvm\",\"punpckhdqPrvm\",\"packssdwPrvm\",\n\"||punpcklqdqXrvm\",\"||punpckhqdqXrvm\",\n\"movPrVSm\",\"movqMrm|movdquXrm|movdqaXrm\",\n--7x\n\"pshufwMrmu|pshufhwXrmu|pshufdXrmu|pshuflwXrmu\",\"pshiftw!Pvmu\",\n\"pshiftd!Pvmu\",\"pshiftq!Mvmu||pshiftdq!Xvmu\",\n\"pcmpeqbPrvm\",\"pcmpeqwPrvm\",\"pcmpeqdPrvm\",\"emms*|\",\n\"vmreadUmr||extrqXmuu$|insertqXrmuu$\",\"vmwriteUrm||extrqXrm$|insertqXrm$\",\nnil,nil,\n\"||haddpdXrvm|haddpsXrvm\",\"||hsubpdXrvm|hsubpsXrvm\",\n\"movVSmMr|movqXrm|movVSmXr\",\"movqMmr|movdquXmr|movdqaXmr\",\n--8x\n\"joVj\",\"jnoVj\",\"jbVj\",\"jnbVj\",\"jzVj\",\"jnzVj\",\"jbeVj\",\"jaVj\",\n\"jsVj\",\"jnsVj\",\"jpeVj\",\"jpoVj\",\"jlVj\",\"jgeVj\",\"jleVj\",\"jgVj\",\n--9x\n\"setoBm\",\"setnoBm\",\"setbBm\",\"setnbBm\",\"setzBm\",\"setnzBm\",\"setbeBm\",\"setaBm\",\n\"setsBm\",\"setnsBm\",\"setpeBm\",\"setpoBm\",\"setlBm\",\"setgeBm\",\"setleBm\",\"setgBm\",\n--Ax\n\"push fs\",\"pop fs\",\"cpuid\",\"btVmr\",\"shldVmru\",\"shldVmrc\",nil,nil,\n\"push gs\",\"pop gs\",\"rsm\",\"btsVmr\",\"shrdVmru\",\"shrdVmrc\",\"fxsave!Dmp\",\"imulVrm\",\n--Bx\n\"cmpxchgBmr\",\"cmpxchgVmr\",\"$lssVrm\",\"btrVmr\",\n\"$lfsVrm\",\"$lgsVrm\",\"movzxVrBmt\",\"movzxVrWmt\",\n\"|popcntVrm\",\"ud2Dp\",\"bt!Vmu\",\"btcVmr\",\n\"bsfVrm\",\"bsrVrm|lzcntVrm|bsrWrm\",\"movsxVrBmt\",\"movsxVrWmt\",\n--Cx\n\"xaddBmr\",\"xaddVmr\",\n\"cmppsXrvmu|cmpssXrvmu|cmppdXrvmu|cmpsdXrvmu\",\"$movntiVmr|\",\n\"pinsrwPrvWmu\",\"pextrwDrPmu\",\n\"shufpsXrvmu||shufpdXrvmu\",\"$cmpxchg!Qmp\",\n\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\n--Dx\n\"||addsubpdXrvm|addsubpsXrvm\",\"psrlwPrvm\",\"psrldPrvm\",\"psrlqPrvm\",\n\"paddqPrvm\",\"pmullwPrvm\",\n\"|movq2dqXrMm|movqXmr|movdq2qMrXm$\",\"pmovmskbVrMm||pmovmskbVrXm\",\n\"psubusbPrvm\",\"psubuswPrvm\",\"pminubPrvm\",\"pandPrvm\",\n\"paddusbPrvm\",\"padduswPrvm\",\"pmaxubPrvm\",\"pandnPrvm\",\n--Ex\n\"pavgbPrvm\",\"psrawPrvm\",\"psradPrvm\",\"pavgwPrvm\",\n\"pmulhuwPrvm\",\"pmulhwPrvm\",\n\"|cvtdq2pdXrm|cvttpd2dqXrm|cvtpd2dqXrm\",\"$movntqMmr||$movntdqXmr\",\n\"psubsbPrvm\",\"psubswPrvm\",\"pminswPrvm\",\"porPrvm\",\n\"paddsbPrvm\",\"paddswPrvm\",\"pmaxswPrvm\",\"pxorPrvm\",\n--Fx\n\"|||lddquXrm\",\"psllwPrvm\",\"pslldPrvm\",\"psllqPrvm\",\n\"pmuludqPrvm\",\"pmaddwdPrvm\",\"psadbwPrvm\",\"maskmovqMrm||maskmovdquXrm$\",\n\"psubbPrvm\",\"psubwPrvm\",\"psubdPrvm\",\"psubqPrvm\",\n\"paddbPrvm\",\"paddwPrvm\",\"padddPrvm\",\"ud\",\n}\nassert(map_opc2[255] == \"ud\")\n\n-- Map for three-byte opcodes. Can't wait for their next invention.\nlocal map_opc3 = {\n[\"38\"] = { -- [66] 0f 38 xx\n--0x\n[0]=\"pshufbPrvm\",\"phaddwPrvm\",\"phadddPrvm\",\"phaddswPrvm\",\n\"pmaddubswPrvm\",\"phsubwPrvm\",\"phsubdPrvm\",\"phsubswPrvm\",\n\"psignbPrvm\",\"psignwPrvm\",\"psigndPrvm\",\"pmulhrswPrvm\",\n\"||permilpsXrvm\",\"||permilpdXrvm\",nil,nil,\n--1x\n\"||pblendvbXrma\",nil,nil,nil,\n\"||blendvpsXrma\",\"||blendvpdXrma\",\"||permpsXrvm\",\"||ptestXrm\",\n\"||broadcastssXrm\",\"||broadcastsdXrm\",\"||broadcastf128XrlXm\",nil,\n\"pabsbPrm\",\"pabswPrm\",\"pabsdPrm\",nil,\n--2x\n\"||pmovsxbwXrm\",\"||pmovsxbdXrm\",\"||pmovsxbqXrm\",\"||pmovsxwdXrm\",\n\"||pmovsxwqXrm\",\"||pmovsxdqXrm\",nil,nil,\n\"||pmuldqXrvm\",\"||pcmpeqqXrvm\",\"||$movntdqaXrm\",\"||packusdwXrvm\",\n\"||maskmovpsXrvm\",\"||maskmovpdXrvm\",\"||maskmovpsXmvr\",\"||maskmovpdXmvr\",\n--3x\n\"||pmovzxbwXrm\",\"||pmovzxbdXrm\",\"||pmovzxbqXrm\",\"||pmovzxwdXrm\",\n\"||pmovzxwqXrm\",\"||pmovzxdqXrm\",\"||permdXrvm\",\"||pcmpgtqXrvm\",\n\"||pminsbXrvm\",\"||pminsdXrvm\",\"||pminuwXrvm\",\"||pminudXrvm\",\n\"||pmaxsbXrvm\",\"||pmaxsdXrvm\",\"||pmaxuwXrvm\",\"||pmaxudXrvm\",\n--4x\n\"||pmulddXrvm\",\"||phminposuwXrm\",nil,nil,\nnil,\"||psrlvVSXrvm\",\"||psravdXrvm\",\"||psllvVSXrvm\",\n--5x\n[0x58] = \"||pbroadcastdXrlXm\",[0x59] = \"||pbroadcastqXrlXm\",\n[0x5a] = \"||broadcasti128XrlXm\",\n--7x\n[0x78] = \"||pbroadcastbXrlXm\",[0x79] = \"||pbroadcastwXrlXm\",\n--8x\n[0x8c] = \"||pmaskmovXrvVSm\",\n[0x8e] = \"||pmaskmovVSmXvr\",\n--9x\n[0x96] = \"||fmaddsub132pHXrvm\",[0x97] = \"||fmsubadd132pHXrvm\",\n[0x98] = \"||fmadd132pHXrvm\",[0x99] = \"||fmadd132sHXrvm\",\n[0x9a] = \"||fmsub132pHXrvm\",[0x9b] = \"||fmsub132sHXrvm\",\n[0x9c] = \"||fnmadd132pHXrvm\",[0x9d] = \"||fnmadd132sHXrvm\",\n[0x9e] = \"||fnmsub132pHXrvm\",[0x9f] = \"||fnmsub132sHXrvm\",\n--Ax\n[0xa6] = \"||fmaddsub213pHXrvm\",[0xa7] = \"||fmsubadd213pHXrvm\",\n[0xa8] = \"||fmadd213pHXrvm\",[0xa9] = \"||fmadd213sHXrvm\",\n[0xaa] = \"||fmsub213pHXrvm\",[0xab] = \"||fmsub213sHXrvm\",\n[0xac] = \"||fnmadd213pHXrvm\",[0xad] = \"||fnmadd213sHXrvm\",\n[0xae] = \"||fnmsub213pHXrvm\",[0xaf] = \"||fnmsub213sHXrvm\",\n--Bx\n[0xb6] = \"||fmaddsub231pHXrvm\",[0xb7] = \"||fmsubadd231pHXrvm\",\n[0xb8] = \"||fmadd231pHXrvm\",[0xb9] = \"||fmadd231sHXrvm\",\n[0xba] = \"||fmsub231pHXrvm\",[0xbb] = \"||fmsub231sHXrvm\",\n[0xbc] = \"||fnmadd231pHXrvm\",[0xbd] = \"||fnmadd231sHXrvm\",\n[0xbe] = \"||fnmsub231pHXrvm\",[0xbf] = \"||fnmsub231sHXrvm\",\n--Dx\n[0xdc] = \"||aesencXrvm\", [0xdd] = \"||aesenclastXrvm\",\n[0xde] = \"||aesdecXrvm\", [0xdf] = \"||aesdeclastXrvm\",\n--Fx\n[0xf0] = \"|||crc32TrBmt\",[0xf1] = \"|||crc32TrVmt\",\n[0xf7] = \"| sarxVrmv| shlxVrmv| shrxVrmv\",\n},\n\n[\"3a\"] = { -- [66] 0f 3a xx\n--0x\n[0x00]=\"||permqXrmu\",\"||permpdXrmu\",\"||pblenddXrvmu\",nil,\n\"||permilpsXrmu\",\"||permilpdXrmu\",\"||perm2f128Xrvmu\",nil,\n\"||roundpsXrmu\",\"||roundpdXrmu\",\"||roundssXrvmu\",\"||roundsdXrvmu\",\n\"||blendpsXrvmu\",\"||blendpdXrvmu\",\"||pblendwXrvmu\",\"palignrPrvmu\",\n--1x\nnil,nil,nil,nil,\n\"||pextrbVmXru\",\"||pextrwVmXru\",\"||pextrVmSXru\",\"||extractpsVmXru\",\n\"||insertf128XrvlXmu\",\"||extractf128XlXmYru\",nil,nil,\nnil,nil,nil,nil,\n--2x\n\"||pinsrbXrvVmu\",\"||insertpsXrvmu\",\"||pinsrXrvVmuS\",nil,\n--3x\n[0x38] = \"||inserti128Xrvmu\",[0x39] = \"||extracti128XlXmYru\",\n--4x\n[0x40] = \"||dppsXrvmu\",\n[0x41] = \"||dppdXrvmu\",\n[0x42] = \"||mpsadbwXrvmu\",\n[0x44] = \"||pclmulqdqXrvmu\",\n[0x46] = \"||perm2i128Xrvmu\",\n[0x4a] = \"||blendvpsXrvmb\",[0x4b] = \"||blendvpdXrvmb\",\n[0x4c] = \"||pblendvbXrvmb\",\n--6x\n[0x60] = \"||pcmpestrmXrmu\",[0x61] = \"||pcmpestriXrmu\",\n[0x62] = \"||pcmpistrmXrmu\",[0x63] = \"||pcmpistriXrmu\",\n[0xdf] = \"||aeskeygenassistXrmu\",\n--Fx\n[0xf0] = \"||| rorxVrmu\",\n},\n}\n\n-- Map for VMX/SVM opcodes 0F 01 C0-FF (sgdt group with register operands).\nlocal map_opcvm = {\n[0xc1]=\"vmcall\",[0xc2]=\"vmlaunch\",[0xc3]=\"vmresume\",[0xc4]=\"vmxoff\",\n[0xc8]=\"monitor\",[0xc9]=\"mwait\",\n[0xd8]=\"vmrun\",[0xd9]=\"vmmcall\",[0xda]=\"vmload\",[0xdb]=\"vmsave\",\n[0xdc]=\"stgi\",[0xdd]=\"clgi\",[0xde]=\"skinit\",[0xdf]=\"invlpga\",\n[0xf8]=\"swapgs\",[0xf9]=\"rdtscp\",\n}\n\n-- Map for FP opcodes. And you thought stack machines are simple?\nlocal map_opcfp = {\n-- D8-DF 00-BF: opcodes with a memory operand.\n-- D8\n[0]=\"faddFm\",\"fmulFm\",\"fcomFm\",\"fcompFm\",\"fsubFm\",\"fsubrFm\",\"fdivFm\",\"fdivrFm\",\n\"fldFm\",nil,\"fstFm\",\"fstpFm\",\"fldenvVm\",\"fldcwWm\",\"fnstenvVm\",\"fnstcwWm\",\n-- DA\n\"fiaddDm\",\"fimulDm\",\"ficomDm\",\"ficompDm\",\n\"fisubDm\",\"fisubrDm\",\"fidivDm\",\"fidivrDm\",\n-- DB\n\"fildDm\",\"fisttpDm\",\"fistDm\",\"fistpDm\",nil,\"fld twordFmp\",nil,\"fstp twordFmp\",\n-- DC\n\"faddGm\",\"fmulGm\",\"fcomGm\",\"fcompGm\",\"fsubGm\",\"fsubrGm\",\"fdivGm\",\"fdivrGm\",\n-- DD\n\"fldGm\",\"fisttpQm\",\"fstGm\",\"fstpGm\",\"frstorDmp\",nil,\"fnsaveDmp\",\"fnstswWm\",\n-- DE\n\"fiaddWm\",\"fimulWm\",\"ficomWm\",\"ficompWm\",\n\"fisubWm\",\"fisubrWm\",\"fidivWm\",\"fidivrWm\",\n-- DF\n\"fildWm\",\"fisttpWm\",\"fistWm\",\"fistpWm\",\n\"fbld twordFmp\",\"fildQm\",\"fbstp twordFmp\",\"fistpQm\",\n-- xx C0-FF: opcodes with a pseudo-register operand.\n-- D8\n\"faddFf\",\"fmulFf\",\"fcomFf\",\"fcompFf\",\"fsubFf\",\"fsubrFf\",\"fdivFf\",\"fdivrFf\",\n-- D9\n\"fldFf\",\"fxchFf\",{\"fnop\"},nil,\n{\"fchs\",\"fabs\",nil,nil,\"ftst\",\"fxam\"},\n{\"fld1\",\"fldl2t\",\"fldl2e\",\"fldpi\",\"fldlg2\",\"fldln2\",\"fldz\"},\n{\"f2xm1\",\"fyl2x\",\"fptan\",\"fpatan\",\"fxtract\",\"fprem1\",\"fdecstp\",\"fincstp\"},\n{\"fprem\",\"fyl2xp1\",\"fsqrt\",\"fsincos\",\"frndint\",\"fscale\",\"fsin\",\"fcos\"},\n-- DA\n\"fcmovbFf\",\"fcmoveFf\",\"fcmovbeFf\",\"fcmovuFf\",nil,{nil,\"fucompp\"},nil,nil,\n-- DB\n\"fcmovnbFf\",\"fcmovneFf\",\"fcmovnbeFf\",\"fcmovnuFf\",\n{nil,nil,\"fnclex\",\"fninit\"},\"fucomiFf\",\"fcomiFf\",nil,\n-- DC\n\"fadd toFf\",\"fmul toFf\",nil,nil,\n\"fsub toFf\",\"fsubr toFf\",\"fdivr toFf\",\"fdiv toFf\",\n-- DD\n\"ffreeFf\",nil,\"fstFf\",\"fstpFf\",\"fucomFf\",\"fucompFf\",nil,nil,\n-- DE\n\"faddpFf\",\"fmulpFf\",nil,{nil,\"fcompp\"},\n\"fsubrpFf\",\"fsubpFf\",\"fdivrpFf\",\"fdivpFf\",\n-- DF\nnil,nil,nil,nil,{\"fnstsw ax\"},\"fucomipFf\",\"fcomipFf\",nil,\n}\nassert(map_opcfp[126] == \"fcomipFf\")\n\n-- Map for opcode groups. The subkey is sp from the ModRM byte.\nlocal map_opcgroup = {\n  arith = { \"add\", \"or\", \"adc\", \"sbb\", \"and\", \"sub\", \"xor\", \"cmp\" },\n  shift = { \"rol\", \"ror\", \"rcl\", \"rcr\", \"shl\", \"shr\", \"sal\", \"sar\" },\n  testb = { \"testBmi\", \"testBmi\", \"not\", \"neg\", \"mul\", \"imul\", \"div\", \"idiv\" },\n  testv = { \"testVmi\", \"testVmi\", \"not\", \"neg\", \"mul\", \"imul\", \"div\", \"idiv\" },\n  incb = { \"inc\", \"dec\" },\n  incd = { \"inc\", \"dec\", \"callUmp\", \"$call farDmp\",\n\t   \"jmpUmp\", \"$jmp farDmp\", \"pushUm\" },\n  sldt = { \"sldt\", \"str\", \"lldt\", \"ltr\", \"verr\", \"verw\" },\n  sgdt = { \"vm*$sgdt\", \"vm*$sidt\", \"$lgdt\", \"vm*$lidt\",\n\t   \"smsw\", nil, \"lmsw\", \"vm*$invlpg\" },\n  bt = { nil, nil, nil, nil, \"bt\", \"bts\", \"btr\", \"btc\" },\n  cmpxchg = { nil, \"sz*,cmpxchg8bQmp,cmpxchg16bXmp\", nil, nil,\n\t      nil, nil, \"vmptrld|vmxon|vmclear\", \"vmptrst\" },\n  pshiftw = { nil, nil, \"psrlw\", nil, \"psraw\", nil, \"psllw\" },\n  pshiftd = { nil, nil, \"psrld\", nil, \"psrad\", nil, \"pslld\" },\n  pshiftq = { nil, nil, \"psrlq\", nil, nil, nil, \"psllq\" },\n  pshiftdq = { nil, nil, \"psrlq\", \"psrldq\", nil, nil, \"psllq\", \"pslldq\" },\n  fxsave = { \"$fxsave\", \"$fxrstor\", \"$ldmxcsr\", \"$stmxcsr\",\n\t     nil, \"lfenceDp$\", \"mfenceDp$\", \"sfenceDp$clflush\" },\n  prefetch = { \"prefetch\", \"prefetchw\" },\n  prefetcht = { \"prefetchnta\", \"prefetcht0\", \"prefetcht1\", \"prefetcht2\" },\n}\n\n------------------------------------------------------------------------------\n\n-- Maps for register names.\nlocal map_regs = {\n  B = { \"al\", \"cl\", \"dl\", \"bl\", \"ah\", \"ch\", \"dh\", \"bh\",\n\t\"r8b\", \"r9b\", \"r10b\", \"r11b\", \"r12b\", \"r13b\", \"r14b\", \"r15b\" },\n  B64 = { \"al\", \"cl\", \"dl\", \"bl\", \"spl\", \"bpl\", \"sil\", \"dil\",\n\t  \"r8b\", \"r9b\", \"r10b\", \"r11b\", \"r12b\", \"r13b\", \"r14b\", \"r15b\" },\n  W = { \"ax\", \"cx\", \"dx\", \"bx\", \"sp\", \"bp\", \"si\", \"di\",\n\t\"r8w\", \"r9w\", \"r10w\", \"r11w\", \"r12w\", \"r13w\", \"r14w\", \"r15w\" },\n  D = { \"eax\", \"ecx\", \"edx\", \"ebx\", \"esp\", \"ebp\", \"esi\", \"edi\",\n\t\"r8d\", \"r9d\", \"r10d\", \"r11d\", \"r12d\", \"r13d\", \"r14d\", \"r15d\" },\n  Q = { \"rax\", \"rcx\", \"rdx\", \"rbx\", \"rsp\", \"rbp\", \"rsi\", \"rdi\",\n\t\"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\" },\n  M = { \"mm0\", \"mm1\", \"mm2\", \"mm3\", \"mm4\", \"mm5\", \"mm6\", \"mm7\",\n\t\"mm0\", \"mm1\", \"mm2\", \"mm3\", \"mm4\", \"mm5\", \"mm6\", \"mm7\" }, -- No x64 ext!\n  X = { \"xmm0\", \"xmm1\", \"xmm2\", \"xmm3\", \"xmm4\", \"xmm5\", \"xmm6\", \"xmm7\",\n\t\"xmm8\", \"xmm9\", \"xmm10\", \"xmm11\", \"xmm12\", \"xmm13\", \"xmm14\", \"xmm15\" },\n  Y = { \"ymm0\", \"ymm1\", \"ymm2\", \"ymm3\", \"ymm4\", \"ymm5\", \"ymm6\", \"ymm7\",\n\t\"ymm8\", \"ymm9\", \"ymm10\", \"ymm11\", \"ymm12\", \"ymm13\", \"ymm14\", \"ymm15\" },\n}\nlocal map_segregs = { \"es\", \"cs\", \"ss\", \"ds\", \"fs\", \"gs\", \"segr6\", \"segr7\" }\n\n-- Maps for size names.\nlocal map_sz2n = {\n  B = 1, W = 2, D = 4, Q = 8, M = 8, X = 16, Y = 32,\n}\nlocal map_sz2prefix = {\n  B = \"byte\", W = \"word\", D = \"dword\",\n  Q = \"qword\",\n  M = \"qword\", X = \"xword\", Y = \"yword\",\n  F = \"dword\", G = \"qword\", -- No need for sizes/register names for these two.\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local code, pos, hex = ctx.code, ctx.pos, \"\"\n  local hmax = ctx.hexdump\n  if hmax > 0 then\n    for i=ctx.start,pos-1 do\n      hex = hex..format(\"%02X\", byte(code, i, i))\n    end\n    if #hex > hmax then hex = sub(hex, 1, hmax)..\". \"\n    else hex = hex..rep(\" \", hmax-#hex+2) end\n  end\n  if operands then text = text..\" \"..operands end\n  if ctx.o16 then text = \"o16 \"..text; ctx.o16 = false end\n  if ctx.a32 then text = \"a32 \"..text; ctx.a32 = false end\n  if ctx.rep then text = ctx.rep..\" \"..text; ctx.rep = false end\n  if ctx.rex then\n    local t = (ctx.rexw and \"w\" or \"\")..(ctx.rexr and \"r\" or \"\")..\n\t      (ctx.rexx and \"x\" or \"\")..(ctx.rexb and \"b\" or \"\")..\n\t      (ctx.vexl and \"l\" or \"\")\n    if ctx.vexv and ctx.vexv ~= 0 then t = t..\"v\"..ctx.vexv end\n    if t ~= \"\" then text = ctx.rex..\".\"..t..\" \"..gsub(text, \"^ \", \"\")\n    elseif ctx.rex == \"vex\" then text = gsub(\"v\"..text, \"^v \", \"\") end\n    ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false\n    ctx.rex = false; ctx.vexl = false; ctx.vexv = false\n  end\n  if ctx.seg then\n    local text2, n = gsub(text, \"%[\", \"[\"..ctx.seg..\":\")\n    if n == 0 then text = ctx.seg..\" \"..text else text = text2 end\n    ctx.seg = false\n  end\n  if ctx.lock then text = \"lock \"..text; ctx.lock = false end\n  local imm = ctx.imm\n  if imm then\n    local sym = ctx.symtab[imm]\n    if sym then text = text..\"\\t->\"..sym end\n  end\n  ctx.out(format(\"%08x  %s%s\\n\", ctx.addr+ctx.start, hex, text))\n  ctx.mrm = false\n  ctx.vexv = false\n  ctx.start = pos\n  ctx.imm = nil\nend\n\n-- Clear all prefix flags.\nlocal function clearprefixes(ctx)\n  ctx.o16 = false; ctx.seg = false; ctx.lock = false; ctx.rep = false\n  ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false\n  ctx.rex = false; ctx.a32 = false; ctx.vexl = false\nend\n\n-- Fallback for incomplete opcodes at the end.\nlocal function incomplete(ctx)\n  ctx.pos = ctx.stop+1\n  clearprefixes(ctx)\n  return putop(ctx, \"(incomplete)\")\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  clearprefixes(ctx)\n  return putop(ctx, \"(unknown)\")\nend\n\n-- Return an immediate of the specified size.\nlocal function getimm(ctx, pos, n)\n  if pos+n-1 > ctx.stop then return incomplete(ctx) end\n  local code = ctx.code\n  if n == 1 then\n    local b1 = byte(code, pos, pos)\n    return b1\n  elseif n == 2 then\n    local b1, b2 = byte(code, pos, pos+1)\n    return b1+b2*256\n  else\n    local b1, b2, b3, b4 = byte(code, pos, pos+3)\n    local imm = b1+b2*256+b3*65536+b4*16777216\n    ctx.imm = imm\n    return imm\n  end\nend\n\n-- Process pattern string and generate the operands.\nlocal function putpat(ctx, name, pat)\n  local operands, regs, sz, mode, sp, rm, sc, rx, sdisp\n  local code, pos, stop, vexl = ctx.code, ctx.pos, ctx.stop, ctx.vexl\n\n  -- Chars used: 1DFGHIMPQRSTUVWXYabcdfgijlmoprstuvwxyz\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"V\" or p == \"U\" then\n      if ctx.rexw then sz = \"Q\"; ctx.rexw = false\n      elseif ctx.o16 then sz = \"W\"; ctx.o16 = false\n      elseif p == \"U\" and ctx.x64 then sz = \"Q\"\n      else sz = \"D\" end\n      regs = map_regs[sz]\n    elseif p == \"T\" then\n      if ctx.rexw then sz = \"Q\"; ctx.rexw = false else sz = \"D\" end\n      regs = map_regs[sz]\n    elseif p == \"B\" then\n      sz = \"B\"\n      regs = ctx.rex and map_regs.B64 or map_regs.B\n    elseif match(p, \"[WDQMXYFG]\") then\n      sz = p\n      if sz == \"X\" and vexl then sz = \"Y\"; ctx.vexl = false end\n      regs = map_regs[sz]\n    elseif p == \"P\" then\n      sz = ctx.o16 and \"X\" or \"M\"; ctx.o16 = false\n      if sz == \"X\" and vexl then sz = \"Y\"; ctx.vexl = false end\n      regs = map_regs[sz]\n    elseif p == \"H\" then\n      name = name..(ctx.rexw and \"d\" or \"s\")\n      ctx.rexw = false\n    elseif p == \"S\" then\n      name = name..lower(sz)\n    elseif p == \"s\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = imm <= 127 and format(\"+0x%02x\", imm)\n\t\t     or format(\"-0x%02x\", 256-imm)\n      pos = pos+1\n    elseif p == \"u\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = format(\"0x%02x\", imm)\n      pos = pos+1\n    elseif p == \"b\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = regs[imm/16+1]\n      pos = pos+1\n    elseif p == \"w\" then\n      local imm = getimm(ctx, pos, 2); if not imm then return end\n      x = format(\"0x%x\", imm)\n      pos = pos+2\n    elseif p == \"o\" then -- [offset]\n      if ctx.x64 then\n\tlocal imm1 = getimm(ctx, pos, 4); if not imm1 then return end\n\tlocal imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end\n\tx = format(\"[0x%08x%08x]\", imm2, imm1)\n\tpos = pos+8\n      else\n\tlocal imm = getimm(ctx, pos, 4); if not imm then return end\n\tx = format(\"[0x%08x]\", imm)\n\tpos = pos+4\n      end\n    elseif p == \"i\" or p == \"I\" then\n      local n = map_sz2n[sz]\n      if n == 8 and ctx.x64 and p == \"I\" then\n\tlocal imm1 = getimm(ctx, pos, 4); if not imm1 then return end\n\tlocal imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end\n\tx = format(\"0x%08x%08x\", imm2, imm1)\n      else\n\tif n == 8 then n = 4 end\n\tlocal imm = getimm(ctx, pos, n); if not imm then return end\n\tif sz == \"Q\" and (imm < 0 or imm > 0x7fffffff) then\n\t  imm = (0xffffffff+1)-imm\n\t  x = format(imm > 65535 and \"-0x%08x\" or \"-0x%x\", imm)\n\telse\n\t  x = format(imm > 65535 and \"0x%08x\" or \"0x%x\", imm)\n\tend\n      end\n      pos = pos+n\n    elseif p == \"j\" then\n      local n = map_sz2n[sz]\n      if n == 8 then n = 4 end\n      local imm = getimm(ctx, pos, n); if not imm then return end\n      if sz == \"B\" and imm > 127 then imm = imm-256\n      elseif imm > 2147483647 then imm = imm-4294967296 end\n      pos = pos+n\n      imm = imm + pos + ctx.addr\n      if imm > 4294967295 and not ctx.x64 then imm = imm-4294967296 end\n      ctx.imm = imm\n      if sz == \"W\" then\n\tx = format(\"word 0x%04x\", imm%65536)\n      elseif ctx.x64 then\n\tlocal lo = imm % 0x1000000\n\tx = format(\"0x%02x%06x\", (imm-lo) / 0x1000000, lo)\n      else\n\tx = \"0x\"..tohex(imm)\n      end\n    elseif p == \"R\" then\n      local r = byte(code, pos-1, pos-1)%8\n      if ctx.rexb then r = r + 8; ctx.rexb = false end\n      x = regs[r+1]\n    elseif p == \"a\" then x = regs[1]\n    elseif p == \"c\" then x = \"cl\"\n    elseif p == \"d\" then x = \"dx\"\n    elseif p == \"1\" then x = \"1\"\n    else\n      if not mode then\n\tmode = ctx.mrm\n\tif not mode then\n\t  if pos > stop then return incomplete(ctx) end\n\t  mode = byte(code, pos, pos)\n\t  pos = pos+1\n\tend\n\trm = mode%8; mode = (mode-rm)/8\n\tsp = mode%8; mode = (mode-sp)/8\n\tsdisp = \"\"\n\tif mode < 3 then\n\t  if rm == 4 then\n\t    if pos > stop then return incomplete(ctx) end\n\t    sc = byte(code, pos, pos)\n\t    pos = pos+1\n\t    rm = sc%8; sc = (sc-rm)/8\n\t    rx = sc%8; sc = (sc-rx)/8\n\t    if ctx.rexx then rx = rx + 8; ctx.rexx = false end\n\t    if rx == 4 then rx = nil end\n\t  end\n\t  if mode > 0 or rm == 5 then\n\t    local dsz = mode\n\t    if dsz ~= 1 then dsz = 4 end\n\t    local disp = getimm(ctx, pos, dsz); if not disp then return end\n\t    if mode == 0 then rm = nil end\n\t    if rm or rx or (not sc and ctx.x64 and not ctx.a32) then\n\t      if dsz == 1 and disp > 127 then\n\t\tsdisp = format(\"-0x%x\", 256-disp)\n\t      elseif disp >= 0 and disp <= 0x7fffffff then\n\t\tsdisp = format(\"+0x%x\", disp)\n\t      else\n\t\tsdisp = format(\"-0x%x\", (0xffffffff+1)-disp)\n\t      end\n\t    else\n\t      sdisp = format(ctx.x64 and not ctx.a32 and\n\t\tnot (disp >= 0 and disp <= 0x7fffffff)\n\t\tand \"0xffffffff%08x\" or \"0x%08x\", disp)\n\t    end\n\t    pos = pos+dsz\n\t  end\n\tend\n\tif rm and ctx.rexb then rm = rm + 8; ctx.rexb = false end\n\tif ctx.rexr then sp = sp + 8; ctx.rexr = false end\n      end\n      if p == \"m\" then\n\tif mode == 3 then x = regs[rm+1]\n\telse\n\t  local aregs = ctx.a32 and map_regs.D or ctx.aregs\n\t  local srm, srx = \"\", \"\"\n\t  if rm then srm = aregs[rm+1]\n\t  elseif not sc and ctx.x64 and not ctx.a32 then srm = \"rip\" end\n\t  ctx.a32 = false\n\t  if rx then\n\t    if rm then srm = srm..\"+\" end\n\t    srx = aregs[rx+1]\n\t    if sc > 0 then srx = srx..\"*\"..(2^sc) end\n\t  end\n\t  x = format(\"[%s%s%s]\", srm, srx, sdisp)\n\tend\n\tif mode < 3 and\n\t   (not match(pat, \"[aRrgp]\") or match(pat, \"t\")) then -- Yuck.\n\t  x = map_sz2prefix[sz]..\" \"..x\n\tend\n      elseif p == \"r\" then x = regs[sp+1]\n      elseif p == \"g\" then x = map_segregs[sp+1]\n      elseif p == \"p\" then -- Suppress prefix.\n      elseif p == \"f\" then x = \"st\"..rm\n      elseif p == \"x\" then\n\tif sp == 0 and ctx.lock and not ctx.x64 then\n\t  x = \"CR8\"; ctx.lock = false\n\telse\n\t  x = \"CR\"..sp\n\tend\n      elseif p == \"v\" then\n\tif ctx.vexv then\n\t  x = regs[ctx.vexv+1]; ctx.vexv = false\n\tend\n      elseif p == \"y\" then x = \"DR\"..sp\n      elseif p == \"z\" then x = \"TR\"..sp\n      elseif p == \"l\" then vexl = false\n      elseif p == \"t\" then\n      else\n\terror(\"bad pattern `\"..pat..\"'\")\n      end\n    end\n    if x then operands = operands and operands..\", \"..x or x end\n  end\n  ctx.pos = pos\n  return putop(ctx, name, operands)\nend\n\n-- Forward declaration.\nlocal map_act\n\n-- Fetch and cache MRM byte.\nlocal function getmrm(ctx)\n  local mrm = ctx.mrm\n  if not mrm then\n    local pos = ctx.pos\n    if pos > ctx.stop then return nil end\n    mrm = byte(ctx.code, pos, pos)\n    ctx.pos = pos+1\n    ctx.mrm = mrm\n  end\n  return mrm\nend\n\n-- Dispatch to handler depending on pattern.\nlocal function dispatch(ctx, opat, patgrp)\n  if not opat then return unknown(ctx) end\n  if match(opat, \"%|\") then -- MMX/SSE variants depending on prefix.\n    local p\n    if ctx.rep then\n      p = ctx.rep==\"rep\" and \"%|([^%|]*)\" or \"%|[^%|]*%|[^%|]*%|([^%|]*)\"\n      ctx.rep = false\n    elseif ctx.o16 then p = \"%|[^%|]*%|([^%|]*)\"; ctx.o16 = false\n    else p = \"^[^%|]*\" end\n    opat = match(opat, p)\n    if not opat then return unknown(ctx) end\n--    ctx.rep = false; ctx.o16 = false\n    --XXX fails for 66 f2 0f 38 f1 06  crc32 eax,WORD PTR [esi]\n    --XXX remove in branches?\n  end\n  if match(opat, \"%$\") then -- reg$mem variants.\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    opat = match(opat, mrm >= 192 and \"^[^%$]*\" or \"%$(.*)\")\n    if opat == \"\" then return unknown(ctx) end\n  end\n  if opat == \"\" then return unknown(ctx) end\n  local name, pat = match(opat, \"^([a-z0-9 ]*)(.*)\")\n  if pat == \"\" and patgrp then pat = patgrp end\n  return map_act[sub(pat, 1, 1)](ctx, name, pat)\nend\n\n-- Get a pattern from an opcode map and dispatch to handler.\nlocal function dispatchmap(ctx, opcmap)\n  local pos = ctx.pos\n  local opat = opcmap[byte(ctx.code, pos, pos)]\n  pos = pos + 1\n  ctx.pos = pos\n  return dispatch(ctx, opat)\nend\n\n-- Map for action codes. The key is the first char after the name.\nmap_act = {\n  -- Simple opcodes without operands.\n  [\"\"] = function(ctx, name, pat)\n    return putop(ctx, name)\n  end,\n\n  -- Operand size chars fall right through.\n  B = putpat, W = putpat, D = putpat, Q = putpat,\n  V = putpat, U = putpat, T = putpat,\n  M = putpat, X = putpat, P = putpat,\n  F = putpat, G = putpat, Y = putpat,\n  H = putpat,\n\n  -- Collect prefixes.\n  [\":\"] = function(ctx, name, pat)\n    ctx[pat == \":\" and name or sub(pat, 2)] = name\n    if ctx.pos - ctx.start > 5 then return unknown(ctx) end -- Limit #prefixes.\n  end,\n\n  -- Chain to special handler specified by name.\n  [\"*\"] = function(ctx, name, pat)\n    return map_act[name](ctx, name, sub(pat, 2))\n  end,\n\n  -- Use named subtable for opcode group.\n  [\"!\"] = function(ctx, name, pat)\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    return dispatch(ctx, map_opcgroup[name][((mrm-(mrm%8))/8)%8+1], sub(pat, 2))\n  end,\n\n  -- o16,o32[,o64] variants.\n  sz = function(ctx, name, pat)\n    if ctx.o16 then ctx.o16 = false\n    else\n      pat = match(pat, \",(.*)\")\n      if ctx.rexw then\n\tlocal p = match(pat, \",(.*)\")\n\tif p then pat = p; ctx.rexw = false end\n      end\n    end\n    pat = match(pat, \"^[^,]*\")\n    return dispatch(ctx, pat)\n  end,\n\n  -- Two-byte opcode dispatch.\n  opc2 = function(ctx, name, pat)\n    return dispatchmap(ctx, map_opc2)\n  end,\n\n  -- Three-byte opcode dispatch.\n  opc3 = function(ctx, name, pat)\n    return dispatchmap(ctx, map_opc3[pat])\n  end,\n\n  -- VMX/SVM dispatch.\n  vm = function(ctx, name, pat)\n    return dispatch(ctx, map_opcvm[ctx.mrm])\n  end,\n\n  -- Floating point opcode dispatch.\n  fp = function(ctx, name, pat)\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    local rm = mrm%8\n    local idx = pat*8 + ((mrm-rm)/8)%8\n    if mrm >= 192 then idx = idx + 64 end\n    local opat = map_opcfp[idx]\n    if type(opat) == \"table\" then opat = opat[rm+1] end\n    return dispatch(ctx, opat)\n  end,\n\n  -- REX prefix.\n  rex = function(ctx, name, pat)\n    if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed.\n    for p in gmatch(pat, \".\") do ctx[\"rex\"..p] = true end\n    ctx.rex = \"rex\"\n  end,\n\n  -- VEX prefix.\n  vex = function(ctx, name, pat)\n    if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed.\n    ctx.rex = \"vex\"\n    local pos = ctx.pos\n    if ctx.mrm then\n      ctx.mrm = nil\n      pos = pos-1\n    end\n    local b = byte(ctx.code, pos, pos)\n    if not b then return incomplete(ctx) end\n    pos = pos+1\n    if b < 128 then ctx.rexr = true end\n    local m = 1\n    if pat == \"3\" then\n      m = b%32; b = (b-m)/32\n      local nb = b%2; b = (b-nb)/2\n      if nb == 0 then ctx.rexb = true end\n      local nx = b%2\n      if nx == 0 then ctx.rexx = true end\n      b = byte(ctx.code, pos, pos)\n      if not b then return incomplete(ctx) end\n      pos = pos+1\n      if b >= 128 then ctx.rexw = true end\n    end\n    ctx.pos = pos\n    local map\n    if m == 1 then map = map_opc2\n    elseif m == 2 then map = map_opc3[\"38\"]\n    elseif m == 3 then map = map_opc3[\"3a\"]\n    else return unknown(ctx) end\n    local p = b%4; b = (b-p)/4\n    if p == 1 then ctx.o16 = \"o16\"\n    elseif p == 2 then ctx.rep = \"rep\"\n    elseif p == 3 then ctx.rep = \"repne\" end\n    local l = b%2; b = (b-l)/2\n    if l ~= 0 then ctx.vexl = true end\n    ctx.vexv = (-1-b)%16\n    return dispatchmap(ctx, map)\n  end,\n\n  -- Special case for nop with REX prefix.\n  nop = function(ctx, name, pat)\n    return dispatch(ctx, ctx.rex and pat or \"nop\")\n  end,\n\n  -- Special case for 0F 77.\n  emms = function(ctx, name, pat)\n    if ctx.rex ~= \"vex\" then\n      return putop(ctx, \"emms\")\n    elseif ctx.vexl then\n      ctx.vexl = false\n      return putop(ctx, \"zeroall\")\n    else\n      return putop(ctx, \"zeroupper\")\n    end\n  end,\n}\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ofs = ofs + 1\n  ctx.start = ofs\n  ctx.pos = ofs\n  ctx.stop = stop\n  ctx.imm = nil\n  ctx.mrm = false\n  clearprefixes(ctx)\n  while ctx.pos <= stop do dispatchmap(ctx, ctx.map1) end\n  if ctx.pos ~= ctx.start then incomplete(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = (addr or 0) - 1\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 16\n  ctx.x64 = false\n  ctx.map1 = map_opc1_32\n  ctx.aregs = map_regs.D\n  return ctx\nend\n\nlocal function create64(code, addr, out)\n  local ctx = create(code, addr, out)\n  ctx.x64 = true\n  ctx.map1 = map_opc1_64\n  ctx.aregs = map_regs.Q\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\nlocal function disass64(code, addr, out)\n  create64(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 8 then return map_regs.D[r+1] end\n  return map_regs.X[r-7]\nend\n\nlocal function regname64(r)\n  if r < 16 then return map_regs.Q[r+1] end\n  return map_regs.X[r-15]\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  create64 = create64,\n  disass = disass,\n  disass64 = disass64,\n  regname = regname,\n  regname64 = regname64\n}\n\n"
  },
  {
    "path": "Luajit/jit/dump.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT compiler dump module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module can be used to debug the JIT compiler itself. It dumps the\n-- code representations and structures used in various compiler stages.\n--\n-- Example usage:\n--\n--   luajit -jdump -e \"local x=0; for i=1,1e6 do x=x+i end; print(x)\"\n--   luajit -jdump=im -e \"for i=1,1000 do for j=1,1000 do end end\" | less -R\n--   luajit -jdump=is myapp.lua | less -R\n--   luajit -jdump=-b myapp.lua\n--   luajit -jdump=+aH,myapp.html myapp.lua\n--   luajit -jdump=ixT,myapp.dump myapp.lua\n--\n-- The first argument specifies the dump mode. The second argument gives\n-- the output file name. Default output is to stdout, unless the environment\n-- variable LUAJIT_DUMPFILE is set. The file is overwritten every time the\n-- module is started.\n--\n-- Different features can be turned on or off with the dump mode. If the\n-- mode starts with a '+', the following features are added to the default\n-- set of features; a '-' removes them. Otherwise the features are replaced.\n--\n-- The following dump features are available (* marks the default):\n--\n--  * t  Print a line for each started, ended or aborted trace (see also -jv).\n--  * b  Dump the traced bytecode.\n--  * i  Dump the IR (intermediate representation).\n--    r  Augment the IR with register/stack slots.\n--    s  Dump the snapshot map.\n--  * m  Dump the generated machine code.\n--    x  Print each taken trace exit.\n--    X  Print each taken trace exit and the contents of all registers.\n--    a  Print the IR of aborted traces, too.\n--\n-- The output format can be set with the following characters:\n--\n--    T  Plain text output.\n--    A  ANSI-colored text output\n--    H  Colorized HTML + CSS output.\n--\n-- The default output format is plain text. It's set to ANSI-colored text\n-- if the COLORTERM variable is set. Note: this is independent of any output\n-- redirection, which is actually considered a feature.\n--\n-- You probably want to use less -R to enjoy viewing ANSI-colored text from\n-- a pipe or a file. Add this to your ~/.bashrc: export LESS=\"-R\"\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal funcinfo, funcbc = jutil.funcinfo, jutil.funcbc\nlocal traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek\nlocal tracemc, tracesnap = jutil.tracemc, jutil.tracesnap\nlocal traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr\nlocal bit = require(\"bit\")\nlocal band, shr, tohex = bit.band, bit.rshift, bit.tohex\nlocal sub, gsub, format = string.sub, string.gsub, string.format\nlocal byte, rep = string.byte, string.rep\nlocal type, tostring = type, tostring\nlocal stdout, stderr = io.stdout, io.stderr\n\n-- Load other modules on-demand.\nlocal bcline, disass\n\n-- Active flag, output file handle and dump mode.\nlocal active, out, dumpmode\n\n------------------------------------------------------------------------------\n\nlocal symtabmt = { __index = false }\nlocal symtab = {}\nlocal nexitsym = 0\n\n-- Fill nested symbol table with per-trace exit stub addresses.\nlocal function fillsymtab_tr(tr, nexit)\n  local t = {}\n  symtabmt.__index = t\n  if jit.arch:sub(1, 4) == \"mips\" then\n    t[traceexitstub(tr, 0)] = \"exit\"\n    return\n  end\n  for i=0,nexit-1 do\n    local addr = traceexitstub(tr, i)\n    if addr < 0 then addr = addr + 2^32 end\n    t[addr] = tostring(i)\n  end\n  local addr = traceexitstub(tr, nexit)\n  if addr then t[addr] = \"stack_check\" end\nend\n\n-- Fill symbol table with trace exit stub addresses.\nlocal function fillsymtab(tr, nexit)\n  local t = symtab\n  if nexitsym == 0 then\n    local ircall = vmdef.ircall\n    for i=0,#ircall do\n      local addr = ircalladdr(i)\n      if addr ~= 0 then\n\tif addr < 0 then addr = addr + 2^32 end\n\tt[addr] = ircall[i]\n      end\n    end\n  end\n  if nexitsym == 1000000 then -- Per-trace exit stubs.\n    fillsymtab_tr(tr, nexit)\n  elseif nexit > nexitsym then -- Shared exit stubs.\n    for i=nexitsym,nexit-1 do\n      local addr = traceexitstub(i)\n      if addr == nil then -- Fall back to per-trace exit stubs.\n\tfillsymtab_tr(tr, nexit)\n\tsetmetatable(symtab, symtabmt)\n\tnexit = 1000000\n\tbreak\n      end\n      if addr < 0 then addr = addr + 2^32 end\n      t[addr] = tostring(i)\n    end\n    nexitsym = nexit\n  end\n  return t\nend\n\nlocal function dumpwrite(s)\n  out:write(s)\nend\n\n-- Disassemble machine code.\nlocal function dump_mcode(tr)\n  local info = traceinfo(tr)\n  if not info then return end\n  local mcode, addr, loop = tracemc(tr)\n  if not mcode then return end\n  if not disass then disass = require(\"jit.dis_\"..jit.arch) end\n  if addr < 0 then addr = addr + 2^32 end\n  out:write(\"---- TRACE \", tr, \" mcode \", #mcode, \"\\n\")\n  local ctx = disass.create(mcode, addr, dumpwrite)\n  ctx.hexdump = 0\n  ctx.symtab = fillsymtab(tr, info.nexit)\n  if loop ~= 0 then\n    symtab[addr+loop] = \"LOOP\"\n    ctx:disass(0, loop)\n    out:write(\"->LOOP:\\n\")\n    ctx:disass(loop, #mcode-loop)\n    symtab[addr+loop] = nil\n  else\n    ctx:disass(0, #mcode)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal irtype_text = {\n  [0] = \"nil\",\n  \"fal\",\n  \"tru\",\n  \"lud\",\n  \"str\",\n  \"p32\",\n  \"thr\",\n  \"pro\",\n  \"fun\",\n  \"p64\",\n  \"cdt\",\n  \"tab\",\n  \"udt\",\n  \"flt\",\n  \"num\",\n  \"i8 \",\n  \"u8 \",\n  \"i16\",\n  \"u16\",\n  \"int\",\n  \"u32\",\n  \"i64\",\n  \"u64\",\n  \"sfp\",\n}\n\nlocal colortype_ansi = {\n  [0] = \"%s\",\n  \"%s\",\n  \"%s\",\n  \"\\027[36m%s\\027[m\",\n  \"\\027[32m%s\\027[m\",\n  \"%s\",\n  \"\\027[1m%s\\027[m\",\n  \"%s\",\n  \"\\027[1m%s\\027[m\",\n  \"%s\",\n  \"\\027[33m%s\\027[m\",\n  \"\\027[31m%s\\027[m\",\n  \"\\027[36m%s\\027[m\",\n  \"\\027[34m%s\\027[m\",\n  \"\\027[34m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n}\n\nlocal function colorize_text(s)\n  return s\nend\n\nlocal function colorize_ansi(s, t)\n  return format(colortype_ansi[t], s)\nend\n\nlocal irtype_ansi = setmetatable({},\n  { __index = function(tab, t)\n      local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end })\n\nlocal html_escape = { [\"<\"] = \"&lt;\", [\">\"] = \"&gt;\", [\"&\"] = \"&amp;\", }\n\nlocal function colorize_html(s, t)\n  s = gsub(s, \"[<>&]\", html_escape)\n  return format('<span class=\"irt_%s\">%s</span>', irtype_text[t], s)\nend\n\nlocal irtype_html = setmetatable({},\n  { __index = function(tab, t)\n      local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end })\n\nlocal header_html = [[\n<style type=\"text/css\">\nbackground { background: #ffffff; color: #000000; }\npre.ljdump {\nfont-size: 10pt;\nbackground: #f0f4ff;\ncolor: #000000;\nborder: 1px solid #bfcfff;\npadding: 0.5em;\nmargin-left: 2em;\nmargin-right: 2em;\n}\nspan.irt_str { color: #00a000; }\nspan.irt_thr, span.irt_fun { color: #404040; font-weight: bold; }\nspan.irt_tab { color: #c00000; }\nspan.irt_udt, span.irt_lud { color: #00c0c0; }\nspan.irt_num { color: #4040c0; }\nspan.irt_int, span.irt_i8, span.irt_u8, span.irt_i16, span.irt_u16 { color: #b040b0; }\n</style>\n]]\n\nlocal colorize, irtype\n\n-- Lookup tables to convert some literals into names.\nlocal litname = {\n  [\"SLOAD \"] = setmetatable({}, { __index = function(t, mode)\n    local s = \"\"\n    if band(mode, 1) ~= 0 then s = s..\"P\" end\n    if band(mode, 2) ~= 0 then s = s..\"F\" end\n    if band(mode, 4) ~= 0 then s = s..\"T\" end\n    if band(mode, 8) ~= 0 then s = s..\"C\" end\n    if band(mode, 16) ~= 0 then s = s..\"R\" end\n    if band(mode, 32) ~= 0 then s = s..\"I\" end\n    t[mode] = s\n    return s\n  end}),\n  [\"XLOAD \"] = { [0] = \"\", \"R\", \"V\", \"RV\", \"U\", \"RU\", \"VU\", \"RVU\", },\n  [\"CONV  \"] = setmetatable({}, { __index = function(t, mode)\n    local s = irtype[band(mode, 31)]\n    s = irtype[band(shr(mode, 5), 31)]..\".\"..s\n    if band(mode, 0x800) ~= 0 then s = s..\" sext\" end\n    local c = shr(mode, 14)\n    if c == 2 then s = s..\" index\" elseif c == 3 then s = s..\" check\" end\n    t[mode] = s\n    return s\n  end}),\n  [\"FLOAD \"] = vmdef.irfield,\n  [\"FREF  \"] = vmdef.irfield,\n  [\"FPMATH\"] = vmdef.irfpm,\n  [\"BUFHDR\"] = { [0] = \"RESET\", \"APPEND\" },\n  [\"TOSTR \"] = { [0] = \"INT\", \"NUM\", \"CHAR\" },\n}\n\nlocal function ctlsub(c)\n  if c == \"\\n\" then return \"\\\\n\"\n  elseif c == \"\\r\" then return \"\\\\r\"\n  elseif c == \"\\t\" then return \"\\\\t\"\n  else return format(\"\\\\%03d\", byte(c))\n  end\nend\n\nlocal function fmtfunc(func, pc)\n  local fi = funcinfo(func, pc)\n  if fi.loc then\n    return fi.loc\n  elseif fi.ffid then\n    return vmdef.ffnames[fi.ffid]\n  elseif fi.addr then\n    return format(\"C:%x\", fi.addr)\n  else\n    return \"(?)\"\n  end\nend\n\nlocal function formatk(tr, idx, sn)\n  local k, t, slot = tracek(tr, idx)\n  local tn = type(k)\n  local s\n  if tn == \"number\" then\n    if band(sn or 0, 0x30000) ~= 0 then\n      s = band(sn, 0x20000) ~= 0 and \"contpc\" or \"ftsz\"\n    elseif k == 2^52+2^51 then\n      s = \"bias\"\n    else\n      s = format(0 < k and k < 0x1p-1026 and \"%+a\" or \"%+.14g\", k)\n    end\n  elseif tn == \"string\" then\n    s = format(#k > 20 and '\"%.20s\"~' or '\"%s\"', gsub(k, \"%c\", ctlsub))\n  elseif tn == \"function\" then\n    s = fmtfunc(k)\n  elseif tn == \"table\" then\n    s = format(\"{%p}\", k)\n  elseif tn == \"userdata\" then\n    if t == 12 then\n      s = format(\"userdata:%p\", k)\n    else\n      s = format(\"[%p]\", k)\n      if s == \"[NULL]\" then s = \"NULL\" end\n    end\n  elseif t == 21 then -- int64_t\n    s = sub(tostring(k), 1, -3)\n    if sub(s, 1, 1) ~= \"-\" then s = \"+\"..s end\n  elseif sn == 0x1057fff then -- SNAP(1, SNAP_FRAME | SNAP_NORESTORE, REF_NIL)\n    return \"----\" -- Special case for LJ_FR2 slot 1.\n  else\n    s = tostring(k) -- For primitives.\n  end\n  s = colorize(format(\"%-4s\", s), t)\n  if slot then\n    s = format(\"%s @%d\", s, slot)\n  end\n  return s\nend\n\nlocal function printsnap(tr, snap)\n  local n = 2\n  for s=0,snap[1]-1 do\n    local sn = snap[n]\n    if shr(sn, 24) == s then\n      n = n + 1\n      local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS\n      if ref < 0 then\n\tout:write(formatk(tr, ref, sn))\n      elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM\n\tout:write(colorize(format(\"%04d/%04d\", ref, ref+1), 14))\n      else\n\tlocal m, ot, op1, op2 = traceir(tr, ref)\n\tout:write(colorize(format(\"%04d\", ref), band(ot, 31)))\n      end\n      out:write(band(sn, 0x10000) == 0 and \" \" or \"|\") -- SNAP_FRAME\n    else\n      out:write(\"---- \")\n    end\n  end\n  out:write(\"]\\n\")\nend\n\n-- Dump snapshots (not interleaved with IR).\nlocal function dump_snap(tr)\n  out:write(\"---- TRACE \", tr, \" snapshots\\n\")\n  for i=0,1000000000 do\n    local snap = tracesnap(tr, i)\n    if not snap then break end\n    out:write(format(\"#%-3d %04d [ \", i, snap[0]))\n    printsnap(tr, snap)\n  end\nend\n\n-- Return a register name or stack slot for a rid/sp location.\nlocal function ridsp_name(ridsp, ins)\n  if not disass then disass = require(\"jit.dis_\"..jit.arch) end\n  local rid, slot = band(ridsp, 0xff), shr(ridsp, 8)\n  if rid == 253 or rid == 254 then\n    return (slot == 0 or slot == 255) and \" {sink\" or format(\" {%04d\", ins-slot)\n  end\n  if ridsp > 255 then return format(\"[%x]\", slot*4) end\n  if rid < 128 then return disass.regname(rid) end\n  return \"\"\nend\n\n-- Dump CALL* function ref and return optional ctype.\nlocal function dumpcallfunc(tr, ins)\n  local ctype\n  if ins > 0 then\n    local m, ot, op1, op2 = traceir(tr, ins)\n    if band(ot, 31) == 0 then -- nil type means CARG(func, ctype).\n      ins = op1\n      ctype = formatk(tr, op2)\n    end\n  end\n  if ins < 0 then\n    out:write(format(\"[0x%x](\", tonumber((tracek(tr, ins)))))\n  else\n    out:write(format(\"%04d (\", ins))\n  end\n  return ctype\nend\n\n-- Recursively gather CALL* args and dump them.\nlocal function dumpcallargs(tr, ins)\n  if ins < 0 then\n    out:write(formatk(tr, ins))\n  else\n    local m, ot, op1, op2 = traceir(tr, ins)\n    local oidx = 6*shr(ot, 8)\n    local op = sub(vmdef.irnames, oidx+1, oidx+6)\n    if op == \"CARG  \" then\n      dumpcallargs(tr, op1)\n      if op2 < 0 then\n\tout:write(\" \", formatk(tr, op2))\n      else\n\tout:write(\" \", format(\"%04d\", op2))\n      end\n    else\n      out:write(format(\"%04d\", ins))\n    end\n  end\nend\n\n-- Dump IR and interleaved snapshots.\nlocal function dump_ir(tr, dumpsnap, dumpreg)\n  local info = traceinfo(tr)\n  if not info then return end\n  local nins = info.nins\n  out:write(\"---- TRACE \", tr, \" IR\\n\")\n  local irnames = vmdef.irnames\n  local snapref = 65536\n  local snap, snapno\n  if dumpsnap then\n    snap = tracesnap(tr, 0)\n    snapref = snap[0]\n    snapno = 0\n  end\n  for ins=1,nins do\n    if ins >= snapref then\n      if dumpreg then\n\tout:write(format(\"....              SNAP   #%-3d [ \", snapno))\n      else\n\tout:write(format(\"....        SNAP   #%-3d [ \", snapno))\n      end\n      printsnap(tr, snap)\n      snapno = snapno + 1\n      snap = tracesnap(tr, snapno)\n      snapref = snap and snap[0] or 65536\n    end\n    local m, ot, op1, op2, ridsp = traceir(tr, ins)\n    local oidx, t = 6*shr(ot, 8), band(ot, 31)\n    local op = sub(irnames, oidx+1, oidx+6)\n    if op == \"LOOP  \" then\n      if dumpreg then\n\tout:write(format(\"%04d ------------ LOOP ------------\\n\", ins))\n      else\n\tout:write(format(\"%04d ------ LOOP ------------\\n\", ins))\n      end\n    elseif op ~= \"NOP   \" and op ~= \"CARG  \" and\n\t   (dumpreg or op ~= \"RENAME\") then\n      local rid = band(ridsp, 255)\n      if dumpreg then\n\tout:write(format(\"%04d %-6s\", ins, ridsp_name(ridsp, ins)))\n      else\n\tout:write(format(\"%04d \", ins))\n      end\n      out:write(format(\"%s%s %s %s \",\n\t\t       (rid == 254 or rid == 253) and \"}\" or\n\t\t       (band(ot, 128) == 0 and \" \" or \">\"),\n\t\t       band(ot, 64) == 0 and \" \" or \"+\",\n\t\t       irtype[t], op))\n      local m1, m2 = band(m, 3), band(m, 3*4)\n      if sub(op, 1, 4) == \"CALL\" then\n\tlocal ctype\n\tif m2 == 1*4 then -- op2 == IRMlit\n\t  out:write(format(\"%-10s  (\", vmdef.ircall[op2]))\n\telse\n\t  ctype = dumpcallfunc(tr, op2)\n\tend\n\tif op1 ~= -1 then dumpcallargs(tr, op1) end\n\tout:write(\")\")\n\tif ctype then out:write(\" ctype \", ctype) end\n      elseif op == \"CNEW  \" and op2 == -1 then\n\tout:write(formatk(tr, op1))\n      elseif m1 ~= 3 then -- op1 != IRMnone\n\tif op1 < 0 then\n\t  out:write(formatk(tr, op1))\n\telse\n\t  out:write(format(m1 == 0 and \"%04d\" or \"#%-3d\", op1))\n\tend\n\tif m2 ~= 3*4 then -- op2 != IRMnone\n\t  if m2 == 1*4 then -- op2 == IRMlit\n\t    local litn = litname[op]\n\t    if litn and litn[op2] then\n\t      out:write(\"  \", litn[op2])\n\t    elseif op == \"UREFO \" or op == \"UREFC \" then\n\t      out:write(format(\"  #%-3d\", shr(op2, 8)))\n\t    else\n\t      out:write(format(\"  #%-3d\", op2))\n\t    end\n\t  elseif op2 < 0 then\n\t    out:write(\"  \", formatk(tr, op2))\n\t  else\n\t    out:write(format(\"  %04d\", op2))\n\t  end\n\tend\n      end\n      out:write(\"\\n\")\n    end\n  end\n  if snap then\n    if dumpreg then\n      out:write(format(\"....              SNAP   #%-3d [ \", snapno))\n    else\n      out:write(format(\"....        SNAP   #%-3d [ \", snapno))\n    end\n    printsnap(tr, snap)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal recprefix = \"\"\nlocal recdepth = 0\n\n-- Format trace error message.\nlocal function fmterr(err, info)\n  if type(err) == \"number\" then\n    if type(info) == \"function\" then info = fmtfunc(info) end\n    err = format(vmdef.traceerr[err], info)\n  end\n  return err\nend\n\n-- Dump trace states.\nlocal function dump_trace(what, tr, func, pc, otr, oex)\n  if what == \"stop\" or (what == \"abort\" and dumpmode.a) then\n    if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == \"stop\")\n    elseif dumpmode.s then dump_snap(tr) end\n    if dumpmode.m then dump_mcode(tr) end\n  end\n  if what == \"start\" then\n    if dumpmode.H then out:write('<pre class=\"ljdump\">\\n') end\n    out:write(\"---- TRACE \", tr, \" \", what)\n    if otr then out:write(\" \", otr, \"/\", oex == -1 and \"stitch\" or oex) end\n    out:write(\" \", fmtfunc(func, pc), \"\\n\")\n  elseif what == \"stop\" or what == \"abort\" then\n    out:write(\"---- TRACE \", tr, \" \", what)\n    if what == \"abort\" then\n      out:write(\" \", fmtfunc(func, pc), \" -- \", fmterr(otr, oex), \"\\n\")\n    else\n      local info = traceinfo(tr)\n      local link, ltype = info.link, info.linktype\n      if link == tr or link == 0 then\n\tout:write(\" -> \", ltype, \"\\n\")\n      elseif ltype == \"root\" then\n\tout:write(\" -> \", link, \"\\n\")\n      else\n\tout:write(\" -> \", link, \" \", ltype, \"\\n\")\n      end\n    end\n    if dumpmode.H then out:write(\"</pre>\\n\\n\") else out:write(\"\\n\") end\n  else\n    if what == \"flush\" then symtab, nexitsym = {}, 0 end\n    out:write(\"---- TRACE \", what, \"\\n\\n\")\n  end\n  out:flush()\nend\n\n-- Dump recorded bytecode.\nlocal function dump_record(tr, func, pc, depth, callee)\n  if depth ~= recdepth then\n    recdepth = depth\n    recprefix = rep(\" .\", depth)\n  end\n  local line\n  if pc >= 0 then\n    line = bcline(func, pc, recprefix)\n    if dumpmode.H then line = gsub(line, \"[<>&]\", html_escape) end\n    if pc > 0 then\n      line = sub(line, 1, -2) .. \"       (\" .. fmtfunc(func, pc) .. \")\\n\"\n    end\n  else\n    line = \"0000 \"..recprefix..\" FUNCC      \\n\"\n    callee = func\n  end\n  if pc <= 0 then\n    out:write(sub(line, 1, -2), \"         ; \", fmtfunc(func), \"\\n\")\n  else\n    out:write(line)\n  end\n  if pc >= 0 and band(funcbc(func, pc), 0xff) < 16 then -- ORDER BC\n    out:write(bcline(func, pc+1, recprefix)) -- Write JMP for cond.\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Dump taken trace exits.\nlocal function dump_texit(tr, ex, ngpr, nfpr, ...)\n  out:write(\"---- TRACE \", tr, \" exit \", ex, \"\\n\")\n  if dumpmode.X then\n    local regs = {...}\n    if jit.arch == \"x64\" then\n      for i=1,ngpr do\n\tout:write(format(\" %016x\", regs[i]))\n\tif i % 4 == 0 then out:write(\"\\n\") end\n      end\n    else\n      for i=1,ngpr do\n\tout:write(\" \", tohex(regs[i]))\n\tif i % 8 == 0 then out:write(\"\\n\") end\n      end\n    end\n    if jit.arch == \"mips\" or jit.arch == \"mipsel\" then\n      for i=1,nfpr,2 do\n\tout:write(format(\" %+17.14g\", regs[ngpr+i]))\n\tif i % 8 == 7 then out:write(\"\\n\") end\n      end\n    else\n      for i=1,nfpr do\n\tout:write(format(\" %+17.14g\", regs[ngpr+i]))\n\tif i % 4 == 0 then out:write(\"\\n\") end\n      end\n    end\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Detach dump handlers.\nlocal function dumpoff()\n  if active then\n    active = false\n    jit.attach(dump_texit)\n    jit.attach(dump_record)\n    jit.attach(dump_trace)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach dump handlers.\nlocal function dumpon(opt, outfile)\n  if active then dumpoff() end\n\n  local term = os.getenv(\"TERM\")\n  local colormode = (term and term:match(\"color\") or os.getenv(\"COLORTERM\")) and \"A\" or \"T\"\n  if opt then\n    opt = gsub(opt, \"[TAH]\", function(mode) colormode = mode; return \"\"; end)\n  end\n\n  local m = { t=true, b=true, i=true, m=true, }\n  if opt and opt ~= \"\" then\n    local o = sub(opt, 1, 1)\n    if o ~= \"+\" and o ~= \"-\" then m = {} end\n    for i=1,#opt do m[sub(opt, i, i)] = (o ~= \"-\") end\n  end\n  dumpmode = m\n\n  if m.t or m.b or m.i or m.s or m.m then\n    jit.attach(dump_trace, \"trace\")\n  end\n  if m.b then\n    jit.attach(dump_record, \"record\")\n    if not bcline then bcline = require(\"jit.bc\").line end\n  end\n  if m.x or m.X then\n    jit.attach(dump_texit, \"texit\")\n  end\n\n  if not outfile then outfile = os.getenv(\"LUAJIT_DUMPFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stdout\n  end\n\n  m[colormode] = true\n  if colormode == \"A\" then\n    colorize = colorize_ansi\n    irtype = irtype_ansi\n  elseif colormode == \"H\" then\n    colorize = colorize_html\n    irtype = irtype_html\n    out:write(header_html)\n  else\n    colorize = colorize_text\n    irtype = irtype_text\n  end\n\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  on = dumpon,\n  off = dumpoff,\n  start = dumpon -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Luajit/jit/p.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT profiler.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module is a simple command line interface to the built-in\n-- low-overhead profiler of LuaJIT.\n--\n-- The lower-level API of the profiler is accessible via the \"jit.profile\"\n-- module or the luaJIT_profile_* C API.\n--\n-- Example usage:\n--\n--   luajit -jp myapp.lua\n--   luajit -jp=s myapp.lua\n--   luajit -jp=-s myapp.lua\n--   luajit -jp=vl myapp.lua\n--   luajit -jp=G,profile.txt myapp.lua\n--\n-- The following dump features are available:\n--\n--   f  Stack dump: function name, otherwise module:line. Default mode.\n--   F  Stack dump: ditto, but always prepend module.\n--   l  Stack dump: module:line.\n--   <number> stack dump depth (callee < caller). Default: 1.\n--   -<number> Inverse stack dump depth (caller > callee).\n--   s  Split stack dump after first stack level. Implies abs(depth) >= 2.\n--   p  Show full path for module names.\n--   v  Show VM states. Can be combined with stack dumps, e.g. vf or fv.\n--   z  Show zones. Can be combined with stack dumps, e.g. zf or fz.\n--   r  Show raw sample counts. Default: show percentages.\n--   a  Annotate excerpts from source code files.\n--   A  Annotate complete source code files.\n--   G  Produce raw output suitable for graphical tools (e.g. flame graphs).\n--   m<number> Minimum sample percentage to be shown. Default: 3.\n--   i<number> Sampling interval in milliseconds. Default: 10.\n--\n----------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal profile = require(\"jit.profile\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal math = math\nlocal pairs, ipairs, tonumber, floor = pairs, ipairs, tonumber, math.floor\nlocal sort, format = table.sort, string.format\nlocal stdout = io.stdout\nlocal zone -- Load jit.zone module on demand.\n\n-- Output file handle.\nlocal out\n\n------------------------------------------------------------------------------\n\nlocal prof_ud\nlocal prof_states, prof_split, prof_min, prof_raw, prof_fmt, prof_depth\nlocal prof_ann, prof_count1, prof_count2, prof_samples\n\nlocal map_vmmode = {\n  N = \"Compiled\",\n  I = \"Interpreted\",\n  C = \"C code\",\n  G = \"Garbage Collector\",\n  J = \"JIT Compiler\",\n}\n\n-- Profiler callback.\nlocal function prof_cb(th, samples, vmmode)\n  prof_samples = prof_samples + samples\n  local key_stack, key_stack2, key_state\n  -- Collect keys for sample.\n  if prof_states then\n    if prof_states == \"v\" then\n      key_state = map_vmmode[vmmode] or vmmode\n    else\n      key_state = zone:get() or \"(none)\"\n    end\n  end\n  if prof_fmt then\n    key_stack = profile.dumpstack(th, prof_fmt, prof_depth)\n    key_stack = key_stack:gsub(\"%[builtin#(%d+)%]\", function(x)\n      return vmdef.ffnames[tonumber(x)]\n    end)\n    if prof_split == 2 then\n      local k1, k2 = key_stack:match(\"(.-) [<>] (.*)\")\n      if k2 then key_stack, key_stack2 = k1, k2 end\n    elseif prof_split == 3 then\n      key_stack2 = profile.dumpstack(th, \"l\", 1)\n    end\n  end\n  -- Order keys.\n  local k1, k2\n  if prof_split == 1 then\n    if key_state then\n      k1 = key_state\n      if key_stack then k2 = key_stack end\n    end\n  elseif key_stack then\n    k1 = key_stack\n    if key_stack2 then k2 = key_stack2 elseif key_state then k2 = key_state end\n  end\n  -- Coalesce samples in one or two levels.\n  if k1 then\n    local t1 = prof_count1\n    t1[k1] = (t1[k1] or 0) + samples\n    if k2 then\n      local t2 = prof_count2\n      local t3 = t2[k1]\n      if not t3 then t3 = {}; t2[k1] = t3 end\n      t3[k2] = (t3[k2] or 0) + samples\n    end\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Show top N list.\nlocal function prof_top(count1, count2, samples, indent)\n  local t, n = {}, 0\n  for k in pairs(count1) do\n    n = n + 1\n    t[n] = k\n  end\n  sort(t, function(a, b) return count1[a] > count1[b] end)\n  for i=1,n do\n    local k = t[i]\n    local v = count1[k]\n    local pct = floor(v*100/samples + 0.5)\n    if pct < prof_min then break end\n    if not prof_raw then\n      out:write(format(\"%s%2d%%  %s\\n\", indent, pct, k))\n    elseif prof_raw == \"r\" then\n      out:write(format(\"%s%5d  %s\\n\", indent, v, k))\n    else\n      out:write(format(\"%s %d\\n\", k, v))\n    end\n    if count2 then\n      local r = count2[k]\n      if r then\n\tprof_top(r, nil, v, (prof_split == 3 or prof_split == 1) and \"  -- \" or\n\t\t\t    (prof_depth < 0 and \"  -> \" or \"  <- \"))\n      end\n    end\n  end\nend\n\n-- Annotate source code\nlocal function prof_annotate(count1, samples)\n  local files = {}\n  local ms = 0\n  for k, v in pairs(count1) do\n    local pct = floor(v*100/samples + 0.5)\n    ms = math.max(ms, v)\n    if pct >= prof_min then\n      local file, line = k:match(\"^(.*):(%d+)$\")\n      if not file then file = k; line = 0 end\n      local fl = files[file]\n      if not fl then fl = {}; files[file] = fl; files[#files+1] = file end\n      line = tonumber(line)\n      fl[line] = prof_raw and v or pct\n    end\n  end\n  sort(files)\n  local fmtv, fmtn = \" %3d%% | %s\\n\", \"      | %s\\n\"\n  if prof_raw then\n    local n = math.max(5, math.ceil(math.log10(ms)))\n    fmtv = \"%\"..n..\"d | %s\\n\"\n    fmtn = (\" \"):rep(n)..\" | %s\\n\"\n  end\n  local ann = prof_ann\n  for _, file in ipairs(files) do\n    local f0 = file:byte()\n    if f0 == 40 or f0 == 91 then\n      out:write(format(\"\\n====== %s ======\\n[Cannot annotate non-file]\\n\", file))\n      break\n    end\n    local fp, err = io.open(file)\n    if not fp then\n      out:write(format(\"====== ERROR: %s: %s\\n\", file, err))\n      break\n    end\n    out:write(format(\"\\n====== %s ======\\n\", file))\n    local fl = files[file]\n    local n, show = 1, false\n    if ann ~= 0 then\n      for i=1,ann do\n\tif fl[i] then show = true; out:write(\"@@ 1 @@\\n\"); break end\n      end\n    end\n    for line in fp:lines() do\n      if line:byte() == 27 then\n\tout:write(\"[Cannot annotate bytecode file]\\n\")\n\tbreak\n      end\n      local v = fl[n]\n      if ann ~= 0 then\n\tlocal v2 = fl[n+ann]\n\tif show then\n\t  if v2 then show = n+ann elseif v then show = n\n\t  elseif show+ann < n then show = false end\n\telseif v2 then\n\t  show = n+ann\n\t  out:write(format(\"@@ %d @@\\n\", n))\n\tend\n\tif not show then goto next end\n      end\n      if v then\n\tout:write(format(fmtv, v, line))\n      else\n\tout:write(format(fmtn, line))\n      end\n    ::next::\n      n = n + 1\n    end\n    fp:close()\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Finish profiling and dump result.\nlocal function prof_finish()\n  if prof_ud then\n    profile.stop()\n    local samples = prof_samples\n    if samples == 0 then\n      if prof_raw ~= true then out:write(\"[No samples collected]\\n\") end\n      return\n    end\n    if prof_ann then\n      prof_annotate(prof_count1, samples)\n    else\n      prof_top(prof_count1, prof_count2, samples, \"\")\n    end\n    prof_count1 = nil\n    prof_count2 = nil\n    prof_ud = nil\n  end\nend\n\n-- Start profiling.\nlocal function prof_start(mode)\n  local interval = \"\"\n  mode = mode:gsub(\"i%d*\", function(s) interval = s; return \"\" end)\n  prof_min = 3\n  mode = mode:gsub(\"m(%d+)\", function(s) prof_min = tonumber(s); return \"\" end)\n  prof_depth = 1\n  mode = mode:gsub(\"%-?%d+\", function(s) prof_depth = tonumber(s); return \"\" end)\n  local m = {}\n  for c in mode:gmatch(\".\") do m[c] = c end\n  prof_states = m.z or m.v\n  if prof_states == \"z\" then zone = require(\"jit.zone\") end\n  local scope = m.l or m.f or m.F or (prof_states and \"\" or \"f\")\n  local flags = (m.p or \"\")\n  prof_raw = m.r\n  if m.s then\n    prof_split = 2\n    if prof_depth == -1 or m[\"-\"] then prof_depth = -2\n    elseif prof_depth == 1 then prof_depth = 2 end\n  elseif mode:find(\"[fF].*l\") then\n    scope = \"l\"\n    prof_split = 3\n  else\n    prof_split = (scope == \"\" or mode:find(\"[zv].*[lfF]\")) and 1 or 0\n  end\n  prof_ann = m.A and 0 or (m.a and 3)\n  if prof_ann then\n    scope = \"l\"\n    prof_fmt = \"pl\"\n    prof_split = 0\n    prof_depth = 1\n  elseif m.G and scope ~= \"\" then\n    prof_fmt = flags..scope..\"Z;\"\n    prof_depth = -100\n    prof_raw = true\n    prof_min = 0\n  elseif scope == \"\" then\n    prof_fmt = false\n  else\n    local sc = prof_split == 3 and m.f or m.F or scope\n    prof_fmt = flags..sc..(prof_depth >= 0 and \"Z < \" or \"Z > \")\n  end\n  prof_count1 = {}\n  prof_count2 = {}\n  prof_samples = 0\n  profile.start(scope:lower()..interval, prof_cb)\n  prof_ud = newproxy(true)\n  getmetatable(prof_ud).__gc = prof_finish\nend\n\n------------------------------------------------------------------------------\n\nlocal function start(mode, outfile)\n  if not outfile then outfile = os.getenv(\"LUAJIT_PROFILEFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stdout\n  end\n  prof_start(mode or \"f\")\nend\n\n-- Public module functions.\nreturn {\n  start = start, -- For -j command line option.\n  stop = prof_finish\n}\n\n"
  },
  {
    "path": "Luajit/jit/v.lua",
    "content": "----------------------------------------------------------------------------\n-- Verbose mode of the LuaJIT compiler.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module shows verbose information about the progress of the\n-- JIT compiler. It prints one line for each generated trace. This module\n-- is useful to see which code has been compiled or where the compiler\n-- punts and falls back to the interpreter.\n--\n-- Example usage:\n--\n--   luajit -jv -e \"for i=1,1000 do for j=1,1000 do end end\"\n--   luajit -jv=myapp.out myapp.lua\n--\n-- Default output is to stderr. To redirect the output to a file, pass a\n-- filename as an argument (use '-' for stdout) or set the environment\n-- variable LUAJIT_VERBOSEFILE. The file is overwritten every time the\n-- module is started.\n--\n-- The output from the first example should look like this:\n--\n-- [TRACE   1 (command line):1 loop]\n-- [TRACE   2 (1/3) (command line):1 -> 1]\n--\n-- The first number in each line is the internal trace number. Next are\n-- the file name ('(command line)') and the line number (':1') where the\n-- trace has started. Side traces also show the parent trace number and\n-- the exit number where they are attached to in parentheses ('(1/3)').\n-- An arrow at the end shows where the trace links to ('-> 1'), unless\n-- it loops to itself.\n--\n-- In this case the inner loop gets hot and is traced first, generating\n-- a root trace. Then the last exit from the 1st trace gets hot, too,\n-- and triggers generation of the 2nd trace. The side trace follows the\n-- path along the outer loop and *around* the inner loop, back to its\n-- start, and then links to the 1st trace. Yes, this may seem unusual,\n-- if you know how traditional compilers work. Trace compilers are full\n-- of surprises like this -- have fun! :-)\n--\n-- Aborted traces are shown like this:\n--\n-- [TRACE --- foo.lua:44 -- leaving loop in root trace at foo:lua:50]\n--\n-- Don't worry -- trace aborts are quite common, even in programs which\n-- can be fully compiled. The compiler may retry several times until it\n-- finds a suitable trace.\n--\n-- Of course this doesn't work with features that are not-yet-implemented\n-- (NYI error messages). The VM simply falls back to the interpreter. This\n-- may not matter at all if the particular trace is not very high up in\n-- the CPU usage profile. Oh, and the interpreter is quite fast, too.\n--\n-- Also check out the -jdump module, which prints all the gory details.\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo\nlocal type, format = type, string.format\nlocal stdout, stderr = io.stdout, io.stderr\n\n-- Active flag and output file handle.\nlocal active, out\n\n------------------------------------------------------------------------------\n\nlocal startloc, startex\n\nlocal function fmtfunc(func, pc)\n  local fi = funcinfo(func, pc)\n  if fi.loc then\n    return fi.loc\n  elseif fi.ffid then\n    return vmdef.ffnames[fi.ffid]\n  elseif fi.addr then\n    return format(\"C:%x\", fi.addr)\n  else\n    return \"(?)\"\n  end\nend\n\n-- Format trace error message.\nlocal function fmterr(err, info)\n  if type(err) == \"number\" then\n    if type(info) == \"function\" then info = fmtfunc(info) end\n    err = format(vmdef.traceerr[err], info)\n  end\n  return err\nend\n\n-- Dump trace states.\nlocal function dump_trace(what, tr, func, pc, otr, oex)\n  if what == \"start\" then\n    startloc = fmtfunc(func, pc)\n    startex = otr and \"(\"..otr..\"/\"..(oex == -1 and \"stitch\" or oex)..\") \" or \"\"\n  else\n    if what == \"abort\" then\n      local loc = fmtfunc(func, pc)\n      if loc ~= startloc then\n\tout:write(format(\"[TRACE --- %s%s -- %s at %s]\\n\",\n\t  startex, startloc, fmterr(otr, oex), loc))\n      else\n\tout:write(format(\"[TRACE --- %s%s -- %s]\\n\",\n\t  startex, startloc, fmterr(otr, oex)))\n      end\n    elseif what == \"stop\" then\n      local info = traceinfo(tr)\n      local link, ltype = info.link, info.linktype\n      if ltype == \"interpreter\" then\n\tout:write(format(\"[TRACE %3s %s%s -- fallback to interpreter]\\n\",\n\t  tr, startex, startloc))\n      elseif ltype == \"stitch\" then\n\tout:write(format(\"[TRACE %3s %s%s %s %s]\\n\",\n\t  tr, startex, startloc, ltype, fmtfunc(func, pc)))\n      elseif link == tr or link == 0 then\n\tout:write(format(\"[TRACE %3s %s%s %s]\\n\",\n\t  tr, startex, startloc, ltype))\n      elseif ltype == \"root\" then\n\tout:write(format(\"[TRACE %3s %s%s -> %d]\\n\",\n\t  tr, startex, startloc, link))\n      else\n\tout:write(format(\"[TRACE %3s %s%s -> %d %s]\\n\",\n\t  tr, startex, startloc, link, ltype))\n      end\n    else\n      out:write(format(\"[TRACE %s]\\n\", what))\n    end\n    out:flush()\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Detach dump handlers.\nlocal function dumpoff()\n  if active then\n    active = false\n    jit.attach(dump_trace)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach dump handlers.\nlocal function dumpon(outfile)\n  if active then dumpoff() end\n  if not outfile then outfile = os.getenv(\"LUAJIT_VERBOSEFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stderr\n  end\n  jit.attach(dump_trace, \"trace\")\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  on = dumpon,\n  off = dumpoff,\n  start = dumpon -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Luajit/jit/vmdef.lua",
    "content": "-- This is a generated file. DO NOT EDIT!\n\nreturn {\n\nbcnames = \"ISLT  ISGE  ISLE  ISGT  ISEQV ISNEV ISEQS ISNES ISEQN ISNEN ISEQP ISNEP ISTC  ISFC  IST   ISF   ISTYPEISNUM MOV   NOT   UNM   LEN   ADDVN SUBVN MULVN DIVVN MODVN ADDNV SUBNV MULNV DIVNV MODNV ADDVV SUBVV MULVV DIVVV MODVV POW   CAT   KSTR  KCDATAKSHORTKNUM  KPRI  KNIL  UGET  USETV USETS USETN USETP UCLO  FNEW  TNEW  TDUP  GGET  GSET  TGETV TGETS TGETB TGETR TSETV TSETS TSETB TSETM TSETR CALLM CALL  CALLMTCALLT ITERC ITERN VARG  ISNEXTRETM  RET   RET0  RET1  FORI  JFORI FORL  IFORL JFORL ITERL IITERLJITERLLOOP  ILOOP JLOOP JMP   FUNCF IFUNCFJFUNCFFUNCV IFUNCVJFUNCVFUNCC FUNCCW\",\n\nirnames = \"LT    GE    LE    GT    ULT   UGE   ULE   UGT   EQ    NE    ABC   RETF  NOP   BASE  PVAL  GCSTEPHIOP  LOOP  USE   PHI   RENAMEPROF  KPRI  KINT  KGC   KPTR  KKPTR KNULL KNUM  KINT64KSLOT BNOT  BSWAP BAND  BOR   BXOR  BSHL  BSHR  BSAR  BROL  BROR  ADD   SUB   MUL   DIV   MOD   POW   NEG   ABS   ATAN2 LDEXP MIN   MAX   FPMATHADDOV SUBOV MULOV AREF  HREFK HREF  NEWREFUREFO UREFC FREF  STRREFLREF  ALOAD HLOAD ULOAD FLOAD XLOAD SLOAD VLOAD ASTOREHSTOREUSTOREFSTOREXSTORESNEW  XSNEW TNEW  TDUP  CNEW  CNEWI BUFHDRBUFPUTBUFSTRTBAR  OBAR  XBAR  CONV  TOBIT TOSTR STRTO CALLN CALLA CALLL CALLS CALLXSCARG  \",\n\nirfpm = { [0]=\"floor\", \"ceil\", \"trunc\", \"sqrt\", \"exp\", \"exp2\", \"log\", \"log2\", \"log10\", \"sin\", \"cos\", \"tan\", \"other\", },\n\nirfield = { [0]=\"str.len\", \"func.env\", \"func.pc\", \"func.ffid\", \"thread.env\", \"thread.exdata\", \"tab.meta\", \"tab.array\", \"tab.node\", \"tab.asize\", \"tab.hmask\", \"tab.nomm\", \"udata.meta\", \"udata.udtype\", \"udata.file\", \"cdata.ctypeid\", \"cdata.ptr\", \"cdata.int\", \"cdata.int64\", \"cdata.int64_4\", },\n\nircall = {\n[0]=\"lj_str_cmp\",\n\"lj_str_find\",\n\"lj_str_new\",\n\"lj_strscan_num\",\n\"lj_strfmt_int\",\n\"lj_strfmt_num\",\n\"lj_strfmt_char\",\n\"lj_strfmt_putint\",\n\"lj_strfmt_putnum\",\n\"lj_strfmt_putquoted\",\n\"lj_strfmt_putfxint\",\n\"lj_strfmt_putfnum_int\",\n\"lj_strfmt_putfnum_uint\",\n\"lj_strfmt_putfnum\",\n\"lj_strfmt_putfstr\",\n\"lj_strfmt_putfchar\",\n\"lj_buf_putmem\",\n\"lj_buf_putstr\",\n\"lj_buf_putchar\",\n\"lj_buf_putstr_reverse\",\n\"lj_buf_putstr_lower\",\n\"lj_buf_putstr_upper\",\n\"lj_buf_putstr_rep\",\n\"lj_buf_puttab\",\n\"lj_buf_tostr\",\n\"lj_tab_new_ah\",\n\"lj_tab_new1\",\n\"lj_tab_dup\",\n\"lj_tab_clear\",\n\"lj_tab_newkey\",\n\"lj_tab_len\",\n\"lj_tab_clone\",\n\"lj_tab_isarray\",\n\"lj_tab_nkeys\",\n\"lj_tab_isempty\",\n\"lj_gc_step_jit\",\n\"lj_gc_barrieruv\",\n\"lj_mem_newgco\",\n\"lj_math_random_step\",\n\"lj_vm_modi\",\n\"sinh\",\n\"cosh\",\n\"tanh\",\n\"fputc\",\n\"fwrite\",\n\"fflush\",\n\"lj_vm_floor\",\n\"lj_vm_ceil\",\n\"lj_vm_trunc\",\n\"sqrt\",\n\"exp\",\n\"lj_vm_exp2\",\n\"log\",\n\"lj_vm_log2\",\n\"log10\",\n\"sin\",\n\"cos\",\n\"tan\",\n\"lj_vm_powi\",\n\"pow\",\n\"atan2\",\n\"ldexp\",\n\"lj_vm_tobit\",\n\"softfp_add\",\n\"softfp_sub\",\n\"softfp_mul\",\n\"softfp_div\",\n\"softfp_cmp\",\n\"softfp_i2d\",\n\"softfp_d2i\",\n\"lj_vm_sfmin\",\n\"lj_vm_sfmax\",\n\"lj_vm_tointg\",\n\"softfp_ui2d\",\n\"softfp_f2d\",\n\"softfp_d2ui\",\n\"softfp_d2f\",\n\"softfp_i2f\",\n\"softfp_ui2f\",\n\"softfp_f2i\",\n\"softfp_f2ui\",\n\"fp64_l2d\",\n\"fp64_ul2d\",\n\"fp64_l2f\",\n\"fp64_ul2f\",\n\"fp64_d2l\",\n\"fp64_d2ul\",\n\"fp64_f2l\",\n\"fp64_f2ul\",\n\"lj_carith_divi64\",\n\"lj_carith_divu64\",\n\"lj_carith_modi64\",\n\"lj_carith_modu64\",\n\"lj_carith_powi64\",\n\"lj_carith_powu64\",\n\"lj_cdata_newv\",\n\"lj_cdata_setfin\",\n\"strlen\",\n\"memcpy\",\n\"memset\",\n\"lj_vm_errno\",\n\"lj_carith_mul64\",\n\"lj_carith_shl64\",\n\"lj_carith_shr64\",\n\"lj_carith_sar64\",\n\"lj_carith_rol64\",\n\"lj_carith_ror64\",\n},\n\ntraceerr = {\n[0]=\"error thrown or hook called during recording\",\n\"trace too short\",\n\"trace too long\",\n\"trace too deep\",\n\"too many snapshots\",\n\"blacklisted\",\n\"retry recording\",\n\"NYI: bytecode %d\",\n\"leaving loop in root trace\",\n\"inner loop in root trace\",\n\"loop unroll limit reached\",\n\"bad argument type\",\n\"JIT compilation disabled for function\",\n\"call unroll limit reached\",\n\"down-recursion, restarting\",\n\"NYI: unsupported variant of FastFunc %s\",\n\"NYI: return to lower frame\",\n\"store with nil or NaN key\",\n\"missing metamethod\",\n\"looping index lookup\",\n\"NYI: mixed sparse/dense table\",\n\"symbol not in cache\",\n\"NYI: unsupported C type conversion\",\n\"NYI: unsupported C function type\",\n\"guard would always fail\",\n\"too many PHIs\",\n\"persistent type instability\",\n\"failed to allocate mcode memory\",\n\"machine code too long\",\n\"hit mcode limit (retrying)\",\n\"too many spill slots\",\n\"inconsistent register allocation\",\n\"NYI: cannot assemble IR instruction %d\",\n\"NYI: PHI shuffling too complex\",\n\"NYI: register coalescing too complex\",\n},\n\nffnames = {\n[0]=\"Lua\",\n\"C\",\n\"assert\",\n\"type\",\n\"next\",\n\"pairs\",\n\"ipairs_aux\",\n\"ipairs\",\n\"getmetatable\",\n\"setmetatable\",\n\"getfenv\",\n\"setfenv\",\n\"rawget\",\n\"rawset\",\n\"rawequal\",\n\"unpack\",\n\"select\",\n\"tonumber\",\n\"tostring\",\n\"error\",\n\"pcall\",\n\"xpcall\",\n\"loadfile\",\n\"load\",\n\"loadstring\",\n\"dofile\",\n\"gcinfo\",\n\"collectgarbage\",\n\"newproxy\",\n\"print\",\n\"coroutine.status\",\n\"coroutine.running\",\n\"coroutine.isyieldable\",\n\"coroutine.create\",\n\"coroutine.yield\",\n\"coroutine.resume\",\n\"coroutine.wrap_aux\",\n\"coroutine.wrap\",\n\"thread.exdata\",\n\"math.abs\",\n\"math.floor\",\n\"math.ceil\",\n\"math.sqrt\",\n\"math.log10\",\n\"math.exp\",\n\"math.sin\",\n\"math.cos\",\n\"math.tan\",\n\"math.asin\",\n\"math.acos\",\n\"math.atan\",\n\"math.sinh\",\n\"math.cosh\",\n\"math.tanh\",\n\"math.frexp\",\n\"math.modf\",\n\"math.log\",\n\"math.atan2\",\n\"math.pow\",\n\"math.fmod\",\n\"math.ldexp\",\n\"math.min\",\n\"math.max\",\n\"math.random\",\n\"math.randomseed\",\n\"bit.tobit\",\n\"bit.bnot\",\n\"bit.bswap\",\n\"bit.lshift\",\n\"bit.rshift\",\n\"bit.arshift\",\n\"bit.rol\",\n\"bit.ror\",\n\"bit.band\",\n\"bit.bor\",\n\"bit.bxor\",\n\"bit.tohex\",\n\"string.byte\",\n\"string.char\",\n\"string.sub\",\n\"string.rep\",\n\"string.reverse\",\n\"string.lower\",\n\"string.upper\",\n\"string.dump\",\n\"string.find\",\n\"string.match\",\n\"string.gmatch_aux\",\n\"string.gmatch\",\n\"string.gsub\",\n\"string.format\",\n\"table.maxn\",\n\"table.insert\",\n\"table.concat\",\n\"table.clone\",\n\"table.isarray\",\n\"table.nkeys\",\n\"table.isempty\",\n\"table.sort\",\n\"table.new\",\n\"table.clear\",\n\"io.method.close\",\n\"io.method.read\",\n\"io.method.write\",\n\"io.method.flush\",\n\"io.method.seek\",\n\"io.method.setvbuf\",\n\"io.method.lines\",\n\"io.method.__gc\",\n\"io.method.__tostring\",\n\"io.open\",\n\"io.popen\",\n\"io.tmpfile\",\n\"io.close\",\n\"io.read\",\n\"io.write\",\n\"io.flush\",\n\"io.input\",\n\"io.output\",\n\"io.lines\",\n\"io.type\",\n\"os.execute\",\n\"os.remove\",\n\"os.rename\",\n\"os.tmpname\",\n\"os.getenv\",\n\"os.exit\",\n\"os.clock\",\n\"os.date\",\n\"os.time\",\n\"os.difftime\",\n\"os.setlocale\",\n\"debug.getregistry\",\n\"debug.getmetatable\",\n\"debug.setmetatable\",\n\"debug.getfenv\",\n\"debug.setfenv\",\n\"debug.getinfo\",\n\"debug.getlocal\",\n\"debug.setlocal\",\n\"debug.getupvalue\",\n\"debug.setupvalue\",\n\"debug.upvalueid\",\n\"debug.upvaluejoin\",\n\"debug.sethook\",\n\"debug.gethook\",\n\"debug.debug\",\n\"debug.traceback\",\n\"jit.on\",\n\"jit.off\",\n\"jit.flush\",\n\"jit.status\",\n\"jit.attach\",\n\"jit.prngstate\",\n\"jit.util.funcinfo\",\n\"jit.util.funcbc\",\n\"jit.util.funck\",\n\"jit.util.funcuvname\",\n\"jit.util.traceinfo\",\n\"jit.util.traceir\",\n\"jit.util.tracek\",\n\"jit.util.tracesnap\",\n\"jit.util.tracemc\",\n\"jit.util.traceexitstub\",\n\"jit.util.ircalladdr\",\n\"jit.opt.start\",\n\"jit.profile.start\",\n\"jit.profile.stop\",\n\"jit.profile.dumpstack\",\n\"ffi.meta.__index\",\n\"ffi.meta.__newindex\",\n\"ffi.meta.__eq\",\n\"ffi.meta.__len\",\n\"ffi.meta.__lt\",\n\"ffi.meta.__le\",\n\"ffi.meta.__concat\",\n\"ffi.meta.__call\",\n\"ffi.meta.__add\",\n\"ffi.meta.__sub\",\n\"ffi.meta.__mul\",\n\"ffi.meta.__div\",\n\"ffi.meta.__mod\",\n\"ffi.meta.__pow\",\n\"ffi.meta.__unm\",\n\"ffi.meta.__tostring\",\n\"ffi.meta.__pairs\",\n\"ffi.meta.__ipairs\",\n\"ffi.clib.__index\",\n\"ffi.clib.__newindex\",\n\"ffi.clib.__gc\",\n\"ffi.callback.free\",\n\"ffi.callback.set\",\n\"ffi.cdef\",\n\"ffi.new\",\n\"ffi.cast\",\n\"ffi.typeof\",\n\"ffi.typeinfo\",\n\"ffi.istype\",\n\"ffi.sizeof\",\n\"ffi.alignof\",\n\"ffi.offsetof\",\n\"ffi.errno\",\n\"ffi.string\",\n\"ffi.copy\",\n\"ffi.fill\",\n\"ffi.abi\",\n\"ffi.metatype\",\n\"ffi.gc\",\n\"ffi.load\",\n},\n\n}\n\n"
  },
  {
    "path": "Luajit/jit/zone.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT profiler zones.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module implements a simple hierarchical zone model.\n--\n-- Example usage:\n--\n--   local zone = require(\"jit.zone\")\n--   zone(\"AI\")\n--   ...\n--     zone(\"A*\")\n--     ...\n--     print(zone:get()) --> \"A*\"\n--     ...\n--     zone()\n--   ...\n--   print(zone:get()) --> \"AI\"\n--   ...\n--   zone()\n--\n----------------------------------------------------------------------------\n\nlocal remove = table.remove\n\nreturn setmetatable({\n  flush = function(t)\n    for i=#t,1,-1 do t[i] = nil end\n  end,\n  get = function(t)\n    return t[#t]\n  end\n}, {\n  __call = function(t, zone)\n    if zone then\n      t[#t+1] = zone\n    else\n      return (assert(remove(t), \"empty zone stack\"))\n    end\n  end\n})\n\n"
  },
  {
    "path": "Luajit64/Build.bat",
    "content": "@echo off\ncd /d %~dp0\n\nif not exist jit (mkdir jit)\nif not exist Out (mkdir Out)\n\nxcopy /Y /D ..\\..\\..\\Luajit64\\jit jit\nsetlocal enabledelayedexpansion\n\nfor /r %%i in (*.lua) do (\n set v=%%~dpi  \n call :loop\n set v=!v:%~dp0=!\n if not exist %~dp0out\\!v! (mkdir %~dp0Out\\!v!)\n )\n\nfor /r %%i in (*.lua) do (\n set v=%%i \n set v=!v:%~dp0=! \n call :loop\n ..\\..\\..\\Luajit64\\luajit64.exe -b -g !v! Out\\!v!.bytes \n)\n\nrd /s/q jit\nrd /s/q .\\Out\\jit\\\nsetlocal disabledelayedexpansion\n\n:loop \nif \"!v:~-1!\"==\" \" set \"v=!v:~0,-1!\" & goto loop \n\n\n"
  },
  {
    "path": "Luajit64/jit/bc.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT bytecode listing module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module lists the bytecode of a Lua function. If it's loaded by -jbc\n-- it hooks into the parser and lists all functions of a chunk as they\n-- are parsed.\n--\n-- Example usage:\n--\n--   luajit -jbc -e 'local x=0; for i=1,1e6 do x=x+i end; print(x)'\n--   luajit -jbc=- foo.lua\n--   luajit -jbc=foo.list foo.lua\n--\n-- Default output is to stderr. To redirect the output to a file, pass a\n-- filename as an argument (use '-' for stdout) or set the environment\n-- variable LUAJIT_LISTFILE. The file is overwritten every time the module\n-- is started.\n--\n-- This module can also be used programmatically:\n--\n--   local bc = require(\"jit.bc\")\n--\n--   local function foo() print(\"hello\") end\n--\n--   bc.dump(foo)           --> -- BYTECODE -- [...]\n--   print(bc.line(foo, 2)) --> 0002    KSTR     1   1      ; \"hello\"\n--\n--   local out = {\n--     -- Do something with each line:\n--     write = function(t, ...) io.write(...) end,\n--     close = function(t) end,\n--     flush = function(t) end,\n--   }\n--   bc.dump(foo, out)\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal bit = require(\"bit\")\nlocal sub, gsub, format = string.sub, string.gsub, string.format\nlocal byte, band, shr = string.byte, bit.band, bit.rshift\nlocal funcinfo, funcbc, funck = jutil.funcinfo, jutil.funcbc, jutil.funck\nlocal funcuvname = jutil.funcuvname\nlocal bcnames = vmdef.bcnames\nlocal stdout, stderr = io.stdout, io.stderr\n\n------------------------------------------------------------------------------\n\nlocal function ctlsub(c)\n  if c == \"\\n\" then return \"\\\\n\"\n  elseif c == \"\\r\" then return \"\\\\r\"\n  elseif c == \"\\t\" then return \"\\\\t\"\n  else return format(\"\\\\%03d\", byte(c))\n  end\nend\n\n-- Return one bytecode line.\nlocal function bcline(func, pc, prefix, lineinfo)\n  local ins, m, l = funcbc(func, pc, lineinfo and 1 or 0)\n  if not ins then return end\n  local ma, mb, mc = band(m, 7), band(m, 15*8), band(m, 15*128)\n  local a = band(shr(ins, 8), 0xff)\n  local oidx = 6*band(ins, 0xff)\n  local op = sub(bcnames, oidx+1, oidx+6)\n  local s\n  if lineinfo then\n    s = format(\"%04d %7s %s %-6s %3s \",\n      pc, \"[\"..l..\"]\", prefix or \"  \", op, ma == 0 and \"\" or a)\n  else\n    s = format(\"%04d %s %-6s %3s \",\n      pc, prefix or \"  \", op, ma == 0 and \"\" or a)\n  end\n  local d = shr(ins, 16)\n  if mc == 13*128 then -- BCMjump\n    return format(\"%s=> %04d\\n\", s, pc+d-0x7fff)\n  end\n  if mb ~= 0 then\n    d = band(d, 0xff)\n  elseif mc == 0 then\n    return s..\"\\n\"\n  end\n  local kc\n  if mc == 10*128 then -- BCMstr\n    kc = funck(func, -d-1)\n    kc = format(#kc > 40 and '\"%.40s\"~' or '\"%s\"', gsub(kc, \"%c\", ctlsub))\n  elseif mc == 9*128 then -- BCMnum\n    kc = funck(func, d)\n    if op == \"TSETM \" then kc = kc - 2^52 end\n  elseif mc == 12*128 then -- BCMfunc\n    local fi = funcinfo(funck(func, -d-1))\n    if fi.ffid then\n      kc = vmdef.ffnames[fi.ffid]\n    else\n      kc = fi.loc\n    end\n  elseif mc == 5*128 then -- BCMuv\n    kc = funcuvname(func, d)\n  end\n  if ma == 5 then -- BCMuv\n    local ka = funcuvname(func, a)\n    if kc then kc = ka..\" ; \"..kc else kc = ka end\n  end\n  if mb ~= 0 then\n    local b = shr(ins, 24)\n    if kc then return format(\"%s%3d %3d  ; %s\\n\", s, b, d, kc) end\n    return format(\"%s%3d %3d\\n\", s, b, d)\n  end\n  if kc then return format(\"%s%3d      ; %s\\n\", s, d, kc) end\n  if mc == 7*128 and d > 32767 then d = d - 65536 end -- BCMlits\n  return format(\"%s%3d\\n\", s, d)\nend\n\n-- Collect branch targets of a function.\nlocal function bctargets(func)\n  local target = {}\n  for pc=1,1000000000 do\n    local ins, m = funcbc(func, pc)\n    if not ins then break end\n    if band(m, 15*128) == 13*128 then target[pc+shr(ins, 16)-0x7fff] = true end\n  end\n  return target\nend\n\n-- Dump bytecode instructions of a function.\nlocal function bcdump(func, out, all, lineinfo)\n  if not out then out = stdout end\n  local fi = funcinfo(func)\n  if all and fi.children then\n    for n=-1,-1000000000,-1 do\n      local k = funck(func, n)\n      if not k then break end\n      if type(k) == \"proto\" then bcdump(k, out, true, lineinfo) end\n    end\n  end\n  out:write(format(\"-- BYTECODE -- %s-%d\\n\", fi.loc, fi.lastlinedefined))\n\n  for n=-1,-1000000000,-1 do\n    local kc = funck(func, n)\n    if not kc then break end\n\n    local typ = type(kc)\n    if typ == \"string\" then\n      kc = format(#kc > 40 and '\"%.40s\"~' or '\"%s\"', gsub(kc, \"%c\", ctlsub))\n      out:write(format(\"KGC    %d    %s\\n\", -(n + 1), kc))\n    elseif typ == \"proto\" then\n      local fi = funcinfo(kc)\n      if fi.ffid then\n\tkc = vmdef.ffnames[fi.ffid]\n      else\n\tkc = fi.loc\n      end\n      out:write(format(\"KGC    %d    %s\\n\", -(n + 1), kc))\n    elseif typ == \"table\" then\n      out:write(format(\"KGC    %d    table\\n\", -(n + 1)))\n    else\n      -- error(\"unknown KGC type: \" .. typ)\n    end\n  end\n\n  for n=1,1000000000 do\n    local kc = funck(func, n)\n    if not kc then break end\n    if type(kc) == \"number\" then\n      out:write(format(\"KN    %d    %s\\n\", n, kc))\n    end\n  end\n\n  local target = bctargets(func)\n  for pc=1,1000000000 do\n    local s = bcline(func, pc, target[pc] and \"=>\", lineinfo)\n    if not s then break end\n    out:write(s)\n  end\n  out:write(\"\\n\")\n  out:flush()\nend\n\n------------------------------------------------------------------------------\n\n-- Active flag and output file handle.\nlocal active, out\n\n-- List handler.\nlocal function h_list(func)\n  return bcdump(func, out)\nend\n\n-- Detach list handler.\nlocal function bclistoff()\n  if active then\n    active = false\n    jit.attach(h_list)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach list handler.\nlocal function bcliston(outfile)\n  if active then bclistoff() end\n  if not outfile then outfile = os.getenv(\"LUAJIT_LISTFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stderr\n  end\n  jit.attach(h_list, \"bc\")\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  line = bcline,\n  dump = bcdump,\n  targets = bctargets,\n  on = bcliston,\n  off = bclistoff,\n  start = bcliston -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Luajit64/jit/bcsave.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT module to save/list bytecode.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module saves or lists the bytecode for an input file.\n-- It's run by the -b command line option.\n--\n------------------------------------------------------------------------------\n\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal bit = require(\"bit\")\n\n-- Symbol name prefix for LuaJIT bytecode.\nlocal LJBC_PREFIX = \"luaJIT_BC_\"\n\n------------------------------------------------------------------------------\n\nlocal function usage()\n  io.stderr:write[[\nSave LuaJIT bytecode: luajit -b[options] input output\n  -l        Only list bytecode.\n  -L        Only list bytecode with lineinfo.\n  -s        Strip debug info (default).\n  -g        Keep debug info.\n  -n name   Set module name (default: auto-detect from input name).\n  -t type   Set output file type (default: auto-detect from output name).\n  -a arch   Override architecture for object files (default: native).\n  -o os     Override OS for object files (default: native).\n  -e chunk  Use chunk string as input.\n  --        Stop handling options.\n  -         Use stdin as input and/or stdout as output.\n\nFile types: c h obj o raw (default)\n]]\n  os.exit(1)\nend\n\nlocal function check(ok, ...)\n  if ok then return ok, ... end\n  io.stderr:write(\"luajit: \", ...)\n  io.stderr:write(\"\\n\")\n  os.exit(1)\nend\n\nlocal function readfile(input)\n  if type(input) == \"function\" then return input end\n  if input == \"-\" then input = nil end\n  return check(loadfile(input))\nend\n\nlocal function savefile(name, mode)\n  if name == \"-\" then return io.stdout end\n  return check(io.open(name, mode))\nend\n\n------------------------------------------------------------------------------\n\nlocal map_type = {\n  raw = \"raw\", c = \"c\", h = \"h\", o = \"obj\", obj = \"obj\",\n}\n\nlocal map_arch = {\n  x86 = true, x64 = true, arm = true, arm64 = true, arm64be = true,\n  ppc = true, mips = true, mipsel = true,\n}\n\nlocal map_os = {\n  linux = true, windows = true, osx = true, freebsd = true, netbsd = true,\n  openbsd = true, dragonfly = true, solaris = true,\n}\n\nlocal function checkarg(str, map, err)\n  str = string.lower(str)\n  local s = check(map[str], \"unknown \", err)\n  return s == true and str or s\nend\n\nlocal function detecttype(str)\n  local ext = string.match(string.lower(str), \"%.(%a+)$\")\n  return map_type[ext] or \"raw\"\nend\n\nlocal function checkmodname(str)\n  check(string.match(str, \"^[%w_.%-]+$\"), \"bad module name\")\n  return string.gsub(str, \"[%.%-]\", \"_\")\nend\n\nlocal function detectmodname(str)\n  if type(str) == \"string\" then\n    local tail = string.match(str, \"[^/\\\\]+$\")\n    if tail then str = tail end\n    local head = string.match(str, \"^(.*)%.[^.]*$\")\n    if head then str = head end\n    str = string.match(str, \"^[%w_.%-]+\")\n  else\n    str = nil\n  end\n  check(str, \"cannot derive module name, use -n name\")\n  return string.gsub(str, \"[%.%-]\", \"_\")\nend\n\n------------------------------------------------------------------------------\n\nlocal function bcsave_tail(fp, output, s)\n  local ok, err = fp:write(s)\n  if ok and output ~= \"-\" then ok, err = fp:close() end\n  check(ok, \"cannot write \", output, \": \", err)\nend\n\nlocal function bcsave_raw(output, s)\n  local fp = savefile(output, \"wb\")\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_c(ctx, output, s)\n  local fp = savefile(output, \"w\")\n  if ctx.type == \"c\" then\n    fp:write(string.format([[\n#ifdef _cplusplus\nextern \"C\"\n#endif\n#ifdef _WIN32\n__declspec(dllexport)\n#endif\nconst unsigned char %s%s[] = {\n]], LJBC_PREFIX, ctx.modname))\n  else\n    fp:write(string.format([[\n#define %s%s_SIZE %d\nstatic const unsigned char %s%s[] = {\n]], LJBC_PREFIX, ctx.modname, #s, LJBC_PREFIX, ctx.modname))\n  end\n  local t, n, m = {}, 0, 0\n  for i=1,#s do\n    local b = tostring(string.byte(s, i))\n    m = m + #b + 1\n    if m > 78 then\n      fp:write(table.concat(t, \",\", 1, n), \",\\n\")\n      n, m = 0, #b + 1\n    end\n    n = n + 1\n    t[n] = b\n  end\n  bcsave_tail(fp, output, table.concat(t, \",\", 1, n)..\"\\n};\\n\")\nend\n\nlocal function bcsave_elfobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct {\n  uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7];\n  uint16_t type, machine;\n  uint32_t version;\n  uint32_t entry, phofs, shofs;\n  uint32_t flags;\n  uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx;\n} ELF32header;\ntypedef struct {\n  uint8_t emagic[4], eclass, eendian, eversion, eosabi, eabiversion, epad[7];\n  uint16_t type, machine;\n  uint32_t version;\n  uint64_t entry, phofs, shofs;\n  uint32_t flags;\n  uint16_t ehsize, phentsize, phnum, shentsize, shnum, shstridx;\n} ELF64header;\ntypedef struct {\n  uint32_t name, type, flags, addr, ofs, size, link, info, align, entsize;\n} ELF32sectheader;\ntypedef struct {\n  uint32_t name, type;\n  uint64_t flags, addr, ofs, size;\n  uint32_t link, info;\n  uint64_t align, entsize;\n} ELF64sectheader;\ntypedef struct {\n  uint32_t name, value, size;\n  uint8_t info, other;\n  uint16_t sectidx;\n} ELF32symbol;\ntypedef struct {\n  uint32_t name;\n  uint8_t info, other;\n  uint16_t sectidx;\n  uint64_t value, size;\n} ELF64symbol;\ntypedef struct {\n  ELF32header hdr;\n  ELF32sectheader sect[6];\n  ELF32symbol sym[2];\n  uint8_t space[4096];\n} ELF32obj;\ntypedef struct {\n  ELF64header hdr;\n  ELF64sectheader sect[6];\n  ELF64symbol sym[2];\n  uint8_t space[4096];\n} ELF64obj;\n]]\n  local symname = LJBC_PREFIX..ctx.modname\n  local is64, isbe = false, false\n  if ctx.arch == \"x64\" or ctx.arch == \"arm64\" or ctx.arch == \"arm64be\" then\n    is64 = true\n  elseif ctx.arch == \"ppc\" or ctx.arch == \"mips\" then\n    isbe = true\n  end\n\n  -- Handle different host/target endianess.\n  local function f32(x) return x end\n  local f16, fofs = f32, f32\n  if ffi.abi(\"be\") ~= isbe then\n    f32 = bit.bswap\n    function f16(x) return bit.rshift(bit.bswap(x), 16) end\n    if is64 then\n      local two32 = ffi.cast(\"int64_t\", 2^32)\n      function fofs(x) return bit.bswap(x)*two32 end\n    else\n      fofs = f32\n    end\n  end\n\n  -- Create ELF object and fill in header.\n  local o = ffi.new(is64 and \"ELF64obj\" or \"ELF32obj\")\n  local hdr = o.hdr\n  if ctx.os == \"bsd\" or ctx.os == \"other\" then -- Determine native hdr.eosabi.\n    local bf = assert(io.open(\"/bin/ls\", \"rb\"))\n    local bs = bf:read(9)\n    bf:close()\n    ffi.copy(o, bs, 9)\n    check(hdr.emagic[0] == 127, \"no support for writing native object files\")\n  else\n    hdr.emagic = \"\\127ELF\"\n    hdr.eosabi = ({ freebsd=9, netbsd=2, openbsd=12, solaris=6 })[ctx.os] or 0\n  end\n  hdr.eclass = is64 and 2 or 1\n  hdr.eendian = isbe and 2 or 1\n  hdr.eversion = 1\n  hdr.type = f16(1)\n  hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, arm64be=183, ppc=20, mips=8, mipsel=8 })[ctx.arch])\n  if ctx.arch == \"mips\" or ctx.arch == \"mipsel\" then\n    hdr.flags = f32(0x50001006)\n  end\n  hdr.version = f32(1)\n  hdr.shofs = fofs(ffi.offsetof(o, \"sect\"))\n  hdr.ehsize = f16(ffi.sizeof(hdr))\n  hdr.shentsize = f16(ffi.sizeof(o.sect[0]))\n  hdr.shnum = f16(6)\n  hdr.shstridx = f16(2)\n\n  -- Fill in sections and symbols.\n  local sofs, ofs = ffi.offsetof(o, \"space\"), 1\n  for i,name in ipairs{\n      \".symtab\", \".shstrtab\", \".strtab\", \".rodata\", \".note.GNU-stack\",\n    } do\n    local sect = o.sect[i]\n    sect.align = fofs(1)\n    sect.name = f32(ofs)\n    ffi.copy(o.space+ofs, name)\n    ofs = ofs + #name+1\n  end\n  o.sect[1].type = f32(2) -- .symtab\n  o.sect[1].link = f32(3)\n  o.sect[1].info = f32(1)\n  o.sect[1].align = fofs(8)\n  o.sect[1].ofs = fofs(ffi.offsetof(o, \"sym\"))\n  o.sect[1].entsize = fofs(ffi.sizeof(o.sym[0]))\n  o.sect[1].size = fofs(ffi.sizeof(o.sym))\n  o.sym[1].name = f32(1)\n  o.sym[1].sectidx = f16(4)\n  o.sym[1].size = fofs(#s)\n  o.sym[1].info = 17\n  o.sect[2].type = f32(3) -- .shstrtab\n  o.sect[2].ofs = fofs(sofs)\n  o.sect[2].size = fofs(ofs)\n  o.sect[3].type = f32(3) -- .strtab\n  o.sect[3].ofs = fofs(sofs + ofs)\n  o.sect[3].size = fofs(#symname+2)\n  ffi.copy(o.space+ofs+1, symname)\n  ofs = ofs + #symname + 2\n  o.sect[4].type = f32(1) -- .rodata\n  o.sect[4].flags = fofs(2)\n  o.sect[4].ofs = fofs(sofs + ofs)\n  o.sect[4].size = fofs(#s)\n  o.sect[5].type = f32(1) -- .note.GNU-stack\n  o.sect[5].ofs = fofs(sofs + ofs + #s)\n\n  -- Write ELF object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_peobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct {\n  uint16_t arch, nsects;\n  uint32_t time, symtabofs, nsyms;\n  uint16_t opthdrsz, flags;\n} PEheader;\ntypedef struct {\n  char name[8];\n  uint32_t vsize, vaddr, size, ofs, relocofs, lineofs;\n  uint16_t nreloc, nline;\n  uint32_t flags;\n} PEsection;\ntypedef struct __attribute((packed)) {\n  union {\n    char name[8];\n    uint32_t nameref[2];\n  };\n  uint32_t value;\n  int16_t sect;\n  uint16_t type;\n  uint8_t scl, naux;\n} PEsym;\ntypedef struct __attribute((packed)) {\n  uint32_t size;\n  uint16_t nreloc, nline;\n  uint32_t cksum;\n  uint16_t assoc;\n  uint8_t comdatsel, unused[3];\n} PEsymaux;\ntypedef struct {\n  PEheader hdr;\n  PEsection sect[2];\n  // Must be an even number of symbol structs.\n  PEsym sym0;\n  PEsymaux sym0aux;\n  PEsym sym1;\n  PEsymaux sym1aux;\n  PEsym sym2;\n  PEsym sym3;\n  uint32_t strtabsize;\n  uint8_t space[4096];\n} PEobj;\n]]\n  local symname = LJBC_PREFIX..ctx.modname\n  local is64 = false\n  if ctx.arch == \"x86\" then\n    symname = \"_\"..symname\n  elseif ctx.arch == \"x64\" then\n    is64 = true\n  end\n  local symexport = \"   /EXPORT:\"..symname..\",DATA \"\n\n  -- The file format is always little-endian. Swap if the host is big-endian.\n  local function f32(x) return x end\n  local f16 = f32\n  if ffi.abi(\"be\") then\n    f32 = bit.bswap\n    function f16(x) return bit.rshift(bit.bswap(x), 16) end\n  end\n\n  -- Create PE object and fill in header.\n  local o = ffi.new(\"PEobj\")\n  local hdr = o.hdr\n  hdr.arch = f16(({ x86=0x14c, x64=0x8664, arm=0x1c0, ppc=0x1f2, mips=0x366, mipsel=0x366 })[ctx.arch])\n  hdr.nsects = f16(2)\n  hdr.symtabofs = f32(ffi.offsetof(o, \"sym0\"))\n  hdr.nsyms = f32(6)\n\n  -- Fill in sections and symbols.\n  o.sect[0].name = \".drectve\"\n  o.sect[0].size = f32(#symexport)\n  o.sect[0].flags = f32(0x00100a00)\n  o.sym0.sect = f16(1)\n  o.sym0.scl = 3\n  o.sym0.name = \".drectve\"\n  o.sym0.naux = 1\n  o.sym0aux.size = f32(#symexport)\n  o.sect[1].name = \".rdata\"\n  o.sect[1].size = f32(#s)\n  o.sect[1].flags = f32(0x40300040)\n  o.sym1.sect = f16(2)\n  o.sym1.scl = 3\n  o.sym1.name = \".rdata\"\n  o.sym1.naux = 1\n  o.sym1aux.size = f32(#s)\n  o.sym2.sect = f16(2)\n  o.sym2.scl = 2\n  o.sym2.nameref[1] = f32(4)\n  o.sym3.sect = f16(-1)\n  o.sym3.scl = 2\n  o.sym3.value = f32(1)\n  o.sym3.name = \"@feat.00\" -- Mark as SafeSEH compliant.\n  ffi.copy(o.space, symname)\n  local ofs = #symname + 1\n  o.strtabsize = f32(ofs + 4)\n  o.sect[0].ofs = f32(ffi.offsetof(o, \"space\") + ofs)\n  ffi.copy(o.space + ofs, symexport)\n  ofs = ofs + #symexport\n  o.sect[1].ofs = f32(ffi.offsetof(o, \"space\") + ofs)\n\n  -- Write PE object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, ffi.sizeof(o)-4096+ofs))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_machobj(ctx, output, s, ffi)\n  ffi.cdef[[\ntypedef struct\n{\n  uint32_t magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags;\n} mach_header;\ntypedef struct\n{\n  mach_header; uint32_t reserved;\n} mach_header_64;\ntypedef struct {\n  uint32_t cmd, cmdsize;\n  char segname[16];\n  uint32_t vmaddr, vmsize, fileoff, filesize;\n  uint32_t maxprot, initprot, nsects, flags;\n} mach_segment_command;\ntypedef struct {\n  uint32_t cmd, cmdsize;\n  char segname[16];\n  uint64_t vmaddr, vmsize, fileoff, filesize;\n  uint32_t maxprot, initprot, nsects, flags;\n} mach_segment_command_64;\ntypedef struct {\n  char sectname[16], segname[16];\n  uint32_t addr, size;\n  uint32_t offset, align, reloff, nreloc, flags;\n  uint32_t reserved1, reserved2;\n} mach_section;\ntypedef struct {\n  char sectname[16], segname[16];\n  uint64_t addr, size;\n  uint32_t offset, align, reloff, nreloc, flags;\n  uint32_t reserved1, reserved2, reserved3;\n} mach_section_64;\ntypedef struct {\n  uint32_t cmd, cmdsize, symoff, nsyms, stroff, strsize;\n} mach_symtab_command;\ntypedef struct {\n  int32_t strx;\n  uint8_t type, sect;\n  int16_t desc;\n  uint32_t value;\n} mach_nlist;\ntypedef struct {\n  uint32_t strx;\n  uint8_t type, sect;\n  uint16_t desc;\n  uint64_t value;\n} mach_nlist_64;\ntypedef struct\n{\n  uint32_t magic, nfat_arch;\n} mach_fat_header;\ntypedef struct\n{\n  uint32_t cputype, cpusubtype, offset, size, align;\n} mach_fat_arch;\ntypedef struct {\n  struct {\n    mach_header hdr;\n    mach_segment_command seg;\n    mach_section sec;\n    mach_symtab_command sym;\n  } arch[1];\n  mach_nlist sym_entry;\n  uint8_t space[4096];\n} mach_obj;\ntypedef struct {\n  struct {\n    mach_header_64 hdr;\n    mach_segment_command_64 seg;\n    mach_section_64 sec;\n    mach_symtab_command sym;\n  } arch[1];\n  mach_nlist_64 sym_entry;\n  uint8_t space[4096];\n} mach_obj_64;\ntypedef struct {\n  mach_fat_header fat;\n  mach_fat_arch fat_arch[2];\n  struct {\n    mach_header hdr;\n    mach_segment_command seg;\n    mach_section sec;\n    mach_symtab_command sym;\n  } arch[2];\n  mach_nlist sym_entry;\n  uint8_t space[4096];\n} mach_fat_obj;\n]]\n  local symname = '_'..LJBC_PREFIX..ctx.modname\n  local isfat, is64, align, mobj = false, false, 4, \"mach_obj\"\n  if ctx.arch == \"x64\" then\n    is64, align, mobj = true, 8, \"mach_obj_64\"\n  elseif ctx.arch == \"arm\" then\n    isfat, mobj = true, \"mach_fat_obj\"\n  elseif ctx.arch == \"arm64\" then\n    is64, align, isfat, mobj = true, 8, true, \"mach_fat_obj\"\n  else\n    check(ctx.arch == \"x86\", \"unsupported architecture for OSX\")\n  end\n  local function aligned(v, a) return bit.band(v+a-1, -a) end\n  local be32 = bit.bswap -- Mach-O FAT is BE, supported archs are LE.\n\n  -- Create Mach-O object and fill in header.\n  local o = ffi.new(mobj)\n  local mach_size = aligned(ffi.offsetof(o, \"space\")+#symname+2, align)\n  local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12}, arm64={0x01000007,0x0100000c} })[ctx.arch]\n  local cpusubtype = ({ x86={3}, x64={3}, arm={3,9}, arm64={3,0} })[ctx.arch]\n  if isfat then\n    o.fat.magic = be32(0xcafebabe)\n    o.fat.nfat_arch = be32(#cpusubtype)\n  end\n\n  -- Fill in sections and symbols.\n  for i=0,#cpusubtype-1 do\n    local ofs = 0\n    if isfat then\n      local a = o.fat_arch[i]\n      a.cputype = be32(cputype[i+1])\n      a.cpusubtype = be32(cpusubtype[i+1])\n      -- Subsequent slices overlap each other to share data.\n      ofs = ffi.offsetof(o, \"arch\") + i*ffi.sizeof(o.arch[0])\n      a.offset = be32(ofs)\n      a.size = be32(mach_size-ofs+#s)\n    end\n    local a = o.arch[i]\n    a.hdr.magic = is64 and 0xfeedfacf or 0xfeedface\n    a.hdr.cputype = cputype[i+1]\n    a.hdr.cpusubtype = cpusubtype[i+1]\n    a.hdr.filetype = 1\n    a.hdr.ncmds = 2\n    a.hdr.sizeofcmds = ffi.sizeof(a.seg)+ffi.sizeof(a.sec)+ffi.sizeof(a.sym)\n    a.seg.cmd = is64 and 0x19 or 0x1\n    a.seg.cmdsize = ffi.sizeof(a.seg)+ffi.sizeof(a.sec)\n    a.seg.vmsize = #s\n    a.seg.fileoff = mach_size-ofs\n    a.seg.filesize = #s\n    a.seg.maxprot = 1\n    a.seg.initprot = 1\n    a.seg.nsects = 1\n    ffi.copy(a.sec.sectname, \"__data\")\n    ffi.copy(a.sec.segname, \"__DATA\")\n    a.sec.size = #s\n    a.sec.offset = mach_size-ofs\n    a.sym.cmd = 2\n    a.sym.cmdsize = ffi.sizeof(a.sym)\n    a.sym.symoff = ffi.offsetof(o, \"sym_entry\")-ofs\n    a.sym.nsyms = 1\n    a.sym.stroff = ffi.offsetof(o, \"sym_entry\")+ffi.sizeof(o.sym_entry)-ofs\n    a.sym.strsize = aligned(#symname+2, align)\n  end\n  o.sym_entry.type = 0xf\n  o.sym_entry.sect = 1\n  o.sym_entry.strx = 1\n  ffi.copy(o.space+1, symname)\n\n  -- Write Macho-O object file.\n  local fp = savefile(output, \"wb\")\n  fp:write(ffi.string(o, mach_size))\n  bcsave_tail(fp, output, s)\nend\n\nlocal function bcsave_obj(ctx, output, s)\n  local ok, ffi = pcall(require, \"ffi\")\n  check(ok, \"FFI library required to write this file type\")\n  if ctx.os == \"windows\" then\n    return bcsave_peobj(ctx, output, s, ffi)\n  elseif ctx.os == \"osx\" then\n    return bcsave_machobj(ctx, output, s, ffi)\n  else\n    return bcsave_elfobj(ctx, output, s, ffi)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal function bclist(input, output, lineinfo)\n  local f = readfile(input)\n  require(\"jit.bc\").dump(f, savefile(output, \"w\"), true, lineinfo)\nend\n\nlocal function bcsave(ctx, input, output)\n  local f = readfile(input)\n  local s = string.dump(f, ctx.strip)\n  local t = ctx.type\n  if not t then\n    t = detecttype(output)\n    ctx.type = t\n  end\n  if t == \"raw\" then\n    bcsave_raw(output, s)\n  else\n    if not ctx.modname then ctx.modname = detectmodname(input) end\n    if t == \"obj\" then\n      bcsave_obj(ctx, output, s)\n    else\n      bcsave_c(ctx, output, s)\n    end\n  end\nend\n\nlocal function docmd(...)\n  local arg = {...}\n  local n = 1\n  local list = false\n  local lineinfo = false\n  local ctx = {\n    strip = true, arch = jit.arch, os = string.lower(jit.os),\n    type = false, modname = false,\n  }\n  while n <= #arg do\n    local a = arg[n]\n    if type(a) == \"string\" and string.sub(a, 1, 1) == \"-\" and a ~= \"-\" then\n      table.remove(arg, n)\n      if a == \"--\" then break end\n      for m=2,#a do\n\tlocal opt = string.sub(a, m, m)\n\tif opt == \"l\" then\n\t  list = true\n\telseif opt == \"L\" then\n\t  list = true\n\t  lineinfo = true\n\telseif opt == \"s\" then\n\t  ctx.strip = true\n\telseif opt == \"g\" then\n\t  ctx.strip = false\n\telse\n\t  if arg[n] == nil or m ~= #a then usage() end\n\t  if opt == \"e\" then\n\t    if n ~= 1 then usage() end\n\t    arg[1] = check(loadstring(arg[1]))\n\t  elseif opt == \"n\" then\n\t    ctx.modname = checkmodname(table.remove(arg, n))\n\t  elseif opt == \"t\" then\n\t    ctx.type = checkarg(table.remove(arg, n), map_type, \"file type\")\n\t  elseif opt == \"a\" then\n\t    ctx.arch = checkarg(table.remove(arg, n), map_arch, \"architecture\")\n\t  elseif opt == \"o\" then\n\t    ctx.os = checkarg(table.remove(arg, n), map_os, \"OS name\")\n\t  else\n\t    usage()\n\t  end\n\tend\n      end\n    else\n      n = n + 1\n    end\n  end\n  if list then\n    if #arg == 0 or #arg > 2 then usage() end\n    bclist(arg[1], arg[2] or \"-\", lineinfo)\n  else\n    if #arg ~= 2 then usage() end\n    bcsave(ctx, arg[1], arg[2])\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Public module functions.\nreturn {\n  start = docmd -- Process -b command line option.\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_arm.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles most user-mode ARMv7 instructions\n-- NYI: Advanced SIMD and VFP instructions.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch = string.match, string.gmatch\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, ror, tohex = bit.band, bit.bor, bit.ror, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Opcode maps\n------------------------------------------------------------------------------\n\nlocal map_loadc = {\n  shift = 8, mask = 15,\n  [10] = {\n    shift = 20, mask = 1,\n    [0] = {\n      shift = 23, mask = 3,\n      [0] = \"vmovFmDN\", \"vstmFNdr\",\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vstrFdl\",\n\t{ shift = 16, mask = 15, [13] = \"vpushFdr\", _ = \"vstmdbFNdr\", }\n      },\n    },\n    {\n      shift = 23, mask = 3,\n      [0] = \"vmovFDNm\",\n      { shift = 16, mask = 15, [13] = \"vpopFdr\", _ = \"vldmFNdr\", },\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vldrFdl\", \"vldmdbFNdr\",\n      },\n    },\n  },\n  [11] = {\n    shift = 20, mask = 1,\n    [0] = {\n      shift = 23, mask = 3,\n      [0] = \"vmovGmDN\", \"vstmGNdr\",\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vstrGdl\",\n\t{ shift = 16, mask = 15, [13] = \"vpushGdr\", _ = \"vstmdbGNdr\", }\n      },\n    },\n    {\n      shift = 23, mask = 3,\n      [0] = \"vmovGDNm\",\n      { shift = 16, mask = 15, [13] = \"vpopGdr\", _ = \"vldmGNdr\", },\n      _ = {\n\tshift = 21, mask = 1,\n\t[0] = \"vldrGdl\", \"vldmdbGNdr\",\n      },\n    },\n  },\n  _ = {\n    shift = 0, mask = 0 -- NYI ldc, mcrr, mrrc.\n  },\n}\n\nlocal map_vfps = {\n  shift = 6, mask = 0x2c001,\n  [0] = \"vmlaF.dnm\", \"vmlsF.dnm\",\n  [0x04000] = \"vnmlsF.dnm\", [0x04001] = \"vnmlaF.dnm\",\n  [0x08000] = \"vmulF.dnm\", [0x08001] = \"vnmulF.dnm\",\n  [0x0c000] = \"vaddF.dnm\", [0x0c001] = \"vsubF.dnm\",\n  [0x20000] = \"vdivF.dnm\",\n  [0x24000] = \"vfnmsF.dnm\", [0x24001] = \"vfnmaF.dnm\",\n  [0x28000] = \"vfmaF.dnm\", [0x28001] = \"vfmsF.dnm\",\n  [0x2c000] = \"vmovF.dY\",\n  [0x2c001] = {\n    shift = 7, mask = 0x1e01,\n    [0] = \"vmovF.dm\", \"vabsF.dm\",\n    [0x0200] = \"vnegF.dm\", [0x0201] = \"vsqrtF.dm\",\n    [0x0800] = \"vcmpF.dm\", [0x0801] = \"vcmpeF.dm\",\n    [0x0a00] = \"vcmpzF.d\", [0x0a01] = \"vcmpzeF.d\",\n    [0x0e01] = \"vcvtG.dF.m\",\n    [0x1000] = \"vcvt.f32.u32Fdm\", [0x1001] = \"vcvt.f32.s32Fdm\",\n    [0x1800] = \"vcvtr.u32F.dm\", [0x1801] = \"vcvt.u32F.dm\",\n    [0x1a00] = \"vcvtr.s32F.dm\", [0x1a01] = \"vcvt.s32F.dm\",\n  },\n}\n\nlocal map_vfpd = {\n  shift = 6, mask = 0x2c001,\n  [0] = \"vmlaG.dnm\", \"vmlsG.dnm\",\n  [0x04000] = \"vnmlsG.dnm\", [0x04001] = \"vnmlaG.dnm\",\n  [0x08000] = \"vmulG.dnm\", [0x08001] = \"vnmulG.dnm\",\n  [0x0c000] = \"vaddG.dnm\", [0x0c001] = \"vsubG.dnm\",\n  [0x20000] = \"vdivG.dnm\",\n  [0x24000] = \"vfnmsG.dnm\", [0x24001] = \"vfnmaG.dnm\",\n  [0x28000] = \"vfmaG.dnm\", [0x28001] = \"vfmsG.dnm\",\n  [0x2c000] = \"vmovG.dY\",\n  [0x2c001] = {\n    shift = 7, mask = 0x1e01,\n    [0] = \"vmovG.dm\", \"vabsG.dm\",\n    [0x0200] = \"vnegG.dm\", [0x0201] = \"vsqrtG.dm\",\n    [0x0800] = \"vcmpG.dm\", [0x0801] = \"vcmpeG.dm\",\n    [0x0a00] = \"vcmpzG.d\", [0x0a01] = \"vcmpzeG.d\",\n    [0x0e01] = \"vcvtF.dG.m\",\n    [0x1000] = \"vcvt.f64.u32GdFm\", [0x1001] = \"vcvt.f64.s32GdFm\",\n    [0x1800] = \"vcvtr.u32FdG.m\", [0x1801] = \"vcvt.u32FdG.m\",\n    [0x1a00] = \"vcvtr.s32FdG.m\", [0x1a01] = \"vcvt.s32FdG.m\",\n  },\n}\n\nlocal map_datac = {\n  shift = 24, mask = 1,\n  [0] = {\n    shift = 4, mask = 1,\n    [0] = {\n      shift = 8, mask = 15,\n      [10] = map_vfps,\n      [11] = map_vfpd,\n      -- NYI cdp, mcr, mrc.\n    },\n    {\n      shift = 8, mask = 15,\n      [10] = {\n\tshift = 20, mask = 15,\n\t[0] = \"vmovFnD\", \"vmovFDn\",\n\t[14] = \"vmsrD\",\n\t[15] = { shift = 12, mask = 15, [15] = \"vmrs\", _ = \"vmrsD\", },\n      },\n    },\n  },\n  \"svcT\",\n}\n\nlocal map_loadcu = {\n  shift = 0, mask = 0, -- NYI unconditional CP load/store.\n}\n\nlocal map_datacu = {\n  shift = 0, mask = 0, -- NYI unconditional CP data.\n}\n\nlocal map_simddata = {\n  shift = 0, mask = 0, -- NYI SIMD data.\n}\n\nlocal map_simdload = {\n  shift = 0, mask = 0, -- NYI SIMD load/store, preload.\n}\n\nlocal map_preload = {\n  shift = 0, mask = 0, -- NYI preload.\n}\n\nlocal map_media = {\n  shift = 20, mask = 31,\n  [0] = false,\n  { --01\n    shift = 5, mask = 7,\n    [0] = \"sadd16DNM\", \"sasxDNM\", \"ssaxDNM\", \"ssub16DNM\",\n    \"sadd8DNM\", false, false, \"ssub8DNM\",\n  },\n  { --02\n    shift = 5, mask = 7,\n    [0] = \"qadd16DNM\", \"qasxDNM\", \"qsaxDNM\", \"qsub16DNM\",\n    \"qadd8DNM\", false, false, \"qsub8DNM\",\n  },\n  { --03\n    shift = 5, mask = 7,\n    [0] = \"shadd16DNM\", \"shasxDNM\", \"shsaxDNM\", \"shsub16DNM\",\n    \"shadd8DNM\", false, false, \"shsub8DNM\",\n  },\n  false,\n  { --05\n    shift = 5, mask = 7,\n    [0] = \"uadd16DNM\", \"uasxDNM\", \"usaxDNM\", \"usub16DNM\",\n    \"uadd8DNM\", false, false, \"usub8DNM\",\n  },\n  { --06\n    shift = 5, mask = 7,\n    [0] = \"uqadd16DNM\", \"uqasxDNM\", \"uqsaxDNM\", \"uqsub16DNM\",\n    \"uqadd8DNM\", false, false, \"uqsub8DNM\",\n  },\n  { --07\n    shift = 5, mask = 7,\n    [0] = \"uhadd16DNM\", \"uhasxDNM\", \"uhsaxDNM\", \"uhsub16DNM\",\n    \"uhadd8DNM\", false, false, \"uhsub8DNM\",\n  },\n  { --08\n    shift = 5, mask = 7,\n    [0] = \"pkhbtDNMU\", false, \"pkhtbDNMU\",\n    { shift = 16, mask = 15, [15] = \"sxtb16DMU\", _ = \"sxtab16DNMU\", },\n    \"pkhbtDNMU\", \"selDNM\", \"pkhtbDNMU\",\n  },\n  false,\n  { --0a\n    shift = 5, mask = 7,\n    [0] = \"ssatDxMu\", \"ssat16DxM\", \"ssatDxMu\",\n    { shift = 16, mask = 15, [15] = \"sxtbDMU\", _ = \"sxtabDNMU\", },\n    \"ssatDxMu\", false, \"ssatDxMu\",\n  },\n  { --0b\n    shift = 5, mask = 7,\n    [0] = \"ssatDxMu\", \"revDM\", \"ssatDxMu\",\n    { shift = 16, mask = 15, [15] = \"sxthDMU\", _ = \"sxtahDNMU\", },\n    \"ssatDxMu\", \"rev16DM\", \"ssatDxMu\",\n  },\n  { --0c\n    shift = 5, mask = 7,\n    [3] = { shift = 16, mask = 15, [15] = \"uxtb16DMU\", _ = \"uxtab16DNMU\", },\n  },\n  false,\n  { --0e\n    shift = 5, mask = 7,\n    [0] = \"usatDwMu\", \"usat16DwM\", \"usatDwMu\",\n    { shift = 16, mask = 15, [15] = \"uxtbDMU\", _ = \"uxtabDNMU\", },\n    \"usatDwMu\", false, \"usatDwMu\",\n  },\n  { --0f\n    shift = 5, mask = 7,\n    [0] = \"usatDwMu\", \"rbitDM\", \"usatDwMu\",\n    { shift = 16, mask = 15, [15] = \"uxthDMU\", _ = \"uxtahDNMU\", },\n    \"usatDwMu\", \"revshDM\", \"usatDwMu\",\n  },\n  { --10\n    shift = 12, mask = 15,\n    [15] = {\n      shift = 5, mask = 7,\n      \"smuadNMS\", \"smuadxNMS\", \"smusdNMS\", \"smusdxNMS\",\n    },\n    _ = {\n      shift = 5, mask = 7,\n      [0] = \"smladNMSD\", \"smladxNMSD\", \"smlsdNMSD\", \"smlsdxNMSD\",\n    },\n  },\n  false, false, false,\n  { --14\n    shift = 5, mask = 7,\n    [0] = \"smlaldDNMS\", \"smlaldxDNMS\", \"smlsldDNMS\", \"smlsldxDNMS\",\n  },\n  { --15\n    shift = 5, mask = 7,\n    [0] = { shift = 12, mask = 15, [15] = \"smmulNMS\", _ = \"smmlaNMSD\", },\n    { shift = 12, mask = 15, [15] = \"smmulrNMS\", _ = \"smmlarNMSD\", },\n    false, false, false, false,\n    \"smmlsNMSD\", \"smmlsrNMSD\",\n  },\n  false, false,\n  { --18\n    shift = 5, mask = 7,\n    [0] = { shift = 12, mask = 15, [15] = \"usad8NMS\", _ = \"usada8NMSD\", },\n  },\n  false,\n  { --1a\n    shift = 5, mask = 3, [2] = \"sbfxDMvw\",\n  },\n  { --1b\n    shift = 5, mask = 3, [2] = \"sbfxDMvw\",\n  },\n  { --1c\n    shift = 5, mask = 3,\n    [0] = { shift = 0, mask = 15, [15] = \"bfcDvX\", _ = \"bfiDMvX\", },\n  },\n  { --1d\n    shift = 5, mask = 3,\n    [0] = { shift = 0, mask = 15, [15] = \"bfcDvX\", _ = \"bfiDMvX\", },\n  },\n  { --1e\n    shift = 5, mask = 3, [2] = \"ubfxDMvw\",\n  },\n  { --1f\n    shift = 5, mask = 3, [2] = \"ubfxDMvw\",\n  },\n}\n\nlocal map_load = {\n  shift = 21, mask = 9,\n  {\n    shift = 20, mask = 5,\n    [0] = \"strtDL\", \"ldrtDL\", [4] = \"strbtDL\", [5] = \"ldrbtDL\",\n  },\n  _ = {\n    shift = 20, mask = 5,\n    [0] = \"strDL\", \"ldrDL\", [4] = \"strbDL\", [5] = \"ldrbDL\",\n  }\n}\n\nlocal map_load1 = {\n  shift = 4, mask = 1,\n  [0] = map_load, map_media,\n}\n\nlocal map_loadm = {\n  shift = 20, mask = 1,\n  [0] = {\n    shift = 23, mask = 3,\n    [0] = \"stmdaNR\", \"stmNR\",\n    { shift = 16, mask = 63, [45] = \"pushR\", _ = \"stmdbNR\", }, \"stmibNR\",\n  },\n  {\n    shift = 23, mask = 3,\n    [0] = \"ldmdaNR\", { shift = 16, mask = 63, [61] = \"popR\", _ = \"ldmNR\", },\n    \"ldmdbNR\", \"ldmibNR\",\n  },\n}\n\nlocal map_data = {\n  shift = 21, mask = 15,\n  [0] = \"andDNPs\", \"eorDNPs\", \"subDNPs\", \"rsbDNPs\",\n  \"addDNPs\", \"adcDNPs\", \"sbcDNPs\", \"rscDNPs\",\n  \"tstNP\", \"teqNP\", \"cmpNP\", \"cmnNP\",\n  \"orrDNPs\", \"movDPs\", \"bicDNPs\", \"mvnDPs\",\n}\n\nlocal map_mul = {\n  shift = 21, mask = 7,\n  [0] = \"mulNMSs\", \"mlaNMSDs\", \"umaalDNMS\", \"mlsDNMS\",\n  \"umullDNMSs\", \"umlalDNMSs\", \"smullDNMSs\", \"smlalDNMSs\",\n}\n\nlocal map_sync = {\n  shift = 20, mask = 15, -- NYI: brackets around N. R(D+1) for ldrexd/strexd.\n  [0] = \"swpDMN\", false, false, false,\n  \"swpbDMN\", false, false, false,\n  \"strexDMN\", \"ldrexDN\", \"strexdDN\", \"ldrexdDN\",\n  \"strexbDMN\", \"ldrexbDN\", \"strexhDN\", \"ldrexhDN\",\n}\n\nlocal map_mulh = {\n  shift = 21, mask = 3,\n  [0] = { shift = 5, mask = 3,\n    [0] = \"smlabbNMSD\", \"smlatbNMSD\", \"smlabtNMSD\", \"smlattNMSD\", },\n  { shift = 5, mask = 3,\n    [0] = \"smlawbNMSD\", \"smulwbNMS\", \"smlawtNMSD\", \"smulwtNMS\", },\n  { shift = 5, mask = 3,\n    [0] = \"smlalbbDNMS\", \"smlaltbDNMS\", \"smlalbtDNMS\", \"smlalttDNMS\", },\n  { shift = 5, mask = 3,\n    [0] = \"smulbbNMS\", \"smultbNMS\", \"smulbtNMS\", \"smulttNMS\", },\n}\n\nlocal map_misc = {\n  shift = 4, mask = 7,\n  -- NYI: decode PSR bits of msr.\n  [0] = { shift = 21, mask = 1, [0] = \"mrsD\", \"msrM\", },\n  { shift = 21, mask = 3, \"bxM\", false, \"clzDM\", },\n  { shift = 21, mask = 3, \"bxjM\", },\n  { shift = 21, mask = 3, \"blxM\", },\n  false,\n  { shift = 21, mask = 3, [0] = \"qaddDMN\", \"qsubDMN\", \"qdaddDMN\", \"qdsubDMN\", },\n  false,\n  { shift = 21, mask = 3, \"bkptK\", },\n}\n\nlocal map_datar = {\n  shift = 4, mask = 9,\n  [9] = {\n    shift = 5, mask = 3,\n    [0] = { shift = 24, mask = 1, [0] = map_mul, map_sync, },\n    { shift = 20, mask = 1, [0] = \"strhDL\", \"ldrhDL\", },\n    { shift = 20, mask = 1, [0] = \"ldrdDL\", \"ldrsbDL\", },\n    { shift = 20, mask = 1, [0] = \"strdDL\", \"ldrshDL\", },\n  },\n  _ = {\n    shift = 20, mask = 25,\n    [16] = { shift = 7, mask = 1, [0] = map_misc, map_mulh, },\n    _ = {\n      shift = 0, mask = 0xffffffff,\n      [bor(0xe1a00000)] = \"nop\",\n      _ = map_data,\n    }\n  },\n}\n\nlocal map_datai = {\n  shift = 20, mask = 31, -- NYI: decode PSR bits of msr. Decode imm12.\n  [16] = \"movwDW\", [20] = \"movtDW\",\n  [18] = { shift = 0, mask = 0xf00ff, [0] = \"nopv6\", _ = \"msrNW\", },\n  [22] = \"msrNW\",\n  _ = map_data,\n}\n\nlocal map_branch = {\n  shift = 24, mask = 1,\n  [0] = \"bB\", \"blB\"\n}\n\nlocal map_condins = {\n  [0] = map_datar, map_datai, map_load, map_load1,\n  map_loadm, map_branch, map_loadc, map_datac\n}\n\n-- NYI: setend.\nlocal map_uncondins = {\n  [0] = false, map_simddata, map_simdload, map_preload,\n  false, \"blxB\", map_loadcu, map_datacu,\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"r1\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"sp\", \"lr\", \"pc\",\n}\n\nlocal map_cond = {\n  [0] = \"eq\", \"ne\", \"hs\", \"lo\", \"mi\", \"pl\", \"vs\", \"vc\",\n  \"hi\", \"ls\", \"ge\", \"lt\", \"gt\", \"le\", \"al\",\n}\n\nlocal map_shift = { [0] = \"lsl\", \"lsr\", \"asr\", \"ror\", }\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then\n      extra = \"\\t->\"..sym\n    elseif band(ctx.op, 0x0e000000) ~= 0x0a000000 then\n      extra = \"\\t; 0x\"..tohex(ctx.rel)\n    end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-5s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-5s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\n-- Format operand 2 of load/store opcodes.\nlocal function fmtload(ctx, op, pos)\n  local base = map_gpr[band(rshift(op, 16), 15)]\n  local x, ofs\n  local ext = (band(op, 0x04000000) == 0)\n  if not ext and band(op, 0x02000000) == 0 then\n    ofs = band(op, 4095)\n    if band(op, 0x00800000) == 0 then ofs = -ofs end\n    if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n    ofs = \"#\"..ofs\n  elseif ext and band(op, 0x00400000) ~= 0 then\n    ofs = band(op, 15) + band(rshift(op, 4), 0xf0)\n    if band(op, 0x00800000) == 0 then ofs = -ofs end\n    if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n    ofs = \"#\"..ofs\n  else\n    ofs = map_gpr[band(op, 15)]\n    if ext or band(op, 0xfe0) == 0 then\n    elseif band(op, 0xfe0) == 0x60 then\n      ofs = format(\"%s, rrx\", ofs)\n    else\n      local sh = band(rshift(op, 7), 31)\n      if sh == 0 then sh = 32 end\n      ofs = format(\"%s, %s #%d\", ofs, map_shift[band(rshift(op, 5), 3)], sh)\n    end\n    if band(op, 0x00800000) == 0 then ofs = \"-\"..ofs end\n  end\n  if ofs == \"#0\" then\n    x = format(\"[%s]\", base)\n  elseif band(op, 0x01000000) == 0 then\n    x = format(\"[%s], %s\", base, ofs)\n  else\n    x = format(\"[%s, %s]\", base, ofs)\n  end\n  if band(op, 0x01200000) == 0x01200000 then x = x..\"!\" end\n  return x\nend\n\n-- Format operand 2 of vector load/store opcodes.\nlocal function fmtvload(ctx, op, pos)\n  local base = map_gpr[band(rshift(op, 16), 15)]\n  local ofs = band(op, 255)*4\n  if band(op, 0x00800000) == 0 then ofs = -ofs end\n  if base == \"pc\" then ctx.rel = ctx.addr + pos + 8 + ofs end\n  if ofs == 0 then\n    return format(\"[%s]\", base)\n  else\n    return format(\"[%s, #%d]\", base, ofs)\n  end\nend\n\nlocal function fmtvr(op, vr, sh0, sh1)\n  if vr == \"s\" then\n    return format(\"s%d\", 2*band(rshift(op, sh0), 15)+band(rshift(op, sh1), 1))\n  else\n    return format(\"d%d\", band(rshift(op, sh0), 15)+band(rshift(op, sh1-4), 16))\n  end\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\n  local operands = {}\n  local suffix = \"\"\n  local last, name, pat\n  local vr\n  ctx.op = op\n  ctx.rel = nil\n\n  local cond = rshift(op, 28)\n  local opat\n  if cond == 15 then\n    opat = map_uncondins[band(rshift(op, 25), 7)]\n  else\n    if cond ~= 14 then suffix = map_cond[cond] end\n    opat = map_condins[band(rshift(op, 25), 7)]\n  end\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  name, pat = match(opat, \"^([a-z0-9]*)(.*)\")\n  if sub(pat, 1, 1) == \".\" then\n    local s2, p2 = match(pat, \"^([a-z0-9.]*)(.*)\")\n    suffix = suffix..s2\n    pat = p2\n  end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"D\" then\n      x = map_gpr[band(rshift(op, 12), 15)]\n    elseif p == \"N\" then\n      x = map_gpr[band(rshift(op, 16), 15)]\n    elseif p == \"S\" then\n      x = map_gpr[band(rshift(op, 8), 15)]\n    elseif p == \"M\" then\n      x = map_gpr[band(op, 15)]\n    elseif p == \"d\" then\n      x = fmtvr(op, vr, 12, 22)\n    elseif p == \"n\" then\n      x = fmtvr(op, vr, 16, 7)\n    elseif p == \"m\" then\n      x = fmtvr(op, vr, 0, 5)\n    elseif p == \"P\" then\n      if band(op, 0x02000000) ~= 0 then\n\tx = ror(band(op, 255), 2*band(rshift(op, 8), 15))\n      else\n\tx = map_gpr[band(op, 15)]\n\tif band(op, 0xff0) ~= 0 then\n\t  operands[#operands+1] = x\n\t  local s = map_shift[band(rshift(op, 5), 3)]\n\t  local r = nil\n\t  if band(op, 0xf90) == 0 then\n\t    if s == \"ror\" then s = \"rrx\" else r = \"#32\" end\n\t  elseif band(op, 0x10) == 0 then\n\t    r = \"#\"..band(rshift(op, 7), 31)\n\t  else\n\t    r = map_gpr[band(rshift(op, 8), 15)]\n\t  end\n\t  if name == \"mov\" then name = s; x = r\n\t  elseif r then x = format(\"%s %s\", s, r)\n\t  else x = s end\n\tend\n      end\n    elseif p == \"L\" then\n      x = fmtload(ctx, op, pos)\n    elseif p == \"l\" then\n      x = fmtvload(ctx, op, pos)\n    elseif p == \"B\" then\n      local addr = ctx.addr + pos + 8 + arshift(lshift(op, 8), 6)\n      if cond == 15 then addr = addr + band(rshift(op, 23), 2) end\n      ctx.rel = addr\n      x = \"0x\"..tohex(addr)\n    elseif p == \"F\" then\n      vr = \"s\"\n    elseif p == \"G\" then\n      vr = \"d\"\n    elseif p == \".\" then\n      suffix = suffix..(vr == \"s\" and \".f32\" or \".f64\")\n    elseif p == \"R\" then\n      if band(op, 0x00200000) ~= 0 and #operands == 1 then\n\toperands[1] = operands[1]..\"!\"\n      end\n      local t = {}\n      for i=0,15 do\n\tif band(rshift(op, i), 1) == 1 then t[#t+1] = map_gpr[i] end\n      end\n      x = \"{\"..concat(t, \", \")..\"}\"\n    elseif p == \"r\" then\n      if band(op, 0x00200000) ~= 0 and #operands == 2 then\n\toperands[1] = operands[1]..\"!\"\n      end\n      local s = tonumber(sub(last, 2))\n      local n = band(op, 255)\n      if vr == \"d\" then n = rshift(n, 1) end\n      operands[#operands] = format(\"{%s-%s%d}\", last, vr, s+n-1)\n    elseif p == \"W\" then\n      x = band(op, 0x0fff) + band(rshift(op, 4), 0xf000)\n    elseif p == \"T\" then\n      x = \"#0x\"..tohex(band(op, 0x00ffffff), 6)\n    elseif p == \"U\" then\n      x = band(rshift(op, 7), 31)\n      if x == 0 then x = nil end\n    elseif p == \"u\" then\n      x = band(rshift(op, 7), 31)\n      if band(op, 0x40) == 0 then\n\tif x == 0 then x = nil else x = \"lsl #\"..x end\n      else\n\tif x == 0 then x = \"asr #32\" else x = \"asr #\"..x end\n      end\n    elseif p == \"v\" then\n      x = band(rshift(op, 7), 31)\n    elseif p == \"w\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"x\" then\n      x = band(rshift(op, 16), 31) + 1\n    elseif p == \"X\" then\n      x = band(rshift(op, 16), 31) - last + 1\n    elseif p == \"Y\" then\n      x = band(rshift(op, 12), 0xf0) + band(op, 0x0f)\n    elseif p == \"K\" then\n      x = \"#0x\"..tohex(band(rshift(op, 4), 0x0000fff0) + band(op, 15), 4)\n    elseif p == \"s\" then\n      if band(op, 0x00100000) ~= 0 then suffix = \"s\"..suffix end\n    else\n      assert(false)\n    end\n    if x then\n      last = x\n      if type(x) == \"number\" then x = \"#\"..x end\n      operands[#operands+1] = x\n    end\n  end\n\n  return putop(ctx, name..suffix, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ctx.pos = ofs\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 16 then return map_gpr[r] end\n  return \"d\"..(r-16)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_arm64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM64 disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n--\n-- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com.\n-- Sponsored by Cisco Systems, Inc.\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles most user-mode AArch64 instructions.\n-- NYI: Advanced SIMD and VFP instructions.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, bxor, tohex = bit.band, bit.bor, bit.bxor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\nlocal ror = bit.ror\n\n------------------------------------------------------------------------------\n-- Opcode maps\n------------------------------------------------------------------------------\n\nlocal map_adr = { -- PC-relative addressing.\n  shift = 31, mask = 1,\n  [0] = \"adrDBx\", \"adrpDBx\"\n}\n\nlocal map_addsubi = { -- Add/subtract immediate.\n  shift = 29, mask = 3,\n  [0] = \"add|movDNIg\", \"adds|cmnD0NIg\", \"subDNIg\", \"subs|cmpD0NIg\",\n}\n\nlocal map_logi = { -- Logical immediate.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"andDNig\", \"orr|movDN0ig\", \"eorDNig\", \"ands|tstD0Nig\"\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = \"andDNig\", \"orr|movDN0ig\", \"eorDNig\", \"ands|tstD0Nig\"\n  }\n}\n\nlocal map_movwi = { -- Move wide immediate.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"movnDWRg\", false, \"movz|movDYRg\", \"movkDWRg\"\n    }, false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = \"movnDWRg\", false, \"movz|movDYRg\", \"movkDWRg\"\n  },\n}\n\nlocal map_bitf = { -- Bitfield.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 22, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"sbfm|sbfiz|sbfx|asr|sxtw|sxth|sxtbDN12w\",\n      \"bfm|bfi|bfxilDN13w\",\n      \"ubfm|ubfiz|ubfx|lsr|lsl|uxth|uxtbDN12w\"\n    }\n  },\n  {\n    shift = 22, mask = 1,\n    {\n      shift = 29, mask = 3,\n      [0] = \"sbfm|sbfiz|sbfx|asr|sxtw|sxth|sxtbDN12x\",\n      \"bfm|bfi|bfxilDN13x\",\n      \"ubfm|ubfiz|ubfx|lsr|lsl|uxth|uxtbDN12x\"\n    }\n  }\n}\n\nlocal map_datai = { -- Data processing - immediate.\n  shift = 23, mask = 7,\n  [0] = map_adr, map_adr, map_addsubi, false,\n  map_logi, map_movwi, map_bitf,\n  {\n    shift = 15, mask = 0x1c0c1,\n    [0] = \"extr|rorDNM4w\", [0x10080] = \"extr|rorDNM4x\",\n    [0x10081] = \"extr|rorDNM4x\"\n  }\n}\n\nlocal map_logsr = { -- Logical, shifted register.\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = {\n\tshift = 21, mask = 7,\n\t[0] = \"andDNMSg\", \"bicDNMSg\", \"andDNMSg\", \"bicDNMSg\",\n\t\"andDNMSg\", \"bicDNMSg\", \"andDNMg\", \"bicDNMg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] =\"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0MSg\", \"orn|mvnDN0MSg\",\n\t     \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0Mg\", \"orn|mvnDN0Mg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] = \"eorDNMSg\", \"eonDNMSg\", \"eorDNMSg\", \"eonDNMSg\",\n\t\"eorDNMSg\", \"eonDNMSg\", \"eorDNMg\", \"eonDNMg\"\n      },\n      {\n\tshift = 21, mask = 7,\n\t[0] = \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMSg\", \"bicsDNMSg\",\n\t\"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMg\", \"bicsDNMg\"\n      }\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = {\n      shift = 21, mask = 7,\n      [0] = \"andDNMSg\", \"bicDNMSg\", \"andDNMSg\", \"bicDNMSg\",\n      \"andDNMSg\", \"bicDNMSg\", \"andDNMg\", \"bicDNMg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0MSg\", \"orn|mvnDN0MSg\",\n      \"orr|movDN0MSg\", \"orn|mvnDN0MSg\", \"orr|movDN0Mg\", \"orn|mvnDN0Mg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"eorDNMSg\", \"eonDNMSg\", \"eorDNMSg\", \"eonDNMSg\",\n      \"eorDNMSg\", \"eonDNMSg\", \"eorDNMg\", \"eonDNMg\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMSg\", \"bicsDNMSg\",\n      \"ands|tstD0NMSg\", \"bicsDNMSg\", \"ands|tstD0NMg\", \"bicsDNMg\"\n    }\n  }\n}\n\nlocal map_assh = {\n  shift = 31, mask = 1,\n  [0] = {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = {\n\tshift = 22, mask = 3,\n\t[0] = \"addDNMSg\", \"addDNMSg\", \"addDNMSg\", \"addDNMg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\",\n\t      \"adds|cmnD0NMSg\", \"adds|cmnD0NMg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0Mg\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0MzSg\",\n\t      \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0Mzg\"\n      },\n    },\n    false -- unallocated\n  },\n  {\n    shift = 29, mask = 3,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"addDNMSg\", \"addDNMSg\", \"addDNMSg\", \"addDNMg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\", \"adds|cmnD0NMSg\",\n\t    \"adds|cmnD0NMg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0MSg\", \"sub|negDN0Mg\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0MzSg\",\n\t    \"subs|cmp|negsD0N0MzSg\", \"subs|cmp|negsD0N0Mzg\"\n    }\n  }\n}\n\nlocal map_addsubsh = { -- Add/subtract, shifted register.\n  shift = 22, mask = 3,\n  [0] = map_assh, map_assh, map_assh\n}\n\nlocal map_addsubex = { -- Add/subtract, extended register.\n  shift = 22, mask = 3,\n  [0] = {\n    shift = 29, mask = 3,\n    [0] = \"addDNMXg\", \"adds|cmnD0NMXg\", \"subDNMXg\", \"subs|cmpD0NMzXg\",\n  }\n}\n\nlocal map_addsubc = { -- Add/subtract, with carry.\n  shift = 10, mask = 63,\n  [0] = {\n    shift = 29, mask = 3,\n    [0] = \"adcDNMg\", \"adcsDNMg\", \"sbc|ngcDN0Mg\", \"sbcs|ngcsDN0Mg\",\n  }\n}\n\nlocal map_ccomp = {\n  shift = 4, mask = 1,\n  [0] = {\n    shift = 10, mask = 3,\n    [0] = { -- Conditional compare register.\n      shift = 29, mask = 3,\n      \"ccmnNMVCg\", false, \"ccmpNMVCg\",\n    },\n    [2] = {  -- Conditional compare immediate.\n      shift = 29, mask = 3,\n      \"ccmnN5VCg\", false, \"ccmpN5VCg\",\n    }\n  }\n}\n\nlocal map_csel = { -- Conditional select.\n  shift = 11, mask = 1,\n  [0] = {\n    shift = 10, mask = 1,\n    [0] = {\n      shift = 29, mask = 3,\n      [0] = \"cselDNMzCg\", false, \"csinv|cinv|csetmDNMcg\", false,\n    },\n    {\n      shift = 29, mask = 3,\n      [0] = \"csinc|cinc|csetDNMcg\", false, \"csneg|cnegDNMcg\", false,\n    }\n  }\n}\n\nlocal map_data1s = { -- Data processing, 1 source.\n  shift = 29, mask = 1,\n  [0] = {\n    shift = 31, mask = 1,\n    [0] = {\n      shift = 10, mask = 0x7ff,\n      [0] = \"rbitDNg\", \"rev16DNg\", \"revDNw\", false, \"clzDNg\", \"clsDNg\"\n    },\n    {\n      shift = 10, mask = 0x7ff,\n      [0] = \"rbitDNg\", \"rev16DNg\", \"rev32DNx\", \"revDNx\", \"clzDNg\", \"clsDNg\"\n    }\n  }\n}\n\nlocal map_data2s = { -- Data processing, 2 sources.\n  shift = 29, mask = 1,\n  [0] = {\n    shift = 10, mask = 63,\n    false, \"udivDNMg\", \"sdivDNMg\", false, false, false, false, \"lslDNMg\",\n    \"lsrDNMg\", \"asrDNMg\", \"rorDNMg\"\n  }\n}\n\nlocal map_data3s = { -- Data processing, 3 sources.\n  shift = 29, mask = 7,\n  [0] = {\n    shift = 21, mask = 7,\n    [0] = {\n      shift = 15, mask = 1,\n      [0] = \"madd|mulDNMA0g\", \"msub|mnegDNMA0g\"\n    }\n  }, false, false, false,\n  {\n    shift = 15, mask = 1,\n    [0] = {\n      shift = 21, mask = 7,\n      [0] = \"madd|mulDNMA0g\", \"smaddl|smullDxNMwA0x\", \"smulhDNMx\", false,\n      false, \"umaddl|umullDxNMwA0x\", \"umulhDNMx\"\n    },\n    {\n      shift = 21, mask = 7,\n      [0] = \"msub|mnegDNMA0g\", \"smsubl|smneglDxNMwA0x\", false, false,\n      false, \"umsubl|umneglDxNMwA0x\"\n    }\n  }\n}\n\nlocal map_datar = { -- Data processing, register.\n  shift = 28, mask = 1,\n  [0] = {\n    shift = 24, mask = 1,\n    [0] = map_logsr,\n    {\n      shift = 21, mask = 1,\n      [0] = map_addsubsh, map_addsubex\n    }\n  },\n  {\n    shift = 21, mask = 15,\n    [0] = map_addsubc, false, map_ccomp, false, map_csel, false,\n    {\n      shift = 30, mask = 1,\n      [0] = map_data2s, map_data1s\n    },\n    false, map_data3s, map_data3s, map_data3s, map_data3s, map_data3s,\n    map_data3s, map_data3s, map_data3s\n  }\n}\n\nlocal map_lrl = { -- Load register, literal.\n  shift = 26, mask = 1,\n  [0] = {\n    shift = 30, mask = 3,\n    [0] = \"ldrDwB\", \"ldrDxB\", \"ldrswDxB\"\n  },\n  {\n    shift = 30, mask = 3,\n    [0] = \"ldrDsB\", \"ldrDdB\"\n  }\n}\n\nlocal map_lsriind = { -- Load/store register, immediate pre/post-indexed.\n  shift = 30, mask = 3,\n  [0] = {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strbDwzL\", \"ldrbDwzL\", \"ldrsbDxzL\", \"ldrsbDwzL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strhDwzL\", \"ldrhDwzL\", \"ldrshDxzL\", \"ldrshDwzL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strDwzL\", \"ldrDwzL\", \"ldrswDxzL\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"strDszL\", \"ldrDszL\"\n    }\n  },\n  {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 22, mask = 3,\n      [0] = \"strDxzL\", \"ldrDxzL\"\n    },\n    {\n      shift = 22, mask = 3,\n      [0] = \"strDdzL\", \"ldrDdzL\"\n    }\n  }\n}\n\nlocal map_lsriro = {\n  shift = 21, mask = 1,\n  [0] = {  -- Load/store register immediate.\n    shift = 10, mask = 3,\n    [0] = { -- Unscaled immediate.\n      shift = 26, mask = 1,\n      [0] = {\n\tshift = 30, mask = 3,\n\t[0] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturbDwK\", \"ldurbDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturhDwK\", \"ldurhDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturDwK\", \"ldurDwK\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"sturDxK\", \"ldurDxK\"\n\t}\n      }\n    }, map_lsriind, false, map_lsriind\n  },\n  {  -- Load/store register, register offset.\n    shift = 10, mask = 3,\n    [2] = {\n      shift = 26, mask = 1,\n      [0] = {\n\tshift = 30, mask = 3,\n\t[0] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strbDwO\", \"ldrbDwO\", \"ldrsbDxO\", \"ldrsbDwO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strhDwO\", \"ldrhDwO\", \"ldrshDxO\", \"ldrshDwO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDwO\", \"ldrDwO\", \"ldrswDxO\"\n\t},\n\t{\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDxO\", \"ldrDxO\"\n\t}\n      },\n      {\n\tshift = 30, mask = 3,\n\t[2] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDsO\", \"ldrDsO\"\n\t},\n\t[3] = {\n\t  shift = 22, mask = 3,\n\t  [0] = \"strDdO\", \"ldrDdO\"\n\t}\n      }\n    }\n  }\n}\n\nlocal map_lsp = { -- Load/store register pair, offset.\n  shift = 22, mask = 1,\n  [0] = {\n    shift = 30, mask = 3,\n    [0] = {\n      shift = 26, mask = 1,\n      [0] = \"stpDzAzwP\", \"stpDzAzsP\",\n    },\n    {\n      shift = 26, mask = 1,\n      \"stpDzAzdP\"\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"stpDzAzxP\"\n    }\n  },\n  {\n    shift = 30, mask = 3,\n    [0] = {\n      shift = 26, mask = 1,\n      [0] = \"ldpDzAzwP\", \"ldpDzAzsP\",\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"ldpswDAxP\", \"ldpDzAzdP\"\n    },\n    {\n      shift = 26, mask = 1,\n      [0] = \"ldpDzAzxP\"\n    }\n  }\n}\n\nlocal map_ls = { -- Loads and stores.\n  shift = 24, mask = 0x31,\n  [0x10] = map_lrl, [0x30] = map_lsriro,\n  [0x20] = {\n    shift = 23, mask = 3,\n    map_lsp, map_lsp, map_lsp\n  },\n  [0x21] = {\n    shift = 23, mask = 3,\n    map_lsp, map_lsp, map_lsp\n  },\n  [0x31] = {\n    shift = 26, mask = 1,\n    [0] = {\n      shift = 30, mask = 3,\n      [0] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strbDwzU\", \"ldrbDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strhDwzU\", \"ldrhDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strDwzU\", \"ldrDwzU\"\n      },\n      {\n\tshift = 22, mask = 3,\n\t[0] = \"strDxzU\", \"ldrDxzU\"\n      }\n    },\n    {\n      shift = 30, mask = 3,\n      [2] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strDszU\", \"ldrDszU\"\n      },\n      [3] = {\n\tshift = 22, mask = 3,\n\t[0] = \"strDdzU\", \"ldrDdzU\"\n      }\n    }\n  },\n}\n\nlocal map_datafp = { -- Data processing, SIMD and FP.\n  shift = 28, mask = 7,\n  { -- 001\n    shift = 24, mask = 1,\n    [0] = {\n      shift = 21, mask = 1,\n      {\n\tshift = 10, mask = 3,\n\t[0] = {\n\t  shift = 12, mask = 1,\n\t  [0] = {\n\t    shift = 13, mask = 1,\n\t    [0] = {\n\t      shift = 14, mask = 1,\n\t      [0] = {\n\t\tshift = 15, mask = 1,\n\t\t[0] = { -- FP/int conversion.\n\t\t  shift = 31, mask = 1,\n\t\t  [0] = {\n\t\t    shift = 16, mask = 0xff,\n\t\t    [0x20] = \"fcvtnsDwNs\", [0x21] = \"fcvtnuDwNs\",\n\t\t    [0x22] = \"scvtfDsNw\", [0x23] = \"ucvtfDsNw\",\n\t\t    [0x24] = \"fcvtasDwNs\", [0x25] = \"fcvtauDwNs\",\n\t\t    [0x26] = \"fmovDwNs\", [0x27] = \"fmovDsNw\",\n\t\t    [0x28] = \"fcvtpsDwNs\", [0x29] = \"fcvtpuDwNs\",\n\t\t    [0x30] = \"fcvtmsDwNs\", [0x31] = \"fcvtmuDwNs\",\n\t\t    [0x38] = \"fcvtzsDwNs\", [0x39] = \"fcvtzuDwNs\",\n\t\t    [0x60] = \"fcvtnsDwNd\", [0x61] = \"fcvtnuDwNd\",\n\t\t    [0x62] = \"scvtfDdNw\", [0x63] = \"ucvtfDdNw\",\n\t\t    [0x64] = \"fcvtasDwNd\", [0x65] = \"fcvtauDwNd\",\n\t\t    [0x68] = \"fcvtpsDwNd\", [0x69] = \"fcvtpuDwNd\",\n\t\t    [0x70] = \"fcvtmsDwNd\", [0x71] = \"fcvtmuDwNd\",\n\t\t    [0x78] = \"fcvtzsDwNd\", [0x79] = \"fcvtzuDwNd\"\n\t\t  },\n\t\t  {\n\t\t    shift = 16, mask = 0xff,\n\t\t    [0x20] = \"fcvtnsDxNs\", [0x21] = \"fcvtnuDxNs\",\n\t\t    [0x22] = \"scvtfDsNx\", [0x23] = \"ucvtfDsNx\",\n\t\t    [0x24] = \"fcvtasDxNs\", [0x25] = \"fcvtauDxNs\",\n\t\t    [0x28] = \"fcvtpsDxNs\", [0x29] = \"fcvtpuDxNs\",\n\t\t    [0x30] = \"fcvtmsDxNs\", [0x31] = \"fcvtmuDxNs\",\n\t\t    [0x38] = \"fcvtzsDxNs\", [0x39] = \"fcvtzuDxNs\",\n\t\t    [0x60] = \"fcvtnsDxNd\", [0x61] = \"fcvtnuDxNd\",\n\t\t    [0x62] = \"scvtfDdNx\", [0x63] = \"ucvtfDdNx\",\n\t\t    [0x64] = \"fcvtasDxNd\", [0x65] = \"fcvtauDxNd\",\n\t\t    [0x66] = \"fmovDxNd\", [0x67] = \"fmovDdNx\",\n\t\t    [0x68] = \"fcvtpsDxNd\", [0x69] = \"fcvtpuDxNd\",\n\t\t    [0x70] = \"fcvtmsDxNd\", [0x71] = \"fcvtmuDxNd\",\n\t\t    [0x78] = \"fcvtzsDxNd\", [0x79] = \"fcvtzuDxNd\"\n\t\t  }\n\t\t}\n\t      },\n\t      { -- FP data-processing, 1 source.\n\t\tshift = 31, mask = 1,\n\t\t[0] = {\n\t\t  shift = 22, mask = 3,\n\t\t  [0] = {\n\t\t    shift = 15, mask = 63,\n\t\t    [0] = \"fmovDNf\", \"fabsDNf\", \"fnegDNf\",\n\t\t    \"fsqrtDNf\", false, \"fcvtDdNs\", false, false,\n\t\t    \"frintnDNf\", \"frintpDNf\", \"frintmDNf\", \"frintzDNf\",\n\t\t    \"frintaDNf\", false, \"frintxDNf\", \"frintiDNf\",\n\t\t  },\n\t\t  {\n\t\t    shift = 15, mask = 63,\n\t\t    [0] = \"fmovDNf\", \"fabsDNf\", \"fnegDNf\",\n\t\t    \"fsqrtDNf\", \"fcvtDsNd\", false, false, false,\n\t\t    \"frintnDNf\", \"frintpDNf\", \"frintmDNf\", \"frintzDNf\",\n\t\t    \"frintaDNf\", false, \"frintxDNf\", \"frintiDNf\",\n\t\t  }\n\t\t}\n\t      }\n\t    },\n\t    { -- FP compare.\n\t      shift = 31, mask = 1,\n\t      [0] = {\n\t\tshift = 14, mask = 3,\n\t\t[0] = {\n\t\t  shift = 23, mask = 1,\n\t\t  [0] = {\n\t\t    shift = 0, mask = 31,\n\t\t    [0] = \"fcmpNMf\", [8] = \"fcmpNZf\",\n\t\t    [16] = \"fcmpeNMf\", [24] = \"fcmpeNZf\",\n\t\t  }\n\t\t}\n\t      }\n\t    }\n\t  },\n\t  { -- FP immediate.\n\t    shift = 31, mask = 1,\n\t    [0] = {\n\t      shift = 5, mask = 31,\n\t      [0] = {\n\t\tshift = 23, mask = 1,\n\t\t[0] = \"fmovDFf\"\n\t      }\n\t    }\n\t  }\n\t},\n\t{ -- FP conditional compare.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = {\n\t      shift = 4, mask = 1,\n\t      [0] = \"fccmpNMVCf\", \"fccmpeNMVCf\"\n\t    }\n\t  }\n\t},\n\t{ -- FP data-processing, 2 sources.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = {\n\t      shift = 12, mask = 15,\n\t      [0] = \"fmulDNMf\", \"fdivDNMf\", \"faddDNMf\", \"fsubDNMf\",\n\t      \"fmaxDNMf\", \"fminDNMf\", \"fmaxnmDNMf\", \"fminnmDNMf\",\n\t      \"fnmulDNMf\"\n\t    }\n\t  }\n\t},\n\t{ -- FP conditional select.\n\t  shift = 31, mask = 1,\n\t  [0] = {\n\t    shift = 23, mask = 1,\n\t    [0] = \"fcselDNMCf\"\n\t  }\n\t}\n      }\n    },\n    { -- FP data-processing, 3 sources.\n      shift = 31, mask = 1,\n      [0] = {\n\tshift = 15, mask = 1,\n\t[0] = {\n\t  shift = 21, mask = 5,\n\t  [0] = \"fmaddDNMAf\", \"fnmaddDNMAf\"\n\t},\n\t{\n\t  shift = 21, mask = 5,\n\t  [0] = \"fmsubDNMAf\", \"fnmsubDNMAf\"\n\t}\n      }\n    }\n  }\n}\n\nlocal map_br = { -- Branches, exception generating and system instructions.\n  shift = 29, mask = 7,\n  [0] = \"bB\",\n  { -- Compare & branch, immediate.\n    shift = 24, mask = 3,\n    [0] = \"cbzDBg\", \"cbnzDBg\", \"tbzDTBw\", \"tbnzDTBw\"\n  },\n  { -- Conditional branch, immediate.\n    shift = 24, mask = 3,\n    [0] = {\n      shift = 4, mask = 1,\n      [0] = {\n\tshift = 0, mask = 15,\n\t[0] = \"beqB\", \"bneB\", \"bhsB\", \"bloB\", \"bmiB\", \"bplB\", \"bvsB\", \"bvcB\",\n\t\"bhiB\", \"blsB\", \"bgeB\", \"bltB\", \"bgtB\", \"bleB\", \"balB\"\n      }\n    }\n  }, false, \"blB\",\n  { -- Compare & branch, immediate.\n    shift = 24, mask = 3,\n    [0] = \"cbzDBg\", \"cbnzDBg\", \"tbzDTBx\", \"tbnzDTBx\"\n  },\n  {\n    shift = 24, mask = 3,\n    [0] = { -- Exception generation.\n      shift = 0, mask = 0xe0001f,\n      [0x200000] = \"brkW\"\n    },\n    { -- System instructions.\n      shift = 0, mask = 0x3fffff,\n      [0x03201f] = \"nop\"\n    },\n    { -- Unconditional branch, register.\n      shift = 0, mask = 0xfffc1f,\n      [0x1f0000] = \"brNx\", [0x3f0000] = \"blrNx\",\n      [0x5f0000] = \"retNx\"\n    },\n  }\n}\n\nlocal map_init = {\n  shift = 25, mask = 15,\n  [0] = false, false, false, false, map_ls, map_datar, map_ls, map_datafp,\n  map_datai, map_datai, map_br, map_br, map_ls, map_datar, map_ls, map_datafp\n}\n\n------------------------------------------------------------------------------\n\nlocal map_regs = { x = {}, w = {}, d = {}, s = {} }\n\nfor i=0,30 do\n  map_regs.x[i] = \"x\"..i\n  map_regs.w[i] = \"w\"..i\n  map_regs.d[i] = \"d\"..i\n  map_regs.s[i] = \"s\"..i\nend\nmap_regs.x[31] = \"sp\"\nmap_regs.w[31] = \"wsp\"\nmap_regs.d[31] = \"d31\"\nmap_regs.s[31] = \"s31\"\n\nlocal map_cond = {\n  [0] = \"eq\", \"ne\", \"cs\", \"cc\", \"mi\", \"pl\", \"vs\", \"vc\",\n  \"hi\", \"ls\", \"ge\", \"lt\", \"gt\", \"le\", \"al\",\n}\n\nlocal map_shift = { [0] = \"lsl\", \"lsr\", \"asr\", }\n\nlocal map_extend = {\n  [0] = \"uxtb\", \"uxth\", \"uxtw\", \"uxtx\", \"sxtb\", \"sxth\", \"sxtw\", \"sxtx\",\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then\n      extra = \"\\t->\"..sym\n    end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-5s %s%s\\n\",\n      ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-5s %s%s\\n\",\n      ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\nlocal function match_reg(p, pat, regnum)\n  return map_regs[match(pat, p..\"%w-([xwds])\")][regnum]\nend\n\nlocal function fmt_hex32(x)\n  if x < 0 then\n    return tohex(x)\n  else\n    return format(\"%x\", x)\n  end\nend\n\nlocal imm13_rep = { 0x55555555, 0x11111111, 0x01010101, 0x00010001, 0x00000001 }\n\nlocal function decode_imm13(op)\n  local imms = band(rshift(op, 10), 63)\n  local immr = band(rshift(op, 16), 63)\n  if band(op, 0x00400000) == 0 then\n    local len = 5\n    if imms >= 56 then\n      if imms >= 60 then len = 1 else len = 2 end\n    elseif imms >= 48 then len = 3 elseif imms >= 32 then len = 4 end\n    local l = lshift(1, len)-1\n    local s = band(imms, l)\n    local r = band(immr, l)\n    local imm = ror(rshift(-1, 31-s), r)\n    if len ~= 5 then imm = band(imm, lshift(1, l)-1) + rshift(imm, 31-l) end\n    imm = imm * imm13_rep[len]\n    local ix = fmt_hex32(imm)\n    if rshift(op, 31) ~= 0 then\n      return ix..tohex(imm)\n    else\n      return ix\n    end\n  else\n    local lo, hi = -1, 0\n    if imms < 32 then lo = rshift(-1, 31-imms) else hi = rshift(-1, 63-imms) end\n    if immr ~= 0 then\n      lo, hi = ror(lo, immr), ror(hi, immr)\n      local x = immr == 32 and 0 or band(bxor(lo, hi), lshift(-1, 32-immr))\n      lo, hi = bxor(lo, x), bxor(hi, x)\n      if immr >= 32 then lo, hi = hi, lo end\n    end\n    if hi ~= 0 then\n      return fmt_hex32(hi)..tohex(lo)\n    else\n      return fmt_hex32(lo)\n    end\n  end\nend\n\nlocal function parse_immpc(op, name)\n  if name == \"b\" or name == \"bl\" then\n    return arshift(lshift(op, 6), 4)\n  elseif name == \"adr\" or name == \"adrp\" then\n    local immlo = band(rshift(op, 29), 3)\n    local immhi = lshift(arshift(lshift(op, 8), 13), 2)\n    return bor(immhi, immlo)\n  elseif name == \"tbz\" or name == \"tbnz\" then\n    return lshift(arshift(lshift(op, 13), 18), 2)\n  else\n    return lshift(arshift(lshift(op, 8), 13), 2)\n  end\nend\n\nlocal function parse_fpimm8(op)\n  local sign = band(op, 0x100000) == 0 and 1 or -1\n  local exp = bxor(rshift(arshift(lshift(op, 12), 5), 24), 0x80) - 131\n  local frac = 16+band(rshift(op, 13), 15)\n  return sign * frac * 2^exp\nend\n\nlocal function prefer_bfx(sf, uns, imms, immr)\n  if imms < immr or imms == 31 or imms == 63 then\n    return false\n  end\n  if immr == 0 then\n    if sf == 0 and (imms == 7 or imms == 15) then\n      return false\n    end\n    if sf ~= 0 and uns == 0 and (imms == 7 or imms == 15 or imms == 31) then\n      return false\n    end\n  end\n  return true\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\n  local operands = {}\n  local suffix = \"\"\n  local last, name, pat\n  local map_reg\n  ctx.op = op\n  ctx.rel = nil\n  last = nil\n  local opat\n  opat = map_init[band(rshift(op, 25), 15)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  name, pat = match(opat, \"^([a-z0-9]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.|]*)(.*)\")\n  if altname then pat = pat2 end\n  if sub(pat, 1, 1) == \".\" then\n    local s2, p2 = match(pat, \"^([a-z0-9.]*)(.*)\")\n    suffix = suffix..s2\n    pat = p2\n  end\n\n  local rt = match(pat, \"[gf]\")\n  if rt then\n    if rt == \"g\" then\n      map_reg = band(op, 0x80000000) ~= 0 and map_regs.x or map_regs.w\n    else\n      map_reg = band(op, 0x400000) ~= 0 and map_regs.d or map_regs.s\n    end\n  end\n\n  local second0, immr\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"D\" then\n      local regnum = band(op, 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"N\" then\n      local regnum = band(rshift(op, 5), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"M\" then\n      local regnum = band(rshift(op, 16), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"A\" then\n      local regnum = band(rshift(op, 10), 31)\n      x = rt and map_reg[regnum] or match_reg(p, pat, regnum)\n    elseif p == \"B\" then\n      local addr = ctx.addr + pos + parse_immpc(op, name)\n      ctx.rel = addr\n      x = \"0x\"..tohex(addr)\n    elseif p == \"T\" then\n      x = bor(band(rshift(op, 26), 32), band(rshift(op, 19), 31))\n    elseif p == \"V\" then\n      x = band(op, 15)\n    elseif p == \"C\" then\n      x = map_cond[band(rshift(op, 12), 15)]\n    elseif p == \"c\" then\n      local rn = band(rshift(op, 5), 31)\n      local rm = band(rshift(op, 16), 31)\n      local cond = band(rshift(op, 12), 15)\n      local invc = bxor(cond, 1)\n      x = map_cond[cond]\n      if altname and cond ~= 14 and cond ~= 15 then\n\tlocal a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\tif rn == rm then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  x = map_cond[invc]\n\t  if rn ~= 31 then\n\t    if a1 then name = a1 else name = altname end\n\t  else\n\t    operands[n-1] = nil\n\t    name = a2\n\t  end\n\tend\n      end\n    elseif p == \"W\" then\n      x = band(rshift(op, 5), 0xffff)\n    elseif p == \"Y\" then\n      x = band(rshift(op, 5), 0xffff)\n      local hw = band(rshift(op, 21), 3)\n      if altname and (hw == 0 or x ~= 0) then\n\tname = altname\n      end\n    elseif p == \"L\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local imm9 = arshift(lshift(op, 11), 23)\n      if band(op, 0x800) ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm9..\"]!\"\n      else\n\tx = \"[\"..rn..\"], #\"..imm9\n      end\n    elseif p == \"U\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local sz = band(rshift(op, 30), 3)\n      local imm12 = lshift(arshift(lshift(op, 10), 20), sz)\n      if imm12 ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm12..\"]\"\n      else\n\tx = \"[\"..rn..\"]\"\n      end\n    elseif p == \"K\" then\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local imm9 = arshift(lshift(op, 11), 23)\n      if imm9 ~= 0 then\n\tx = \"[\"..rn..\", #\"..imm9..\"]\"\n      else\n\tx = \"[\"..rn..\"]\"\n      end\n    elseif p == \"O\" then\n      local rn, rm = map_regs.x[band(rshift(op, 5), 31)]\n      local m = band(rshift(op, 13), 1)\n      if m == 0 then\n\trm = map_regs.w[band(rshift(op, 16), 31)]\n      else\n\trm = map_regs.x[band(rshift(op, 16), 31)]\n      end\n      x = \"[\"..rn..\", \"..rm\n      local opt = band(rshift(op, 13), 7)\n      local s = band(rshift(op, 12), 1)\n      local sz = band(rshift(op, 30), 3)\n      -- extension to be applied\n      if opt == 3 then\n       if s == 0 then x = x..\"]\"\n       else x = x..\", lsl #\"..sz..\"]\" end\n      elseif opt == 2 or opt == 6 or opt == 7 then\n\tif s == 0 then x = x..\", \"..map_extend[opt]..\"]\"\n\telse x = x..\", \"..map_extend[opt]..\" #\"..sz..\"]\" end\n      else\n\tx = x..\"]\"\n      end\n    elseif p == \"P\" then\n      local opcv, sh = rshift(op, 26), 2\n      if opcv >= 0x2a then sh = 4 elseif opcv >= 0x1b then sh = 3 end\n      local imm7 = lshift(arshift(lshift(op, 10), 25), sh)\n      local rn = map_regs.x[band(rshift(op, 5), 31)]\n      local ind = band(rshift(op, 23), 3)\n      if ind == 1 then\n\tx = \"[\"..rn..\"], #\"..imm7\n      elseif ind == 2 then\n\tif imm7 == 0 then\n\t  x = \"[\"..rn..\"]\"\n\telse\n\t  x = \"[\"..rn..\", #\"..imm7..\"]\"\n\tend\n      elseif ind == 3 then\n\tx = \"[\"..rn..\", #\"..imm7..\"]!\"\n      end\n    elseif p == \"I\" then\n      local shf = band(rshift(op, 22), 3)\n      local imm12 = band(rshift(op, 10), 0x0fff)\n      local rn, rd = band(rshift(op, 5), 31), band(op, 31)\n      if altname == \"mov\" and shf == 0 and imm12 == 0 and (rn == 31 or rd == 31) then\n\tname = altname\n\tx = nil\n      elseif shf == 0 then\n\tx = imm12\n      elseif shf == 1 then\n\tx = imm12..\", lsl #12\"\n      end\n    elseif p == \"i\" then\n      x = \"#0x\"..decode_imm13(op)\n    elseif p == \"1\" then\n      immr = band(rshift(op, 16), 63)\n      x = immr\n    elseif p == \"2\" then\n      x = band(rshift(op, 10), 63)\n      if altname then\n\tlocal a1, a2, a3, a4, a5, a6 =\n\t  match(altname, \"([^|]*)|([^|]*)|([^|]*)|([^|]*)|([^|]*)|(.*)\")\n\tlocal sf = band(rshift(op, 26), 32)\n\tlocal uns = band(rshift(op, 30), 1)\n\tif prefer_bfx(sf, uns, x, immr) then\n\t  name = a2\n\t  x = x - immr + 1\n\telseif immr == 0 and x == 7 then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  if sf ~= 0 then\n\t    operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t  end\n\t  last = operands[n-1]\n\t  name = a6\n\t  x = nil\n\telseif immr == 0 and x == 15 then\n\t  local n = #operands\n\t  operands[n] = nil\n\t  if sf ~= 0 then\n\t    operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t  end\n\t  last = operands[n-1]\n\t  name = a5\n\t  x = nil\n\telseif x == 31 or x == 63 then\n\t  if x == 31 and immr == 0 and name == \"sbfm\" then\n\t    name = a4\n\t    local n = #operands\n\t    operands[n] = nil\n\t    if sf ~= 0 then\n\t      operands[n-1] = gsub(operands[n-1], \"x\", \"w\")\n\t    end\n\t    last = operands[n-1]\n\t  else\n\t    name = a3\n\t  end\n\t  x = nil\n\telseif band(x, 31) ~= 31 and immr == x+1 and name == \"ubfm\" then\n\t  name = a4\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = nil\n\telseif x < immr then\n\t  name = a1\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = x + 1\n\tend\n      end\n    elseif p == \"3\" then\n      x = band(rshift(op, 10), 63)\n      if altname then\n\tlocal a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\tif x < immr then\n\t  name = a1\n\t  local sf = band(rshift(op, 26), 32)\n\t  last = \"#\"..(sf+32 - immr)\n\t  operands[#operands] = last\n\t  x = x + 1\n\telseif x >= immr then\n\t  name = a2\n\t  x = x - immr + 1\n\tend\n      end\n    elseif p == \"4\" then\n      x = band(rshift(op, 10), 63)\n      local rn = band(rshift(op, 5), 31)\n      local rm = band(rshift(op, 16), 31)\n      if altname and rn == rm then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tname = altname\n      end\n    elseif p == \"5\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"S\" then\n      x = band(rshift(op, 10), 63)\n      if x == 0 then x = nil\n      else x = map_shift[band(rshift(op, 22), 3)]..\" #\"..x end\n    elseif p == \"X\" then\n      local opt = band(rshift(op, 13), 7)\n      -- Width specifier <R>.\n      if opt ~= 3 and opt ~= 7 then\n\tlast = map_regs.w[band(rshift(op, 16), 31)]\n\toperands[#operands] = last\n      end\n      x = band(rshift(op, 10), 7)\n      -- Extension.\n      if opt == 2 + band(rshift(op, 31), 1) and\n\t band(rshift(op, second0 and 5 or 0), 31) == 31 then\n\tif x == 0 then x = nil\n\telse x = \"lsl #\"..x end\n      else\n\tif x == 0 then x = map_extend[band(rshift(op, 13), 7)]\n\telse x = map_extend[band(rshift(op, 13), 7)]..\" #\"..x end\n      end\n    elseif p == \"R\" then\n      x = band(rshift(op,21), 3)\n      if x == 0 then x = nil\n      else x = \"lsl #\"..x*16 end\n    elseif p == \"z\" then\n      local n = #operands\n      if operands[n] == \"sp\" then operands[n] = \"xzr\"\n      elseif operands[n] == \"wsp\" then operands[n] = \"wzr\"\n      end\n    elseif p == \"Z\" then\n      x = 0\n    elseif p == \"F\" then\n      x = parse_fpimm8(op)\n    elseif p == \"g\" or p == \"f\" or p == \"x\" or p == \"w\" or\n\t   p == \"d\" or p == \"s\" then\n      -- These are handled in D/N/M/A.\n    elseif p == \"0\" then\n      if last == \"sp\" or last == \"wsp\" then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tif altname then\n\t  local a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\t  if not a1 then\n\t    name = altname\n\t  elseif second0 then\n\t    name, altname = a2, a1\n\t  else\n\t    name, altname = a1, a2\n\t  end\n\tend\n      end\n      second0 = true\n    else\n      assert(false)\n    end\n    if x then\n      last = x\n      if type(x) == \"number\" then x = \"#\"..x end\n      operands[#operands+1] = x\n    end\n  end\n\n  return putop(ctx, name..suffix, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ctx.pos = ofs\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_regs.x[r] end\n  return map_regs.d[r-32]\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_arm64be.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT ARM64BE disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- ARM64 instructions are always little-endian. So just forward to the\n-- common ARM64 disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nreturn require((string.match(..., \".*%.\") or \"\")..\"dis_arm64\")\n\n"
  },
  {
    "path": "Luajit64/jit/dis_mips.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT/X license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles all standard MIPS32R1/R2 instructions.\n-- Default mode is big-endian, but see: dis_mipsel.lua\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal byte, format = string.byte, string.format\nlocal match, gmatch = string.match, string.gmatch\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, tohex = bit.band, bit.bor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Primary and extended opcode maps\n------------------------------------------------------------------------------\n\nlocal map_movci = { shift = 16, mask = 1, [0] = \"movfDSC\", \"movtDSC\", }\nlocal map_srl = { shift = 21, mask = 1, [0] = \"srlDTA\", \"rotrDTA\", }\nlocal map_srlv = { shift = 6, mask = 1, [0] = \"srlvDTS\", \"rotrvDTS\", }\n\nlocal map_special = {\n  shift = 0, mask = 63,\n  [0] = { shift = 0, mask = -1, [0] = \"nop\", _ = \"sllDTA\" },\n  map_movci,\tmap_srl,\t\"sraDTA\",\n  \"sllvDTS\",\tfalse,\t\tmap_srlv,\t\"sravDTS\",\n  \"jrS\",\t\"jalrD1S\",\t\"movzDST\",\t\"movnDST\",\n  \"syscallY\",\t\"breakY\",\tfalse,\t\t\"sync\",\n  \"mfhiD\",\t\"mthiS\",\t\"mfloD\",\t\"mtloS\",\n  \"dsllvDST\",\tfalse,\t\t\"dsrlvDST\",\t\"dsravDST\",\n  \"multST\",\t\"multuST\",\t\"divST\",\t\"divuST\",\n  \"dmultST\",\t\"dmultuST\",\t\"ddivST\",\t\"ddivuST\",\n  \"addDST\",\t\"addu|moveDST0\", \"subDST\",\t\"subu|neguDS0T\",\n  \"andDST\",\t\"or|moveDST0\",\t\"xorDST\",\t\"nor|notDST0\",\n  false,\tfalse,\t\t\"sltDST\",\t\"sltuDST\",\n  \"daddDST\",\t\"dadduDST\",\t\"dsubDST\",\t\"dsubuDST\",\n  \"tgeSTZ\",\t\"tgeuSTZ\",\t\"tltSTZ\",\t\"tltuSTZ\",\n  \"teqSTZ\",\tfalse,\t\t\"tneSTZ\",\tfalse,\n  \"dsllDTA\",\tfalse,\t\t\"dsrlDTA\",\t\"dsraDTA\",\n  \"dsll32DTA\",\tfalse,\t\t\"dsrl32DTA\",\t\"dsra32DTA\",\n}\n\nlocal map_special2 = {\n  shift = 0, mask = 63,\n  [0] = \"maddST\", \"madduST\",\t\"mulDST\",\tfalse,\n  \"msubST\",\t\"msubuST\",\n  [32] = \"clzDS\", [33] = \"cloDS\",\n  [63] = \"sdbbpY\",\n}\n\nlocal map_bshfl = {\n  shift = 6, mask = 31,\n  [2] = \"wsbhDT\",\n  [16] = \"sebDT\",\n  [24] = \"sehDT\",\n}\n\nlocal map_dbshfl = {\n  shift = 6, mask = 31,\n  [2] = \"dsbhDT\",\n  [5] = \"dshdDT\",\n}\n\nlocal map_special3 = {\n  shift = 0, mask = 63,\n  [0]  = \"extTSAK\", [1]  = \"dextmTSAP\", [3]  = \"dextTSAK\",\n  [4]  = \"insTSAL\", [6]  = \"dinsuTSEQ\", [7]  = \"dinsTSAL\",\n  [32] = map_bshfl, [36] = map_dbshfl,  [59] = \"rdhwrTD\",\n}\n\nlocal map_regimm = {\n  shift = 16, mask = 31,\n  [0] = \"bltzSB\",\t\"bgezSB\",\t\"bltzlSB\",\t\"bgezlSB\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"tgeiSI\",\t\"tgeiuSI\",\t\"tltiSI\",\t\"tltiuSI\",\n  \"teqiSI\",\tfalse,\t\t\"tneiSI\",\tfalse,\n  \"bltzalSB\",\t\"bgezalSB\",\t\"bltzallSB\",\t\"bgezallSB\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\t\"synciSO\",\n}\n\nlocal map_cop0 = {\n  shift = 25, mask = 1,\n  [0] = {\n    shift = 21, mask = 15,\n    [0] = \"mfc0TDW\", [4] = \"mtc0TDW\",\n    [10] = \"rdpgprDT\",\n    [11] = { shift = 5, mask = 1, [0] = \"diT0\", \"eiT0\", },\n    [14] = \"wrpgprDT\",\n  }, {\n    shift = 0, mask = 63,\n    [1] = \"tlbr\", [2] = \"tlbwi\", [6] = \"tlbwr\", [8] = \"tlbp\",\n    [24] = \"eret\", [31] = \"deret\",\n    [32] = \"wait\",\n  },\n}\n\nlocal map_cop1s = {\n  shift = 0, mask = 63,\n  [0] = \"add.sFGH\",\t\"sub.sFGH\",\t\"mul.sFGH\",\t\"div.sFGH\",\n  \"sqrt.sFG\",\t\t\"abs.sFG\",\t\"mov.sFG\",\t\"neg.sFG\",\n  \"round.l.sFG\",\t\"trunc.l.sFG\",\t\"ceil.l.sFG\",\t\"floor.l.sFG\",\n  \"round.w.sFG\",\t\"trunc.w.sFG\",\t\"ceil.w.sFG\",\t\"floor.w.sFG\",\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.sFGC\", \"movt.sFGC\" },\n  \"movz.sFGT\",\t\"movn.sFGT\",\n  false,\t\"recip.sFG\",\t\"rsqrt.sFG\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\t\"cvt.d.sFG\",\tfalse,\t\tfalse,\n  \"cvt.w.sFG\",\t\"cvt.l.sFG\",\t\"cvt.ps.sFGH\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"c.f.sVGH\",\t\"c.un.sVGH\",\t\"c.eq.sVGH\",\t\"c.ueq.sVGH\",\n  \"c.olt.sVGH\",\t\"c.ult.sVGH\",\t\"c.ole.sVGH\",\t\"c.ule.sVGH\",\n  \"c.sf.sVGH\",\t\"c.ngle.sVGH\",\t\"c.seq.sVGH\",\t\"c.ngl.sVGH\",\n  \"c.lt.sVGH\",\t\"c.nge.sVGH\",\t\"c.le.sVGH\",\t\"c.ngt.sVGH\",\n}\n\nlocal map_cop1d = {\n  shift = 0, mask = 63,\n  [0] = \"add.dFGH\",\t\"sub.dFGH\",\t\"mul.dFGH\",\t\"div.dFGH\",\n  \"sqrt.dFG\",\t\t\"abs.dFG\",\t\"mov.dFG\",\t\"neg.dFG\",\n  \"round.l.dFG\",\t\"trunc.l.dFG\",\t\"ceil.l.dFG\",\t\"floor.l.dFG\",\n  \"round.w.dFG\",\t\"trunc.w.dFG\",\t\"ceil.w.dFG\",\t\"floor.w.dFG\",\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.dFGC\", \"movt.dFGC\" },\n  \"movz.dFGT\",\t\"movn.dFGT\",\n  false,\t\"recip.dFG\",\t\"rsqrt.dFG\",\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.dFG\",\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.w.dFG\",\t\"cvt.l.dFG\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"c.f.dVGH\",\t\"c.un.dVGH\",\t\"c.eq.dVGH\",\t\"c.ueq.dVGH\",\n  \"c.olt.dVGH\",\t\"c.ult.dVGH\",\t\"c.ole.dVGH\",\t\"c.ule.dVGH\",\n  \"c.df.dVGH\",\t\"c.ngle.dVGH\",\t\"c.deq.dVGH\",\t\"c.ngl.dVGH\",\n  \"c.lt.dVGH\",\t\"c.nge.dVGH\",\t\"c.le.dVGH\",\t\"c.ngt.dVGH\",\n}\n\nlocal map_cop1ps = {\n  shift = 0, mask = 63,\n  [0] = \"add.psFGH\",\t\"sub.psFGH\",\t\"mul.psFGH\",\tfalse,\n  false,\t\t\"abs.psFG\",\t\"mov.psFG\",\t\"neg.psFG\",\n  false,\t\tfalse,\t\tfalse,\t\tfalse,\n  false,\t\tfalse,\t\tfalse,\t\tfalse,\n  false,\n  { shift = 16, mask = 1, [0] = \"movf.psFGC\", \"movt.psFGC\" },\n  \"movz.psFGT\",\t\"movn.psFGT\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.puFG\",\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  \"cvt.s.plFG\",\tfalse,\t\tfalse,\t\tfalse,\n  \"pll.psFGH\",\t\"plu.psFGH\",\t\"pul.psFGH\",\t\"puu.psFGH\",\n  \"c.f.psVGH\",\t\"c.un.psVGH\",\t\"c.eq.psVGH\",\t\"c.ueq.psVGH\",\n  \"c.olt.psVGH\", \"c.ult.psVGH\",\t\"c.ole.psVGH\",\t\"c.ule.psVGH\",\n  \"c.psf.psVGH\", \"c.ngle.psVGH\", \"c.pseq.psVGH\", \"c.ngl.psVGH\",\n  \"c.lt.psVGH\",\t\"c.nge.psVGH\",\t\"c.le.psVGH\",\t\"c.ngt.psVGH\",\n}\n\nlocal map_cop1w = {\n  shift = 0, mask = 63,\n  [32] = \"cvt.s.wFG\", [33] = \"cvt.d.wFG\",\n}\n\nlocal map_cop1l = {\n  shift = 0, mask = 63,\n  [32] = \"cvt.s.lFG\", [33] = \"cvt.d.lFG\",\n}\n\nlocal map_cop1bc = {\n  shift = 16, mask = 3,\n  [0] = \"bc1fCB\", \"bc1tCB\",\t\"bc1flCB\",\t\"bc1tlCB\",\n}\n\nlocal map_cop1 = {\n  shift = 21, mask = 31,\n  [0] = \"mfc1TG\", \"dmfc1TG\",\t\"cfc1TG\",\t\"mfhc1TG\",\n  \"mtc1TG\",\t\"dmtc1TG\",\t\"ctc1TG\",\t\"mthc1TG\",\n  map_cop1bc,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  map_cop1s,\tmap_cop1d,\tfalse,\t\tfalse,\n  map_cop1w,\tmap_cop1l,\tmap_cop1ps,\n}\n\nlocal map_cop1x = {\n  shift = 0, mask = 63,\n  [0] = \"lwxc1FSX\",\t\"ldxc1FSX\",\tfalse,\t\tfalse,\n  false,\t\"luxc1FSX\",\tfalse,\t\tfalse,\n  \"swxc1FSX\",\t\"sdxc1FSX\",\tfalse,\t\tfalse,\n  false,\t\"suxc1FSX\",\tfalse,\t\t\"prefxMSX\",\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"alnv.psFGHS\",\tfalse,\n  \"madd.sFRGH\",\t\"madd.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"madd.psFRGH\",\tfalse,\n  \"msub.sFRGH\",\t\"msub.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"msub.psFRGH\",\tfalse,\n  \"nmadd.sFRGH\", \"nmadd.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"nmadd.psFRGH\",\tfalse,\n  \"nmsub.sFRGH\", \"nmsub.dFRGH\",\tfalse,\t\tfalse,\n  false,\tfalse,\t\t\"nmsub.psFRGH\",\tfalse,\n}\n\nlocal map_pri = {\n  [0] = map_special,\tmap_regimm,\t\"jJ\",\t\"jalJ\",\n  \"beq|beqz|bST00B\",\t\"bne|bnezST0B\",\t\t\"blezSB\",\t\"bgtzSB\",\n  \"addiTSI\",\t\"addiu|liTS0I\",\t\"sltiTSI\",\t\"sltiuTSI\",\n  \"andiTSU\",\t\"ori|liTS0U\",\t\"xoriTSU\",\t\"luiTU\",\n  map_cop0,\tmap_cop1,\tfalse,\t\tmap_cop1x,\n  \"beql|beqzlST0B\",\t\"bnel|bnezlST0B\",\t\"blezlSB\",\t\"bgtzlSB\",\n  \"daddiTSI\",\t\"daddiuTSI\",\tfalse,\t\tfalse,\n  map_special2,\t\"jalxJ\",\tfalse,\t\tmap_special3,\n  \"lbTSO\",\t\"lhTSO\",\t\"lwlTSO\",\t\"lwTSO\",\n  \"lbuTSO\",\t\"lhuTSO\",\t\"lwrTSO\",\tfalse,\n  \"sbTSO\",\t\"shTSO\",\t\"swlTSO\",\t\"swTSO\",\n  false,\tfalse,\t\t\"swrTSO\",\t\"cacheNSO\",\n  \"llTSO\",\t\"lwc1HSO\",\t\"lwc2TSO\",\t\"prefNSO\",\n  false,\t\"ldc1HSO\",\t\"ldc2TSO\",\t\"ldTSO\",\n  \"scTSO\",\t\"swc1HSO\",\t\"swc2TSO\",\tfalse,\n  false,\t\"sdc1HSO\",\t\"sdc2TSO\",\t\"sdTSO\",\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"r1\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\",\n  \"r16\", \"r17\", \"r18\", \"r19\", \"r20\", \"r21\", \"r22\", \"r23\",\n  \"r24\", \"r25\", \"r26\", \"r27\", \"r28\", \"sp\", \"r30\", \"ra\",\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then extra = \"\\t->\"..sym end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-7s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-7s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\nlocal function get_be(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  return bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3)\nend\n\nlocal function get_le(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  return bor(lshift(b3, 24), lshift(b2, 16), lshift(b1, 8), b0)\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local op = ctx:get()\n  local operands = {}\n  local last = nil\n  ctx.op = op\n  ctx.rel = nil\n\n  local opat = map_pri[rshift(op, 26)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)] or opat._\n  end\n  local name, pat = match(opat, \"^([a-z0-9_.]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.|]*)(.*)\")\n  if altname then pat = pat2 end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"S\" then\n      x = map_gpr[band(rshift(op, 21), 31)]\n    elseif p == \"T\" then\n      x = map_gpr[band(rshift(op, 16), 31)]\n    elseif p == \"D\" then\n      x = map_gpr[band(rshift(op, 11), 31)]\n    elseif p == \"F\" then\n      x = \"f\"..band(rshift(op, 6), 31)\n    elseif p == \"G\" then\n      x = \"f\"..band(rshift(op, 11), 31)\n    elseif p == \"H\" then\n      x = \"f\"..band(rshift(op, 16), 31)\n    elseif p == \"R\" then\n      x = \"f\"..band(rshift(op, 21), 31)\n    elseif p == \"A\" then\n      x = band(rshift(op, 6), 31)\n    elseif p == \"E\" then\n      x = band(rshift(op, 6), 31) + 32\n    elseif p == \"M\" then\n      x = band(rshift(op, 11), 31)\n    elseif p == \"N\" then\n      x = band(rshift(op, 16), 31)\n    elseif p == \"C\" then\n      x = band(rshift(op, 18), 7)\n      if x == 0 then x = nil end\n    elseif p == \"K\" then\n      x = band(rshift(op, 11), 31) + 1\n    elseif p == \"P\" then\n      x = band(rshift(op, 11), 31) + 33\n    elseif p == \"L\" then\n      x = band(rshift(op, 11), 31) - last + 1\n    elseif p == \"Q\" then\n      x = band(rshift(op, 11), 31) - last + 33\n    elseif p == \"I\" then\n      x = arshift(lshift(op, 16), 16)\n    elseif p == \"U\" then\n      x = band(op, 0xffff)\n    elseif p == \"O\" then\n      local disp = arshift(lshift(op, 16), 16)\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p == \"X\" then\n      local index = map_gpr[band(rshift(op, 16), 31)]\n      operands[#operands] = format(\"%s(%s)\", index, last)\n    elseif p == \"B\" then\n      x = ctx.addr + ctx.pos + arshift(lshift(op, 16), 16)*4 + 4\n      ctx.rel = x\n      x = format(\"0x%08x\", x)\n    elseif p == \"J\" then\n      local a = ctx.addr + ctx.pos\n      x = a - band(a, 0x0fffffff) + band(op, 0x03ffffff)*4\n      ctx.rel = x\n      x = format(\"0x%08x\", x)\n    elseif p == \"V\" then\n      x = band(rshift(op, 8), 7)\n      if x == 0 then x = nil end\n    elseif p == \"W\" then\n      x = band(op, 7)\n      if x == 0 then x = nil end\n    elseif p == \"Y\" then\n      x = band(rshift(op, 6), 0x000fffff)\n      if x == 0 then x = nil end\n    elseif p == \"Z\" then\n      x = band(rshift(op, 6), 1023)\n      if x == 0 then x = nil end\n    elseif p == \"0\" then\n      if last == \"r0\" or last == 0 then\n\tlocal n = #operands\n\toperands[n] = nil\n\tlast = operands[n-1]\n\tif altname then\n\t  local a1, a2 = match(altname, \"([^|]*)|(.*)\")\n\t  if a1 then name, altname = a1, a2\n\t  else name = altname end\n\tend\n      end\n    elseif p == \"1\" then\n      if last == \"ra\" then\n\toperands[#operands] = nil\n      end\n    else\n      assert(false)\n    end\n    if x then operands[#operands+1] = x; last = x end\n  end\n\n  return putop(ctx, name, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  stop = stop - stop % 4\n  ctx.pos = ofs - ofs % 4\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  ctx.get = get_be\n  return ctx\nend\n\nlocal function create_el(code, addr, out)\n  local ctx = create(code, addr, out)\n  ctx.get = get_le\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\nlocal function disass_el(code, addr, out)\n  create_el(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_gpr[r] end\n  return \"f\"..(r-32)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  create_el = create_el,\n  disass = disass,\n  disass_el = disass_el,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_mips64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS64 disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the big-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create,\n  disass = dis_mips.disass,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_mips64el.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPS64EL disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the little-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create_el,\n  disass = dis_mips.disass_el,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_mipsel.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT MIPSEL disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the little-endian functions from the\n-- MIPS disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_mips = require((string.match(..., \".*%.\") or \"\")..\"dis_mips\")\nreturn {\n  create = dis_mips.create_el,\n  disass = dis_mips.disass_el,\n  regname = dis_mips.regname\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_ppc.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT PPC disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT/X license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- It disassembles all common, non-privileged 32/64 bit PowerPC instructions\n-- plus the e500 SPE instructions and some Cell/Xenon extensions.\n--\n-- NYI: VMX, VMX128\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal byte, format = string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal concat = table.concat\nlocal bit = require(\"bit\")\nlocal band, bor, tohex = bit.band, bit.bor, bit.tohex\nlocal lshift, rshift, arshift = bit.lshift, bit.rshift, bit.arshift\n\n------------------------------------------------------------------------------\n-- Primary and extended opcode maps\n------------------------------------------------------------------------------\n\nlocal map_crops = {\n  shift = 1, mask = 1023,\n  [0] = \"mcrfXX\",\n  [33] = \"crnor|crnotCCC=\", [129] = \"crandcCCC\",\n  [193] = \"crxor|crclrCCC%\", [225] = \"crnandCCC\",\n  [257] = \"crandCCC\", [289] = \"creqv|crsetCCC%\",\n  [417] = \"crorcCCC\", [449] = \"cror|crmoveCCC=\",\n  [16] = \"b_lrKB\", [528] = \"b_ctrKB\",\n  [150] = \"isync\",\n}\n\nlocal map_rlwinm = setmetatable({\n  shift = 0, mask = -1,\n},\n{ __index = function(t, x)\n    local rot = band(rshift(x, 11), 31)\n    local mb = band(rshift(x, 6), 31)\n    local me = band(rshift(x, 1), 31)\n    if mb == 0 and me == 31-rot then\n      return \"slwiRR~A.\"\n    elseif me == 31 and mb == 32-rot then\n      return \"srwiRR~-A.\"\n    else\n      return \"rlwinmRR~AAA.\"\n    end\n  end\n})\n\nlocal map_rld = {\n  shift = 2, mask = 7,\n  [0] = \"rldiclRR~HM.\", \"rldicrRR~HM.\", \"rldicRR~HM.\", \"rldimiRR~HM.\",\n  {\n    shift = 1, mask = 1,\n    [0] = \"rldclRR~RM.\", \"rldcrRR~RM.\",\n  },\n}\n\nlocal map_ext = setmetatable({\n  shift = 1, mask = 1023,\n\n  [0] = \"cmp_YLRR\", [32] = \"cmpl_YLRR\",\n  [4] = \"twARR\", [68] = \"tdARR\",\n\n  [8] = \"subfcRRR.\", [40] = \"subfRRR.\",\n  [104] = \"negRR.\", [136] = \"subfeRRR.\",\n  [200] = \"subfzeRR.\", [232] = \"subfmeRR.\",\n  [520] = \"subfcoRRR.\", [552] = \"subfoRRR.\",\n  [616] = \"negoRR.\", [648] = \"subfeoRRR.\",\n  [712] = \"subfzeoRR.\", [744] = \"subfmeoRR.\",\n\n  [9] = \"mulhduRRR.\", [73] = \"mulhdRRR.\", [233] = \"mulldRRR.\",\n  [457] = \"divduRRR.\", [489] = \"divdRRR.\",\n  [745] = \"mulldoRRR.\",\n  [969] = \"divduoRRR.\", [1001] = \"divdoRRR.\",\n\n  [10] = \"addcRRR.\", [138] = \"addeRRR.\",\n  [202] = \"addzeRR.\", [234] = \"addmeRR.\", [266] = \"addRRR.\",\n  [522] = \"addcoRRR.\", [650] = \"addeoRRR.\",\n  [714] = \"addzeoRR.\", [746] = \"addmeoRR.\", [778] = \"addoRRR.\",\n\n  [11] = \"mulhwuRRR.\", [75] = \"mulhwRRR.\", [235] = \"mullwRRR.\",\n  [459] = \"divwuRRR.\", [491] = \"divwRRR.\",\n  [747] = \"mullwoRRR.\",\n  [971] = \"divwouRRR.\", [1003] = \"divwoRRR.\",\n\n  [15] = \"iselltRRR\", [47] = \"iselgtRRR\", [79] = \"iseleqRRR\",\n\n  [144] = { shift = 20, mask = 1, [0] = \"mtcrfRZ~\", \"mtocrfRZ~\", },\n  [19] = { shift = 20, mask = 1, [0] = \"mfcrR\", \"mfocrfRZ\", },\n  [371] = { shift = 11, mask = 1023, [392] = \"mftbR\", [424] = \"mftbuR\", },\n  [339] = {\n    shift = 11, mask = 1023,\n    [32] = \"mferR\", [256] = \"mflrR\", [288] = \"mfctrR\", [16] = \"mfspefscrR\",\n  },\n  [467] = {\n    shift = 11, mask = 1023,\n    [32] = \"mtxerR\", [256] = \"mtlrR\", [288] = \"mtctrR\", [16] = \"mtspefscrR\",\n  },\n\n  [20] = \"lwarxRR0R\", [84] = \"ldarxRR0R\",\n\n  [21] = \"ldxRR0R\", [53] = \"lduxRRR\",\n  [149] = \"stdxRR0R\", [181] = \"stduxRRR\",\n  [341] = \"lwaxRR0R\", [373] = \"lwauxRRR\",\n\n  [23] = \"lwzxRR0R\", [55] = \"lwzuxRRR\",\n  [87] = \"lbzxRR0R\", [119] = \"lbzuxRRR\",\n  [151] = \"stwxRR0R\", [183] = \"stwuxRRR\",\n  [215] = \"stbxRR0R\", [247] = \"stbuxRRR\",\n  [279] = \"lhzxRR0R\", [311] = \"lhzuxRRR\",\n  [343] = \"lhaxRR0R\", [375] = \"lhauxRRR\",\n  [407] = \"sthxRR0R\", [439] = \"sthuxRRR\",\n\n  [54] = \"dcbst-R0R\", [86] = \"dcbf-R0R\",\n  [150] = \"stwcxRR0R.\", [214] = \"stdcxRR0R.\",\n  [246] = \"dcbtst-R0R\", [278] = \"dcbt-R0R\",\n  [310] = \"eciwxRR0R\", [438] = \"ecowxRR0R\",\n  [470] = \"dcbi-RR\",\n\n  [598] = {\n    shift = 21, mask = 3,\n    [0] = \"sync\", \"lwsync\", \"ptesync\",\n  },\n  [758] = \"dcba-RR\",\n  [854] = \"eieio\", [982] = \"icbi-R0R\", [1014] = \"dcbz-R0R\",\n\n  [26] = \"cntlzwRR~\", [58] = \"cntlzdRR~\",\n  [122] = \"popcntbRR~\",\n  [154] = \"prtywRR~\", [186] = \"prtydRR~\",\n\n  [28] = \"andRR~R.\", [60] = \"andcRR~R.\", [124] = \"nor|notRR~R=.\",\n  [284] = \"eqvRR~R.\", [316] = \"xorRR~R.\",\n  [412] = \"orcRR~R.\", [444] = \"or|mrRR~R=.\", [476] = \"nandRR~R.\",\n  [508] = \"cmpbRR~R\",\n\n  [512] = \"mcrxrX\",\n\n  [532] = \"ldbrxRR0R\", [660] = \"stdbrxRR0R\",\n\n  [533] = \"lswxRR0R\", [597] = \"lswiRR0A\",\n  [661] = \"stswxRR0R\", [725] = \"stswiRR0A\",\n\n  [534] = \"lwbrxRR0R\", [662] = \"stwbrxRR0R\",\n  [790] = \"lhbrxRR0R\", [918] = \"sthbrxRR0R\",\n\n  [535] = \"lfsxFR0R\", [567] = \"lfsuxFRR\",\n  [599] = \"lfdxFR0R\", [631] = \"lfduxFRR\",\n  [663] = \"stfsxFR0R\", [695] = \"stfsuxFRR\",\n  [727] = \"stfdxFR0R\", [759] = \"stfduxFR0R\",\n  [855] = \"lfiwaxFR0R\",\n  [983] = \"stfiwxFR0R\",\n\n  [24] = \"slwRR~R.\",\n\n  [27] = \"sldRR~R.\", [536] = \"srwRR~R.\",\n  [792] = \"srawRR~R.\", [824] = \"srawiRR~A.\",\n\n  [794] = \"sradRR~R.\", [826] = \"sradiRR~H.\", [827] = \"sradiRR~H.\",\n  [922] = \"extshRR~.\", [954] = \"extsbRR~.\", [986] = \"extswRR~.\",\n\n  [539] = \"srdRR~R.\",\n},\n{ __index = function(t, x)\n    if band(x, 31) == 15 then return \"iselRRRC\" end\n  end\n})\n\nlocal map_ld = {\n  shift = 0, mask = 3,\n  [0] = \"ldRRE\", \"lduRRE\", \"lwaRRE\",\n}\n\nlocal map_std = {\n  shift = 0, mask = 3,\n  [0] = \"stdRRE\", \"stduRRE\",\n}\n\nlocal map_fps = {\n  shift = 5, mask = 1,\n  {\n    shift = 1, mask = 15,\n    [0] = false, false, \"fdivsFFF.\", false,\n    \"fsubsFFF.\", \"faddsFFF.\", \"fsqrtsF-F.\", false,\n    \"fresF-F.\", \"fmulsFF-F.\", \"frsqrtesF-F.\", false,\n    \"fmsubsFFFF~.\", \"fmaddsFFFF~.\", \"fnmsubsFFFF~.\", \"fnmaddsFFFF~.\",\n  }\n}\n\nlocal map_fpd = {\n  shift = 5, mask = 1,\n  [0] = {\n    shift = 1, mask = 1023,\n    [0] = \"fcmpuXFF\", [32] = \"fcmpoXFF\", [64] = \"mcrfsXX\",\n    [38] = \"mtfsb1A.\", [70] = \"mtfsb0A.\", [134] = \"mtfsfiA>>-A>\",\n    [8] = \"fcpsgnFFF.\", [40] = \"fnegF-F.\", [72] = \"fmrF-F.\",\n    [136] = \"fnabsF-F.\", [264] = \"fabsF-F.\",\n    [12] = \"frspF-F.\",\n    [14] = \"fctiwF-F.\", [15] = \"fctiwzF-F.\",\n    [583] = \"mffsF.\", [711] = \"mtfsfZF.\",\n    [392] = \"frinF-F.\", [424] = \"frizF-F.\",\n    [456] = \"fripF-F.\", [488] = \"frimF-F.\",\n    [814] = \"fctidF-F.\", [815] = \"fctidzF-F.\", [846] = \"fcfidF-F.\",\n  },\n  {\n    shift = 1, mask = 15,\n    [0] = false, false, \"fdivFFF.\", false,\n    \"fsubFFF.\", \"faddFFF.\", \"fsqrtF-F.\", \"fselFFFF~.\",\n    \"freF-F.\", \"fmulFF-F.\", \"frsqrteF-F.\", false,\n    \"fmsubFFFF~.\", \"fmaddFFFF~.\", \"fnmsubFFFF~.\", \"fnmaddFFFF~.\",\n  }\n}\n\nlocal map_spe = {\n  shift = 0, mask = 2047,\n\n  [512] = \"evaddwRRR\", [514] = \"evaddiwRAR~\",\n  [516] = \"evsubwRRR~\", [518] = \"evsubiwRAR~\",\n  [520] = \"evabsRR\", [521] = \"evnegRR\",\n  [522] = \"evextsbRR\", [523] = \"evextshRR\", [524] = \"evrndwRR\",\n  [525] = \"evcntlzwRR\", [526] = \"evcntlswRR\",\n\n  [527] = \"brincRRR\",\n\n  [529] = \"evandRRR\", [530] = \"evandcRRR\", [534] = \"evxorRRR\",\n  [535] = \"evor|evmrRRR=\", [536] = \"evnor|evnotRRR=\",\n  [537] = \"eveqvRRR\", [539] = \"evorcRRR\", [542] = \"evnandRRR\",\n\n  [544] = \"evsrwuRRR\", [545] = \"evsrwsRRR\",\n  [546] = \"evsrwiuRRA\", [547] = \"evsrwisRRA\",\n  [548] = \"evslwRRR\", [550] = \"evslwiRRA\",\n  [552] = \"evrlwRRR\", [553] = \"evsplatiRS\",\n  [554] = \"evrlwiRRA\", [555] = \"evsplatfiRS\",\n  [556] = \"evmergehiRRR\", [557] = \"evmergeloRRR\",\n  [558] = \"evmergehiloRRR\", [559] = \"evmergelohiRRR\",\n\n  [560] = \"evcmpgtuYRR\", [561] = \"evcmpgtsYRR\",\n  [562] = \"evcmpltuYRR\", [563] = \"evcmpltsYRR\",\n  [564] = \"evcmpeqYRR\",\n\n  [632] = \"evselRRR\", [633] = \"evselRRRW\",\n  [634] = \"evselRRRW\", [635] = \"evselRRRW\",\n  [636] = \"evselRRRW\", [637] = \"evselRRRW\",\n  [638] = \"evselRRRW\", [639] = \"evselRRRW\",\n\n  [640] = \"evfsaddRRR\", [641] = \"evfssubRRR\",\n  [644] = \"evfsabsRR\", [645] = \"evfsnabsRR\", [646] = \"evfsnegRR\",\n  [648] = \"evfsmulRRR\", [649] = \"evfsdivRRR\",\n  [652] = \"evfscmpgtYRR\", [653] = \"evfscmpltYRR\", [654] = \"evfscmpeqYRR\",\n  [656] = \"evfscfuiR-R\", [657] = \"evfscfsiR-R\",\n  [658] = \"evfscfufR-R\", [659] = \"evfscfsfR-R\",\n  [660] = \"evfsctuiR-R\", [661] = \"evfsctsiR-R\",\n  [662] = \"evfsctufR-R\", [663] = \"evfsctsfR-R\",\n  [664] = \"evfsctuizR-R\", [666] = \"evfsctsizR-R\",\n  [668] = \"evfststgtYRR\", [669] = \"evfststltYRR\", [670] = \"evfststeqYRR\",\n\n  [704] = \"efsaddRRR\", [705] = \"efssubRRR\",\n  [708] = \"efsabsRR\", [709] = \"efsnabsRR\", [710] = \"efsnegRR\",\n  [712] = \"efsmulRRR\", [713] = \"efsdivRRR\",\n  [716] = \"efscmpgtYRR\", [717] = \"efscmpltYRR\", [718] = \"efscmpeqYRR\",\n  [719] = \"efscfdR-R\",\n  [720] = \"efscfuiR-R\", [721] = \"efscfsiR-R\",\n  [722] = \"efscfufR-R\", [723] = \"efscfsfR-R\",\n  [724] = \"efsctuiR-R\", [725] = \"efsctsiR-R\",\n  [726] = \"efsctufR-R\", [727] = \"efsctsfR-R\",\n  [728] = \"efsctuizR-R\", [730] = \"efsctsizR-R\",\n  [732] = \"efststgtYRR\", [733] = \"efststltYRR\", [734] = \"efststeqYRR\",\n\n  [736] = \"efdaddRRR\", [737] = \"efdsubRRR\",\n  [738] = \"efdcfuidR-R\", [739] = \"efdcfsidR-R\",\n  [740] = \"efdabsRR\", [741] = \"efdnabsRR\", [742] = \"efdnegRR\",\n  [744] = \"efdmulRRR\", [745] = \"efddivRRR\",\n  [746] = \"efdctuidzR-R\", [747] = \"efdctsidzR-R\",\n  [748] = \"efdcmpgtYRR\", [749] = \"efdcmpltYRR\", [750] = \"efdcmpeqYRR\",\n  [751] = \"efdcfsR-R\",\n  [752] = \"efdcfuiR-R\", [753] = \"efdcfsiR-R\",\n  [754] = \"efdcfufR-R\", [755] = \"efdcfsfR-R\",\n  [756] = \"efdctuiR-R\", [757] = \"efdctsiR-R\",\n  [758] = \"efdctufR-R\", [759] = \"efdctsfR-R\",\n  [760] = \"efdctuizR-R\", [762] = \"efdctsizR-R\",\n  [764] = \"efdtstgtYRR\", [765] = \"efdtstltYRR\", [766] = \"efdtsteqYRR\",\n\n  [768] = \"evlddxRR0R\", [769] = \"evlddRR8\",\n  [770] = \"evldwxRR0R\", [771] = \"evldwRR8\",\n  [772] = \"evldhxRR0R\", [773] = \"evldhRR8\",\n  [776] = \"evlhhesplatxRR0R\", [777] = \"evlhhesplatRR2\",\n  [780] = \"evlhhousplatxRR0R\", [781] = \"evlhhousplatRR2\",\n  [782] = \"evlhhossplatxRR0R\", [783] = \"evlhhossplatRR2\",\n  [784] = \"evlwhexRR0R\", [785] = \"evlwheRR4\",\n  [788] = \"evlwhouxRR0R\", [789] = \"evlwhouRR4\",\n  [790] = \"evlwhosxRR0R\", [791] = \"evlwhosRR4\",\n  [792] = \"evlwwsplatxRR0R\", [793] = \"evlwwsplatRR4\",\n  [796] = \"evlwhsplatxRR0R\", [797] = \"evlwhsplatRR4\",\n\n  [800] = \"evstddxRR0R\", [801] = \"evstddRR8\",\n  [802] = \"evstdwxRR0R\", [803] = \"evstdwRR8\",\n  [804] = \"evstdhxRR0R\", [805] = \"evstdhRR8\",\n  [816] = \"evstwhexRR0R\", [817] = \"evstwheRR4\",\n  [820] = \"evstwhoxRR0R\", [821] = \"evstwhoRR4\",\n  [824] = \"evstwwexRR0R\", [825] = \"evstwweRR4\",\n  [828] = \"evstwwoxRR0R\", [829] = \"evstwwoRR4\",\n\n  [1027] = \"evmhessfRRR\", [1031] = \"evmhossfRRR\", [1032] = \"evmheumiRRR\",\n  [1033] = \"evmhesmiRRR\", [1035] = \"evmhesmfRRR\", [1036] = \"evmhoumiRRR\",\n  [1037] = \"evmhosmiRRR\", [1039] = \"evmhosmfRRR\", [1059] = \"evmhessfaRRR\",\n  [1063] = \"evmhossfaRRR\", [1064] = \"evmheumiaRRR\", [1065] = \"evmhesmiaRRR\",\n  [1067] = \"evmhesmfaRRR\", [1068] = \"evmhoumiaRRR\", [1069] = \"evmhosmiaRRR\",\n  [1071] = \"evmhosmfaRRR\", [1095] = \"evmwhssfRRR\", [1096] = \"evmwlumiRRR\",\n  [1100] = \"evmwhumiRRR\", [1101] = \"evmwhsmiRRR\", [1103] = \"evmwhsmfRRR\",\n  [1107] = \"evmwssfRRR\", [1112] = \"evmwumiRRR\", [1113] = \"evmwsmiRRR\",\n  [1115] = \"evmwsmfRRR\", [1127] = \"evmwhssfaRRR\", [1128] = \"evmwlumiaRRR\",\n  [1132] = \"evmwhumiaRRR\", [1133] = \"evmwhsmiaRRR\", [1135] = \"evmwhsmfaRRR\",\n  [1139] = \"evmwssfaRRR\", [1144] = \"evmwumiaRRR\", [1145] = \"evmwsmiaRRR\",\n  [1147] = \"evmwsmfaRRR\",\n\n  [1216] = \"evaddusiaawRR\", [1217] = \"evaddssiaawRR\",\n  [1218] = \"evsubfusiaawRR\", [1219] = \"evsubfssiaawRR\",\n  [1220] = \"evmraRR\",\n  [1222] = \"evdivwsRRR\", [1223] = \"evdivwuRRR\",\n  [1224] = \"evaddumiaawRR\", [1225] = \"evaddsmiaawRR\",\n  [1226] = \"evsubfumiaawRR\", [1227] = \"evsubfsmiaawRR\",\n\n  [1280] = \"evmheusiaawRRR\", [1281] = \"evmhessiaawRRR\",\n  [1283] = \"evmhessfaawRRR\", [1284] = \"evmhousiaawRRR\",\n  [1285] = \"evmhossiaawRRR\", [1287] = \"evmhossfaawRRR\",\n  [1288] = \"evmheumiaawRRR\", [1289] = \"evmhesmiaawRRR\",\n  [1291] = \"evmhesmfaawRRR\", [1292] = \"evmhoumiaawRRR\",\n  [1293] = \"evmhosmiaawRRR\", [1295] = \"evmhosmfaawRRR\",\n  [1320] = \"evmhegumiaaRRR\", [1321] = \"evmhegsmiaaRRR\",\n  [1323] = \"evmhegsmfaaRRR\", [1324] = \"evmhogumiaaRRR\",\n  [1325] = \"evmhogsmiaaRRR\", [1327] = \"evmhogsmfaaRRR\",\n  [1344] = \"evmwlusiaawRRR\", [1345] = \"evmwlssiaawRRR\",\n  [1352] = \"evmwlumiaawRRR\", [1353] = \"evmwlsmiaawRRR\",\n  [1363] = \"evmwssfaaRRR\", [1368] = \"evmwumiaaRRR\",\n  [1369] = \"evmwsmiaaRRR\", [1371] = \"evmwsmfaaRRR\",\n  [1408] = \"evmheusianwRRR\", [1409] = \"evmhessianwRRR\",\n  [1411] = \"evmhessfanwRRR\", [1412] = \"evmhousianwRRR\",\n  [1413] = \"evmhossianwRRR\", [1415] = \"evmhossfanwRRR\",\n  [1416] = \"evmheumianwRRR\", [1417] = \"evmhesmianwRRR\",\n  [1419] = \"evmhesmfanwRRR\", [1420] = \"evmhoumianwRRR\",\n  [1421] = \"evmhosmianwRRR\", [1423] = \"evmhosmfanwRRR\",\n  [1448] = \"evmhegumianRRR\", [1449] = \"evmhegsmianRRR\",\n  [1451] = \"evmhegsmfanRRR\", [1452] = \"evmhogumianRRR\",\n  [1453] = \"evmhogsmianRRR\", [1455] = \"evmhogsmfanRRR\",\n  [1472] = \"evmwlusianwRRR\", [1473] = \"evmwlssianwRRR\",\n  [1480] = \"evmwlumianwRRR\", [1481] = \"evmwlsmianwRRR\",\n  [1491] = \"evmwssfanRRR\", [1496] = \"evmwumianRRR\",\n  [1497] = \"evmwsmianRRR\", [1499] = \"evmwsmfanRRR\",\n}\n\nlocal map_pri = {\n  [0] = false,\tfalse,\t\t\"tdiARI\",\t\"twiARI\",\n  map_spe,\tfalse,\t\tfalse,\t\t\"mulliRRI\",\n  \"subficRRI\",\tfalse,\t\t\"cmpl_iYLRU\",\t\"cmp_iYLRI\",\n  \"addicRRI\",\t\"addic.RRI\",\t\"addi|liRR0I\",\t\"addis|lisRR0I\",\n  \"b_KBJ\",\t\"sc\",\t\t \"bKJ\",\t\tmap_crops,\n  \"rlwimiRR~AAA.\", map_rlwinm,\tfalse,\t\t\"rlwnmRR~RAA.\",\n  \"oriNRR~U\",\t\"orisRR~U\",\t\"xoriRR~U\",\t\"xorisRR~U\",\n  \"andi.RR~U\",\t\"andis.RR~U\",\tmap_rld,\tmap_ext,\n  \"lwzRRD\",\t\"lwzuRRD\",\t\"lbzRRD\",\t\"lbzuRRD\",\n  \"stwRRD\",\t\"stwuRRD\",\t\"stbRRD\",\t\"stbuRRD\",\n  \"lhzRRD\",\t\"lhzuRRD\",\t\"lhaRRD\",\t\"lhauRRD\",\n  \"sthRRD\",\t\"sthuRRD\",\t\"lmwRRD\",\t\"stmwRRD\",\n  \"lfsFRD\",\t\"lfsuFRD\",\t\"lfdFRD\",\t\"lfduFRD\",\n  \"stfsFRD\",\t\"stfsuFRD\",\t\"stfdFRD\",\t\"stfduFRD\",\n  false,\tfalse,\t\tmap_ld,\t\tmap_fps,\n  false,\tfalse,\t\tmap_std,\tmap_fpd,\n}\n\n------------------------------------------------------------------------------\n\nlocal map_gpr = {\n  [0] = \"r0\", \"sp\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\",\n  \"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\",\n  \"r16\", \"r17\", \"r18\", \"r19\", \"r20\", \"r21\", \"r22\", \"r23\",\n  \"r24\", \"r25\", \"r26\", \"r27\", \"r28\", \"r29\", \"r30\", \"r31\",\n}\n\nlocal map_cond = { [0] = \"lt\", \"gt\", \"eq\", \"so\", \"ge\", \"le\", \"ne\", \"ns\", }\n\n-- Format a condition bit.\nlocal function condfmt(cond)\n  if cond <= 3 then\n    return map_cond[band(cond, 3)]\n  else\n    return format(\"4*cr%d+%s\", rshift(cond, 2), map_cond[band(cond, 3)])\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local pos = ctx.pos\n  local extra = \"\"\n  if ctx.rel then\n    local sym = ctx.symtab[ctx.rel]\n    if sym then extra = \"\\t->\"..sym end\n  end\n  if ctx.hexdump > 0 then\n    ctx.out(format(\"%08x  %s  %-7s %s%s\\n\",\n\t    ctx.addr+pos, tohex(ctx.op), text, concat(operands, \", \"), extra))\n  else\n    ctx.out(format(\"%08x  %-7s %s%s\\n\",\n\t    ctx.addr+pos, text, concat(operands, \", \"), extra))\n  end\n  ctx.pos = pos + 4\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  return putop(ctx, \".long\", { \"0x\"..tohex(ctx.op) })\nend\n\n-- Disassemble a single instruction.\nlocal function disass_ins(ctx)\n  local pos = ctx.pos\n  local b0, b1, b2, b3 = byte(ctx.code, pos+1, pos+4)\n  local op = bor(lshift(b0, 24), lshift(b1, 16), lshift(b2, 8), b3)\n  local operands = {}\n  local last = nil\n  local rs = 21\n  ctx.op = op\n  ctx.rel = nil\n\n  local opat = map_pri[rshift(b0, 2)]\n  while type(opat) ~= \"string\" do\n    if not opat then return unknown(ctx) end\n    opat = opat[band(rshift(op, opat.shift), opat.mask)]\n  end\n  local name, pat = match(opat, \"^([a-z0-9_.]*)(.*)\")\n  local altname, pat2 = match(pat, \"|([a-z0-9_.]*)(.*)\")\n  if altname then pat = pat2 end\n\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"R\" then\n      x = map_gpr[band(rshift(op, rs), 31)]\n      rs = rs - 5\n    elseif p == \"F\" then\n      x = \"f\"..band(rshift(op, rs), 31)\n      rs = rs - 5\n    elseif p == \"A\" then\n      x = band(rshift(op, rs), 31)\n      rs = rs - 5\n    elseif p == \"S\" then\n      x = arshift(lshift(op, 27-rs), 27)\n      rs = rs - 5\n    elseif p == \"I\" then\n      x = arshift(lshift(op, 16), 16)\n    elseif p == \"U\" then\n      x = band(op, 0xffff)\n    elseif p == \"D\" or p == \"E\" then\n      local disp = arshift(lshift(op, 16), 16)\n      if p == \"E\" then disp = band(disp, -4) end\n      if last == \"r0\" then last = \"0\" end\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p >= \"2\" and p <= \"8\" then\n      local disp = band(rshift(op, rs), 31) * p\n      if last == \"r0\" then last = \"0\" end\n      operands[#operands] = format(\"%d(%s)\", disp, last)\n    elseif p == \"H\" then\n      x = band(rshift(op, rs), 31) + lshift(band(op, 2), 4)\n      rs = rs - 5\n    elseif p == \"M\" then\n      x = band(rshift(op, rs), 31) + band(op, 0x20)\n    elseif p == \"C\" then\n      x = condfmt(band(rshift(op, rs), 31))\n      rs = rs - 5\n    elseif p == \"B\" then\n      local bo = rshift(op, 21)\n      local cond = band(rshift(op, 16), 31)\n      local cn = \"\"\n      rs = rs - 10\n      if band(bo, 4) == 0 then\n\tcn = band(bo, 2) == 0 and \"dnz\" or \"dz\"\n\tif band(bo, 0x10) == 0 then\n\t  cn = cn..(band(bo, 8) == 0 and \"f\" or \"t\")\n\tend\n\tif band(bo, 0x10) == 0 then x = condfmt(cond) end\n\tname = name..(band(bo, 1) == band(rshift(op, 15), 1) and \"-\" or \"+\")\n      elseif band(bo, 0x10) == 0 then\n\tcn = map_cond[band(cond, 3) + (band(bo, 8) == 0 and 4 or 0)]\n\tif cond > 3 then x = \"cr\"..rshift(cond, 2) end\n\tname = name..(band(bo, 1) == band(rshift(op, 15), 1) and \"-\" or \"+\")\n      end\n      name = gsub(name, \"_\", cn)\n    elseif p == \"J\" then\n      x = arshift(lshift(op, 27-rs), 29-rs)*4\n      if band(op, 2) == 0 then x = ctx.addr + pos + x end\n      ctx.rel = x\n      x = \"0x\"..tohex(x)\n    elseif p == \"K\" then\n      if band(op, 1) ~= 0 then name = name..\"l\" end\n      if band(op, 2) ~= 0 then name = name..\"a\" end\n    elseif p == \"X\" or p == \"Y\" then\n      x = band(rshift(op, rs+2), 7)\n      if x == 0 and p == \"Y\" then x = nil else x = \"cr\"..x end\n      rs = rs - 5\n    elseif p == \"W\" then\n      x = \"cr\"..band(op, 7)\n    elseif p == \"Z\" then\n      x = band(rshift(op, rs-4), 255)\n      rs = rs - 10\n    elseif p == \">\" then\n      operands[#operands] = rshift(operands[#operands], 1)\n    elseif p == \"0\" then\n      if last == \"r0\" then\n\toperands[#operands] = nil\n\tif altname then name = altname end\n      end\n    elseif p == \"L\" then\n      name = gsub(name, \"_\", band(op, 0x00200000) ~= 0 and \"d\" or \"w\")\n    elseif p == \".\" then\n      if band(op, 1) == 1 then name = name..\".\" end\n    elseif p == \"N\" then\n      if op == 0x60000000 then name = \"nop\"; break end\n    elseif p == \"~\" then\n      local n = #operands\n      operands[n-1],  operands[n] = operands[n], operands[n-1]\n    elseif p == \"=\" then\n      local n = #operands\n      if last == operands[n-1] then\n\toperands[n] = nil\n\tname = altname\n      end\n    elseif p == \"%\" then\n      local n = #operands\n      if last == operands[n-1] and last == operands[n-2] then\n\toperands[n] = nil\n\toperands[n-1] = nil\n\tname = altname\n      end\n    elseif p == \"-\" then\n      rs = rs - 5\n    else\n      assert(false)\n    end\n    if x then operands[#operands+1] = x; last = x end\n  end\n\n  return putop(ctx, name, operands)\nend\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  stop = stop - stop % 4\n  ctx.pos = ofs - ofs % 4\n  ctx.rel = nil\n  while ctx.pos < stop do disass_ins(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = addr or 0\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 8\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 32 then return map_gpr[r] end\n  return \"f\"..(r-32)\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  disass = disass,\n  regname = regname\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_x64.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT x64 disassembler wrapper module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This module just exports the 64 bit functions from the combined\n-- x86/x64 disassembler module. All the interesting stuff is there.\n------------------------------------------------------------------------------\n\nlocal dis_x86 = require((string.match(..., \".*%.\") or \"\")..\"dis_x86\")\nreturn {\n  create = dis_x86.create64,\n  disass = dis_x86.disass64,\n  regname = dis_x86.regname64\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dis_x86.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT x86/x64 disassembler module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n-- This is a helper module used by the LuaJIT machine code dumper module.\n--\n-- Sending small code snippets to an external disassembler and mixing the\n-- output with our own stuff was too fragile. So I had to bite the bullet\n-- and write yet another x86 disassembler. Oh well ...\n--\n-- The output format is very similar to what ndisasm generates. But it has\n-- been developed independently by looking at the opcode tables from the\n-- Intel and AMD manuals. The supported instruction set is quite extensive\n-- and reflects what a current generation Intel or AMD CPU implements in\n-- 32 bit and 64 bit mode. Yes, this includes MMX, SSE, SSE2, SSE3, SSSE3,\n-- SSE4.1, SSE4.2, SSE4a, AVX, AVX2 and even privileged and hypervisor\n-- (VMX/SVM) instructions.\n--\n-- Notes:\n-- * The (useless) a16 prefix, 3DNow and pre-586 opcodes are unsupported.\n-- * No attempt at optimization has been made -- it's fast enough for my needs.\n------------------------------------------------------------------------------\n\nlocal type = type\nlocal sub, byte, format = string.sub, string.byte, string.format\nlocal match, gmatch, gsub = string.match, string.gmatch, string.gsub\nlocal lower, rep = string.lower, string.rep\nlocal bit = require(\"bit\")\nlocal tohex = bit.tohex\n\n-- Map for 1st opcode byte in 32 bit mode. Ugly? Well ... read on.\nlocal map_opc1_32 = {\n--0x\n[0]=\"addBmr\",\"addVmr\",\"addBrm\",\"addVrm\",\"addBai\",\"addVai\",\"push es\",\"pop es\",\n\"orBmr\",\"orVmr\",\"orBrm\",\"orVrm\",\"orBai\",\"orVai\",\"push cs\",\"opc2*\",\n--1x\n\"adcBmr\",\"adcVmr\",\"adcBrm\",\"adcVrm\",\"adcBai\",\"adcVai\",\"push ss\",\"pop ss\",\n\"sbbBmr\",\"sbbVmr\",\"sbbBrm\",\"sbbVrm\",\"sbbBai\",\"sbbVai\",\"push ds\",\"pop ds\",\n--2x\n\"andBmr\",\"andVmr\",\"andBrm\",\"andVrm\",\"andBai\",\"andVai\",\"es:seg\",\"daa\",\n\"subBmr\",\"subVmr\",\"subBrm\",\"subVrm\",\"subBai\",\"subVai\",\"cs:seg\",\"das\",\n--3x\n\"xorBmr\",\"xorVmr\",\"xorBrm\",\"xorVrm\",\"xorBai\",\"xorVai\",\"ss:seg\",\"aaa\",\n\"cmpBmr\",\"cmpVmr\",\"cmpBrm\",\"cmpVrm\",\"cmpBai\",\"cmpVai\",\"ds:seg\",\"aas\",\n--4x\n\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\"incVR\",\n\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\"decVR\",\n--5x\n\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\"pushUR\",\n\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\"popUR\",\n--6x\n\"sz*pushaw,pusha\",\"sz*popaw,popa\",\"boundVrm\",\"arplWmr\",\n\"fs:seg\",\"gs:seg\",\"o16:\",\"a16\",\n\"pushUi\",\"imulVrmi\",\"pushBs\",\"imulVrms\",\n\"insb\",\"insVS\",\"outsb\",\"outsVS\",\n--7x\n\"joBj\",\"jnoBj\",\"jbBj\",\"jnbBj\",\"jzBj\",\"jnzBj\",\"jbeBj\",\"jaBj\",\n\"jsBj\",\"jnsBj\",\"jpeBj\",\"jpoBj\",\"jlBj\",\"jgeBj\",\"jleBj\",\"jgBj\",\n--8x\n\"arith!Bmi\",\"arith!Vmi\",\"arith!Bmi\",\"arith!Vms\",\n\"testBmr\",\"testVmr\",\"xchgBrm\",\"xchgVrm\",\n\"movBmr\",\"movVmr\",\"movBrm\",\"movVrm\",\n\"movVmg\",\"leaVrm\",\"movWgm\",\"popUm\",\n--9x\n\"nop*xchgVaR|pause|xchgWaR|repne nop\",\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\n\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\"xchgVaR\",\n\"sz*cbw,cwde,cdqe\",\"sz*cwd,cdq,cqo\",\"call farViw\",\"wait\",\n\"sz*pushfw,pushf\",\"sz*popfw,popf\",\"sahf\",\"lahf\",\n--Ax\n\"movBao\",\"movVao\",\"movBoa\",\"movVoa\",\n\"movsb\",\"movsVS\",\"cmpsb\",\"cmpsVS\",\n\"testBai\",\"testVai\",\"stosb\",\"stosVS\",\n\"lodsb\",\"lodsVS\",\"scasb\",\"scasVS\",\n--Bx\n\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\"movBRi\",\n\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\"movVRI\",\n--Cx\n\"shift!Bmu\",\"shift!Vmu\",\"retBw\",\"ret\",\"vex*3$lesVrm\",\"vex*2$ldsVrm\",\"movBmi\",\"movVmi\",\n\"enterBwu\",\"leave\",\"retfBw\",\"retf\",\"int3\",\"intBu\",\"into\",\"iretVS\",\n--Dx\n\"shift!Bm1\",\"shift!Vm1\",\"shift!Bmc\",\"shift!Vmc\",\"aamBu\",\"aadBu\",\"salc\",\"xlatb\",\n\"fp*0\",\"fp*1\",\"fp*2\",\"fp*3\",\"fp*4\",\"fp*5\",\"fp*6\",\"fp*7\",\n--Ex\n\"loopneBj\",\"loopeBj\",\"loopBj\",\"sz*jcxzBj,jecxzBj,jrcxzBj\",\n\"inBau\",\"inVau\",\"outBua\",\"outVua\",\n\"callVj\",\"jmpVj\",\"jmp farViw\",\"jmpBj\",\"inBad\",\"inVad\",\"outBda\",\"outVda\",\n--Fx\n\"lock:\",\"int1\",\"repne:rep\",\"rep:\",\"hlt\",\"cmc\",\"testb!Bm\",\"testv!Vm\",\n\"clc\",\"stc\",\"cli\",\"sti\",\"cld\",\"std\",\"incb!Bm\",\"incd!Vm\",\n}\nassert(#map_opc1_32 == 255)\n\n-- Map for 1st opcode byte in 64 bit mode (overrides only).\nlocal map_opc1_64 = setmetatable({\n  [0x06]=false, [0x07]=false, [0x0e]=false,\n  [0x16]=false, [0x17]=false, [0x1e]=false, [0x1f]=false,\n  [0x27]=false, [0x2f]=false, [0x37]=false, [0x3f]=false,\n  [0x60]=false, [0x61]=false, [0x62]=false, [0x63]=\"movsxdVrDmt\", [0x67]=\"a32:\",\n  [0x40]=\"rex*\",   [0x41]=\"rex*b\",   [0x42]=\"rex*x\",   [0x43]=\"rex*xb\",\n  [0x44]=\"rex*r\",  [0x45]=\"rex*rb\",  [0x46]=\"rex*rx\",  [0x47]=\"rex*rxb\",\n  [0x48]=\"rex*w\",  [0x49]=\"rex*wb\",  [0x4a]=\"rex*wx\",  [0x4b]=\"rex*wxb\",\n  [0x4c]=\"rex*wr\", [0x4d]=\"rex*wrb\", [0x4e]=\"rex*wrx\", [0x4f]=\"rex*wrxb\",\n  [0x82]=false, [0x9a]=false, [0xc4]=\"vex*3\", [0xc5]=\"vex*2\", [0xce]=false,\n  [0xd4]=false, [0xd5]=false, [0xd6]=false, [0xea]=false,\n}, { __index = map_opc1_32 })\n\n-- Map for 2nd opcode byte (0F xx). True CISC hell. Hey, I told you.\n-- Prefix dependent MMX/SSE opcodes: (none)|rep|o16|repne, -|F3|66|F2\nlocal map_opc2 = {\n--0x\n[0]=\"sldt!Dmp\",\"sgdt!Ump\",\"larVrm\",\"lslVrm\",nil,\"syscall\",\"clts\",\"sysret\",\n\"invd\",\"wbinvd\",nil,\"ud1\",nil,\"$prefetch!Bm\",\"femms\",\"3dnowMrmu\",\n--1x\n\"movupsXrm|movssXrvm|movupdXrm|movsdXrvm\",\n\"movupsXmr|movssXmvr|movupdXmr|movsdXmvr\",\n\"movhlpsXrm$movlpsXrm|movsldupXrm|movlpdXrm|movddupXrm\",\n\"movlpsXmr||movlpdXmr\",\n\"unpcklpsXrvm||unpcklpdXrvm\",\n\"unpckhpsXrvm||unpckhpdXrvm\",\n\"movlhpsXrm$movhpsXrm|movshdupXrm|movhpdXrm\",\n\"movhpsXmr||movhpdXmr\",\n\"$prefetcht!Bm\",\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\n\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\"hintnopVm\",\n--2x\n\"movUmx$\",\"movUmy$\",\"movUxm$\",\"movUym$\",\"movUmz$\",nil,\"movUzm$\",nil,\n\"movapsXrm||movapdXrm\",\n\"movapsXmr||movapdXmr\",\n\"cvtpi2psXrMm|cvtsi2ssXrvVmt|cvtpi2pdXrMm|cvtsi2sdXrvVmt\",\n\"movntpsXmr|movntssXmr|movntpdXmr|movntsdXmr\",\n\"cvttps2piMrXm|cvttss2siVrXm|cvttpd2piMrXm|cvttsd2siVrXm\",\n\"cvtps2piMrXm|cvtss2siVrXm|cvtpd2piMrXm|cvtsd2siVrXm\",\n\"ucomissXrm||ucomisdXrm\",\n\"comissXrm||comisdXrm\",\n--3x\n\"wrmsr\",\"rdtsc\",\"rdmsr\",\"rdpmc\",\"sysenter\",\"sysexit\",nil,\"getsec\",\n\"opc3*38\",nil,\"opc3*3a\",nil,nil,nil,nil,nil,\n--4x\n\"cmovoVrm\",\"cmovnoVrm\",\"cmovbVrm\",\"cmovnbVrm\",\n\"cmovzVrm\",\"cmovnzVrm\",\"cmovbeVrm\",\"cmovaVrm\",\n\"cmovsVrm\",\"cmovnsVrm\",\"cmovpeVrm\",\"cmovpoVrm\",\n\"cmovlVrm\",\"cmovgeVrm\",\"cmovleVrm\",\"cmovgVrm\",\n--5x\n\"movmskpsVrXm$||movmskpdVrXm$\",\"sqrtpsXrm|sqrtssXrm|sqrtpdXrm|sqrtsdXrm\",\n\"rsqrtpsXrm|rsqrtssXrvm\",\"rcppsXrm|rcpssXrvm\",\n\"andpsXrvm||andpdXrvm\",\"andnpsXrvm||andnpdXrvm\",\n\"orpsXrvm||orpdXrvm\",\"xorpsXrvm||xorpdXrvm\",\n\"addpsXrvm|addssXrvm|addpdXrvm|addsdXrvm\",\"mulpsXrvm|mulssXrvm|mulpdXrvm|mulsdXrvm\",\n\"cvtps2pdXrm|cvtss2sdXrvm|cvtpd2psXrm|cvtsd2ssXrvm\",\n\"cvtdq2psXrm|cvttps2dqXrm|cvtps2dqXrm\",\n\"subpsXrvm|subssXrvm|subpdXrvm|subsdXrvm\",\"minpsXrvm|minssXrvm|minpdXrvm|minsdXrvm\",\n\"divpsXrvm|divssXrvm|divpdXrvm|divsdXrvm\",\"maxpsXrvm|maxssXrvm|maxpdXrvm|maxsdXrvm\",\n--6x\n\"punpcklbwPrvm\",\"punpcklwdPrvm\",\"punpckldqPrvm\",\"packsswbPrvm\",\n\"pcmpgtbPrvm\",\"pcmpgtwPrvm\",\"pcmpgtdPrvm\",\"packuswbPrvm\",\n\"punpckhbwPrvm\",\"punpckhwdPrvm\",\"punpckhdqPrvm\",\"packssdwPrvm\",\n\"||punpcklqdqXrvm\",\"||punpckhqdqXrvm\",\n\"movPrVSm\",\"movqMrm|movdquXrm|movdqaXrm\",\n--7x\n\"pshufwMrmu|pshufhwXrmu|pshufdXrmu|pshuflwXrmu\",\"pshiftw!Pvmu\",\n\"pshiftd!Pvmu\",\"pshiftq!Mvmu||pshiftdq!Xvmu\",\n\"pcmpeqbPrvm\",\"pcmpeqwPrvm\",\"pcmpeqdPrvm\",\"emms*|\",\n\"vmreadUmr||extrqXmuu$|insertqXrmuu$\",\"vmwriteUrm||extrqXrm$|insertqXrm$\",\nnil,nil,\n\"||haddpdXrvm|haddpsXrvm\",\"||hsubpdXrvm|hsubpsXrvm\",\n\"movVSmMr|movqXrm|movVSmXr\",\"movqMmr|movdquXmr|movdqaXmr\",\n--8x\n\"joVj\",\"jnoVj\",\"jbVj\",\"jnbVj\",\"jzVj\",\"jnzVj\",\"jbeVj\",\"jaVj\",\n\"jsVj\",\"jnsVj\",\"jpeVj\",\"jpoVj\",\"jlVj\",\"jgeVj\",\"jleVj\",\"jgVj\",\n--9x\n\"setoBm\",\"setnoBm\",\"setbBm\",\"setnbBm\",\"setzBm\",\"setnzBm\",\"setbeBm\",\"setaBm\",\n\"setsBm\",\"setnsBm\",\"setpeBm\",\"setpoBm\",\"setlBm\",\"setgeBm\",\"setleBm\",\"setgBm\",\n--Ax\n\"push fs\",\"pop fs\",\"cpuid\",\"btVmr\",\"shldVmru\",\"shldVmrc\",nil,nil,\n\"push gs\",\"pop gs\",\"rsm\",\"btsVmr\",\"shrdVmru\",\"shrdVmrc\",\"fxsave!Dmp\",\"imulVrm\",\n--Bx\n\"cmpxchgBmr\",\"cmpxchgVmr\",\"$lssVrm\",\"btrVmr\",\n\"$lfsVrm\",\"$lgsVrm\",\"movzxVrBmt\",\"movzxVrWmt\",\n\"|popcntVrm\",\"ud2Dp\",\"bt!Vmu\",\"btcVmr\",\n\"bsfVrm\",\"bsrVrm|lzcntVrm|bsrWrm\",\"movsxVrBmt\",\"movsxVrWmt\",\n--Cx\n\"xaddBmr\",\"xaddVmr\",\n\"cmppsXrvmu|cmpssXrvmu|cmppdXrvmu|cmpsdXrvmu\",\"$movntiVmr|\",\n\"pinsrwPrvWmu\",\"pextrwDrPmu\",\n\"shufpsXrvmu||shufpdXrvmu\",\"$cmpxchg!Qmp\",\n\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\"bswapVR\",\n--Dx\n\"||addsubpdXrvm|addsubpsXrvm\",\"psrlwPrvm\",\"psrldPrvm\",\"psrlqPrvm\",\n\"paddqPrvm\",\"pmullwPrvm\",\n\"|movq2dqXrMm|movqXmr|movdq2qMrXm$\",\"pmovmskbVrMm||pmovmskbVrXm\",\n\"psubusbPrvm\",\"psubuswPrvm\",\"pminubPrvm\",\"pandPrvm\",\n\"paddusbPrvm\",\"padduswPrvm\",\"pmaxubPrvm\",\"pandnPrvm\",\n--Ex\n\"pavgbPrvm\",\"psrawPrvm\",\"psradPrvm\",\"pavgwPrvm\",\n\"pmulhuwPrvm\",\"pmulhwPrvm\",\n\"|cvtdq2pdXrm|cvttpd2dqXrm|cvtpd2dqXrm\",\"$movntqMmr||$movntdqXmr\",\n\"psubsbPrvm\",\"psubswPrvm\",\"pminswPrvm\",\"porPrvm\",\n\"paddsbPrvm\",\"paddswPrvm\",\"pmaxswPrvm\",\"pxorPrvm\",\n--Fx\n\"|||lddquXrm\",\"psllwPrvm\",\"pslldPrvm\",\"psllqPrvm\",\n\"pmuludqPrvm\",\"pmaddwdPrvm\",\"psadbwPrvm\",\"maskmovqMrm||maskmovdquXrm$\",\n\"psubbPrvm\",\"psubwPrvm\",\"psubdPrvm\",\"psubqPrvm\",\n\"paddbPrvm\",\"paddwPrvm\",\"padddPrvm\",\"ud\",\n}\nassert(map_opc2[255] == \"ud\")\n\n-- Map for three-byte opcodes. Can't wait for their next invention.\nlocal map_opc3 = {\n[\"38\"] = { -- [66] 0f 38 xx\n--0x\n[0]=\"pshufbPrvm\",\"phaddwPrvm\",\"phadddPrvm\",\"phaddswPrvm\",\n\"pmaddubswPrvm\",\"phsubwPrvm\",\"phsubdPrvm\",\"phsubswPrvm\",\n\"psignbPrvm\",\"psignwPrvm\",\"psigndPrvm\",\"pmulhrswPrvm\",\n\"||permilpsXrvm\",\"||permilpdXrvm\",nil,nil,\n--1x\n\"||pblendvbXrma\",nil,nil,nil,\n\"||blendvpsXrma\",\"||blendvpdXrma\",\"||permpsXrvm\",\"||ptestXrm\",\n\"||broadcastssXrm\",\"||broadcastsdXrm\",\"||broadcastf128XrlXm\",nil,\n\"pabsbPrm\",\"pabswPrm\",\"pabsdPrm\",nil,\n--2x\n\"||pmovsxbwXrm\",\"||pmovsxbdXrm\",\"||pmovsxbqXrm\",\"||pmovsxwdXrm\",\n\"||pmovsxwqXrm\",\"||pmovsxdqXrm\",nil,nil,\n\"||pmuldqXrvm\",\"||pcmpeqqXrvm\",\"||$movntdqaXrm\",\"||packusdwXrvm\",\n\"||maskmovpsXrvm\",\"||maskmovpdXrvm\",\"||maskmovpsXmvr\",\"||maskmovpdXmvr\",\n--3x\n\"||pmovzxbwXrm\",\"||pmovzxbdXrm\",\"||pmovzxbqXrm\",\"||pmovzxwdXrm\",\n\"||pmovzxwqXrm\",\"||pmovzxdqXrm\",\"||permdXrvm\",\"||pcmpgtqXrvm\",\n\"||pminsbXrvm\",\"||pminsdXrvm\",\"||pminuwXrvm\",\"||pminudXrvm\",\n\"||pmaxsbXrvm\",\"||pmaxsdXrvm\",\"||pmaxuwXrvm\",\"||pmaxudXrvm\",\n--4x\n\"||pmulddXrvm\",\"||phminposuwXrm\",nil,nil,\nnil,\"||psrlvVSXrvm\",\"||psravdXrvm\",\"||psllvVSXrvm\",\n--5x\n[0x58] = \"||pbroadcastdXrlXm\",[0x59] = \"||pbroadcastqXrlXm\",\n[0x5a] = \"||broadcasti128XrlXm\",\n--7x\n[0x78] = \"||pbroadcastbXrlXm\",[0x79] = \"||pbroadcastwXrlXm\",\n--8x\n[0x8c] = \"||pmaskmovXrvVSm\",\n[0x8e] = \"||pmaskmovVSmXvr\",\n--9x\n[0x96] = \"||fmaddsub132pHXrvm\",[0x97] = \"||fmsubadd132pHXrvm\",\n[0x98] = \"||fmadd132pHXrvm\",[0x99] = \"||fmadd132sHXrvm\",\n[0x9a] = \"||fmsub132pHXrvm\",[0x9b] = \"||fmsub132sHXrvm\",\n[0x9c] = \"||fnmadd132pHXrvm\",[0x9d] = \"||fnmadd132sHXrvm\",\n[0x9e] = \"||fnmsub132pHXrvm\",[0x9f] = \"||fnmsub132sHXrvm\",\n--Ax\n[0xa6] = \"||fmaddsub213pHXrvm\",[0xa7] = \"||fmsubadd213pHXrvm\",\n[0xa8] = \"||fmadd213pHXrvm\",[0xa9] = \"||fmadd213sHXrvm\",\n[0xaa] = \"||fmsub213pHXrvm\",[0xab] = \"||fmsub213sHXrvm\",\n[0xac] = \"||fnmadd213pHXrvm\",[0xad] = \"||fnmadd213sHXrvm\",\n[0xae] = \"||fnmsub213pHXrvm\",[0xaf] = \"||fnmsub213sHXrvm\",\n--Bx\n[0xb6] = \"||fmaddsub231pHXrvm\",[0xb7] = \"||fmsubadd231pHXrvm\",\n[0xb8] = \"||fmadd231pHXrvm\",[0xb9] = \"||fmadd231sHXrvm\",\n[0xba] = \"||fmsub231pHXrvm\",[0xbb] = \"||fmsub231sHXrvm\",\n[0xbc] = \"||fnmadd231pHXrvm\",[0xbd] = \"||fnmadd231sHXrvm\",\n[0xbe] = \"||fnmsub231pHXrvm\",[0xbf] = \"||fnmsub231sHXrvm\",\n--Dx\n[0xdc] = \"||aesencXrvm\", [0xdd] = \"||aesenclastXrvm\",\n[0xde] = \"||aesdecXrvm\", [0xdf] = \"||aesdeclastXrvm\",\n--Fx\n[0xf0] = \"|||crc32TrBmt\",[0xf1] = \"|||crc32TrVmt\",\n[0xf7] = \"| sarxVrmv| shlxVrmv| shrxVrmv\",\n},\n\n[\"3a\"] = { -- [66] 0f 3a xx\n--0x\n[0x00]=\"||permqXrmu\",\"||permpdXrmu\",\"||pblenddXrvmu\",nil,\n\"||permilpsXrmu\",\"||permilpdXrmu\",\"||perm2f128Xrvmu\",nil,\n\"||roundpsXrmu\",\"||roundpdXrmu\",\"||roundssXrvmu\",\"||roundsdXrvmu\",\n\"||blendpsXrvmu\",\"||blendpdXrvmu\",\"||pblendwXrvmu\",\"palignrPrvmu\",\n--1x\nnil,nil,nil,nil,\n\"||pextrbVmXru\",\"||pextrwVmXru\",\"||pextrVmSXru\",\"||extractpsVmXru\",\n\"||insertf128XrvlXmu\",\"||extractf128XlXmYru\",nil,nil,\nnil,nil,nil,nil,\n--2x\n\"||pinsrbXrvVmu\",\"||insertpsXrvmu\",\"||pinsrXrvVmuS\",nil,\n--3x\n[0x38] = \"||inserti128Xrvmu\",[0x39] = \"||extracti128XlXmYru\",\n--4x\n[0x40] = \"||dppsXrvmu\",\n[0x41] = \"||dppdXrvmu\",\n[0x42] = \"||mpsadbwXrvmu\",\n[0x44] = \"||pclmulqdqXrvmu\",\n[0x46] = \"||perm2i128Xrvmu\",\n[0x4a] = \"||blendvpsXrvmb\",[0x4b] = \"||blendvpdXrvmb\",\n[0x4c] = \"||pblendvbXrvmb\",\n--6x\n[0x60] = \"||pcmpestrmXrmu\",[0x61] = \"||pcmpestriXrmu\",\n[0x62] = \"||pcmpistrmXrmu\",[0x63] = \"||pcmpistriXrmu\",\n[0xdf] = \"||aeskeygenassistXrmu\",\n--Fx\n[0xf0] = \"||| rorxVrmu\",\n},\n}\n\n-- Map for VMX/SVM opcodes 0F 01 C0-FF (sgdt group with register operands).\nlocal map_opcvm = {\n[0xc1]=\"vmcall\",[0xc2]=\"vmlaunch\",[0xc3]=\"vmresume\",[0xc4]=\"vmxoff\",\n[0xc8]=\"monitor\",[0xc9]=\"mwait\",\n[0xd8]=\"vmrun\",[0xd9]=\"vmmcall\",[0xda]=\"vmload\",[0xdb]=\"vmsave\",\n[0xdc]=\"stgi\",[0xdd]=\"clgi\",[0xde]=\"skinit\",[0xdf]=\"invlpga\",\n[0xf8]=\"swapgs\",[0xf9]=\"rdtscp\",\n}\n\n-- Map for FP opcodes. And you thought stack machines are simple?\nlocal map_opcfp = {\n-- D8-DF 00-BF: opcodes with a memory operand.\n-- D8\n[0]=\"faddFm\",\"fmulFm\",\"fcomFm\",\"fcompFm\",\"fsubFm\",\"fsubrFm\",\"fdivFm\",\"fdivrFm\",\n\"fldFm\",nil,\"fstFm\",\"fstpFm\",\"fldenvVm\",\"fldcwWm\",\"fnstenvVm\",\"fnstcwWm\",\n-- DA\n\"fiaddDm\",\"fimulDm\",\"ficomDm\",\"ficompDm\",\n\"fisubDm\",\"fisubrDm\",\"fidivDm\",\"fidivrDm\",\n-- DB\n\"fildDm\",\"fisttpDm\",\"fistDm\",\"fistpDm\",nil,\"fld twordFmp\",nil,\"fstp twordFmp\",\n-- DC\n\"faddGm\",\"fmulGm\",\"fcomGm\",\"fcompGm\",\"fsubGm\",\"fsubrGm\",\"fdivGm\",\"fdivrGm\",\n-- DD\n\"fldGm\",\"fisttpQm\",\"fstGm\",\"fstpGm\",\"frstorDmp\",nil,\"fnsaveDmp\",\"fnstswWm\",\n-- DE\n\"fiaddWm\",\"fimulWm\",\"ficomWm\",\"ficompWm\",\n\"fisubWm\",\"fisubrWm\",\"fidivWm\",\"fidivrWm\",\n-- DF\n\"fildWm\",\"fisttpWm\",\"fistWm\",\"fistpWm\",\n\"fbld twordFmp\",\"fildQm\",\"fbstp twordFmp\",\"fistpQm\",\n-- xx C0-FF: opcodes with a pseudo-register operand.\n-- D8\n\"faddFf\",\"fmulFf\",\"fcomFf\",\"fcompFf\",\"fsubFf\",\"fsubrFf\",\"fdivFf\",\"fdivrFf\",\n-- D9\n\"fldFf\",\"fxchFf\",{\"fnop\"},nil,\n{\"fchs\",\"fabs\",nil,nil,\"ftst\",\"fxam\"},\n{\"fld1\",\"fldl2t\",\"fldl2e\",\"fldpi\",\"fldlg2\",\"fldln2\",\"fldz\"},\n{\"f2xm1\",\"fyl2x\",\"fptan\",\"fpatan\",\"fxtract\",\"fprem1\",\"fdecstp\",\"fincstp\"},\n{\"fprem\",\"fyl2xp1\",\"fsqrt\",\"fsincos\",\"frndint\",\"fscale\",\"fsin\",\"fcos\"},\n-- DA\n\"fcmovbFf\",\"fcmoveFf\",\"fcmovbeFf\",\"fcmovuFf\",nil,{nil,\"fucompp\"},nil,nil,\n-- DB\n\"fcmovnbFf\",\"fcmovneFf\",\"fcmovnbeFf\",\"fcmovnuFf\",\n{nil,nil,\"fnclex\",\"fninit\"},\"fucomiFf\",\"fcomiFf\",nil,\n-- DC\n\"fadd toFf\",\"fmul toFf\",nil,nil,\n\"fsub toFf\",\"fsubr toFf\",\"fdivr toFf\",\"fdiv toFf\",\n-- DD\n\"ffreeFf\",nil,\"fstFf\",\"fstpFf\",\"fucomFf\",\"fucompFf\",nil,nil,\n-- DE\n\"faddpFf\",\"fmulpFf\",nil,{nil,\"fcompp\"},\n\"fsubrpFf\",\"fsubpFf\",\"fdivrpFf\",\"fdivpFf\",\n-- DF\nnil,nil,nil,nil,{\"fnstsw ax\"},\"fucomipFf\",\"fcomipFf\",nil,\n}\nassert(map_opcfp[126] == \"fcomipFf\")\n\n-- Map for opcode groups. The subkey is sp from the ModRM byte.\nlocal map_opcgroup = {\n  arith = { \"add\", \"or\", \"adc\", \"sbb\", \"and\", \"sub\", \"xor\", \"cmp\" },\n  shift = { \"rol\", \"ror\", \"rcl\", \"rcr\", \"shl\", \"shr\", \"sal\", \"sar\" },\n  testb = { \"testBmi\", \"testBmi\", \"not\", \"neg\", \"mul\", \"imul\", \"div\", \"idiv\" },\n  testv = { \"testVmi\", \"testVmi\", \"not\", \"neg\", \"mul\", \"imul\", \"div\", \"idiv\" },\n  incb = { \"inc\", \"dec\" },\n  incd = { \"inc\", \"dec\", \"callUmp\", \"$call farDmp\",\n\t   \"jmpUmp\", \"$jmp farDmp\", \"pushUm\" },\n  sldt = { \"sldt\", \"str\", \"lldt\", \"ltr\", \"verr\", \"verw\" },\n  sgdt = { \"vm*$sgdt\", \"vm*$sidt\", \"$lgdt\", \"vm*$lidt\",\n\t   \"smsw\", nil, \"lmsw\", \"vm*$invlpg\" },\n  bt = { nil, nil, nil, nil, \"bt\", \"bts\", \"btr\", \"btc\" },\n  cmpxchg = { nil, \"sz*,cmpxchg8bQmp,cmpxchg16bXmp\", nil, nil,\n\t      nil, nil, \"vmptrld|vmxon|vmclear\", \"vmptrst\" },\n  pshiftw = { nil, nil, \"psrlw\", nil, \"psraw\", nil, \"psllw\" },\n  pshiftd = { nil, nil, \"psrld\", nil, \"psrad\", nil, \"pslld\" },\n  pshiftq = { nil, nil, \"psrlq\", nil, nil, nil, \"psllq\" },\n  pshiftdq = { nil, nil, \"psrlq\", \"psrldq\", nil, nil, \"psllq\", \"pslldq\" },\n  fxsave = { \"$fxsave\", \"$fxrstor\", \"$ldmxcsr\", \"$stmxcsr\",\n\t     nil, \"lfenceDp$\", \"mfenceDp$\", \"sfenceDp$clflush\" },\n  prefetch = { \"prefetch\", \"prefetchw\" },\n  prefetcht = { \"prefetchnta\", \"prefetcht0\", \"prefetcht1\", \"prefetcht2\" },\n}\n\n------------------------------------------------------------------------------\n\n-- Maps for register names.\nlocal map_regs = {\n  B = { \"al\", \"cl\", \"dl\", \"bl\", \"ah\", \"ch\", \"dh\", \"bh\",\n\t\"r8b\", \"r9b\", \"r10b\", \"r11b\", \"r12b\", \"r13b\", \"r14b\", \"r15b\" },\n  B64 = { \"al\", \"cl\", \"dl\", \"bl\", \"spl\", \"bpl\", \"sil\", \"dil\",\n\t  \"r8b\", \"r9b\", \"r10b\", \"r11b\", \"r12b\", \"r13b\", \"r14b\", \"r15b\" },\n  W = { \"ax\", \"cx\", \"dx\", \"bx\", \"sp\", \"bp\", \"si\", \"di\",\n\t\"r8w\", \"r9w\", \"r10w\", \"r11w\", \"r12w\", \"r13w\", \"r14w\", \"r15w\" },\n  D = { \"eax\", \"ecx\", \"edx\", \"ebx\", \"esp\", \"ebp\", \"esi\", \"edi\",\n\t\"r8d\", \"r9d\", \"r10d\", \"r11d\", \"r12d\", \"r13d\", \"r14d\", \"r15d\" },\n  Q = { \"rax\", \"rcx\", \"rdx\", \"rbx\", \"rsp\", \"rbp\", \"rsi\", \"rdi\",\n\t\"r8\", \"r9\", \"r10\", \"r11\", \"r12\", \"r13\", \"r14\", \"r15\" },\n  M = { \"mm0\", \"mm1\", \"mm2\", \"mm3\", \"mm4\", \"mm5\", \"mm6\", \"mm7\",\n\t\"mm0\", \"mm1\", \"mm2\", \"mm3\", \"mm4\", \"mm5\", \"mm6\", \"mm7\" }, -- No x64 ext!\n  X = { \"xmm0\", \"xmm1\", \"xmm2\", \"xmm3\", \"xmm4\", \"xmm5\", \"xmm6\", \"xmm7\",\n\t\"xmm8\", \"xmm9\", \"xmm10\", \"xmm11\", \"xmm12\", \"xmm13\", \"xmm14\", \"xmm15\" },\n  Y = { \"ymm0\", \"ymm1\", \"ymm2\", \"ymm3\", \"ymm4\", \"ymm5\", \"ymm6\", \"ymm7\",\n\t\"ymm8\", \"ymm9\", \"ymm10\", \"ymm11\", \"ymm12\", \"ymm13\", \"ymm14\", \"ymm15\" },\n}\nlocal map_segregs = { \"es\", \"cs\", \"ss\", \"ds\", \"fs\", \"gs\", \"segr6\", \"segr7\" }\n\n-- Maps for size names.\nlocal map_sz2n = {\n  B = 1, W = 2, D = 4, Q = 8, M = 8, X = 16, Y = 32,\n}\nlocal map_sz2prefix = {\n  B = \"byte\", W = \"word\", D = \"dword\",\n  Q = \"qword\",\n  M = \"qword\", X = \"xword\", Y = \"yword\",\n  F = \"dword\", G = \"qword\", -- No need for sizes/register names for these two.\n}\n\n------------------------------------------------------------------------------\n\n-- Output a nicely formatted line with an opcode and operands.\nlocal function putop(ctx, text, operands)\n  local code, pos, hex = ctx.code, ctx.pos, \"\"\n  local hmax = ctx.hexdump\n  if hmax > 0 then\n    for i=ctx.start,pos-1 do\n      hex = hex..format(\"%02X\", byte(code, i, i))\n    end\n    if #hex > hmax then hex = sub(hex, 1, hmax)..\". \"\n    else hex = hex..rep(\" \", hmax-#hex+2) end\n  end\n  if operands then text = text..\" \"..operands end\n  if ctx.o16 then text = \"o16 \"..text; ctx.o16 = false end\n  if ctx.a32 then text = \"a32 \"..text; ctx.a32 = false end\n  if ctx.rep then text = ctx.rep..\" \"..text; ctx.rep = false end\n  if ctx.rex then\n    local t = (ctx.rexw and \"w\" or \"\")..(ctx.rexr and \"r\" or \"\")..\n\t      (ctx.rexx and \"x\" or \"\")..(ctx.rexb and \"b\" or \"\")..\n\t      (ctx.vexl and \"l\" or \"\")\n    if ctx.vexv and ctx.vexv ~= 0 then t = t..\"v\"..ctx.vexv end\n    if t ~= \"\" then text = ctx.rex..\".\"..t..\" \"..gsub(text, \"^ \", \"\")\n    elseif ctx.rex == \"vex\" then text = gsub(\"v\"..text, \"^v \", \"\") end\n    ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false\n    ctx.rex = false; ctx.vexl = false; ctx.vexv = false\n  end\n  if ctx.seg then\n    local text2, n = gsub(text, \"%[\", \"[\"..ctx.seg..\":\")\n    if n == 0 then text = ctx.seg..\" \"..text else text = text2 end\n    ctx.seg = false\n  end\n  if ctx.lock then text = \"lock \"..text; ctx.lock = false end\n  local imm = ctx.imm\n  if imm then\n    local sym = ctx.symtab[imm]\n    if sym then text = text..\"\\t->\"..sym end\n  end\n  ctx.out(format(\"%08x  %s%s\\n\", ctx.addr+ctx.start, hex, text))\n  ctx.mrm = false\n  ctx.vexv = false\n  ctx.start = pos\n  ctx.imm = nil\nend\n\n-- Clear all prefix flags.\nlocal function clearprefixes(ctx)\n  ctx.o16 = false; ctx.seg = false; ctx.lock = false; ctx.rep = false\n  ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false\n  ctx.rex = false; ctx.a32 = false; ctx.vexl = false\nend\n\n-- Fallback for incomplete opcodes at the end.\nlocal function incomplete(ctx)\n  ctx.pos = ctx.stop+1\n  clearprefixes(ctx)\n  return putop(ctx, \"(incomplete)\")\nend\n\n-- Fallback for unknown opcodes.\nlocal function unknown(ctx)\n  clearprefixes(ctx)\n  return putop(ctx, \"(unknown)\")\nend\n\n-- Return an immediate of the specified size.\nlocal function getimm(ctx, pos, n)\n  if pos+n-1 > ctx.stop then return incomplete(ctx) end\n  local code = ctx.code\n  if n == 1 then\n    local b1 = byte(code, pos, pos)\n    return b1\n  elseif n == 2 then\n    local b1, b2 = byte(code, pos, pos+1)\n    return b1+b2*256\n  else\n    local b1, b2, b3, b4 = byte(code, pos, pos+3)\n    local imm = b1+b2*256+b3*65536+b4*16777216\n    ctx.imm = imm\n    return imm\n  end\nend\n\n-- Process pattern string and generate the operands.\nlocal function putpat(ctx, name, pat)\n  local operands, regs, sz, mode, sp, rm, sc, rx, sdisp\n  local code, pos, stop, vexl = ctx.code, ctx.pos, ctx.stop, ctx.vexl\n\n  -- Chars used: 1DFGHIMPQRSTUVWXYabcdfgijlmoprstuvwxyz\n  for p in gmatch(pat, \".\") do\n    local x = nil\n    if p == \"V\" or p == \"U\" then\n      if ctx.rexw then sz = \"Q\"; ctx.rexw = false\n      elseif ctx.o16 then sz = \"W\"; ctx.o16 = false\n      elseif p == \"U\" and ctx.x64 then sz = \"Q\"\n      else sz = \"D\" end\n      regs = map_regs[sz]\n    elseif p == \"T\" then\n      if ctx.rexw then sz = \"Q\"; ctx.rexw = false else sz = \"D\" end\n      regs = map_regs[sz]\n    elseif p == \"B\" then\n      sz = \"B\"\n      regs = ctx.rex and map_regs.B64 or map_regs.B\n    elseif match(p, \"[WDQMXYFG]\") then\n      sz = p\n      if sz == \"X\" and vexl then sz = \"Y\"; ctx.vexl = false end\n      regs = map_regs[sz]\n    elseif p == \"P\" then\n      sz = ctx.o16 and \"X\" or \"M\"; ctx.o16 = false\n      if sz == \"X\" and vexl then sz = \"Y\"; ctx.vexl = false end\n      regs = map_regs[sz]\n    elseif p == \"H\" then\n      name = name..(ctx.rexw and \"d\" or \"s\")\n      ctx.rexw = false\n    elseif p == \"S\" then\n      name = name..lower(sz)\n    elseif p == \"s\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = imm <= 127 and format(\"+0x%02x\", imm)\n\t\t     or format(\"-0x%02x\", 256-imm)\n      pos = pos+1\n    elseif p == \"u\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = format(\"0x%02x\", imm)\n      pos = pos+1\n    elseif p == \"b\" then\n      local imm = getimm(ctx, pos, 1); if not imm then return end\n      x = regs[imm/16+1]\n      pos = pos+1\n    elseif p == \"w\" then\n      local imm = getimm(ctx, pos, 2); if not imm then return end\n      x = format(\"0x%x\", imm)\n      pos = pos+2\n    elseif p == \"o\" then -- [offset]\n      if ctx.x64 then\n\tlocal imm1 = getimm(ctx, pos, 4); if not imm1 then return end\n\tlocal imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end\n\tx = format(\"[0x%08x%08x]\", imm2, imm1)\n\tpos = pos+8\n      else\n\tlocal imm = getimm(ctx, pos, 4); if not imm then return end\n\tx = format(\"[0x%08x]\", imm)\n\tpos = pos+4\n      end\n    elseif p == \"i\" or p == \"I\" then\n      local n = map_sz2n[sz]\n      if n == 8 and ctx.x64 and p == \"I\" then\n\tlocal imm1 = getimm(ctx, pos, 4); if not imm1 then return end\n\tlocal imm2 = getimm(ctx, pos+4, 4); if not imm2 then return end\n\tx = format(\"0x%08x%08x\", imm2, imm1)\n      else\n\tif n == 8 then n = 4 end\n\tlocal imm = getimm(ctx, pos, n); if not imm then return end\n\tif sz == \"Q\" and (imm < 0 or imm > 0x7fffffff) then\n\t  imm = (0xffffffff+1)-imm\n\t  x = format(imm > 65535 and \"-0x%08x\" or \"-0x%x\", imm)\n\telse\n\t  x = format(imm > 65535 and \"0x%08x\" or \"0x%x\", imm)\n\tend\n      end\n      pos = pos+n\n    elseif p == \"j\" then\n      local n = map_sz2n[sz]\n      if n == 8 then n = 4 end\n      local imm = getimm(ctx, pos, n); if not imm then return end\n      if sz == \"B\" and imm > 127 then imm = imm-256\n      elseif imm > 2147483647 then imm = imm-4294967296 end\n      pos = pos+n\n      imm = imm + pos + ctx.addr\n      if imm > 4294967295 and not ctx.x64 then imm = imm-4294967296 end\n      ctx.imm = imm\n      if sz == \"W\" then\n\tx = format(\"word 0x%04x\", imm%65536)\n      elseif ctx.x64 then\n\tlocal lo = imm % 0x1000000\n\tx = format(\"0x%02x%06x\", (imm-lo) / 0x1000000, lo)\n      else\n\tx = \"0x\"..tohex(imm)\n      end\n    elseif p == \"R\" then\n      local r = byte(code, pos-1, pos-1)%8\n      if ctx.rexb then r = r + 8; ctx.rexb = false end\n      x = regs[r+1]\n    elseif p == \"a\" then x = regs[1]\n    elseif p == \"c\" then x = \"cl\"\n    elseif p == \"d\" then x = \"dx\"\n    elseif p == \"1\" then x = \"1\"\n    else\n      if not mode then\n\tmode = ctx.mrm\n\tif not mode then\n\t  if pos > stop then return incomplete(ctx) end\n\t  mode = byte(code, pos, pos)\n\t  pos = pos+1\n\tend\n\trm = mode%8; mode = (mode-rm)/8\n\tsp = mode%8; mode = (mode-sp)/8\n\tsdisp = \"\"\n\tif mode < 3 then\n\t  if rm == 4 then\n\t    if pos > stop then return incomplete(ctx) end\n\t    sc = byte(code, pos, pos)\n\t    pos = pos+1\n\t    rm = sc%8; sc = (sc-rm)/8\n\t    rx = sc%8; sc = (sc-rx)/8\n\t    if ctx.rexx then rx = rx + 8; ctx.rexx = false end\n\t    if rx == 4 then rx = nil end\n\t  end\n\t  if mode > 0 or rm == 5 then\n\t    local dsz = mode\n\t    if dsz ~= 1 then dsz = 4 end\n\t    local disp = getimm(ctx, pos, dsz); if not disp then return end\n\t    if mode == 0 then rm = nil end\n\t    if rm or rx or (not sc and ctx.x64 and not ctx.a32) then\n\t      if dsz == 1 and disp > 127 then\n\t\tsdisp = format(\"-0x%x\", 256-disp)\n\t      elseif disp >= 0 and disp <= 0x7fffffff then\n\t\tsdisp = format(\"+0x%x\", disp)\n\t      else\n\t\tsdisp = format(\"-0x%x\", (0xffffffff+1)-disp)\n\t      end\n\t    else\n\t      sdisp = format(ctx.x64 and not ctx.a32 and\n\t\tnot (disp >= 0 and disp <= 0x7fffffff)\n\t\tand \"0xffffffff%08x\" or \"0x%08x\", disp)\n\t    end\n\t    pos = pos+dsz\n\t  end\n\tend\n\tif rm and ctx.rexb then rm = rm + 8; ctx.rexb = false end\n\tif ctx.rexr then sp = sp + 8; ctx.rexr = false end\n      end\n      if p == \"m\" then\n\tif mode == 3 then x = regs[rm+1]\n\telse\n\t  local aregs = ctx.a32 and map_regs.D or ctx.aregs\n\t  local srm, srx = \"\", \"\"\n\t  if rm then srm = aregs[rm+1]\n\t  elseif not sc and ctx.x64 and not ctx.a32 then srm = \"rip\" end\n\t  ctx.a32 = false\n\t  if rx then\n\t    if rm then srm = srm..\"+\" end\n\t    srx = aregs[rx+1]\n\t    if sc > 0 then srx = srx..\"*\"..(2^sc) end\n\t  end\n\t  x = format(\"[%s%s%s]\", srm, srx, sdisp)\n\tend\n\tif mode < 3 and\n\t   (not match(pat, \"[aRrgp]\") or match(pat, \"t\")) then -- Yuck.\n\t  x = map_sz2prefix[sz]..\" \"..x\n\tend\n      elseif p == \"r\" then x = regs[sp+1]\n      elseif p == \"g\" then x = map_segregs[sp+1]\n      elseif p == \"p\" then -- Suppress prefix.\n      elseif p == \"f\" then x = \"st\"..rm\n      elseif p == \"x\" then\n\tif sp == 0 and ctx.lock and not ctx.x64 then\n\t  x = \"CR8\"; ctx.lock = false\n\telse\n\t  x = \"CR\"..sp\n\tend\n      elseif p == \"v\" then\n\tif ctx.vexv then\n\t  x = regs[ctx.vexv+1]; ctx.vexv = false\n\tend\n      elseif p == \"y\" then x = \"DR\"..sp\n      elseif p == \"z\" then x = \"TR\"..sp\n      elseif p == \"l\" then vexl = false\n      elseif p == \"t\" then\n      else\n\terror(\"bad pattern `\"..pat..\"'\")\n      end\n    end\n    if x then operands = operands and operands..\", \"..x or x end\n  end\n  ctx.pos = pos\n  return putop(ctx, name, operands)\nend\n\n-- Forward declaration.\nlocal map_act\n\n-- Fetch and cache MRM byte.\nlocal function getmrm(ctx)\n  local mrm = ctx.mrm\n  if not mrm then\n    local pos = ctx.pos\n    if pos > ctx.stop then return nil end\n    mrm = byte(ctx.code, pos, pos)\n    ctx.pos = pos+1\n    ctx.mrm = mrm\n  end\n  return mrm\nend\n\n-- Dispatch to handler depending on pattern.\nlocal function dispatch(ctx, opat, patgrp)\n  if not opat then return unknown(ctx) end\n  if match(opat, \"%|\") then -- MMX/SSE variants depending on prefix.\n    local p\n    if ctx.rep then\n      p = ctx.rep==\"rep\" and \"%|([^%|]*)\" or \"%|[^%|]*%|[^%|]*%|([^%|]*)\"\n      ctx.rep = false\n    elseif ctx.o16 then p = \"%|[^%|]*%|([^%|]*)\"; ctx.o16 = false\n    else p = \"^[^%|]*\" end\n    opat = match(opat, p)\n    if not opat then return unknown(ctx) end\n--    ctx.rep = false; ctx.o16 = false\n    --XXX fails for 66 f2 0f 38 f1 06  crc32 eax,WORD PTR [esi]\n    --XXX remove in branches?\n  end\n  if match(opat, \"%$\") then -- reg$mem variants.\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    opat = match(opat, mrm >= 192 and \"^[^%$]*\" or \"%$(.*)\")\n    if opat == \"\" then return unknown(ctx) end\n  end\n  if opat == \"\" then return unknown(ctx) end\n  local name, pat = match(opat, \"^([a-z0-9 ]*)(.*)\")\n  if pat == \"\" and patgrp then pat = patgrp end\n  return map_act[sub(pat, 1, 1)](ctx, name, pat)\nend\n\n-- Get a pattern from an opcode map and dispatch to handler.\nlocal function dispatchmap(ctx, opcmap)\n  local pos = ctx.pos\n  local opat = opcmap[byte(ctx.code, pos, pos)]\n  pos = pos + 1\n  ctx.pos = pos\n  return dispatch(ctx, opat)\nend\n\n-- Map for action codes. The key is the first char after the name.\nmap_act = {\n  -- Simple opcodes without operands.\n  [\"\"] = function(ctx, name, pat)\n    return putop(ctx, name)\n  end,\n\n  -- Operand size chars fall right through.\n  B = putpat, W = putpat, D = putpat, Q = putpat,\n  V = putpat, U = putpat, T = putpat,\n  M = putpat, X = putpat, P = putpat,\n  F = putpat, G = putpat, Y = putpat,\n  H = putpat,\n\n  -- Collect prefixes.\n  [\":\"] = function(ctx, name, pat)\n    ctx[pat == \":\" and name or sub(pat, 2)] = name\n    if ctx.pos - ctx.start > 5 then return unknown(ctx) end -- Limit #prefixes.\n  end,\n\n  -- Chain to special handler specified by name.\n  [\"*\"] = function(ctx, name, pat)\n    return map_act[name](ctx, name, sub(pat, 2))\n  end,\n\n  -- Use named subtable for opcode group.\n  [\"!\"] = function(ctx, name, pat)\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    return dispatch(ctx, map_opcgroup[name][((mrm-(mrm%8))/8)%8+1], sub(pat, 2))\n  end,\n\n  -- o16,o32[,o64] variants.\n  sz = function(ctx, name, pat)\n    if ctx.o16 then ctx.o16 = false\n    else\n      pat = match(pat, \",(.*)\")\n      if ctx.rexw then\n\tlocal p = match(pat, \",(.*)\")\n\tif p then pat = p; ctx.rexw = false end\n      end\n    end\n    pat = match(pat, \"^[^,]*\")\n    return dispatch(ctx, pat)\n  end,\n\n  -- Two-byte opcode dispatch.\n  opc2 = function(ctx, name, pat)\n    return dispatchmap(ctx, map_opc2)\n  end,\n\n  -- Three-byte opcode dispatch.\n  opc3 = function(ctx, name, pat)\n    return dispatchmap(ctx, map_opc3[pat])\n  end,\n\n  -- VMX/SVM dispatch.\n  vm = function(ctx, name, pat)\n    return dispatch(ctx, map_opcvm[ctx.mrm])\n  end,\n\n  -- Floating point opcode dispatch.\n  fp = function(ctx, name, pat)\n    local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end\n    local rm = mrm%8\n    local idx = pat*8 + ((mrm-rm)/8)%8\n    if mrm >= 192 then idx = idx + 64 end\n    local opat = map_opcfp[idx]\n    if type(opat) == \"table\" then opat = opat[rm+1] end\n    return dispatch(ctx, opat)\n  end,\n\n  -- REX prefix.\n  rex = function(ctx, name, pat)\n    if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed.\n    for p in gmatch(pat, \".\") do ctx[\"rex\"..p] = true end\n    ctx.rex = \"rex\"\n  end,\n\n  -- VEX prefix.\n  vex = function(ctx, name, pat)\n    if ctx.rex then return unknown(ctx) end -- Only 1 REX or VEX prefix allowed.\n    ctx.rex = \"vex\"\n    local pos = ctx.pos\n    if ctx.mrm then\n      ctx.mrm = nil\n      pos = pos-1\n    end\n    local b = byte(ctx.code, pos, pos)\n    if not b then return incomplete(ctx) end\n    pos = pos+1\n    if b < 128 then ctx.rexr = true end\n    local m = 1\n    if pat == \"3\" then\n      m = b%32; b = (b-m)/32\n      local nb = b%2; b = (b-nb)/2\n      if nb == 0 then ctx.rexb = true end\n      local nx = b%2\n      if nx == 0 then ctx.rexx = true end\n      b = byte(ctx.code, pos, pos)\n      if not b then return incomplete(ctx) end\n      pos = pos+1\n      if b >= 128 then ctx.rexw = true end\n    end\n    ctx.pos = pos\n    local map\n    if m == 1 then map = map_opc2\n    elseif m == 2 then map = map_opc3[\"38\"]\n    elseif m == 3 then map = map_opc3[\"3a\"]\n    else return unknown(ctx) end\n    local p = b%4; b = (b-p)/4\n    if p == 1 then ctx.o16 = \"o16\"\n    elseif p == 2 then ctx.rep = \"rep\"\n    elseif p == 3 then ctx.rep = \"repne\" end\n    local l = b%2; b = (b-l)/2\n    if l ~= 0 then ctx.vexl = true end\n    ctx.vexv = (-1-b)%16\n    return dispatchmap(ctx, map)\n  end,\n\n  -- Special case for nop with REX prefix.\n  nop = function(ctx, name, pat)\n    return dispatch(ctx, ctx.rex and pat or \"nop\")\n  end,\n\n  -- Special case for 0F 77.\n  emms = function(ctx, name, pat)\n    if ctx.rex ~= \"vex\" then\n      return putop(ctx, \"emms\")\n    elseif ctx.vexl then\n      ctx.vexl = false\n      return putop(ctx, \"zeroall\")\n    else\n      return putop(ctx, \"zeroupper\")\n    end\n  end,\n}\n\n------------------------------------------------------------------------------\n\n-- Disassemble a block of code.\nlocal function disass_block(ctx, ofs, len)\n  if not ofs then ofs = 0 end\n  local stop = len and ofs+len or #ctx.code\n  ofs = ofs + 1\n  ctx.start = ofs\n  ctx.pos = ofs\n  ctx.stop = stop\n  ctx.imm = nil\n  ctx.mrm = false\n  clearprefixes(ctx)\n  while ctx.pos <= stop do dispatchmap(ctx, ctx.map1) end\n  if ctx.pos ~= ctx.start then incomplete(ctx) end\nend\n\n-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).\nlocal function create(code, addr, out)\n  local ctx = {}\n  ctx.code = code\n  ctx.addr = (addr or 0) - 1\n  ctx.out = out or io.write\n  ctx.symtab = {}\n  ctx.disass = disass_block\n  ctx.hexdump = 16\n  ctx.x64 = false\n  ctx.map1 = map_opc1_32\n  ctx.aregs = map_regs.D\n  return ctx\nend\n\nlocal function create64(code, addr, out)\n  local ctx = create(code, addr, out)\n  ctx.x64 = true\n  ctx.map1 = map_opc1_64\n  ctx.aregs = map_regs.Q\n  return ctx\nend\n\n-- Simple API: disassemble code (a string) at address and output via out.\nlocal function disass(code, addr, out)\n  create(code, addr, out):disass()\nend\n\nlocal function disass64(code, addr, out)\n  create64(code, addr, out):disass()\nend\n\n-- Return register name for RID.\nlocal function regname(r)\n  if r < 8 then return map_regs.D[r+1] end\n  return map_regs.X[r-7]\nend\n\nlocal function regname64(r)\n  if r < 16 then return map_regs.Q[r+1] end\n  return map_regs.X[r-15]\nend\n\n-- Public module functions.\nreturn {\n  create = create,\n  create64 = create64,\n  disass = disass,\n  disass64 = disass64,\n  regname = regname,\n  regname64 = regname64\n}\n\n"
  },
  {
    "path": "Luajit64/jit/dump.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT compiler dump module.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module can be used to debug the JIT compiler itself. It dumps the\n-- code representations and structures used in various compiler stages.\n--\n-- Example usage:\n--\n--   luajit -jdump -e \"local x=0; for i=1,1e6 do x=x+i end; print(x)\"\n--   luajit -jdump=im -e \"for i=1,1000 do for j=1,1000 do end end\" | less -R\n--   luajit -jdump=is myapp.lua | less -R\n--   luajit -jdump=-b myapp.lua\n--   luajit -jdump=+aH,myapp.html myapp.lua\n--   luajit -jdump=ixT,myapp.dump myapp.lua\n--\n-- The first argument specifies the dump mode. The second argument gives\n-- the output file name. Default output is to stdout, unless the environment\n-- variable LUAJIT_DUMPFILE is set. The file is overwritten every time the\n-- module is started.\n--\n-- Different features can be turned on or off with the dump mode. If the\n-- mode starts with a '+', the following features are added to the default\n-- set of features; a '-' removes them. Otherwise the features are replaced.\n--\n-- The following dump features are available (* marks the default):\n--\n--  * t  Print a line for each started, ended or aborted trace (see also -jv).\n--  * b  Dump the traced bytecode.\n--  * i  Dump the IR (intermediate representation).\n--    r  Augment the IR with register/stack slots.\n--    s  Dump the snapshot map.\n--  * m  Dump the generated machine code.\n--    x  Print each taken trace exit.\n--    X  Print each taken trace exit and the contents of all registers.\n--    a  Print the IR of aborted traces, too.\n--\n-- The output format can be set with the following characters:\n--\n--    T  Plain text output.\n--    A  ANSI-colored text output\n--    H  Colorized HTML + CSS output.\n--\n-- The default output format is plain text. It's set to ANSI-colored text\n-- if the COLORTERM variable is set. Note: this is independent of any output\n-- redirection, which is actually considered a feature.\n--\n-- You probably want to use less -R to enjoy viewing ANSI-colored text from\n-- a pipe or a file. Add this to your ~/.bashrc: export LESS=\"-R\"\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal funcinfo, funcbc = jutil.funcinfo, jutil.funcbc\nlocal traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek\nlocal tracemc, tracesnap = jutil.tracemc, jutil.tracesnap\nlocal traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr\nlocal bit = require(\"bit\")\nlocal band, shr, tohex = bit.band, bit.rshift, bit.tohex\nlocal sub, gsub, format = string.sub, string.gsub, string.format\nlocal byte, rep = string.byte, string.rep\nlocal type, tostring = type, tostring\nlocal stdout, stderr = io.stdout, io.stderr\n\n-- Load other modules on-demand.\nlocal bcline, disass\n\n-- Active flag, output file handle and dump mode.\nlocal active, out, dumpmode\n\n------------------------------------------------------------------------------\n\nlocal symtabmt = { __index = false }\nlocal symtab = {}\nlocal nexitsym = 0\n\n-- Fill nested symbol table with per-trace exit stub addresses.\nlocal function fillsymtab_tr(tr, nexit)\n  local t = {}\n  symtabmt.__index = t\n  if jit.arch:sub(1, 4) == \"mips\" then\n    t[traceexitstub(tr, 0)] = \"exit\"\n    return\n  end\n  for i=0,nexit-1 do\n    local addr = traceexitstub(tr, i)\n    if addr < 0 then addr = addr + 2^32 end\n    t[addr] = tostring(i)\n  end\n  local addr = traceexitstub(tr, nexit)\n  if addr then t[addr] = \"stack_check\" end\nend\n\n-- Fill symbol table with trace exit stub addresses.\nlocal function fillsymtab(tr, nexit)\n  local t = symtab\n  if nexitsym == 0 then\n    local ircall = vmdef.ircall\n    for i=0,#ircall do\n      local addr = ircalladdr(i)\n      if addr ~= 0 then\n\tif addr < 0 then addr = addr + 2^32 end\n\tt[addr] = ircall[i]\n      end\n    end\n  end\n  if nexitsym == 1000000 then -- Per-trace exit stubs.\n    fillsymtab_tr(tr, nexit)\n  elseif nexit > nexitsym then -- Shared exit stubs.\n    for i=nexitsym,nexit-1 do\n      local addr = traceexitstub(i)\n      if addr == nil then -- Fall back to per-trace exit stubs.\n\tfillsymtab_tr(tr, nexit)\n\tsetmetatable(symtab, symtabmt)\n\tnexit = 1000000\n\tbreak\n      end\n      if addr < 0 then addr = addr + 2^32 end\n      t[addr] = tostring(i)\n    end\n    nexitsym = nexit\n  end\n  return t\nend\n\nlocal function dumpwrite(s)\n  out:write(s)\nend\n\n-- Disassemble machine code.\nlocal function dump_mcode(tr)\n  local info = traceinfo(tr)\n  if not info then return end\n  local mcode, addr, loop = tracemc(tr)\n  if not mcode then return end\n  if not disass then disass = require(\"jit.dis_\"..jit.arch) end\n  if addr < 0 then addr = addr + 2^32 end\n  out:write(\"---- TRACE \", tr, \" mcode \", #mcode, \"\\n\")\n  local ctx = disass.create(mcode, addr, dumpwrite)\n  ctx.hexdump = 0\n  ctx.symtab = fillsymtab(tr, info.nexit)\n  if loop ~= 0 then\n    symtab[addr+loop] = \"LOOP\"\n    ctx:disass(0, loop)\n    out:write(\"->LOOP:\\n\")\n    ctx:disass(loop, #mcode-loop)\n    symtab[addr+loop] = nil\n  else\n    ctx:disass(0, #mcode)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal irtype_text = {\n  [0] = \"nil\",\n  \"fal\",\n  \"tru\",\n  \"lud\",\n  \"str\",\n  \"p32\",\n  \"thr\",\n  \"pro\",\n  \"fun\",\n  \"p64\",\n  \"cdt\",\n  \"tab\",\n  \"udt\",\n  \"flt\",\n  \"num\",\n  \"i8 \",\n  \"u8 \",\n  \"i16\",\n  \"u16\",\n  \"int\",\n  \"u32\",\n  \"i64\",\n  \"u64\",\n  \"sfp\",\n}\n\nlocal colortype_ansi = {\n  [0] = \"%s\",\n  \"%s\",\n  \"%s\",\n  \"\\027[36m%s\\027[m\",\n  \"\\027[32m%s\\027[m\",\n  \"%s\",\n  \"\\027[1m%s\\027[m\",\n  \"%s\",\n  \"\\027[1m%s\\027[m\",\n  \"%s\",\n  \"\\027[33m%s\\027[m\",\n  \"\\027[31m%s\\027[m\",\n  \"\\027[36m%s\\027[m\",\n  \"\\027[34m%s\\027[m\",\n  \"\\027[34m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n  \"\\027[35m%s\\027[m\",\n}\n\nlocal function colorize_text(s)\n  return s\nend\n\nlocal function colorize_ansi(s, t)\n  return format(colortype_ansi[t], s)\nend\n\nlocal irtype_ansi = setmetatable({},\n  { __index = function(tab, t)\n      local s = colorize_ansi(irtype_text[t], t); tab[t] = s; return s; end })\n\nlocal html_escape = { [\"<\"] = \"&lt;\", [\">\"] = \"&gt;\", [\"&\"] = \"&amp;\", }\n\nlocal function colorize_html(s, t)\n  s = gsub(s, \"[<>&]\", html_escape)\n  return format('<span class=\"irt_%s\">%s</span>', irtype_text[t], s)\nend\n\nlocal irtype_html = setmetatable({},\n  { __index = function(tab, t)\n      local s = colorize_html(irtype_text[t], t); tab[t] = s; return s; end })\n\nlocal header_html = [[\n<style type=\"text/css\">\nbackground { background: #ffffff; color: #000000; }\npre.ljdump {\nfont-size: 10pt;\nbackground: #f0f4ff;\ncolor: #000000;\nborder: 1px solid #bfcfff;\npadding: 0.5em;\nmargin-left: 2em;\nmargin-right: 2em;\n}\nspan.irt_str { color: #00a000; }\nspan.irt_thr, span.irt_fun { color: #404040; font-weight: bold; }\nspan.irt_tab { color: #c00000; }\nspan.irt_udt, span.irt_lud { color: #00c0c0; }\nspan.irt_num { color: #4040c0; }\nspan.irt_int, span.irt_i8, span.irt_u8, span.irt_i16, span.irt_u16 { color: #b040b0; }\n</style>\n]]\n\nlocal colorize, irtype\n\n-- Lookup tables to convert some literals into names.\nlocal litname = {\n  [\"SLOAD \"] = setmetatable({}, { __index = function(t, mode)\n    local s = \"\"\n    if band(mode, 1) ~= 0 then s = s..\"P\" end\n    if band(mode, 2) ~= 0 then s = s..\"F\" end\n    if band(mode, 4) ~= 0 then s = s..\"T\" end\n    if band(mode, 8) ~= 0 then s = s..\"C\" end\n    if band(mode, 16) ~= 0 then s = s..\"R\" end\n    if band(mode, 32) ~= 0 then s = s..\"I\" end\n    t[mode] = s\n    return s\n  end}),\n  [\"XLOAD \"] = { [0] = \"\", \"R\", \"V\", \"RV\", \"U\", \"RU\", \"VU\", \"RVU\", },\n  [\"CONV  \"] = setmetatable({}, { __index = function(t, mode)\n    local s = irtype[band(mode, 31)]\n    s = irtype[band(shr(mode, 5), 31)]..\".\"..s\n    if band(mode, 0x800) ~= 0 then s = s..\" sext\" end\n    local c = shr(mode, 14)\n    if c == 2 then s = s..\" index\" elseif c == 3 then s = s..\" check\" end\n    t[mode] = s\n    return s\n  end}),\n  [\"FLOAD \"] = vmdef.irfield,\n  [\"FREF  \"] = vmdef.irfield,\n  [\"FPMATH\"] = vmdef.irfpm,\n  [\"BUFHDR\"] = { [0] = \"RESET\", \"APPEND\" },\n  [\"TOSTR \"] = { [0] = \"INT\", \"NUM\", \"CHAR\" },\n}\n\nlocal function ctlsub(c)\n  if c == \"\\n\" then return \"\\\\n\"\n  elseif c == \"\\r\" then return \"\\\\r\"\n  elseif c == \"\\t\" then return \"\\\\t\"\n  else return format(\"\\\\%03d\", byte(c))\n  end\nend\n\nlocal function fmtfunc(func, pc)\n  local fi = funcinfo(func, pc)\n  if fi.loc then\n    return fi.loc\n  elseif fi.ffid then\n    return vmdef.ffnames[fi.ffid]\n  elseif fi.addr then\n    return format(\"C:%x\", fi.addr)\n  else\n    return \"(?)\"\n  end\nend\n\nlocal function formatk(tr, idx, sn)\n  local k, t, slot = tracek(tr, idx)\n  local tn = type(k)\n  local s\n  if tn == \"number\" then\n    if band(sn or 0, 0x30000) ~= 0 then\n      s = band(sn, 0x20000) ~= 0 and \"contpc\" or \"ftsz\"\n    elseif k == 2^52+2^51 then\n      s = \"bias\"\n    else\n      s = format(0 < k and k < 0x1p-1026 and \"%+a\" or \"%+.14g\", k)\n    end\n  elseif tn == \"string\" then\n    s = format(#k > 20 and '\"%.20s\"~' or '\"%s\"', gsub(k, \"%c\", ctlsub))\n  elseif tn == \"function\" then\n    s = fmtfunc(k)\n  elseif tn == \"table\" then\n    s = format(\"{%p}\", k)\n  elseif tn == \"userdata\" then\n    if t == 12 then\n      s = format(\"userdata:%p\", k)\n    else\n      s = format(\"[%p]\", k)\n      if s == \"[NULL]\" then s = \"NULL\" end\n    end\n  elseif t == 21 then -- int64_t\n    s = sub(tostring(k), 1, -3)\n    if sub(s, 1, 1) ~= \"-\" then s = \"+\"..s end\n  elseif sn == 0x1057fff then -- SNAP(1, SNAP_FRAME | SNAP_NORESTORE, REF_NIL)\n    return \"----\" -- Special case for LJ_FR2 slot 1.\n  else\n    s = tostring(k) -- For primitives.\n  end\n  s = colorize(format(\"%-4s\", s), t)\n  if slot then\n    s = format(\"%s @%d\", s, slot)\n  end\n  return s\nend\n\nlocal function printsnap(tr, snap)\n  local n = 2\n  for s=0,snap[1]-1 do\n    local sn = snap[n]\n    if shr(sn, 24) == s then\n      n = n + 1\n      local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS\n      if ref < 0 then\n\tout:write(formatk(tr, ref, sn))\n      elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM\n\tout:write(colorize(format(\"%04d/%04d\", ref, ref+1), 14))\n      else\n\tlocal m, ot, op1, op2 = traceir(tr, ref)\n\tout:write(colorize(format(\"%04d\", ref), band(ot, 31)))\n      end\n      out:write(band(sn, 0x10000) == 0 and \" \" or \"|\") -- SNAP_FRAME\n    else\n      out:write(\"---- \")\n    end\n  end\n  out:write(\"]\\n\")\nend\n\n-- Dump snapshots (not interleaved with IR).\nlocal function dump_snap(tr)\n  out:write(\"---- TRACE \", tr, \" snapshots\\n\")\n  for i=0,1000000000 do\n    local snap = tracesnap(tr, i)\n    if not snap then break end\n    out:write(format(\"#%-3d %04d [ \", i, snap[0]))\n    printsnap(tr, snap)\n  end\nend\n\n-- Return a register name or stack slot for a rid/sp location.\nlocal function ridsp_name(ridsp, ins)\n  if not disass then disass = require(\"jit.dis_\"..jit.arch) end\n  local rid, slot = band(ridsp, 0xff), shr(ridsp, 8)\n  if rid == 253 or rid == 254 then\n    return (slot == 0 or slot == 255) and \" {sink\" or format(\" {%04d\", ins-slot)\n  end\n  if ridsp > 255 then return format(\"[%x]\", slot*4) end\n  if rid < 128 then return disass.regname(rid) end\n  return \"\"\nend\n\n-- Dump CALL* function ref and return optional ctype.\nlocal function dumpcallfunc(tr, ins)\n  local ctype\n  if ins > 0 then\n    local m, ot, op1, op2 = traceir(tr, ins)\n    if band(ot, 31) == 0 then -- nil type means CARG(func, ctype).\n      ins = op1\n      ctype = formatk(tr, op2)\n    end\n  end\n  if ins < 0 then\n    out:write(format(\"[0x%x](\", tonumber((tracek(tr, ins)))))\n  else\n    out:write(format(\"%04d (\", ins))\n  end\n  return ctype\nend\n\n-- Recursively gather CALL* args and dump them.\nlocal function dumpcallargs(tr, ins)\n  if ins < 0 then\n    out:write(formatk(tr, ins))\n  else\n    local m, ot, op1, op2 = traceir(tr, ins)\n    local oidx = 6*shr(ot, 8)\n    local op = sub(vmdef.irnames, oidx+1, oidx+6)\n    if op == \"CARG  \" then\n      dumpcallargs(tr, op1)\n      if op2 < 0 then\n\tout:write(\" \", formatk(tr, op2))\n      else\n\tout:write(\" \", format(\"%04d\", op2))\n      end\n    else\n      out:write(format(\"%04d\", ins))\n    end\n  end\nend\n\n-- Dump IR and interleaved snapshots.\nlocal function dump_ir(tr, dumpsnap, dumpreg)\n  local info = traceinfo(tr)\n  if not info then return end\n  local nins = info.nins\n  out:write(\"---- TRACE \", tr, \" IR\\n\")\n  local irnames = vmdef.irnames\n  local snapref = 65536\n  local snap, snapno\n  if dumpsnap then\n    snap = tracesnap(tr, 0)\n    snapref = snap[0]\n    snapno = 0\n  end\n  for ins=1,nins do\n    if ins >= snapref then\n      if dumpreg then\n\tout:write(format(\"....              SNAP   #%-3d [ \", snapno))\n      else\n\tout:write(format(\"....        SNAP   #%-3d [ \", snapno))\n      end\n      printsnap(tr, snap)\n      snapno = snapno + 1\n      snap = tracesnap(tr, snapno)\n      snapref = snap and snap[0] or 65536\n    end\n    local m, ot, op1, op2, ridsp = traceir(tr, ins)\n    local oidx, t = 6*shr(ot, 8), band(ot, 31)\n    local op = sub(irnames, oidx+1, oidx+6)\n    if op == \"LOOP  \" then\n      if dumpreg then\n\tout:write(format(\"%04d ------------ LOOP ------------\\n\", ins))\n      else\n\tout:write(format(\"%04d ------ LOOP ------------\\n\", ins))\n      end\n    elseif op ~= \"NOP   \" and op ~= \"CARG  \" and\n\t   (dumpreg or op ~= \"RENAME\") then\n      local rid = band(ridsp, 255)\n      if dumpreg then\n\tout:write(format(\"%04d %-6s\", ins, ridsp_name(ridsp, ins)))\n      else\n\tout:write(format(\"%04d \", ins))\n      end\n      out:write(format(\"%s%s %s %s \",\n\t\t       (rid == 254 or rid == 253) and \"}\" or\n\t\t       (band(ot, 128) == 0 and \" \" or \">\"),\n\t\t       band(ot, 64) == 0 and \" \" or \"+\",\n\t\t       irtype[t], op))\n      local m1, m2 = band(m, 3), band(m, 3*4)\n      if sub(op, 1, 4) == \"CALL\" then\n\tlocal ctype\n\tif m2 == 1*4 then -- op2 == IRMlit\n\t  out:write(format(\"%-10s  (\", vmdef.ircall[op2]))\n\telse\n\t  ctype = dumpcallfunc(tr, op2)\n\tend\n\tif op1 ~= -1 then dumpcallargs(tr, op1) end\n\tout:write(\")\")\n\tif ctype then out:write(\" ctype \", ctype) end\n      elseif op == \"CNEW  \" and op2 == -1 then\n\tout:write(formatk(tr, op1))\n      elseif m1 ~= 3 then -- op1 != IRMnone\n\tif op1 < 0 then\n\t  out:write(formatk(tr, op1))\n\telse\n\t  out:write(format(m1 == 0 and \"%04d\" or \"#%-3d\", op1))\n\tend\n\tif m2 ~= 3*4 then -- op2 != IRMnone\n\t  if m2 == 1*4 then -- op2 == IRMlit\n\t    local litn = litname[op]\n\t    if litn and litn[op2] then\n\t      out:write(\"  \", litn[op2])\n\t    elseif op == \"UREFO \" or op == \"UREFC \" then\n\t      out:write(format(\"  #%-3d\", shr(op2, 8)))\n\t    else\n\t      out:write(format(\"  #%-3d\", op2))\n\t    end\n\t  elseif op2 < 0 then\n\t    out:write(\"  \", formatk(tr, op2))\n\t  else\n\t    out:write(format(\"  %04d\", op2))\n\t  end\n\tend\n      end\n      out:write(\"\\n\")\n    end\n  end\n  if snap then\n    if dumpreg then\n      out:write(format(\"....              SNAP   #%-3d [ \", snapno))\n    else\n      out:write(format(\"....        SNAP   #%-3d [ \", snapno))\n    end\n    printsnap(tr, snap)\n  end\nend\n\n------------------------------------------------------------------------------\n\nlocal recprefix = \"\"\nlocal recdepth = 0\n\n-- Format trace error message.\nlocal function fmterr(err, info)\n  if type(err) == \"number\" then\n    if type(info) == \"function\" then info = fmtfunc(info) end\n    err = format(vmdef.traceerr[err], info)\n  end\n  return err\nend\n\n-- Dump trace states.\nlocal function dump_trace(what, tr, func, pc, otr, oex)\n  if what == \"stop\" or (what == \"abort\" and dumpmode.a) then\n    if dumpmode.i then dump_ir(tr, dumpmode.s, dumpmode.r and what == \"stop\")\n    elseif dumpmode.s then dump_snap(tr) end\n    if dumpmode.m then dump_mcode(tr) end\n  end\n  if what == \"start\" then\n    if dumpmode.H then out:write('<pre class=\"ljdump\">\\n') end\n    out:write(\"---- TRACE \", tr, \" \", what)\n    if otr then out:write(\" \", otr, \"/\", oex == -1 and \"stitch\" or oex) end\n    out:write(\" \", fmtfunc(func, pc), \"\\n\")\n  elseif what == \"stop\" or what == \"abort\" then\n    out:write(\"---- TRACE \", tr, \" \", what)\n    if what == \"abort\" then\n      out:write(\" \", fmtfunc(func, pc), \" -- \", fmterr(otr, oex), \"\\n\")\n    else\n      local info = traceinfo(tr)\n      local link, ltype = info.link, info.linktype\n      if link == tr or link == 0 then\n\tout:write(\" -> \", ltype, \"\\n\")\n      elseif ltype == \"root\" then\n\tout:write(\" -> \", link, \"\\n\")\n      else\n\tout:write(\" -> \", link, \" \", ltype, \"\\n\")\n      end\n    end\n    if dumpmode.H then out:write(\"</pre>\\n\\n\") else out:write(\"\\n\") end\n  else\n    if what == \"flush\" then symtab, nexitsym = {}, 0 end\n    out:write(\"---- TRACE \", what, \"\\n\\n\")\n  end\n  out:flush()\nend\n\n-- Dump recorded bytecode.\nlocal function dump_record(tr, func, pc, depth, callee)\n  if depth ~= recdepth then\n    recdepth = depth\n    recprefix = rep(\" .\", depth)\n  end\n  local line\n  if pc >= 0 then\n    line = bcline(func, pc, recprefix)\n    if dumpmode.H then line = gsub(line, \"[<>&]\", html_escape) end\n    if pc > 0 then\n      line = sub(line, 1, -2) .. \"       (\" .. fmtfunc(func, pc) .. \")\\n\"\n    end\n  else\n    line = \"0000 \"..recprefix..\" FUNCC      \\n\"\n    callee = func\n  end\n  if pc <= 0 then\n    out:write(sub(line, 1, -2), \"         ; \", fmtfunc(func), \"\\n\")\n  else\n    out:write(line)\n  end\n  if pc >= 0 and band(funcbc(func, pc), 0xff) < 16 then -- ORDER BC\n    out:write(bcline(func, pc+1, recprefix)) -- Write JMP for cond.\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Dump taken trace exits.\nlocal function dump_texit(tr, ex, ngpr, nfpr, ...)\n  out:write(\"---- TRACE \", tr, \" exit \", ex, \"\\n\")\n  if dumpmode.X then\n    local regs = {...}\n    if jit.arch == \"x64\" then\n      for i=1,ngpr do\n\tout:write(format(\" %016x\", regs[i]))\n\tif i % 4 == 0 then out:write(\"\\n\") end\n      end\n    else\n      for i=1,ngpr do\n\tout:write(\" \", tohex(regs[i]))\n\tif i % 8 == 0 then out:write(\"\\n\") end\n      end\n    end\n    if jit.arch == \"mips\" or jit.arch == \"mipsel\" then\n      for i=1,nfpr,2 do\n\tout:write(format(\" %+17.14g\", regs[ngpr+i]))\n\tif i % 8 == 7 then out:write(\"\\n\") end\n      end\n    else\n      for i=1,nfpr do\n\tout:write(format(\" %+17.14g\", regs[ngpr+i]))\n\tif i % 4 == 0 then out:write(\"\\n\") end\n      end\n    end\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Detach dump handlers.\nlocal function dumpoff()\n  if active then\n    active = false\n    jit.attach(dump_texit)\n    jit.attach(dump_record)\n    jit.attach(dump_trace)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach dump handlers.\nlocal function dumpon(opt, outfile)\n  if active then dumpoff() end\n\n  local term = os.getenv(\"TERM\")\n  local colormode = (term and term:match(\"color\") or os.getenv(\"COLORTERM\")) and \"A\" or \"T\"\n  if opt then\n    opt = gsub(opt, \"[TAH]\", function(mode) colormode = mode; return \"\"; end)\n  end\n\n  local m = { t=true, b=true, i=true, m=true, }\n  if opt and opt ~= \"\" then\n    local o = sub(opt, 1, 1)\n    if o ~= \"+\" and o ~= \"-\" then m = {} end\n    for i=1,#opt do m[sub(opt, i, i)] = (o ~= \"-\") end\n  end\n  dumpmode = m\n\n  if m.t or m.b or m.i or m.s or m.m then\n    jit.attach(dump_trace, \"trace\")\n  end\n  if m.b then\n    jit.attach(dump_record, \"record\")\n    if not bcline then bcline = require(\"jit.bc\").line end\n  end\n  if m.x or m.X then\n    jit.attach(dump_texit, \"texit\")\n  end\n\n  if not outfile then outfile = os.getenv(\"LUAJIT_DUMPFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stdout\n  end\n\n  m[colormode] = true\n  if colormode == \"A\" then\n    colorize = colorize_ansi\n    irtype = irtype_ansi\n  elseif colormode == \"H\" then\n    colorize = colorize_html\n    irtype = irtype_html\n    out:write(header_html)\n  else\n    colorize = colorize_text\n    irtype = irtype_text\n  end\n\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  on = dumpon,\n  off = dumpoff,\n  start = dumpon -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Luajit64/jit/p.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT profiler.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module is a simple command line interface to the built-in\n-- low-overhead profiler of LuaJIT.\n--\n-- The lower-level API of the profiler is accessible via the \"jit.profile\"\n-- module or the luaJIT_profile_* C API.\n--\n-- Example usage:\n--\n--   luajit -jp myapp.lua\n--   luajit -jp=s myapp.lua\n--   luajit -jp=-s myapp.lua\n--   luajit -jp=vl myapp.lua\n--   luajit -jp=G,profile.txt myapp.lua\n--\n-- The following dump features are available:\n--\n--   f  Stack dump: function name, otherwise module:line. Default mode.\n--   F  Stack dump: ditto, but always prepend module.\n--   l  Stack dump: module:line.\n--   <number> stack dump depth (callee < caller). Default: 1.\n--   -<number> Inverse stack dump depth (caller > callee).\n--   s  Split stack dump after first stack level. Implies abs(depth) >= 2.\n--   p  Show full path for module names.\n--   v  Show VM states. Can be combined with stack dumps, e.g. vf or fv.\n--   z  Show zones. Can be combined with stack dumps, e.g. zf or fz.\n--   r  Show raw sample counts. Default: show percentages.\n--   a  Annotate excerpts from source code files.\n--   A  Annotate complete source code files.\n--   G  Produce raw output suitable for graphical tools (e.g. flame graphs).\n--   m<number> Minimum sample percentage to be shown. Default: 3.\n--   i<number> Sampling interval in milliseconds. Default: 10.\n--\n----------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal profile = require(\"jit.profile\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal math = math\nlocal pairs, ipairs, tonumber, floor = pairs, ipairs, tonumber, math.floor\nlocal sort, format = table.sort, string.format\nlocal stdout = io.stdout\nlocal zone -- Load jit.zone module on demand.\n\n-- Output file handle.\nlocal out\n\n------------------------------------------------------------------------------\n\nlocal prof_ud\nlocal prof_states, prof_split, prof_min, prof_raw, prof_fmt, prof_depth\nlocal prof_ann, prof_count1, prof_count2, prof_samples\n\nlocal map_vmmode = {\n  N = \"Compiled\",\n  I = \"Interpreted\",\n  C = \"C code\",\n  G = \"Garbage Collector\",\n  J = \"JIT Compiler\",\n}\n\n-- Profiler callback.\nlocal function prof_cb(th, samples, vmmode)\n  prof_samples = prof_samples + samples\n  local key_stack, key_stack2, key_state\n  -- Collect keys for sample.\n  if prof_states then\n    if prof_states == \"v\" then\n      key_state = map_vmmode[vmmode] or vmmode\n    else\n      key_state = zone:get() or \"(none)\"\n    end\n  end\n  if prof_fmt then\n    key_stack = profile.dumpstack(th, prof_fmt, prof_depth)\n    key_stack = key_stack:gsub(\"%[builtin#(%d+)%]\", function(x)\n      return vmdef.ffnames[tonumber(x)]\n    end)\n    if prof_split == 2 then\n      local k1, k2 = key_stack:match(\"(.-) [<>] (.*)\")\n      if k2 then key_stack, key_stack2 = k1, k2 end\n    elseif prof_split == 3 then\n      key_stack2 = profile.dumpstack(th, \"l\", 1)\n    end\n  end\n  -- Order keys.\n  local k1, k2\n  if prof_split == 1 then\n    if key_state then\n      k1 = key_state\n      if key_stack then k2 = key_stack end\n    end\n  elseif key_stack then\n    k1 = key_stack\n    if key_stack2 then k2 = key_stack2 elseif key_state then k2 = key_state end\n  end\n  -- Coalesce samples in one or two levels.\n  if k1 then\n    local t1 = prof_count1\n    t1[k1] = (t1[k1] or 0) + samples\n    if k2 then\n      local t2 = prof_count2\n      local t3 = t2[k1]\n      if not t3 then t3 = {}; t2[k1] = t3 end\n      t3[k2] = (t3[k2] or 0) + samples\n    end\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Show top N list.\nlocal function prof_top(count1, count2, samples, indent)\n  local t, n = {}, 0\n  for k in pairs(count1) do\n    n = n + 1\n    t[n] = k\n  end\n  sort(t, function(a, b) return count1[a] > count1[b] end)\n  for i=1,n do\n    local k = t[i]\n    local v = count1[k]\n    local pct = floor(v*100/samples + 0.5)\n    if pct < prof_min then break end\n    if not prof_raw then\n      out:write(format(\"%s%2d%%  %s\\n\", indent, pct, k))\n    elseif prof_raw == \"r\" then\n      out:write(format(\"%s%5d  %s\\n\", indent, v, k))\n    else\n      out:write(format(\"%s %d\\n\", k, v))\n    end\n    if count2 then\n      local r = count2[k]\n      if r then\n\tprof_top(r, nil, v, (prof_split == 3 or prof_split == 1) and \"  -- \" or\n\t\t\t    (prof_depth < 0 and \"  -> \" or \"  <- \"))\n      end\n    end\n  end\nend\n\n-- Annotate source code\nlocal function prof_annotate(count1, samples)\n  local files = {}\n  local ms = 0\n  for k, v in pairs(count1) do\n    local pct = floor(v*100/samples + 0.5)\n    ms = math.max(ms, v)\n    if pct >= prof_min then\n      local file, line = k:match(\"^(.*):(%d+)$\")\n      if not file then file = k; line = 0 end\n      local fl = files[file]\n      if not fl then fl = {}; files[file] = fl; files[#files+1] = file end\n      line = tonumber(line)\n      fl[line] = prof_raw and v or pct\n    end\n  end\n  sort(files)\n  local fmtv, fmtn = \" %3d%% | %s\\n\", \"      | %s\\n\"\n  if prof_raw then\n    local n = math.max(5, math.ceil(math.log10(ms)))\n    fmtv = \"%\"..n..\"d | %s\\n\"\n    fmtn = (\" \"):rep(n)..\" | %s\\n\"\n  end\n  local ann = prof_ann\n  for _, file in ipairs(files) do\n    local f0 = file:byte()\n    if f0 == 40 or f0 == 91 then\n      out:write(format(\"\\n====== %s ======\\n[Cannot annotate non-file]\\n\", file))\n      break\n    end\n    local fp, err = io.open(file)\n    if not fp then\n      out:write(format(\"====== ERROR: %s: %s\\n\", file, err))\n      break\n    end\n    out:write(format(\"\\n====== %s ======\\n\", file))\n    local fl = files[file]\n    local n, show = 1, false\n    if ann ~= 0 then\n      for i=1,ann do\n\tif fl[i] then show = true; out:write(\"@@ 1 @@\\n\"); break end\n      end\n    end\n    for line in fp:lines() do\n      if line:byte() == 27 then\n\tout:write(\"[Cannot annotate bytecode file]\\n\")\n\tbreak\n      end\n      local v = fl[n]\n      if ann ~= 0 then\n\tlocal v2 = fl[n+ann]\n\tif show then\n\t  if v2 then show = n+ann elseif v then show = n\n\t  elseif show+ann < n then show = false end\n\telseif v2 then\n\t  show = n+ann\n\t  out:write(format(\"@@ %d @@\\n\", n))\n\tend\n\tif not show then goto next end\n      end\n      if v then\n\tout:write(format(fmtv, v, line))\n      else\n\tout:write(format(fmtn, line))\n      end\n    ::next::\n      n = n + 1\n    end\n    fp:close()\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Finish profiling and dump result.\nlocal function prof_finish()\n  if prof_ud then\n    profile.stop()\n    local samples = prof_samples\n    if samples == 0 then\n      if prof_raw ~= true then out:write(\"[No samples collected]\\n\") end\n      return\n    end\n    if prof_ann then\n      prof_annotate(prof_count1, samples)\n    else\n      prof_top(prof_count1, prof_count2, samples, \"\")\n    end\n    prof_count1 = nil\n    prof_count2 = nil\n    prof_ud = nil\n  end\nend\n\n-- Start profiling.\nlocal function prof_start(mode)\n  local interval = \"\"\n  mode = mode:gsub(\"i%d*\", function(s) interval = s; return \"\" end)\n  prof_min = 3\n  mode = mode:gsub(\"m(%d+)\", function(s) prof_min = tonumber(s); return \"\" end)\n  prof_depth = 1\n  mode = mode:gsub(\"%-?%d+\", function(s) prof_depth = tonumber(s); return \"\" end)\n  local m = {}\n  for c in mode:gmatch(\".\") do m[c] = c end\n  prof_states = m.z or m.v\n  if prof_states == \"z\" then zone = require(\"jit.zone\") end\n  local scope = m.l or m.f or m.F or (prof_states and \"\" or \"f\")\n  local flags = (m.p or \"\")\n  prof_raw = m.r\n  if m.s then\n    prof_split = 2\n    if prof_depth == -1 or m[\"-\"] then prof_depth = -2\n    elseif prof_depth == 1 then prof_depth = 2 end\n  elseif mode:find(\"[fF].*l\") then\n    scope = \"l\"\n    prof_split = 3\n  else\n    prof_split = (scope == \"\" or mode:find(\"[zv].*[lfF]\")) and 1 or 0\n  end\n  prof_ann = m.A and 0 or (m.a and 3)\n  if prof_ann then\n    scope = \"l\"\n    prof_fmt = \"pl\"\n    prof_split = 0\n    prof_depth = 1\n  elseif m.G and scope ~= \"\" then\n    prof_fmt = flags..scope..\"Z;\"\n    prof_depth = -100\n    prof_raw = true\n    prof_min = 0\n  elseif scope == \"\" then\n    prof_fmt = false\n  else\n    local sc = prof_split == 3 and m.f or m.F or scope\n    prof_fmt = flags..sc..(prof_depth >= 0 and \"Z < \" or \"Z > \")\n  end\n  prof_count1 = {}\n  prof_count2 = {}\n  prof_samples = 0\n  profile.start(scope:lower()..interval, prof_cb)\n  prof_ud = newproxy(true)\n  getmetatable(prof_ud).__gc = prof_finish\nend\n\n------------------------------------------------------------------------------\n\nlocal function start(mode, outfile)\n  if not outfile then outfile = os.getenv(\"LUAJIT_PROFILEFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stdout\n  end\n  prof_start(mode or \"f\")\nend\n\n-- Public module functions.\nreturn {\n  start = start, -- For -j command line option.\n  stop = prof_finish\n}\n\n"
  },
  {
    "path": "Luajit64/jit/v.lua",
    "content": "----------------------------------------------------------------------------\n-- Verbose mode of the LuaJIT compiler.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module shows verbose information about the progress of the\n-- JIT compiler. It prints one line for each generated trace. This module\n-- is useful to see which code has been compiled or where the compiler\n-- punts and falls back to the interpreter.\n--\n-- Example usage:\n--\n--   luajit -jv -e \"for i=1,1000 do for j=1,1000 do end end\"\n--   luajit -jv=myapp.out myapp.lua\n--\n-- Default output is to stderr. To redirect the output to a file, pass a\n-- filename as an argument (use '-' for stdout) or set the environment\n-- variable LUAJIT_VERBOSEFILE. The file is overwritten every time the\n-- module is started.\n--\n-- The output from the first example should look like this:\n--\n-- [TRACE   1 (command line):1 loop]\n-- [TRACE   2 (1/3) (command line):1 -> 1]\n--\n-- The first number in each line is the internal trace number. Next are\n-- the file name ('(command line)') and the line number (':1') where the\n-- trace has started. Side traces also show the parent trace number and\n-- the exit number where they are attached to in parentheses ('(1/3)').\n-- An arrow at the end shows where the trace links to ('-> 1'), unless\n-- it loops to itself.\n--\n-- In this case the inner loop gets hot and is traced first, generating\n-- a root trace. Then the last exit from the 1st trace gets hot, too,\n-- and triggers generation of the 2nd trace. The side trace follows the\n-- path along the outer loop and *around* the inner loop, back to its\n-- start, and then links to the 1st trace. Yes, this may seem unusual,\n-- if you know how traditional compilers work. Trace compilers are full\n-- of surprises like this -- have fun! :-)\n--\n-- Aborted traces are shown like this:\n--\n-- [TRACE --- foo.lua:44 -- leaving loop in root trace at foo:lua:50]\n--\n-- Don't worry -- trace aborts are quite common, even in programs which\n-- can be fully compiled. The compiler may retry several times until it\n-- finds a suitable trace.\n--\n-- Of course this doesn't work with features that are not-yet-implemented\n-- (NYI error messages). The VM simply falls back to the interpreter. This\n-- may not matter at all if the particular trace is not very high up in\n-- the CPU usage profile. Oh, and the interpreter is quite fast, too.\n--\n-- Also check out the -jdump module, which prints all the gory details.\n--\n------------------------------------------------------------------------------\n\n-- Cache some library functions and objects.\nlocal jit = require(\"jit\")\nassert(jit.version_num == 20100, \"LuaJIT core/library version mismatch\")\nlocal jutil = require(\"jit.util\")\nlocal vmdef = require(\"jit.vmdef\")\nlocal funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo\nlocal type, format = type, string.format\nlocal stdout, stderr = io.stdout, io.stderr\n\n-- Active flag and output file handle.\nlocal active, out\n\n------------------------------------------------------------------------------\n\nlocal startloc, startex\n\nlocal function fmtfunc(func, pc)\n  local fi = funcinfo(func, pc)\n  if fi.loc then\n    return fi.loc\n  elseif fi.ffid then\n    return vmdef.ffnames[fi.ffid]\n  elseif fi.addr then\n    return format(\"C:%x\", fi.addr)\n  else\n    return \"(?)\"\n  end\nend\n\n-- Format trace error message.\nlocal function fmterr(err, info)\n  if type(err) == \"number\" then\n    if type(info) == \"function\" then info = fmtfunc(info) end\n    err = format(vmdef.traceerr[err], info)\n  end\n  return err\nend\n\n-- Dump trace states.\nlocal function dump_trace(what, tr, func, pc, otr, oex)\n  if what == \"start\" then\n    startloc = fmtfunc(func, pc)\n    startex = otr and \"(\"..otr..\"/\"..(oex == -1 and \"stitch\" or oex)..\") \" or \"\"\n  else\n    if what == \"abort\" then\n      local loc = fmtfunc(func, pc)\n      if loc ~= startloc then\n\tout:write(format(\"[TRACE --- %s%s -- %s at %s]\\n\",\n\t  startex, startloc, fmterr(otr, oex), loc))\n      else\n\tout:write(format(\"[TRACE --- %s%s -- %s]\\n\",\n\t  startex, startloc, fmterr(otr, oex)))\n      end\n    elseif what == \"stop\" then\n      local info = traceinfo(tr)\n      local link, ltype = info.link, info.linktype\n      if ltype == \"interpreter\" then\n\tout:write(format(\"[TRACE %3s %s%s -- fallback to interpreter]\\n\",\n\t  tr, startex, startloc))\n      elseif ltype == \"stitch\" then\n\tout:write(format(\"[TRACE %3s %s%s %s %s]\\n\",\n\t  tr, startex, startloc, ltype, fmtfunc(func, pc)))\n      elseif link == tr or link == 0 then\n\tout:write(format(\"[TRACE %3s %s%s %s]\\n\",\n\t  tr, startex, startloc, ltype))\n      elseif ltype == \"root\" then\n\tout:write(format(\"[TRACE %3s %s%s -> %d]\\n\",\n\t  tr, startex, startloc, link))\n      else\n\tout:write(format(\"[TRACE %3s %s%s -> %d %s]\\n\",\n\t  tr, startex, startloc, link, ltype))\n      end\n    else\n      out:write(format(\"[TRACE %s]\\n\", what))\n    end\n    out:flush()\n  end\nend\n\n------------------------------------------------------------------------------\n\n-- Detach dump handlers.\nlocal function dumpoff()\n  if active then\n    active = false\n    jit.attach(dump_trace)\n    if out and out ~= stdout and out ~= stderr then out:close() end\n    out = nil\n  end\nend\n\n-- Open the output file and attach dump handlers.\nlocal function dumpon(outfile)\n  if active then dumpoff() end\n  if not outfile then outfile = os.getenv(\"LUAJIT_VERBOSEFILE\") end\n  if outfile then\n    out = outfile == \"-\" and stdout or assert(io.open(outfile, \"w\"))\n  else\n    out = stderr\n  end\n  jit.attach(dump_trace, \"trace\")\n  active = true\nend\n\n-- Public module functions.\nreturn {\n  on = dumpon,\n  off = dumpoff,\n  start = dumpon -- For -j command line option.\n}\n\n"
  },
  {
    "path": "Luajit64/jit/vmdef.lua",
    "content": "-- This is a generated file. DO NOT EDIT!\n\nreturn {\n\nbcnames = \"ISLT  ISGE  ISLE  ISGT  ISEQV ISNEV ISEQS ISNES ISEQN ISNEN ISEQP ISNEP ISTC  ISFC  IST   ISF   ISTYPEISNUM MOV   NOT   UNM   LEN   ADDVN SUBVN MULVN DIVVN MODVN ADDNV SUBNV MULNV DIVNV MODNV ADDVV SUBVV MULVV DIVVV MODVV POW   CAT   KSTR  KCDATAKSHORTKNUM  KPRI  KNIL  UGET  USETV USETS USETN USETP UCLO  FNEW  TNEW  TDUP  GGET  GSET  TGETV TGETS TGETB TGETR TSETV TSETS TSETB TSETM TSETR CALLM CALL  CALLMTCALLT ITERC ITERN VARG  ISNEXTRETM  RET   RET0  RET1  FORI  JFORI FORL  IFORL JFORL ITERL IITERLJITERLLOOP  ILOOP JLOOP JMP   FUNCF IFUNCFJFUNCFFUNCV IFUNCVJFUNCVFUNCC FUNCCW\",\n\nirnames = \"LT    GE    LE    GT    ULT   UGE   ULE   UGT   EQ    NE    ABC   RETF  NOP   BASE  PVAL  GCSTEPHIOP  LOOP  USE   PHI   RENAMEPROF  KPRI  KINT  KGC   KPTR  KKPTR KNULL KNUM  KINT64KSLOT BNOT  BSWAP BAND  BOR   BXOR  BSHL  BSHR  BSAR  BROL  BROR  ADD   SUB   MUL   DIV   MOD   POW   NEG   ABS   ATAN2 LDEXP MIN   MAX   FPMATHADDOV SUBOV MULOV AREF  HREFK HREF  NEWREFUREFO UREFC FREF  STRREFLREF  ALOAD HLOAD ULOAD FLOAD XLOAD SLOAD VLOAD ASTOREHSTOREUSTOREFSTOREXSTORESNEW  XSNEW TNEW  TDUP  CNEW  CNEWI BUFHDRBUFPUTBUFSTRTBAR  OBAR  XBAR  CONV  TOBIT TOSTR STRTO CALLN CALLA CALLL CALLS CALLXSCARG  \",\n\nirfpm = { [0]=\"floor\", \"ceil\", \"trunc\", \"sqrt\", \"exp\", \"exp2\", \"log\", \"log2\", \"log10\", \"sin\", \"cos\", \"tan\", \"other\", },\n\nirfield = { [0]=\"str.len\", \"func.env\", \"func.pc\", \"func.ffid\", \"thread.env\", \"thread.exdata\", \"tab.meta\", \"tab.array\", \"tab.node\", \"tab.asize\", \"tab.hmask\", \"tab.nomm\", \"udata.meta\", \"udata.udtype\", \"udata.file\", \"cdata.ctypeid\", \"cdata.ptr\", \"cdata.int\", \"cdata.int64\", \"cdata.int64_4\", },\n\nircall = {\n[0]=\"lj_str_cmp\",\n\"lj_str_find\",\n\"lj_str_new\",\n\"lj_strscan_num\",\n\"lj_strfmt_int\",\n\"lj_strfmt_num\",\n\"lj_strfmt_char\",\n\"lj_strfmt_putint\",\n\"lj_strfmt_putnum\",\n\"lj_strfmt_putquoted\",\n\"lj_strfmt_putfxint\",\n\"lj_strfmt_putfnum_int\",\n\"lj_strfmt_putfnum_uint\",\n\"lj_strfmt_putfnum\",\n\"lj_strfmt_putfstr\",\n\"lj_strfmt_putfchar\",\n\"lj_buf_putmem\",\n\"lj_buf_putstr\",\n\"lj_buf_putchar\",\n\"lj_buf_putstr_reverse\",\n\"lj_buf_putstr_lower\",\n\"lj_buf_putstr_upper\",\n\"lj_buf_putstr_rep\",\n\"lj_buf_puttab\",\n\"lj_buf_tostr\",\n\"lj_tab_new_ah\",\n\"lj_tab_new1\",\n\"lj_tab_dup\",\n\"lj_tab_clear\",\n\"lj_tab_newkey\",\n\"lj_tab_len\",\n\"lj_tab_clone\",\n\"lj_tab_isarray\",\n\"lj_tab_nkeys\",\n\"lj_tab_isempty\",\n\"lj_gc_step_jit\",\n\"lj_gc_barrieruv\",\n\"lj_mem_newgco\",\n\"lj_math_random_step\",\n\"lj_vm_modi\",\n\"sinh\",\n\"cosh\",\n\"tanh\",\n\"fputc\",\n\"fwrite\",\n\"fflush\",\n\"lj_vm_floor\",\n\"lj_vm_ceil\",\n\"lj_vm_trunc\",\n\"sqrt\",\n\"exp\",\n\"lj_vm_exp2\",\n\"log\",\n\"lj_vm_log2\",\n\"log10\",\n\"sin\",\n\"cos\",\n\"tan\",\n\"lj_vm_powi\",\n\"pow\",\n\"atan2\",\n\"ldexp\",\n\"lj_vm_tobit\",\n\"softfp_add\",\n\"softfp_sub\",\n\"softfp_mul\",\n\"softfp_div\",\n\"softfp_cmp\",\n\"softfp_i2d\",\n\"softfp_d2i\",\n\"lj_vm_sfmin\",\n\"lj_vm_sfmax\",\n\"lj_vm_tointg\",\n\"softfp_ui2d\",\n\"softfp_f2d\",\n\"softfp_d2ui\",\n\"softfp_d2f\",\n\"softfp_i2f\",\n\"softfp_ui2f\",\n\"softfp_f2i\",\n\"softfp_f2ui\",\n\"fp64_l2d\",\n\"fp64_ul2d\",\n\"fp64_l2f\",\n\"fp64_ul2f\",\n\"fp64_d2l\",\n\"fp64_d2ul\",\n\"fp64_f2l\",\n\"fp64_f2ul\",\n\"lj_carith_divi64\",\n\"lj_carith_divu64\",\n\"lj_carith_modi64\",\n\"lj_carith_modu64\",\n\"lj_carith_powi64\",\n\"lj_carith_powu64\",\n\"lj_cdata_newv\",\n\"lj_cdata_setfin\",\n\"strlen\",\n\"memcpy\",\n\"memset\",\n\"lj_vm_errno\",\n\"lj_carith_mul64\",\n\"lj_carith_shl64\",\n\"lj_carith_shr64\",\n\"lj_carith_sar64\",\n\"lj_carith_rol64\",\n\"lj_carith_ror64\",\n},\n\ntraceerr = {\n[0]=\"error thrown or hook called during recording\",\n\"trace too short\",\n\"trace too long\",\n\"trace too deep\",\n\"too many snapshots\",\n\"blacklisted\",\n\"retry recording\",\n\"NYI: bytecode %d\",\n\"leaving loop in root trace\",\n\"inner loop in root trace\",\n\"loop unroll limit reached\",\n\"bad argument type\",\n\"JIT compilation disabled for function\",\n\"call unroll limit reached\",\n\"down-recursion, restarting\",\n\"NYI: unsupported variant of FastFunc %s\",\n\"NYI: return to lower frame\",\n\"store with nil or NaN key\",\n\"missing metamethod\",\n\"looping index lookup\",\n\"NYI: mixed sparse/dense table\",\n\"symbol not in cache\",\n\"NYI: unsupported C type conversion\",\n\"NYI: unsupported C function type\",\n\"guard would always fail\",\n\"too many PHIs\",\n\"persistent type instability\",\n\"failed to allocate mcode memory\",\n\"machine code too long\",\n\"hit mcode limit (retrying)\",\n\"too many spill slots\",\n\"inconsistent register allocation\",\n\"NYI: cannot assemble IR instruction %d\",\n\"NYI: PHI shuffling too complex\",\n\"NYI: register coalescing too complex\",\n},\n\nffnames = {\n[0]=\"Lua\",\n\"C\",\n\"assert\",\n\"type\",\n\"next\",\n\"pairs\",\n\"ipairs_aux\",\n\"ipairs\",\n\"getmetatable\",\n\"setmetatable\",\n\"getfenv\",\n\"setfenv\",\n\"rawget\",\n\"rawset\",\n\"rawequal\",\n\"unpack\",\n\"select\",\n\"tonumber\",\n\"tostring\",\n\"error\",\n\"pcall\",\n\"xpcall\",\n\"loadfile\",\n\"load\",\n\"loadstring\",\n\"dofile\",\n\"gcinfo\",\n\"collectgarbage\",\n\"newproxy\",\n\"print\",\n\"coroutine.status\",\n\"coroutine.running\",\n\"coroutine.isyieldable\",\n\"coroutine.create\",\n\"coroutine.yield\",\n\"coroutine.resume\",\n\"coroutine.wrap_aux\",\n\"coroutine.wrap\",\n\"thread.exdata\",\n\"math.abs\",\n\"math.floor\",\n\"math.ceil\",\n\"math.sqrt\",\n\"math.log10\",\n\"math.exp\",\n\"math.sin\",\n\"math.cos\",\n\"math.tan\",\n\"math.asin\",\n\"math.acos\",\n\"math.atan\",\n\"math.sinh\",\n\"math.cosh\",\n\"math.tanh\",\n\"math.frexp\",\n\"math.modf\",\n\"math.log\",\n\"math.atan2\",\n\"math.pow\",\n\"math.fmod\",\n\"math.ldexp\",\n\"math.min\",\n\"math.max\",\n\"math.random\",\n\"math.randomseed\",\n\"bit.tobit\",\n\"bit.bnot\",\n\"bit.bswap\",\n\"bit.lshift\",\n\"bit.rshift\",\n\"bit.arshift\",\n\"bit.rol\",\n\"bit.ror\",\n\"bit.band\",\n\"bit.bor\",\n\"bit.bxor\",\n\"bit.tohex\",\n\"string.byte\",\n\"string.char\",\n\"string.sub\",\n\"string.rep\",\n\"string.reverse\",\n\"string.lower\",\n\"string.upper\",\n\"string.dump\",\n\"string.find\",\n\"string.match\",\n\"string.gmatch_aux\",\n\"string.gmatch\",\n\"string.gsub\",\n\"string.format\",\n\"table.maxn\",\n\"table.insert\",\n\"table.concat\",\n\"table.clone\",\n\"table.isarray\",\n\"table.nkeys\",\n\"table.isempty\",\n\"table.sort\",\n\"table.new\",\n\"table.clear\",\n\"io.method.close\",\n\"io.method.read\",\n\"io.method.write\",\n\"io.method.flush\",\n\"io.method.seek\",\n\"io.method.setvbuf\",\n\"io.method.lines\",\n\"io.method.__gc\",\n\"io.method.__tostring\",\n\"io.open\",\n\"io.popen\",\n\"io.tmpfile\",\n\"io.close\",\n\"io.read\",\n\"io.write\",\n\"io.flush\",\n\"io.input\",\n\"io.output\",\n\"io.lines\",\n\"io.type\",\n\"os.execute\",\n\"os.remove\",\n\"os.rename\",\n\"os.tmpname\",\n\"os.getenv\",\n\"os.exit\",\n\"os.clock\",\n\"os.date\",\n\"os.time\",\n\"os.difftime\",\n\"os.setlocale\",\n\"debug.getregistry\",\n\"debug.getmetatable\",\n\"debug.setmetatable\",\n\"debug.getfenv\",\n\"debug.setfenv\",\n\"debug.getinfo\",\n\"debug.getlocal\",\n\"debug.setlocal\",\n\"debug.getupvalue\",\n\"debug.setupvalue\",\n\"debug.upvalueid\",\n\"debug.upvaluejoin\",\n\"debug.sethook\",\n\"debug.gethook\",\n\"debug.debug\",\n\"debug.traceback\",\n\"jit.on\",\n\"jit.off\",\n\"jit.flush\",\n\"jit.status\",\n\"jit.attach\",\n\"jit.prngstate\",\n\"jit.util.funcinfo\",\n\"jit.util.funcbc\",\n\"jit.util.funck\",\n\"jit.util.funcuvname\",\n\"jit.util.traceinfo\",\n\"jit.util.traceir\",\n\"jit.util.tracek\",\n\"jit.util.tracesnap\",\n\"jit.util.tracemc\",\n\"jit.util.traceexitstub\",\n\"jit.util.ircalladdr\",\n\"jit.opt.start\",\n\"jit.profile.start\",\n\"jit.profile.stop\",\n\"jit.profile.dumpstack\",\n\"ffi.meta.__index\",\n\"ffi.meta.__newindex\",\n\"ffi.meta.__eq\",\n\"ffi.meta.__len\",\n\"ffi.meta.__lt\",\n\"ffi.meta.__le\",\n\"ffi.meta.__concat\",\n\"ffi.meta.__call\",\n\"ffi.meta.__add\",\n\"ffi.meta.__sub\",\n\"ffi.meta.__mul\",\n\"ffi.meta.__div\",\n\"ffi.meta.__mod\",\n\"ffi.meta.__pow\",\n\"ffi.meta.__unm\",\n\"ffi.meta.__tostring\",\n\"ffi.meta.__pairs\",\n\"ffi.meta.__ipairs\",\n\"ffi.clib.__index\",\n\"ffi.clib.__newindex\",\n\"ffi.clib.__gc\",\n\"ffi.callback.free\",\n\"ffi.callback.set\",\n\"ffi.cdef\",\n\"ffi.new\",\n\"ffi.cast\",\n\"ffi.typeof\",\n\"ffi.typeinfo\",\n\"ffi.istype\",\n\"ffi.sizeof\",\n\"ffi.alignof\",\n\"ffi.offsetof\",\n\"ffi.errno\",\n\"ffi.string\",\n\"ffi.copy\",\n\"ffi.fill\",\n\"ffi.abi\",\n\"ffi.metatype\",\n\"ffi.gc\",\n\"ffi.load\",\n},\n\n}\n\n"
  },
  {
    "path": "Luajit64/jit/zone.lua",
    "content": "----------------------------------------------------------------------------\n-- LuaJIT profiler zones.\n--\n-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.\n-- Released under the MIT license. See Copyright Notice in luajit.h\n----------------------------------------------------------------------------\n--\n-- This module implements a simple hierarchical zone model.\n--\n-- Example usage:\n--\n--   local zone = require(\"jit.zone\")\n--   zone(\"AI\")\n--   ...\n--     zone(\"A*\")\n--     ...\n--     print(zone:get()) --> \"A*\"\n--     ...\n--     zone()\n--   ...\n--   print(zone:get()) --> \"AI\"\n--   ...\n--   zone()\n--\n----------------------------------------------------------------------------\n\nlocal remove = table.remove\n\nreturn setmetatable({\n  flush = function(t)\n    for i=#t,1,-1 do t[i] = nil end\n  end,\n  get = function(t)\n    return t[#t]\n  end\n}, {\n  __call = function(t, zone)\n    if zone then\n      t[#t+1] = zone\n    else\n      return (assert(remove(t), \"empty zone stack\"))\n    end\n  end\n})\n\n"
  },
  {
    "path": "README-tolua.md",
    "content": "## tolua#\n\ntolua# is a Unity lua static binder solution. the first solution that analyzes code by reflection and generates wrapper classes.<br>\nIt is a Unity plugin that greatly simplifies the integration of C# code with Lua. which can automatically generate the binding code to access Unity from Lua and map c# constants, variables, functions, properties, classes, and enums to Lua.<br>\ntolua# grows up from cstolua. it's goal is to be a powerful development environment for Unity.<br>\nSupport unity4.6.x and Unity5.x all(copy /Unity5.x/Assets to /Assets) <br>\nIf you want to test examples(example 1 is excluded)in mobile, first click menu Lua/Copy lua files to Resources. then build it <br>\n如果你想在手机上测试例子(例子1除外)，首先点击菜单Lua/Copy lua files to Resources， 之后再build. <br>\n\n欢迎大家点星支持，谢谢^_^<br>\n有bug 可以到QQ群286510803反馈。 可以加讨论群: <br>\nulua&tolua技术交流群① 341746602(已满) <br>\nulua&tolua技术讨论群② 469941220(已满)  <br>\ntolua#技术讨论群④ 543826216(已满)<br>\ntolua#技术群 286510803<br>\n\n\n# Library\n**tolua_runtime** <br>\nhttps://github.com/topameng/tolua_runtime <br>\n**Debugger** <br>\nhttps://github.com/topameng/Debugger <br>\n**CString** <br>\nhttps://github.com/topameng/CString <br>\n**protoc-gen-lua** <br>\nhttps://github.com/topameng/protoc-gen-lua <br>\n\n# FrameWork and Demo\n**LuaFrameWork**<br>\nhttps://github.com/jarjin/LuaFramework_NGUI <br>\nhttps://github.com/jarjin/LuaFramework_UGUI <br>\n**XlsxToLua**<br>\nhttps://github.com/zhangqi-ulua/XlsxToLua<br>\n**UnityHello**<br>\nhttps://github.com/woshihuo12/UnityHello<br>\n**UWA-ToLua**<br>\nhttp://uwa-download.oss-cn-beijing.aliyuncs.com/plugins%2FiOS%2FUWA-iOS-ToLua.zip<br>\n\n# Debugger\n**EmmyLua**<br>\nhttps://github.com/tangzx/IntelliJ-EmmyLua<br>\n**unity_tolua-_zerobrane_api**<br>\nhttps://github.com/LabOfHoward/unity_tolua-_zerobrane_api<br>\n\n# Packages\n　**Basics**　　　　　　　　**Math**　　　　　　**Data Structures**<br>\n　luabitop　　　　　　　Quaternion　　　　　　　list<br>\n　 struct　　　　　　　 　Vector3　　　　　　　　event<br>\n　 int64　　　　 　　　  　Vector4　　　　　　　　slot<br>\n　 Time　　　　 　　　  　Vector2<br>\n**Networking**　　　　 　　　Ray<br>\n　luasocket　　　　 　　　 Color<br>\n　**Parsing**　　　　 　　　Bounds<br>\n　lpeg　　 　　 　　　 　  　Mathf<br>\n　**Protol**　　　　　 　 　　 Touch<br>\n　pblua　　　 　　 　 　RaycastHit<br>\n# 特性\n* 自动生成绑定代码文件，非反射调用 <br>\n* 大量内建基础类型支持，如枚举，委托，事件，Type, 数组，迭代器等 <br>\n* 支持多种协同形式 <br>\n* 支持所有unity内部类导出，支持委托类型导出 <br>\n* 支持导出自定义，跳过某个空的基类，修改导出名称等 <br>\n* 支持扩展函数自定义导出, 比如DoTween <br>\n* 支持值类型Nullable导出，包括Nullable&lt;Vector3&gt;等 <br>\n* 支持Lua中function转委托，可以区分需要不同委托的参数的重载函数 <br>\n* 支持c# LuaFunction对象转委托，简化调用方式。 支持无GC的多参数调用形式 <br>\n* 支持重载函数自动折叠, 如:Convert.ToUInt32只导出double参数的函数 <br>\n* 支持重载函数自动排序, 如:参数个数相同, object参数执行级最低, 不会出现错误匹配情况 <br>\n* 支持导出函数重命名, 可以分离导出某个重载函数(可以导出被折叠掉的函数) <br>\n* 支持使用编辑器类改写导出规则 <br>\n* 支持this数组访问，索引为int可以通过[]访问，其他可使用.get_Item或者.this:get()访问数组成员 <br>\n* 支持委托(事件)+-lua function。支持通过函数接口的Add和Remove委托操作 <br>\n* 支持静态反射操作, 形式同c# <br>\n* 支持peer表，可在lua端扩展导出的userdata <br>\n* 支持自定义struct压入和读取，做到无GC，并且结构成员无类型限制, 参考例子24 <br>\n* 支持preloading, 可以通过requie后绑定wrap文件 <br>\n* 支持int64, uint64  <br>\n* 大量的lua数学类型，如Quaternion, Vector3, Mathf等\n* 包含第三方lua扩展，包括luasocket, struct, lpeg, utf8, pb等库 <br>\n* 当lua出现异常，能够同时捕获c#端和lua端堆栈，便于调试 <br>\n* print信息，在编辑器点击日志, 能自动打开对应lua文件 <br>\n* 支持unity所有版本 <br>\n* **支持Lua hook C#相代码实现，一定程度上支持利用Lua代码修改C#端代码的bug**（[暖更新使用说明](https://zhuanlan.zhihu.com/p/35124260)） <br>\n\n# 快速入门\n在CustomSetting.cs中添加需要导出的类或者委托，类加入到customTypeList列表，委托加入到customDelegateList列表 <br>\n通过设置saveDir变量更改导出目录,默认生成在Assets/Source/Generate/下,点击菜单Lua->Generate All,生成绑定文件 <br>\n在LuaConst.cs中配置开发lua文件目录luaDir以及tolua lua文件目录toluaDir <br>\n```csharp\n//例子1\nLuaState lua = new LuaState();\nlua.Start();\nlua.DoString(\"print('hello world')\");\nlua.Dispose();\n\n//例子2\nLuaState luaState = null;\n\nvoid Awake()\n{\n    luaState = LuaClient.GetMainState();\n\n    try\n    {            \n        luaState.Call(\"UIShop.Awake\", false);\n    }\n    catch (Exception e)\n    {\n        //Awake中必须这样特殊处理异常\n        luaState.ThrowLuaException(e);\n    }\n}\n\nvoid Start()\n{\n    luaState.Call(\"UIShop.Start\", false);\n}\n```\n```lua\nlocal go = GameObject('go')\ngo:AddComponent(typeof(UnityEngine.ParticleSystem))\ngo.transform.position = Vector3.zero\ngo.transform:Rotate(Vector3(0,90,0), UnityEngine.Space.World)\ngo.transform:Rotate(Vector3(0, 1, 0), 0)\n\n--DoTween 需要在CustomSetting导出前定义USING_DOTWEENING宏，或者取消相关注释\ngo.transform:DORotate(Vector3(0,0,360), 2, DG.Tweening.RotateMode.FastBeyond360)\n\nShop = {}\n\nfunction Shop:Awake()\n    self.OnUpdate = UpdateBeat:CreateListener(Shop.Update, self)\n    UpdateBeat:AddListener(self.OnUpdate)\nend\n\nfunction Shop:OnDestroy()\n    UpdateBeat:RemoveListener(self.OnUpdate)\nend\n\nfunction Shop:OnClick()\n    print(\"OnClick\")\nend\n\nfunction Shop:OnToggle()\n    print(\"OnToggle\")\nend\n\nfunction Shop:Update()\nend\n\n--委托\nlocal listener = UIEventListener.Get(go)\nlistener.onClick = function() print(\"OnClick\") end\nlistener.onClick = nil\nlistener.onClick = UIEventListener.VoidDelegate(Shop.OnClick, Shop)\nlistener.onClick = listener.onClick + UIEventListener.VoidDelegate(Shop.OnClick, Shop)\nlistener.onClick = listener.onClick - UIEventListener.VoidDelegate(Shop.OnClick, Shop)\n\nlocal toggle = go:GetComponent(typeof(UIToggle))\nEventDelegate.Add(toggle.onChange, EventDelegate.Callback(Shop.OnToggle, Shop))\nEventDelegate.Remove(toggle.onChange, EventDelegate.Callback(Shop.OnToggle, Shop))\n\n--事件\nlocal Client = {}\n\nfunction Client:Log(str)\nend\n\nApplication.logMessageReceived = Application.logMessageReceived + Application.LogCallback(Clent.Log, Client)\nApplication.logMessageReceived = Application.logMessageReceived - Application.LogCallback(Clent.Log, Client)\n\n--out参数\nlocal _layer = 2 ^ LayerMask.NameToLayer('Default')\nlocal flag, hit = UnityEngine.Physics.Raycast(ray, nil, 5000, _layer)\n\nif flag then\n    print('pick from lua, point: '..tostring(hit.point))\nend\n```\n[这里](Assets/ToLua/Examples/README.md)是更多的示例。\n# 关于反射\ntolua# 不支持动态反射。动态反射对于重载函数有参数匹配问题，函数排序问题，ref,out 参数问题等等。<br>\ntolua#提供的替换方法是:<br>\n1. preloading, 把你未来可能需要的类型添加到导出列表customTypeList，同时也添加到dynamicList列表中，这样导出后该类型并不会随binder注册到lua中，你可以通过 require \"namespace.classname\" 动态注册到lua中，对于非枚举类型tolua#系统也可以在第一次push该类型时动态载入，当然也可在过场动画、资源下载、登录、场景加载或者某个的函数中require这个类型。<br>\n2. 静态反射，参考例子22。通过静态反射支持精确的函数参数匹配和类型检查。不会存在重载函数参数混乱匹配错误问题, 注意iOS必须配置好link.xml<br>\n\n# Performance\n|   平台    |   属性读写   | 重载函数  | Vector3构造 |GameObject构造|Vector3归一化|Slerp|\n| :-- \t\t| :-----------:|:---------:| :---------: |:-----------: |:----------: |:--: |\n| PC  \t\t|  0.0465:0.15 | 0.076:0.12|0.02:0.001   |0.1:0.14\t\t|0.014:0.001  |0.10:0.11|\n| Android   |   0.16:1.1  | 0.28:0.76 |0.17:0.00035   |0.43:0.5\t\t|0.21:0.02\t  |0.3:0.06|\n| iOS       |  0.04:0.145  | 0.055:0.11 |0.017:0.05   |0.074:0.08\t|0.035:0.11\t  |0.078:0.5|\n\n测试结果为C#:Lua. 环境不同会略有差异。可用数字倍率做参考<br>\nPC: Intel(R) Core(TM) i5-4590 CPU@3.3GHz + 8GB + 64 位win7 + Unity5.4.5p4<br>\nAndroid: 中兴nubia z9 max(NX512J) + Adnroid5.0.2<br>\niOS(il2cpp): IPhone6 Plus<br>\n按照1.0.7.355版本更新了测试数据, u5相对u4, 安卓上c#有了不小的提升<br>\n# Examples\n参考包内1-24例子\n\n# About Lua\nwin, android ios using luajit2.1-beta3. macos using luac5.1.5(for u5.x). \n注意iOS未编译模拟器库，请用真机测试\n"
  },
  {
    "path": "README.md",
    "content": "# CSharpLuaForUnity\nCSharpLuaForUnity尝试使用[CSharp.lua](https://github.com/yanghuan/CSharp.lua)将Unity工程中的C#脚本编译至Lua,以使其可用C#进行高效的开发,但是也能用Lua完成热更新,也已经开始在部分新项目中被采用。\n\n## 依赖说明\n* 使用[tolua](https://github.com/topameng/tolua)版本作为Lua支持环境\n* 使用[LuaFramework_UGUI_V2](https://github.com/jarjin/LuaFramework_UGUI_V2)编译的动态链接tolua库(集成了pbc)\n* 使用[CSharp.lua](https://github.com/yanghuan/CSharp.lua)来将C#代码转换至Lua\n\n\n## 如何使用\n* 在Unity编辑器环境下，会新增菜单项'CSharpLua',子菜单'Compile'可将工程目录[Compiled](https://github.com/yanghuan/CSharpLuaForUnity/tree/master/Assets/CSharpLua/Compiled)下的C#代码编译成Lua代码放置到Assets/Lua/Compiled目录，子菜单'Switch to XXX'可在运行C#代码还是编译后的Lua代码中切换。**设想的是实际开发中一直使用C#代码开发和调试，需要真机发布时，才编译到Lua代码**。\n* [Examples](https://github.com/yanghuan/CSharpLuaForUnity/tree/master/Assets/CSharpLua/Examples)目录下有一个简易的列子,可直接运行。可以看出能够支持在预设中挂载自定义的C#脚本，在运行Lua代码时，预设会被动态适配处理，具体实现可见代码。因而在打包时也需要对存在挂载了自定义C#脚本的的预设做相同的处理。\n\n## 项目结构\n使用了[assembly definition files](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html)额外定义了一些程序集工程，依赖顺序如下。\n\nAssembly-CSharp.dll --------> Compiled.dll --------> Bridge.dll --------> Base.dll\n\n* Compiled 此工程中的代码可编译至Lua，需要热更新的代码放到这个工程中\n* Bridge 可被Compiled引用的代码，需要Wrap到Lua的环境中\n* Base 可被Bridge引用的代码，但是不需要被Compiled所引用到\n\n## 交流讨论\n- [Issues](https://github.com/yanghuan/CSharpLuaForUnity/issues)\n- 邮箱：sy.yanghuan@gmail.com\n- QQ群: 715350749\n\n## 致谢\n* https://github.com/topameng/tolua\n* https://github.com/jarjin/LuaFramework_UGUI_V2\n\n## 相关工程\n* DCET 在ET框架的基础上集成了CSharp.lua和**xlua**  \n  https://github.com/DukeChiang/DCET\n* 也是在ET框架的基础上集成了CSharp.lua和**xlua**  \n  https://github.com/zzjfengqing/ETCsharpToXLua \n* 集成了tolua、LuaFramework_UGUI_V2和CSharp.lua  \n  https://gitee.com/googleapp/LuaFramework_UGUI_V2\n* ILRuntime C#实现的IL运行环境   \n  https://github.com/Ourpalm/ILRuntime\n\n"
  },
  {
    "path": "Tools/CSharpLua/CSharp.lua/CSharp.lua.Launcher.deps.json",
    "content": "{\n  \"runtimeTarget\": {\n    \"name\": \".NETCoreApp,Version=v5.0\",\n    \"signature\": \"\"\n  },\n  \"compilationOptions\": {},\n  \"targets\": {\n    \".NETCoreApp,Version=v5.0\": {\n      \"CSharp.lua.Launcher/1.0.0\": {\n        \"dependencies\": {\n          \"CSharp.lua\": \"1.1.0\"\n        },\n        \"runtime\": {\n          \"CSharp.lua.Launcher.dll\": {}\n        }\n      },\n      \"Microsoft.CodeAnalysis.Analyzers/3.0.0\": {},\n      \"Microsoft.CodeAnalysis.Common/3.7.0\": {\n        \"dependencies\": {\n          \"Microsoft.CodeAnalysis.Analyzers\": \"3.0.0\",\n          \"System.Collections.Immutable\": \"1.5.0\",\n          \"System.Memory\": \"4.5.4\",\n          \"System.Reflection.Metadata\": \"1.6.0\",\n          \"System.Runtime.CompilerServices.Unsafe\": \"4.7.0\",\n          \"System.Text.Encoding.CodePages\": \"4.5.1\",\n          \"System.Threading.Tasks.Extensions\": \"4.5.3\"\n        },\n        \"runtime\": {\n          \"lib/netcoreapp3.1/Microsoft.CodeAnalysis.dll\": {\n            \"assemblyVersion\": \"3.7.0.0\",\n            \"fileVersion\": \"3.700.20.37502\"\n          }\n        },\n        \"resources\": {\n          \"lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"cs\"\n          },\n          \"lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"de\"\n          },\n          \"lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"es\"\n          },\n          \"lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"fr\"\n          },\n          \"lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"it\"\n          },\n          \"lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"ja\"\n          },\n          \"lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"ko\"\n          },\n          \"lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"pl\"\n          },\n          \"lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"pt-BR\"\n          },\n          \"lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"ru\"\n          },\n          \"lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"tr\"\n          },\n          \"lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"zh-Hans\"\n          },\n          \"lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.resources.dll\": {\n            \"locale\": \"zh-Hant\"\n          }\n        }\n      },\n      \"Microsoft.CodeAnalysis.CSharp/3.7.0\": {\n        \"dependencies\": {\n          \"Microsoft.CodeAnalysis.Common\": \"3.7.0\"\n        },\n        \"runtime\": {\n          \"lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.dll\": {\n            \"assemblyVersion\": \"3.7.0.0\",\n            \"fileVersion\": \"3.700.20.37502\"\n          }\n        },\n        \"resources\": {\n          \"lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"cs\"\n          },\n          \"lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"de\"\n          },\n          \"lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"es\"\n          },\n          \"lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"fr\"\n          },\n          \"lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"it\"\n          },\n          \"lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"ja\"\n          },\n          \"lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"ko\"\n          },\n          \"lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"pl\"\n          },\n          \"lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"pt-BR\"\n          },\n          \"lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"ru\"\n          },\n          \"lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"tr\"\n          },\n          \"lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"zh-Hans\"\n          },\n          \"lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll\": {\n            \"locale\": \"zh-Hant\"\n          }\n        }\n      },\n      \"Microsoft.NETCore.Platforms/2.1.2\": {},\n      \"System.Collections.Immutable/1.5.0\": {},\n      \"System.Memory/4.5.4\": {},\n      \"System.Reflection.Metadata/1.6.0\": {},\n      \"System.Runtime.CompilerServices.Unsafe/4.7.0\": {},\n      \"System.Text.Encoding.CodePages/4.5.1\": {\n        \"dependencies\": {\n          \"Microsoft.NETCore.Platforms\": \"2.1.2\",\n          \"System.Runtime.CompilerServices.Unsafe\": \"4.7.0\"\n        }\n      },\n      \"System.Threading.Tasks.Extensions/4.5.3\": {},\n      \"CSharp.lua/1.1.0\": {\n        \"dependencies\": {\n          \"Microsoft.CodeAnalysis.CSharp\": \"3.7.0\"\n        },\n        \"runtime\": {\n          \"CSharp.lua.dll\": {}\n        }\n      }\n    }\n  },\n  \"libraries\": {\n    \"CSharp.lua.Launcher/1.0.0\": {\n      \"type\": \"project\",\n      \"serviceable\": false,\n      \"sha512\": \"\"\n    },\n    \"Microsoft.CodeAnalysis.Analyzers/3.0.0\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-ojG5pGAhTPmjxRGTNvuszO3H8XPZqksDwr9xLd4Ae/JBjZZdl6GuoLk7uLMf+o7yl5wO0TAqoWcEKkEWqrZE5g==\",\n      \"path\": \"microsoft.codeanalysis.analyzers/3.0.0\",\n      \"hashPath\": \"microsoft.codeanalysis.analyzers.3.0.0.nupkg.sha512\"\n    },\n    \"Microsoft.CodeAnalysis.Common/3.7.0\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-SFEdnbw8204hTlde3JePYSIpNX58h/MMXa7LctUsUDigWMR8Ar9gE8LnsLqAIFM0O33JEuQbJ0G4Sat+cPGldw==\",\n      \"path\": \"microsoft.codeanalysis.common/3.7.0\",\n      \"hashPath\": \"microsoft.codeanalysis.common.3.7.0.nupkg.sha512\"\n    },\n    \"Microsoft.CodeAnalysis.CSharp/3.7.0\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-sKi5PIVy9nVDerkbplY6OQhJBNzEO4XJsMGrnmb6KFEa6K1ulGCHIv6NtDjdUQ/dGrouU3OExc3yzww0COD76w==\",\n      \"path\": \"microsoft.codeanalysis.csharp/3.7.0\",\n      \"hashPath\": \"microsoft.codeanalysis.csharp.3.7.0.nupkg.sha512\"\n    },\n    \"Microsoft.NETCore.Platforms/2.1.2\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-mOJy3M0UN+LUG21dLGMxaWZEP6xYpQEpLuvuEQBaownaX4YuhH6NmNUlN9si+vNkAS6dwJ//N1O4DmLf2CikVg==\",\n      \"path\": \"microsoft.netcore.platforms/2.1.2\",\n      \"hashPath\": \"microsoft.netcore.platforms.2.1.2.nupkg.sha512\"\n    },\n    \"System.Collections.Immutable/1.5.0\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ==\",\n      \"path\": \"system.collections.immutable/1.5.0\",\n      \"hashPath\": \"system.collections.immutable.1.5.0.nupkg.sha512\"\n    },\n    \"System.Memory/4.5.4\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==\",\n      \"path\": \"system.memory/4.5.4\",\n      \"hashPath\": \"system.memory.4.5.4.nupkg.sha512\"\n    },\n    \"System.Reflection.Metadata/1.6.0\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ==\",\n      \"path\": \"system.reflection.metadata/1.6.0\",\n      \"hashPath\": \"system.reflection.metadata.1.6.0.nupkg.sha512\"\n    },\n    \"System.Runtime.CompilerServices.Unsafe/4.7.0\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-IpU1lcHz8/09yDr9N+Juc7SCgNUz+RohkCQI+KsWKR67XxpFr8Z6c8t1iENCXZuRuNCc4HBwme/MDHNVCwyAKg==\",\n      \"path\": \"system.runtime.compilerservices.unsafe/4.7.0\",\n      \"hashPath\": \"system.runtime.compilerservices.unsafe.4.7.0.nupkg.sha512\"\n    },\n    \"System.Text.Encoding.CodePages/4.5.1\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-4J2JQXbftjPMppIHJ7IC+VXQ9XfEagN92vZZNoG12i+zReYlim5dMoXFC1Zzg7tsnKDM7JPo5bYfFK4Jheq44w==\",\n      \"path\": \"system.text.encoding.codepages/4.5.1\",\n      \"hashPath\": \"system.text.encoding.codepages.4.5.1.nupkg.sha512\"\n    },\n    \"System.Threading.Tasks.Extensions/4.5.3\": {\n      \"type\": \"package\",\n      \"serviceable\": true,\n      \"sha512\": \"sha512-+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ==\",\n      \"path\": \"system.threading.tasks.extensions/4.5.3\",\n      \"hashPath\": \"system.threading.tasks.extensions.4.5.3.nupkg.sha512\"\n    },\n    \"CSharp.lua/1.1.0\": {\n      \"type\": \"project\",\n      \"serviceable\": false,\n      \"sha512\": \"\"\n    }\n  }\n}"
  },
  {
    "path": "Tools/CSharpLua/CSharp.lua/CSharp.lua.Launcher.runtimeconfig.json",
    "content": "{\n  \"runtimeOptions\": {\n    \"tfm\": \"net5.0\",\n    \"framework\": {\n      \"name\": \"Microsoft.NETCore.App\",\n      \"version\": \"5.0.0\"\n    }\n  }\n}"
  },
  {
    "path": "Tools/CSharpLua/CSharp.lua/System.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!--\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n!-->\n<meta>\n  <assembly>\n    <namespace name=\"System\">\n      <class name=\"Single\">\n        <field name=\"NaN\" Template=\"System.Single.NaN\" />\n        <field name=\"PositiveInfinity\" Template=\"System.Single.PositiveInfinity\" />\n        <field name=\"NegativeInfinity\" Template=\"System.Single.NegativeInfinity\" />\n      </class>\n      <class name=\"Double\">\n        <field name=\"NaN\" Template=\"System.Double.NaN\" />\n        <field name=\"PositiveInfinity\" Template=\"System.Double.PositiveInfinity\" />\n        <field name=\"NegativeInfinity\" Template=\"System.Double.NegativeInfinity\" />\n      </class>\n      <class name=\"Decimal\" Name=\"System.Double\" />\n      <class name=\"Char\">\n        <method name=\"ToString\" Template=\"System.Char.ToString({0})\">\n          <arg type=\"System.Char\" />\n        </method>  \n        <method name=\"ToString\" Template=\"System.Char.ToString({this})\" />\n      </class>\n      <class name=\"String\">\n        <field name=\"Empty\" Template=\"(&quot;&quot;)\" />\n        <property name=\"Length\">\n          <get Template=\"#{this}\" />\n        </property>\n        <method name=\"Concat\" GenericArgCount=\"1\" IgnoreGeneric=\"true\" />\n        <method name=\"Join\" GenericArgCount=\"1\" Name=\"JoinEnumerable\" IgnoreGeneric=\"true\" />\n        <method name=\"Join\" Name=\"JoinEnumerable\">\n          <arg type=\"System.String\" />\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n        </method>\n        <method name=\"Join\" ArgCount=\"2\" Name=\"JoinParams\" />\n        <method name=\"LastIndexOf\" Template=\"{this}:LastIndexOf({0}, nil, nil, {1})\">\n          <arg type=\"System.String\" />\n          <arg type=\"System.StringComparison\" />\n        </method>\n        <method name=\"LastIndexOf\" Template=\"{this}:LastIndexOf({0}, {1}, nil, {2})\">\n          <arg type=\"System.String\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.StringComparison\" />\n        </method>\n         <method name=\"Split\" Template=\"{this}:Split({0}, nil, {1})\">\n          <arg type=\"System.Char\" />\n          <arg type=\"System.StringSplitOptions\" />\n        </method>\n        <method name=\"Split\" Template=\"{this}:Split({0}, nil, {1})\">\n          <arg type=\"System.Char[]\" />\n          <arg type=\"System.StringSplitOptions\" />\n        </method>\n        <method name=\"Split\" Template=\"{this}:Split({0}, nil, {1})\">\n          <arg type=\"System.String[]\" />\n          <arg type=\"System.StringSplitOptions\" />\n        </method>\n      </class>\n      <class name=\"Enum\">\n        <method name=\"Parse\" GenericArgCount=\"1\" ArgCount=\"1\" Template=\"System.Enum.Parse({`0}, {0})\" />\n        <method name=\"Parse\" GenericArgCount=\"1\" ArgCount=\"2\" Template=\"System.Enum.Parse({`0}, {0}, {1})\" />\n        <method name=\"TryParse\" GenericArgCount=\"1\" ArgCount=\"2\" Template=\"System.Enum.TryParse({`0}, {0})\" />\n        <method name=\"TryParse\" GenericArgCount=\"1\" ArgCount=\"3\" Template=\"System.Enum.TryParse({`0}, {0}, {1})\" />\n      </class>\n      <class name=\"DateTime\">\n        <method name=\".ctor\" ArgCount=\"4\" Baned=\"true\" />\n        <method name=\".ctor\" Baned=\"true\">\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Globalization.Calendar\" />\n        </method>\n        <method name=\".ctor\" Baned=\"true\">\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Globalization.Calendar\" />\n        </method>\n        <method name=\".ctor\" ArgCount=\"9\" Baned=\"true\" />\n        <method name=\".ctor\" Template=\"System.DateTime({0}, {1}, {2}, {3}, {4}, {5}, 0, {6})\">\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.DateTimeKind\" />\n        </method>\n        <method name=\"op_Addition\" Template=\"{0} + {1}\" />\n        <method name=\"op_Subtraction\" Template=\"{0} - {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_LessThan\" Template=\"{0} &lt; {1}\" />\n        <method name=\"op_LessThanOrEqual\" Template=\"{0} &lt;= {1}\" />\n        <method name=\"op_GreaterThan\" Template=\"{0} &gt; {1}\" />\n        <method name=\"op_GreaterThanOrEqual\" Template=\"{0} &gt;= {1}\" />\n      </class>\n      <class name=\"TimeSpan\">\n        <method name=\"op_UnaryPlus\" Template=\"{0}\" />\n        <method name=\"op_Addition\" Template=\"{0} + {1}\" />\n        <method name=\"op_UnaryNegation\" Template=\"-{0}\" />\n        <method name=\"op_Subtraction\" Template=\"{0} - {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_LessThan\" Template=\"{0} &lt; {1}\" />\n        <method name=\"op_LessThanOrEqual\" Template=\"{0} &lt;= {1}\" />\n        <method name=\"op_GreaterThan\" Template=\"{0} &gt; {1}\" />\n        <method name=\"op_GreaterThanOrEqual\" Template=\"{0} &gt;= {1}\" />\n      </class>\n      <class name=\"TimeZoneInfo\">\n        <property name=\"BaseUtcOffset\" >\n          <get Template=\"System.DateTime.BaseUtcOffset\" />\n        </property>\n      </class>\n      <class name=\"Object\">\n        <method name=\"Equals\" Name=\"EqualsObj\" >\n          <arg type=\"System.Object\" />\n        </method>\n        <method name=\"Equals\" Name=\"EqualsStatic\" >\n          <arg type=\"System.Object\" />\n          <arg type=\"System.Object\" />\n        </method>\n      </class>\n      <class name=\"Type\">\n        <method name=\"GetType\" ArgCount =\"1\" Name=\"GetTypeFrom\" />\n        <method name=\"GetType\" ArgCount =\"2\" Name=\"GetTypeFrom\" />\n        <method name=\"GetType\" ArgCount =\"3\" Name=\"GetTypeFrom\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n      </class>\n      <class name=\"Array\">\n        <property name=\"Length\">\n          <get Template=\"#{this}\" />\n        </property>\n        <method name=\"BinarySearch\" IgnoreGeneric=\"true\" />\n        <method name=\"Clear\" Name=\"ClearArray\" />\n        <method name=\"Exists\" IgnoreGeneric=\"true\" />\n        <method name=\"Fill\" IgnoreGeneric=\"true\" />\n        <method name=\"Find\" IgnoreGeneric=\"true\" />\n        <method name=\"FindAll\" IgnoreGeneric=\"true\" />\n        <method name=\"FindIndex\" IgnoreGeneric=\"true\" />\n        <method name=\"FindLast\" IgnoreGeneric=\"true\" />\n        <method name=\"FindLastIndex\" IgnoreGeneric=\"true\" />\n        <method name=\"ForEach\" IgnoreGeneric=\"true\" />\n        <method name=\"IndexOf\" IgnoreGeneric=\"true\" />\n        <method name=\"LastIndexOf\" IgnoreGeneric=\"true\" />\n        <method name=\"Reverse\" IgnoreGeneric=\"true\" />\n        <method name=\"Sort\" IgnoreGeneric=\"true\" />\n        <method name=\"TrueForAll\" IgnoreGeneric=\"true\" />\n      </class>\n      <class name=\"IComparable\">\n        <method name=\"CompareTo\" Name=\"CompareToObj\" />\n      </class>\n      <class name=\"Console\">\n        <method name=\"Write\" Name=\"WriteChar\" >\n          <arg type=\"System.Char\" />\n        </method>\n        <method name=\"WriteLine\" Name=\"WriteLineChar\" >\n          <arg type=\"System.Char\" />\n        </method>\n      </class>\n      <class name=\"Math\" Name=\"math\" >\n        <method name=\"Round\" Template=\"math.Round({0}, nil, {1})\">\n          <arg type=\"System.Double\" />\n          <arg type=\"System.MidpointRounding\" />\n        </method>\n        <method name=\"Round\" Template=\"math.Round({0}, nil, {1})\">\n          <arg type=\"System.Decimal\" />\n          <arg type=\"System.MidpointRounding\" />\n        </method>\n      </class>\n      <class name=\"Activator\" >\n        <method name=\"CreateInstance\" Template=\"System.Activator.CreateInstance({0}, {*1})\">\n          <arg type=\"System.Type\" />\n          <arg type=\"System.Object[]\" />\n        </method>\n        <method name=\"CreateInstance\" Name=\"CreateInstance1\">\n          <arg type=\"System.Type\" />\n          <arg type=\"System.Boolean\" />\n        </method>\n        <method name=\"CreateInstance\" ArgCount=\"3\" Baned=\"true\" />\n        <method name=\"CreateInstance\" ArgCount=\"5\" Baned=\"true\" />\n        <method name=\"CreateInstance\" ArgCount=\"6\" Baned=\"true\" />\n      </class>\n      <class name=\"Tuple\">\n        <method name=\"Create\" ArgCount=\"1\" Template=\"System.Tuple({0})\" />\n        <method name=\"Create\" ArgCount=\"2\" Template=\"System.Tuple({0}, {1})\" />\n        <method name=\"Create\" ArgCount=\"3\" Template=\"System.Tuple({0}, {1}, {2})\" />\n        <method name=\"Create\" ArgCount=\"4\" Template=\"System.Tuple({0}, {1}, {2}, {3})\" />\n        <method name=\"Create\" ArgCount=\"5\" Template=\"System.Tuple({0}, {1}, {2}, {3}, {4})\" />\n        <method name=\"Create\" ArgCount=\"6\" Template=\"System.Tuple({0}, {1}, {2}, {3}, {4}, {5})\" />\n        <method name=\"Create\" ArgCount=\"7\" Template=\"System.Tuple({0}, {1}, {2}, {3}, {4}, {5}, {6})\" />\n        <method name=\"Create\" ArgCount=\"8\" Template=\"System.Tuple({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})\" />\n      </class>\n      <class name=\"Tuple`1\" IgnoreGeneric=\"true\">\n        <property name=\"Item1\">\n          <get Template=\"{this}[1]\" />\n        </property> \n      </class>\n      <class name=\"Tuple`2\" IgnoreGeneric=\"true\">\n        <property name=\"Item1\">\n          <get Template=\"{this}[1]\" />\n        </property>\n        <property name=\"Item2\">\n          <get Template=\"{this}[2]\" />\n        </property>\n      </class>\n      <class name=\"Tuple`3\" IgnoreGeneric=\"true\">\n        <property name=\"Item1\">\n          <get Template=\"{this}[1]\" />\n        </property>\n        <property name=\"Item2\">\n          <get Template=\"{this}[2]\" />\n        </property>\n        <property name=\"Item3\">\n          <get Template=\"{this}[3]\" />\n        </property>\n      </class>\n      <class name=\"Tuple`4\" IgnoreGeneric=\"true\">\n        <property name=\"Item1\">\n          <get Template=\"{this}[1]\" />\n        </property>\n        <property name=\"Item2\">\n          <get Template=\"{this}[2]\" />\n        </property>\n        <property name=\"Item3\">\n          <get Template=\"{this}[3]\" />\n        </property>\n        <property name=\"Item4\">\n          <get Template=\"{this}[4]\" />\n        </property>\n      </class>\n      <class name=\"Tuple`5\" IgnoreGeneric=\"true\">\n        <property name=\"Item1\">\n          <get Template=\"{this}[1]\" />\n        </property>\n        <property name=\"Item2\">\n          <get Template=\"{this}[2]\" />\n        </property>\n        <property name=\"Item3\">\n          <get Template=\"{this}[3]\" />\n        </property>\n        <property name=\"Item4\">\n          <get Template=\"{this}[4]\" />\n        </property>\n        <property name=\"Item5\">\n          <get Template=\"{this}[5]\" />\n        </property>\n      </class>\n      <class name=\"Tuple`6\" IgnoreGeneric=\"true\">\n        <property name=\"Item1\">\n          <get Template=\"{this}[1]\" />\n        </property>\n        <property name=\"Item2\">\n          <get Template=\"{this}[2]\" />\n        </property>\n        <property name=\"Item3\">\n          <get Template=\"{this}[3]\" />\n        </property>\n        <property name=\"Item4\">\n          <get Template=\"{this}[4]\" />\n        </property>\n        <property name=\"Item5\">\n          <get Template=\"{this}[5]\" />\n        </property>\n        <property name=\"Item6\">\n          <get Template=\"{this}[6]\" />\n        </property>\n      </class>\n      <class name=\"Tuple`7\" IgnoreGeneric=\"true\">\n        <property name=\"Item1\">\n          <get Template=\"{this}[1]\" />\n        </property>\n        <property name=\"Item2\">\n          <get Template=\"{this}[2]\" />\n        </property>\n        <property name=\"Item3\">\n          <get Template=\"{this}[3]\" />\n        </property>\n        <property name=\"Item4\">\n          <get Template=\"{this}[4]\" />\n        </property>\n        <property name=\"Item5\">\n          <get Template=\"{this}[5]\" />\n        </property>\n        <property name=\"Item6\">\n          <get Template=\"{this}[6]\" />\n        </property>\n        <property name=\"Item7\">\n          <get Template=\"{this}[7]\" />\n        </property>\n      </class>\n      <class name=\"Tuple`8\" IgnoreGeneric=\"true\">\n        <property name=\"Item1\">\n          <get Template=\"{this}[1]\" />\n        </property>\n        <property name=\"Item2\">\n          <get Template=\"{this}[2]\" />\n        </property>\n        <property name=\"Item3\">\n          <get Template=\"{this}[3]\" />\n        </property>\n        <property name=\"Item4\">\n          <get Template=\"{this}[4]\" />\n        </property>\n        <property name=\"Item5\">\n          <get Template=\"{this}[5]\" />\n        </property>\n        <property name=\"Item6\">\n          <get Template=\"{this}[6]\" />\n        </property>\n        <property name=\"Item7\">\n          <get Template=\"{this}[7]\" />\n        </property>\n        <property name=\"Item8\">\n          <get Template=\"{this}[8]\" />\n        </property>\n      </class>\n      <class name=\"ValueTuple\">\n        <method name=\"Create\" ArgCount=\"2\" Template=\"System.ValueTuple({0}, {1})\" />\n        <method name=\"Create\" ArgCount=\"3\" Template=\"System.ValueTuple({0}, {1}, {2})\" />\n        <method name=\"Create\" ArgCount=\"4\" Template=\"System.ValueTuple({0}, {1}, {2}, {3})\" />\n        <method name=\"Create\" ArgCount=\"5\" Template=\"System.ValueTuple({0}, {1}, {2}, {3}, {4})\" />\n        <method name=\"Create\" ArgCount=\"6\" Template=\"System.ValueTuple({0}, {1}, {2}, {3}, {4}, {5})\" />\n        <method name=\"Create\" ArgCount=\"7\" Template=\"System.ValueTuple({0}, {1}, {2}, {3}, {4}, {5}, {6})\" />\n        <method name=\"Create\" ArgCount=\"8\" Template=\"System.ValueTuple({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})\" />\n      </class>\n      <class name=\"Nullable`1\" Name=\"System.Nullable\">\n        <method name=\".ctor\" Template=\"{0}\" />\n        <property name=\"HasValue\">\n          <get Template=\"({this} ~= nil)\" />\n        </property>\n        <property name=\"Value\">\n          <get Template=\"System.Nullable.Value({this})\" />\n        </property>\n        <method name=\"Equals\" Template=\"System.Nullable.EqualsObj({this}, {0})\" />\n        <method name=\"GetHashCode\" Template=\"System.Nullable.GetHashCode({this})\" />\n        <method name=\"GetValueOrDefault\" ArgCount=\"0\" Template=\"({this} or {`0}:default())\" />\n        <method name=\"GetValueOrDefault\" ArgCount=\"1\" Template=\"({this} or {0})\" />\n        <method name=\"ToString\" Template=\"System.toString({this})\" />\n        <method name=\"op_Explicit\" Template=\"System.Nullable.Value({0})\" />\n      </class>\n      <class name=\"MulticastDelegate\" Name=\"System.Delegate\" />\n      <class name=\"Index\">\n        <property name=\"End\" IsField=\"true\" />\n        <property name=\"Start\" IsField=\"true\" />\n        <property name=\"Value\">\n          <get Template=\"{this}\" />\n        </property>\n        <property name=\"IsFromEnd\">\n          <get Template=\"System.Index.IsFromEnd({this})\" />\n        </property>\n        <method name=\"FromStart\" Template=\"System.Index({0})\" />\n        <method name=\"FromEnd\" Template=\"System.Index({0}, true)\" />\n        <method name=\"GetOffset\" Template=\"System.Index.GetOffset({this}, {0})\" />\n        <method name=\"ToString\" Template=\"System.Index.ToString({this})\" />\n        <method name=\"op_Implicit\" Template=\"System.Index({0})\" />\n      </class>\n      <class name=\"WeakReference`1\" IgnoreGeneric=\"true\" />\n      <class name=\"Lazy`1\" Name=\"System.Lazy\" />\n      <class name=\"Convert\">\n        <method name=\"ToString\" Name=\"ToStringFromChar\">\n          <arg type=\"System.Char\" />\n        </method>\n        <method name=\"ToString\" Name=\"ToStringFromChar\">\n          <arg type=\"System.Char\" />\n          <arg type=\"System.IFormatProvider\" />\n        </method>\n        <method name=\"ToString\" Template=\"({0})\">\n          <arg type=\"System.String\" />\n        </method>\n        <method name=\"ToString\" Template=\"({0})\">\n          <arg type=\"System.String\" />\n          <arg type=\"System.IFormatProvider\" />\n        </method>\n        <method name=\"ToString\" Template=\"System.Convert.ToString({0}, {1}, System.toUInt16)\">\n          <arg type=\"System.Int16\" />\n          <arg type=\"System.Int32\" />\n        </method>\n        <method name=\"ToString\" Template=\"System.Convert.ToString({0}, {1}, System.toUInt32)\">\n          <arg type=\"System.Int32\" />\n          <arg type=\"System.Int32\" />\n        </method>\n      </class>\n      <class name=\"BitConverter\">\n        <method name=\"GetBytes\" Name=\"GetBytesFromBoolean\">\n          <arg type=\"System.Boolean\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromInt16\">\n          <arg type=\"System.Char\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromInt16\">\n          <arg type=\"System.Int16\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromInt16\">\n          <arg type=\"System.UInt16\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromInt32\">\n          <arg type=\"System.Int32\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromInt32\">\n          <arg type=\"System.UInt32\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromInt64\">\n          <arg type=\"System.Int64\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromInt64\">\n          <arg type=\"System.UInt64\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromFloat\">\n          <arg type=\"System.Single\" />\n        </method>\n        <method name=\"GetBytes\" Name=\"GetBytesFromDouble\">\n          <arg type=\"System.Double\" />\n        </method>\n      </class>\n      <class name=\"ArraySegment`1\" Name=\"System.ArraySegment\" />\n      <class name=\"Guid\" Readonly=\"true\" />\n      <class name=\"ArgumentNullException\">\n        <method name=\".ctor\" Template=\"System.ArgumentNullException(nil, {0}, {1})\">\n          <arg type=\"System.String\" />\n          <arg type=\"System.Exception\" />\n        </method>\n      </class>\n      <class name=\"ArgumentOutOfRangeException\">\n        <method name=\".ctor\" Template=\"System.ArgumentOutOfRangeException(nil, {0}, {1})\">\n          <arg type=\"System.String\" />\n          <arg type=\"System.Exception\" />\n        </method>\n        <method name=\".ctor\" Template=\"System.ArgumentOutOfRangeException({0}, nil, nil, {1}, {2})\">\n          <arg type=\"System.String\" />\n          <arg type=\"System.Object\" />\n          <arg type=\"System.String\" />\n        </method>\n      </class>\n      <class name=\"ObjectDisposedException\">\n        <method name=\".ctor\" Template=\"System.ObjectDisposedException(nil, {0}, {1})\">\n          <arg type=\"System.String\" />\n          <arg type=\"System.Exception\" />\n        </method>\n      </class>\n    </namespace>\n    <namespace name=\"System.Collections\" Name=\"System\" >\n      <class name=\"IEqualityComparer\">\n        <method name=\"Equals\" Name=\"EqualsObjOf\" />\n        <method name=\"GetHashCode\" Name=\"GetHashCodeObjOf\" />\n      </class>\n      <class name=\"IList\">\n        <method name=\"Add\" Name=\"AddObj\" />\n      </class>\n      <class name=\"Queue\" Name=\"queue\" />\n      <class name=\"Stack\" Name=\"stack\" />\n    </namespace>\n    <namespace name=\"System.Collections.Generic\" Name=\"System\">\n      <class name=\"List`1\" Name=\"System.List\">\n        <property name=\"Count\">\n          <get Template=\"#{this}\" />\n        </property>\n      </class>\n      <class name=\"Dictionary`2\" Name=\"System.Dictionary\"/>\n      <class name=\"Queue`1\" Name=\"System.Queue\">\n        <property name=\"Count\">\n          <get Template=\"#{this}\" />\n        </property>\n      </class>\n      <class name=\"Stack`1\" Name=\"System.Stack\">\n        <property name=\"Count\">\n          <get Template=\"#{this}\" />\n        </property>\n      </class>\n      <class name=\"LinkedList`1\" Name=\"System.LinkedList\">\n        <property name=\"Count\" IsField=\"true\" />\n        <method name=\"AddAfter\" Name=\"AddAfterNode\">\n          <arg type=\"System.Collections.Generic.LinkedListNode`1\" />\n          <arg type=\"System.Collections.Generic.LinkedListNode`1\" />\n        </method>\n        <method name=\"AddBefore\" Name=\"AddBeforeNode\">\n          <arg type=\"System.Collections.Generic.LinkedListNode`1\" />\n          <arg type=\"System.Collections.Generic.LinkedListNode`1\" />\n        </method>\n        <method name=\"AddFirst\" Name=\"AddFirstNode\">\n          <arg type=\"System.Collections.Generic.LinkedListNode`1\" />\n        </method>\n        <method name=\"AddLast\" Name=\"AddLastNode\">\n          <arg type=\"System.Collections.Generic.LinkedListNode`1\" />\n        </method>\n        <method name=\"Remove\" Name=\"RemoveNode\">\n          <arg type=\"System.Collections.Generic.LinkedListNode`1\" />\n        </method>\n      </class>\n      <class name=\"LinkedListNode`1\" Name=\"System.LinkedListNode\" IgnoreGeneric=\"true\">\n        <property name=\"Value\" IsField=\"true\" />\n        <property name=\"List\" IsField=\"true\" />\n      </class>\n      <class name=\"HashSet`1\" Name=\"System.HashSet\" />\n      <class name=\"KeyValuePair`2\" Name=\"System.KeyValuePair\">\n        <property name=\"Key\" IsField=\"true\" />\n        <property name=\"Value\" IsField=\"true\" />\n      </class>\n      <class name=\"IDictionary`2\">\n        <method name=\"Add\" Name=\"AddKeyValue\" />\n        <method name=\"Remove\" Name=\"RemoveKey\" />\n      </class>\n      <class name=\"IEqualityComparer`1\">\n        <method name=\"Equals\" Name=\"EqualsOf\" />\n        <method name=\"GetHashCode\" Name=\"GetHashCodeOf\" />\n      </class>\n      <class name=\"EqualityComparer`1\" Name=\"System.EqualityComparer\" />\n    </namespace>\n    <namespace name=\"System.Collections.ObjectModel\" Name=\"System\" >\n      <class name=\"ReadOnlyCollection`1\" Name=\"System.ReadOnlyCollection\" />\n    </namespace>\n    <namespace name=\"System.Linq\">\n      <class name=\"Enumerable\">\n        <method name=\"Where\" Template=\"Linq.Where({0}, {1})\" />\n        <method name=\"Select\" Template=\"Linq.Select({0}, {1}, {`1})\" />\n        <method name=\"SelectMany\" Template=\"Linq.SelectMany({0}, {1}, {`1})\" />\n        <method name=\"Take\" Template=\"Linq.Take({0}, {1})\" />\n        <method name=\"TakeWhile\" Template=\"Linq.TakeWhile({0}, {1})\" />\n        <method name=\"Skip\" Template=\"Linq.Skip({0}, {1})\" />\n        <method name=\"SkipWhile\" Template=\"Linq.SkipWhile({0}, {1})\" />\n        <method name=\"Join\" ArgCount=\"5\" Template=\"Linq.Join({0}, {1}, {2}, {3}, {4}, {5}, nil, {`2}, {`3})\" />\n        <method name=\"Join\" ArgCount=\"6\" Template=\"Linq.Join({0}, {1}, {2}, {3}, {4}, {5}, {6}, {`2}, {`3})\" />\n        <method name=\"GroupJoin\" ArgCount=\"5\" Template=\"Linq.GroupJoin({0}, {1}, {2}, {3}, {4}, {5}, nil, {`2}, {`3})\" />\n        <method name=\"GroupJoin\" ArgCount=\"6\" Template=\"Linq.GroupJoin({0}, {1}, {2}, {3}, {4}, {5}, {6}, {`2}, {`3})\" />\n        <method name=\"GroupBy\" ArgCount=\"2\" Template=\"Linq.GroupBy({0}, {1}, {`1})\" />\n        <method name=\"GroupBy\" Template=\"Linq.GroupBy({0}, {1}, {2}, {`1})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Collections.Generic.IEqualityComparer`1\" />\n        </method>\n        <method name=\"GroupBy\" Template=\"Linq.GroupBy({0}, {1}, {2}, {`1}, {`2})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`2\" />\n        </method>\n        <method name=\"GroupBy\" Template=\"Linq.GroupBySelect({0}, {1}, {2}, {`1}, {`2})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`3\" />\n        </method>\n        <method name=\"GroupBy\" Template=\"Linq.GroupBy({0}, {1}, {2}, {3}, {`1}, {`2})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Collections.Generic.IEqualityComparer`1\" />\n        </method>\n        <method name=\"GroupBy\" Template=\"Linq.GroupBySelect({0}, {1}, {2}, {3}, {`1}, {`2}, {`3})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`3\" />\n        </method>\n        <method name=\"GroupBy\" Template=\"Linq.GroupBySelect({0}, {1}, {2}, {3}, {`1}, {`2})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`3\" />\n          <arg type=\"System.Collections.Generic.IEqualityComparer`1\" />\n        </method>\n        <method name=\"GroupBy\" Template=\"Linq.GroupBySelect({0}, {1}, {2}, {3}, {4}, {`1}, {`2}, {`3})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`3\" />\n          <arg type=\"System.Collections.Generic.IEqualityComparer`1\" />\n        </method>\n        <method name=\"Concat\" Template=\"Linq.Concat({0}, {1})\" />\n        <method name=\"Zip\" Template=\"Linq.Zip({0, {1}, {2}}, {`2})\" />\n        <method name=\"Distinct\" Template=\"Linq.Distinct({0}, {1})\" />\n        <method name=\"Union\" Template=\"Linq.Union({0}, {1}, {2})\" />\n        <method name=\"Intersect\" Template=\"Linq.Intersect({0}, {1}, {2})\" />\n        <method name=\"Except\" Template=\"Linq.Except({0}, {1}, {2})\" />\n        <method name=\"Reverse\" Template=\"Linq.Reverse({0})\" />\n        <method name=\"SequenceEqual\" Template=\"Linq.SequenceEqual({0}, {1}, {2})\" />\n        <method name=\"ToArray\" Template=\"Linq.ToArray({0})\" />\n        <method name=\"ToList\" Template=\"Linq.ToList({0})\" />\n        <method name=\"ToDictionary\" ArgCount=\"2\" Template=\"Linq.ToDictionary({0}, {1}, {`1})\" />\n        <method name=\"ToDictionary\" Template=\"Linq.ToDictionary({0}, {1}, {2}, {`1})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Collections.Generic.IEqualityComparer`1\" />\n        </method>\n        <method name=\"ToDictionary\" Template=\"Linq.ToDictionary({0}, {1}, {2}, {`1}, {`2})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`2\" />\n        </method>\n        <method name=\"ToDictionary\" Template=\"Linq.ToDictionary({0}, {1}, {2}, {3}, {`1}, {`2})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Collections.Generic.IEqualityComparer`1\" />\n        </method>\n        <method name=\"ToLookup\" ArgCount=\"2\" Template=\"Linq.ToLookup({0}, {1}, {`1})\" />\n        <method name=\"ToLookup\" Template=\"Linq.ToLookup({0}, {1}, {2}, {`1})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Collections.Generic.IEqualityComparer`1\" />\n        </method>\n        <method name=\"ToLookup\" Template=\"Linq.ToLookup({0}, {1}, {2}, {`1}, {`2})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`2\" />\n        </method>\n        <method name=\"ToLookup\" Template=\"Linq.ToLookup({0}, {1}, {2}, {3}, {`1}, {`2})\" >\n          <arg type=\"System.Collections.Generic.IEnumerable`1\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Func`2\" />\n          <arg type=\"System.Collections.Generic.IEqualityComparer`1\" />\n        </method>\n        <method name=\"Cast\" Template=\"Linq.Cast({0}, {`0})\" />\n        <method name=\"First\" Template=\"Linq.First({0}, {1})\" />\n        <method name=\"FirstOrDefault\" Template=\"Linq.FirstOrDefault({0}, {1})\" />\n        <method name=\"Last\" Template=\"Linq.Last({0}, {1})\" />\n        <method name=\"LastOrDefault\" Template=\"Linq.LastOrDefault({0}, {1})\" />\n        <method name=\"Single\" Template=\"Linq.Single({0}, {1})\" />\n        <method name=\"SingleOrDefault\" Template=\"Linq.SingleOrDefault({0}, {1})\" />\n        <method name=\"ElementAt\" Template=\"Linq.ElementAt({0}, {1})\" />\n        <method name=\"ElementAtOrDefault\" Template=\"Linq.ElementAtOrDefault({0}, {1})\" />\n        <method name=\"Any\" Template=\"Linq.Any({0}, {1})\" />\n        <method name=\"All\" Template=\"Linq.All({0}, {1})\" />\n        <method name=\"Count\" Template=\"Linq.Count({0}, {1})\" />\n        <method name=\"Contains\" Template=\"Linq.Contains({0}, {1}, {2})\" />\n        <method name=\"Aggregate\" Template=\"Linq.Aggregate({0}, {1}, {2})\" />\n        <method name=\"Sum\" Template=\"Linq.Sum({0}, {1})\" />\n        <method name=\"Min\" ArgCount=\"1\"  Template=\"Linq.Min({0})\" />\n        <method name=\"Min\" ArgCount=\"2\" RetType=\"System.Int32\" Template=\"Linq.Min({0}, {1}, System.Int32)\" />\n        <method name=\"Min\" ArgCount=\"2\" RetType=\"System.Int64\" Template=\"Linq.Min({0}, {1}, System.Int64)\" />\n        <method name=\"Min\" ArgCount=\"2\" RetType=\"System.Single\" Template=\"Linq.Min({0}, {1}, System.Single)\" />\n        <method name=\"Min\" ArgCount=\"2\" RetType=\"System.Double\" Template=\"Linq.Min({0}, {1}, System.Double)\" />\n        <method name=\"Min\" ArgCount=\"2\" RetType=\"System.Decimal\" Template=\"Linq.Min({0}, {1}, System.Double)\" />\n        <method name=\"Min\" ArgCount=\"2\" GenericArgCount=\"2\" Template=\"Linq.Min({0}, {1}, {`1})\" />\n        <method name=\"Max\" ArgCount=\"1\" Template=\"Linq.Max({0})\" />\n        <method name=\"Max\" ArgCount=\"2\" RetType=\"System.Int32\" Template=\"Linq.Max({0}, {1}, System.Int32)\" />\n        <method name=\"Max\" ArgCount=\"2\" RetType=\"System.Int64\" Template=\"Linq.Max({0}, {1}, System.Int64)\" />\n        <method name=\"Max\" ArgCount=\"2\" RetType=\"System.Single\" Template=\"Linq.Max({0}, {1}, System.Single)\" />\n        <method name=\"Max\" ArgCount=\"2\" RetType=\"System.Double\" Template=\"Linq.Max({0}, {1}, System.Double)\" />\n        <method name=\"Max\" ArgCount=\"2\" RetType=\"System.Decimal\" Template=\"Linq.Max({0}, {1}, System.Double)\" />\n        <method name=\"Max\" ArgCount=\"2\" GenericArgCount=\"2\" Template=\"Linq.Max({0}, {1}, {`1})\" />\n        <method name=\"OfType\" Template=\"Linq.OfType({0}, {`0})\" />\n        <method name=\"OrderBy\" ArgCount=\"2\" Template=\"Linq.OrderBy({0}, {1}, nil, {`1})\" />\n        <method name=\"OrderBy\" ArgCount=\"3\" Template=\"Linq.OrderBy({0}, {1}, {2}, {`1})\" />\n        <method name=\"OrderByDescending\" ArgCount=\"2\" Template=\"Linq.OrderByDescending({0}, {1}, nil, {`1})\" />\n        <method name=\"OrderByDescending\" ArgCount=\"3\" Template=\"Linq.OrderByDescending({0}, {1}, {2}, {`1})\" />\n        <method name=\"ThenBy\" ArgCount=\"2\" Template=\"Linq.ThenBy({0}, {1}, nil, {`1})\" />\n        <method name=\"ThenBy\" ArgCount=\"3\" Template=\"Linq.ThenBy({0}, {1}, {2}, {`1})\" />\n        <method name=\"ThenByDescending\" ArgCount=\"2\" Template=\"Linq.ThenByDescending({0}, {1}, nil, {`1})\" />\n        <method name=\"ThenByDescending\" ArgCount=\"3\" Template=\"Linq.ThenByDescending({0}, {1}, {2}, {`1})\" />\n        <method name=\"Average\" Template=\"Linq.Average({0}, {1})\" />\n        <method name=\"DefaultIfEmpty\" Template=\"Linq.DefaultIfEmpty({0})\" />\n      </class>\n    </namespace>\n    <namespace name=\"System.Diagnostics\" Name=\"System\">\n      <class name=\"Debug\">\n        <method name=\"Assert\" Template=\"assert({0}, {1})\" />\n        <method name=\"Requires\" GenericArgCount=\"0\" Template=\"assert({0}, {1})\" />\n      </class>\n    </namespace>\n    <namespace name=\"System.Diagnostics.Contracts\" Name=\"System\">\n      <class name=\"Contract\">\n        <method name=\"Assert\" Template=\"assert({0}, {1})\" />\n        <method name=\"Assume\" Template=\"assert({0}, {1})\" />\n        <method name=\"Ensures\" Template=\"assert({0}, {1})\" />\n      </class>\n    </namespace>\n    <namespace name=\"System.Reflection\">\n      <class name=\"Assembly\">\n        <method name=\"GetExecutingAssembly\" Template=\"System.GetExecutingAssembly(namespace)\" />\n        <method name=\"GetType\" Name=\"GetTypeFrom\" />\n      </class>\n      <class name=\"MemberInfo\">\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n      </class>\n      <class name=\"FieldInfo\">\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n      </class>\n      <class name=\"PropertyInfo\">\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n      </class>\n      <class name=\"MethodInfo\">\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n      </class>\n      <class name=\"MethodBase\">\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n      </class>\n    </namespace>\n    <namespace name=\"System.Text\">\n      <class name=\"StringBuilder\" Name=\"System.StringBuilder\">\n        <method name=\"Append\" Name=\"AppendChar\" >\n          <arg type=\"System.Char\" />\n        </method> \n        <method name=\"Append\" Name=\"AppendCharRepeat\">\n          <arg type=\"System.Char\" />\n          <arg type=\"System.Int32\" />\n        </method>\n      </class>\n    </namespace>\n    <namespace name=\"System.Threading\" Name=\"System\">\n      <class name=\"Thread\">\n        <property name=\"IsBackground\" IsField=\"true\" />\n        <property name=\"Name\" IsField=\"true\" />\n        <property name=\"Priority\" IsField=\"true\" />\n        <property name=\"ApartmentState\" IsField=\"true\" />\n        <property name=\"IsThreadPoolThread\" IsField=\"true\" />\n      </class>\n      <class name=\"CancellationToken\" Readonly=\"true\">\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n      </class>\n      <class name=\"CancellationTokenRegistration\" Readonly=\"true\">\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n      </class>\n    </namespace>\n    <namespace name=\"System.Threading.Tasks\" Name=\"System\">\n      <class name=\"Task\">\n        <method name=\"WhenAll\" GenericArgCount=\"0\" Template=\"System.Task.WhenAll(nil, {*0})\" />\n        <method name=\"WhenAll\" GenericArgCount=\"1\" Template=\"System.Task.WhenAll({`0}, {*0})\" />\n        <method name=\"WhenAny\" IgnoreGeneric=\"true\" />\n      </class>\n      <class name=\"Task`1\" IgnoreGeneric=\"true\" />\n      <class name=\"TaskCompletionSource`1\" IgnoreGeneric=\"true\" />\n    </namespace>\n    <namespace name=\"System.Numerics\">\n      <class name=\"Complex\" Readonly=\"true\">\n        <method name=\"op_Addition\" Template=\"{0} + {1}\" />\n        <method name=\"op_Subtraction\" Template=\"{0} - {1}\" />\n        <method name=\"op_Multiply\" Template=\"{0} * {1}\" />\n        <method name=\"op_Division\" Template=\"{0} / {1}\" />\n        <method name=\"op_UnaryNegation\" Template=\"- {0}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Implicit\" Name=\"ToComplex\" />\n      </class>\n    </namespace>\n    <namespace name=\"System.Runtime.CompilerServices\" Name=\"System\" />\n</assembly>\n</meta>\n"
  },
  {
    "path": "Tools/CSharpLua/UnityEngine.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<meta>\n  <assembly>\n    <namespace name=\"UnityEngine\">\n      <class name=\"MonoBehaviour\">\n        <method name=\"CancelInvoke\" ArgCount=\"1\" Baned=\"true\" />\n        <method name=\"Invoke\" Baned=\"true\" />\n        <method name=\"InvokeRepeating\" Baned=\"true\" />\n        <method name=\"IsInvoking\" ArgCount=\"1\" Baned=\"true\" />\n        <method name=\"StartCoroutine\" ArgCount=\"2\" Baned=\"true\" />\n        <method name=\"StartCoroutine\" Baned=\"true\">\n          <arg type=\"System.String\" />\n        </method>\n        <method name=\"StartCoroutine_Auto\" Baned=\"true\" />\n        <method name=\"StopCoroutine\" Baned=\"true\">\n          <arg type=\"System.String\" />\n        </method>\n      </class>\n      <class name=\"Component\">\n        <method name=\"BroadcastMessage\" Baned=\"true\" />\n        <method name=\"SendMessage\" Baned=\"true\" />\n        <method name=\"SendMessageUpwards\" Baned=\"true\" />\n      </class>\n      <class name=\"Object\">\n        <method name=\"DestroyObject\" Baned=\"true\" />\n        <method name=\"Instantiate\" GenericArgCount=\"1\" IgnoreGeneric=\"true\" />\n        <method name=\"op_Equality\" Template=\"UnityEngine.op_Equality({0}, {1})\" />\n        <method name=\"op_Inequality\" Template=\"UnityEngine.op_Inequality({0}, {1})\" />\n        <method name=\"op_Implicit\" Template=\"UnityEngine.op_Implicit({0})\" />\n      </class>\n      <class name=\"Vector2\">\n        <method name=\"op_Addition\" Template=\"{0} + {1}\" />\n        <method name=\"op_UnaryNegation\" Template=\"- {0}\" />\n        <method name=\"op_Subtraction\" Template=\"{0} - {1}\" />\n        <method name=\"op_Multiply\" Template=\"{0} * {1}\" />\n        <method name=\"op_Division\" Template=\"{0} / {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Vector3\" Template=\"UnityEngine.ToVector3({0})\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Vector2\"  Template=\"UnityEngine.ToVector2({0})\" />\n      </class>\n      <class name=\"Vector3\">\n        <method name=\"op_Addition\" Template=\"{0} + {1}\" />\n        <method name=\"op_UnaryNegation\" Template=\"- {0}\" />\n        <method name=\"op_Subtraction\" Template=\"{0} - {1}\" />\n        <method name=\"op_Multiply\" Template=\"{0} * {1}\" />\n        <method name=\"op_Division\" Template=\"{0} / {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n      </class>\n      <class name=\"Vector4\">\n        <method name=\"op_Addition\" Template=\"{0} + {1}\" />\n        <method name=\"op_UnaryNegation\" Template=\"- {0}\" />\n        <method name=\"op_Subtraction\" Template=\"{0} - {1}\" />\n        <method name=\"op_Multiply\" Template=\"{0} * {1}\" />\n        <method name=\"op_Division\" Template=\"{0} / {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Vector4\" Template=\"UnityEngine.ToVector4({0})\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Vector3\" Template=\"UnityEngine.ToVector3({0})\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Vector2\" Template=\"UnityEngine.ToVector2({0})\" />\n      </class>\n      <class name=\"Color\">\n        <method name=\"op_Addition\" Template=\"{0} + {1}\" />\n        <method name=\"op_Subtraction\" Template=\"{0} - {1}\" />\n        <method name=\"op_Multiply\" Template=\"{0} * {1}\" />\n        <method name=\"op_Division\" Template=\"{0} / {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Color\" Template=\"UnityEngine.ToColorFromVector4({0})\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Vector4\" Template=\"UnityEngine.ToVector4FromColor({0})\" />\n      </class>\n      <class name=\"Color32\">\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Color32\" Template=\"UnityEngine.ToColor32FromColor({0})\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.Color\" Template=\"UnityEngine.ToColorFromColor32({0})\" />\n      </class>\n      <class name=\"Quaternion\">\n        <method name=\"Normalize\" Name=\"SetNormalize\" />\n        <method name=\"op_Multiply\" Template=\"{0} * {1}\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n      </class>\n      <class name=\"Bounds\">\n        <property name=\"extents\" IsField=\"true\" />\n        <property name=\"center\" IsField=\"true\" />\n        <method name=\"op_Equality\" Template=\"{0} == {1}\" />\n        <method name=\"op_Inequality\" Template=\"{0} ~= {1}\" />\n      </class>\n      <class name=\"Plane\">\n        <property name=\"normal\" IsField=\"true\" />\n        <property name=\"distance\" IsField=\"true\" />\n      </class>\n      <class name=\"LayerMask\">\n        <method name=\"op_Implicit\" RetType=\"System.Int32\" Template=\"this.value\" />\n        <method name=\"op_Implicit\" RetType=\"UnityEngine.LayerMask\" Template=\"UnityEngine.ToLayerMask({0})\" />\n      </class>\n      <class name=\"Ray\">\n        <property name=\"origin\" IsField=\"true\" />\n        <property name=\"direction\" IsField=\"true\" />\n      </class>\n      <class name=\"RaycastHit\">\n        <property name=\"collider\" IsField=\"true\" />\n        <property name=\"distance\" IsField=\"true\" />\n        <property name=\"normal\" IsField=\"true\" />\n        <property name=\"point\" IsField=\"true\" />\n        <property name=\"rigidbody\" IsField=\"true\" />\n        <property name=\"transform\" IsField=\"true\" />\n      </class>\n      <class name=\"Resources\">\n        <method name=\"Load\" GenericArgCount=\"1\" ArgCount=\"1\" Template=\"UnityEngine.Resources.Load({0}, typeof({`0}))\" />\n      </class>\n    </namespace>\n    <namespace name=\"LuaInterface\">\n      <class name=\"Debugger\" Name=\"Debugger\" />\n    </namespace>\n  </assembly>\n</meta>"
  },
  {
    "path": "Tools/CSharpLua/codes/All.lua",
    "content": "--[[\nCopyright 2017 YANG Huan (sy.yanghuan@gmail.com).\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--]]\n\nreturn function(dir, conf)\n  dir = (dir and #dir > 0) and (dir .. \".CoreSystem.\") or \"CoreSystem.\"\n  local require = require\n  local load = function(module) return require(dir .. module) end\n    \n  load(\"Core\")(conf)\n  load(\"Interfaces\")\n  load(\"Exception\")\n  load(\"Number\")\n  load(\"Char\")\n  load(\"String\")\n  load(\"Boolean\")\n  load(\"Delegate\")\n  load(\"Enum\")\n  load(\"TimeSpan\")\n  load(\"DateTime\")\n  load(\"Collections.EqualityComparer\")\n  load(\"Array\")\n  load(\"Type\")\n  load(\"Collections.List\")\n  load(\"Collections.Dictionary\")\n  load(\"Collections.Queue\")\n  load(\"Collections.Stack\")\n  load(\"Collections.HashSet\")\n  load(\"Collections.LinkedList\")\n  load(\"Collections.Linq\")\n  load(\"Convert\")\n  load(\"Math\")\n  load(\"Random\")\n  load(\"Text.StringBuilder\")\n  load(\"Console\")\n  load(\"IO.File\")\n  load(\"Reflection.Assembly\")\n  load(\"Threading.Timer\")\n  load(\"Threading.Thread\")\n  load(\"Threading.Task\")\n  load(\"Utilities\")\nend\n"
  },
  {
    "path": "Tools/CSharpLua/disable_track.bat",
    "content": "git update-index --assume-unchanged ../../Assets/Source/Generate/LuaBinder.cs\ngit update-index --assume-unchanged ../../Assets/Source/Generate/DelegateFactory.cs\ngit update-index --assume-unchanged ../../ProjectSettings/GraphicsSettings.asset\ngit update-index --assume-unchanged ../../ProjectSettings/ProjectSettings.asset"
  },
  {
    "path": "Tools/CSharpLua/enable_track.bat",
    "content": "git update-index --no-assume-unchanged ../../Assets/Source/Generate/LuaBinder.cs\ngit update-index --no-assume-unchanged ../../Assets/Source/Generate/DelegateFactory.cs\ngit update-index --no-assume-unchanged ../../ProjectSettings/GraphicsSettings.asset\ngit update-index --no-assume-unchanged ../../ProjectSettings/ProjectSettings.asset"
  },
  {
    "path": "Tools/CSharpLua/update_csharp.lua.cmd",
    "content": "set csharplua=D:\\Project\\Person\\CSharp.lua\nset launcher=%csharplua%\\CSharp.lua.Launcher\\bin\\Debug\\net5.0\nset coresystem=%csharplua%\\CSharp.lua\\CoreSystem.Lua\nset localcoresystem=..\\..\\Assets\\Lua\\CoreSystemLua\n\nxcopy %launcher% CSharp.lua /y \ndel /s /q CSharp.lua\\*.dev.json\ndel /s /q %localcoresystem%\\*.lua\nxcopy %coresystem% %localcoresystem% /s /y\n\ndel /s /q %localcoresystem%\\All.lua\nrd /s /q %localcoresystem%\\CoreSystem\\Numerics\nrd /s /q %localcoresystem%\\CoreSystem\\Globalization\nxcopy codes\\All.lua %localcoresystem% /s /y\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/Licence.txt",
    "content": "The core Protocol Buffers technology is provided courtesy of Google.\nAt the time of writing, this is released under the BSD license.\nFull details can be found here:\n\nhttp://code.google.com/p/protobuf/\n\n\nThis .NET implementation is Copyright 2008 Marc Gravell\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/common.xslt",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n    xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" exclude-result-prefixes=\"msxsl\"\n>\n  <!--\n  <xsl:template name=\"capitalizeFirst\">\n    <xsl:param name=\"value\"/>\n    <xsl:value-of select=\"translate(substring($value,1,1),$alpha,$ALPHA)\"/>\n    <xsl:value-of select=\"substring($value,2)\"/>\n  </xsl:template>\n  -->\n  <xsl:template match=\"*\">\n    <xsl:message terminate=\"yes\">\n      Node not handled: <xsl:for-each select=\"ancestor-or-self::*\">/<xsl:value-of select=\"name()\"/></xsl:for-each>\n      <xsl:for-each select=\"*\">\n        ; <xsl:value-of select=\"concat(name(),'=',.)\"/>\n      </xsl:for-each>\n    </xsl:message>\n  </xsl:template>\n  <xsl:param name=\"fixCase\"/>\n  <xsl:variable name=\"optionFixCase\" select=\"$fixCase='true'\"/>\n  \n  <xsl:template name=\"escapeKeyword\">\n    <xsl:param name=\"value\"/>\n    <xsl:value-of select=\"$value\"/>\n  </xsl:template>\n  \n  <xsl:template name=\"toCamelCase\">\n    <xsl:param name=\"value\"/>\n    <xsl:param name=\"delimiter\" select=\"'_'\"/>\n    <xsl:param name=\"keepDelimiter\" select=\"false()\"/>\n    <xsl:variable name=\"segment\" select=\"substring-before($value, $delimiter)\"/>\n    <xsl:choose>\n      <xsl:when test=\"$segment != ''\">\n        <xsl:value-of select=\"$segment\"/><xsl:if test=\"$keepDelimiter\"><xsl:value-of select=\"$delimiter\"/></xsl:if>\n        <xsl:call-template name=\"toPascalCase\">\n          <xsl:with-param name=\"value\" select=\"substring-after($value, $delimiter)\"/>\n          <xsl:with-param name=\"delimiter\" select=\"$delimiter\"/>\n          <xsl:with-param name=\"keepDelimiter\" select=\"$keepDelimiter\"/>\n        </xsl:call-template>\n      </xsl:when>\n      <xsl:otherwise>\n        <xsl:value-of select=\"$value\"/>\n      </xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n\n  <xsl:variable name=\"alpha\" select=\"'abcdefghijklmnopqrstuvwxyz'\"/>\n  <xsl:variable name=\"ALPHA\" select=\"'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\"/>\n\n  <xsl:template name=\"toPascalCase\">\n    <xsl:param name=\"value\"/>\n    <xsl:param name=\"delimiter\" select=\"'_'\"/>\n    <xsl:param name=\"keepDelimiter\" select=\"false()\"/>\n    <xsl:if test=\"$value != ''\">\n      <xsl:variable name=\"segment\" select=\"substring-before($value, $delimiter)\"/>\n      <xsl:choose>\n        <xsl:when test=\"$segment != ''\">\n          <xsl:value-of select=\"translate(substring($segment,1,1),$alpha,$ALPHA)\"/><xsl:value-of select=\"substring($segment,2)\"/><xsl:if test=\"$keepDelimiter\"><xsl:value-of select=\"$delimiter\"/></xsl:if>\n          <xsl:call-template name=\"toPascalCase\">\n            <xsl:with-param name=\"value\" select=\"substring-after($value, $delimiter)\"/>\n            <xsl:with-param name=\"delimiter\" select=\"$delimiter\"/>\n            <xsl:with-param name=\"keepDelimiter\" select=\"$keepDelimiter\"/>\n          </xsl:call-template>    \n        </xsl:when>\n        <xsl:otherwise>\n          <xsl:value-of select=\"translate(substring($value,1,1),$alpha,$ALPHA)\"/><xsl:value-of select=\"substring($value,2)\"/>\n        </xsl:otherwise>\n      </xsl:choose>      \n    </xsl:if>\n  </xsl:template>\n    <xsl:template name=\"pascal\">\n    <xsl:param name=\"value\" select=\"name\"/>\n    <xsl:param name=\"delimiter\" select=\"'_'\"/>\n    <xsl:call-template name=\"escapeKeyword\">\n      <xsl:with-param name=\"value\"><xsl:choose>\n      <xsl:when test=\"$optionFixCase\"><xsl:variable name=\"dotted\"><xsl:call-template name=\"toPascalCase\">\n          <xsl:with-param name=\"value\" select=\"$value\"/>\n          <xsl:with-param name=\"delimiter\" select=\"'.'\"/>\n          <xsl:with-param name=\"keepDelimiter\" select=\"true()\"/>\n        </xsl:call-template></xsl:variable><xsl:call-template name=\"toPascalCase\">\n          <xsl:with-param name=\"value\" select=\"$dotted\"/>\n          <xsl:with-param name=\"delimiter\" select=\"$delimiter\"/>\n        </xsl:call-template></xsl:when>\n      <xsl:otherwise><xsl:value-of select=\"$value\"/></xsl:otherwise>\n    </xsl:choose></xsl:with-param></xsl:call-template>\n  </xsl:template>\n  \n  <xsl:template name=\"PickNamespace\"><xsl:param name=\"defaultNamespace\"/><xsl:choose>\n    <xsl:when test=\"package\"><xsl:call-template name=\"pascal\">\n      <xsl:with-param name=\"value\" select=\"package\"/>\n    </xsl:call-template></xsl:when>\n    <xsl:when test=\"$defaultNamespace\"><xsl:value-of select=\"$defaultNamespace\"/></xsl:when>\n    <xsl:otherwise><xsl:variable name=\"trimmedName\"><xsl:choose>\n      <xsl:when test=\"substring(name,string-length(name)-5,6)='.proto'\"><xsl:value-of select=\"substring(name,1,string-length(name)-6)\"/></xsl:when>\n      <xsl:otherwise><xsl:value-of select=\"name\"/></xsl:otherwise>  \n    </xsl:choose></xsl:variable><xsl:call-template name=\"pascal\">\n      <xsl:with-param name=\"value\" select=\"$trimmedName\"/>\n    </xsl:call-template></xsl:otherwise>    \n  </xsl:choose></xsl:template>\n\n  <xsl:template match=\"FieldDescriptorProto/options\"/>\n  <xsl:template match=\"FileDescriptorProto/options\"/>\n  <xsl:template match=\"DescriptorProto/options\"/>\n  <xsl:template match=\"EnumValueDescriptorProto/options\"/>\n  <xsl:template match=\"EnumDescriptorProto/options\"/>\n  <xsl:template match=\"ServiceDescriptorProto/options\"/>\n  <xsl:template match=\"MethodDescriptorProto/options\"/>\n</xsl:stylesheet>\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/csharp.xslt",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xsl:stylesheet version=\"1.0\"\n    xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n    xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" exclude-result-prefixes=\"xsl msxsl\"\n>\n  <xsl:import href=\"common.xslt\"/>\n  <xsl:param name=\"help\"/>\n  <xsl:param name=\"xml\"/>\n  <xsl:param name=\"datacontract\"/>\n  <xsl:param name=\"binary\"/>\n  <xsl:param name=\"protoRpc\"/>\n  <xsl:param name=\"observable\"/>\n  <xsl:param name=\"preObservable\"/>\n  <xsl:param name=\"partialMethods\"/>\n  <xsl:param name=\"detectMissing\"/>\n  <xsl:param name=\"lightFramework\"/>\n  <xsl:param name=\"asynchronous\"/>\n  <xsl:param name=\"clientProxy\"/>\n  <xsl:param name=\"defaultNamespace\"/>\n  <xsl:param name=\"import\"/>\n  \n  <xsl:key name=\"fieldNames\" match=\"//FieldDescriptorProto\" use=\"name\"/>\n  <xsl:output method=\"text\" indent=\"no\" omit-xml-declaration=\"yes\"/>\n\n  <xsl:variable name=\"optionXml\" select=\"$xml='true'\"/>\n  <xsl:variable name=\"optionDataContract\" select=\"$datacontract='true'\"/>\n  <xsl:variable name=\"optionBinary\" select=\"$binary='true'\"/>\n  <xsl:variable name=\"optionProtoRpc\" select=\"$protoRpc='true'\"/>\n  <xsl:variable name=\"optionObservable\" select=\"$observable='true'\"/>\n  <xsl:variable name=\"optionPreObservable\" select=\"$preObservable='true'\"/>\n  <xsl:variable name=\"optionPartialMethods\" select=\"$partialMethods='true'\"/>\n  <xsl:variable name=\"optionDetectMissing\" select=\"$detectMissing='true'\"/>\n  <xsl:variable name=\"optionFullFramework\" select=\"not($lightFramework='true')\"/>\n  <xsl:variable name=\"optionAsynchronous\" select=\"$asynchronous='true'\"/>\n  <xsl:variable name=\"optionClientProxy\" select=\"$clientProxy='true'\"/>\n\n  <xsl:template match=\"/\">\n    <xsl:text disable-output-escaping=\"yes\">//------------------------------------------------------------------------------\n// &lt;auto-generated&gt;\n//     This code was generated by a tool.\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// &lt;/auto-generated&gt;\n//------------------------------------------------------------------------------\n</xsl:text><!--\n    --><xsl:apply-templates select=\"*\"/><!--\n  --></xsl:template>\n\n  <xsl:template name=\"WriteUsings\">\n    <xsl:param name=\"ns\"/>\n    <xsl:if test=\"$ns != ''\"><xsl:choose>\n   <xsl:when test=\"contains($ns,';')\">\nusing <xsl:value-of select=\"substring-before($ns,';')\"/>;<!--\n --><xsl:call-template name=\"WriteUsings\">\n       <xsl:with-param name=\"ns\" select=\"substring-after($ns,';')\"/>\n  </xsl:call-template>\n  </xsl:when>\n   <xsl:otherwise>\nusing <xsl:value-of select=\"$ns\"/>;\n   </xsl:otherwise>\n </xsl:choose></xsl:if></xsl:template>\n  \n  <xsl:template match=\"FileDescriptorSet\">\n    <xsl:if test=\"$help='true'\">\n      <xsl:message terminate=\"yes\">\n        CSharp template for protobuf-net.\n        Options:\n        General:\n          \"help\" - this page\n        Additional serializer support:\n          \"xml\" - enable explicit xml support (XmlSerializer)\n          \"datacontract\" - enable data-contract support (DataContractSerializer; requires .NET 3.0)\n          \"binary\" - enable binary support (BinaryFormatter; not supported on Silverlight)\n        Other:\n          \"protoRpc\" - enable proto-rpc client\n          \"observable\" - change notification (observer pattern) support\n          \"preObservable\" - pre-change notification (observer pattern) support (requires .NET 3.5)\n          \"partialMethods\" - provide partial methods for changes (requires C# 3.0)\n          \"detectMissing\" - provide *Specified properties to indicate whether fields are present\n          \"lightFramework\" - omit additional attributes not included in CF/Silverlight\n          \"asynchronous\" - emit asynchronous methods for use with WCF\n          \"clientProxy\" - emit asynchronous client proxy class\n          \"import\" - additional namespaces to import (semicolon delimited)\n          \"fixCase\" - change type/member names (types/properties become PascalCase; fields become camelCase)\n      </xsl:message>\n    </xsl:if>\n\n    <xsl:if test=\"$optionXml and $optionDataContract\">\n      <xsl:message terminate=\"yes\">\n        Invalid options: xml and data-contract serialization are mutually exclusive.\n      </xsl:message>\n    </xsl:if>\n    <xsl:if test=\"$optionXml\">\n// Option: xml serialization ([XmlType]/[XmlElement]) enabled\n    </xsl:if><xsl:if test=\"$optionDataContract\">\n// Option: data-contract serialization ([DataContract]/[DataMember]) enabled\n    </xsl:if><xsl:if test=\"$optionBinary\">\n// Option: binary serialization (ISerializable) enabled\n    </xsl:if><xsl:if test=\"$optionObservable\">\n// Option: observable (OnPropertyChanged) enabled\n    </xsl:if><xsl:if test=\"$optionPreObservable\">\n// Option: pre-observable (OnPropertyChanging) enabled\n    </xsl:if><xsl:if test=\"$partialMethods\">\n// Option: partial methods (On*Changing/On*Changed) enabled\n    </xsl:if><xsl:if test=\"$optionDetectMissing\">\n// Option: missing-value detection (*Specified/ShouldSerialize*/Reset*) enabled\n    </xsl:if><xsl:if test=\"not($optionFullFramework)\">\n// Option: light framework (CF/Silverlight) enabled\n    </xsl:if><xsl:if test=\"$optionProtoRpc\">\n// Option: proto-rpc enabled\n  </xsl:if>\n    <xsl:call-template name=\"WriteUsings\">\n      <xsl:with-param name=\"ns\" select=\"$import\"/>\n    </xsl:call-template>\n    <xsl:apply-templates select=\"file/FileDescriptorProto\"/>\n  </xsl:template>\n\n  \n  <xsl:template match=\"FileDescriptorProto\">\n// Generated from: <xsl:value-of select=\"name\"/>\n\nusing System;   \nusing System.Collections.Generic;\nusing ProtoBuf;\n    <xsl:apply-templates select=\"dependency/string[.!='']\"/>\n    <xsl:variable name=\"namespace\"><xsl:call-template name=\"PickNamespace\">\n      <xsl:with-param name=\"defaultNamespace\" select=\"$defaultNamespace\"/>\n        </xsl:call-template>\n      </xsl:variable>\n    <xsl:if test=\"string($namespace) != ''\">\nnamespace <xsl:value-of select=\"translate($namespace,':-/\\','__..')\"/>\n{</xsl:if>\n    <xsl:apply-templates select=\"message_type | enum_type | service\"/>\n    <xsl:if test=\"string($namespace) != ''\">\n}</xsl:if></xsl:template>\n  \n  <xsl:template match=\"FileDescriptorProto/dependency/string\">\n// Note: requires additional types generated from: <xsl:value-of select=\".\"/></xsl:template>\n\n\n  <xsl:template name=\"camel\">\n    <xsl:param name=\"value\" select=\"name\"/>\n    <xsl:param name=\"delimiter\" select=\"'_'\"/>\n    <xsl:choose>\n      <xsl:when test=\"$optionFixCase\"><xsl:call-template name=\"toCamelCase\">\n          <xsl:with-param name=\"value\" select=\"$value\"/>\n          <xsl:with-param name=\"delimiter\" select=\"$delimiter\"/>\n        </xsl:call-template></xsl:when>\n      <xsl:otherwise><xsl:value-of select=\"$value\"/></xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n  \n  <xsl:template match=\"DescriptorProto\">\n  [ProtoContract]\n  <xsl:if test=\"$optionDataContract\">[global::System.Runtime.Serialization.DataContract(Name=@\"<xsl:value-of select=\"name\"/>\")]\n  </xsl:if><xsl:if test=\"$optionXml\">[global::System.Xml.Serialization.XmlType(TypeName=@\"<xsl:value-of select=\"name\"/>\")]\n  </xsl:if><!--\n  -->public partial class <xsl:call-template name=\"pascal\"/> : IProtocol<!--\n  --><xsl:if test=\"$optionBinary\">, global::System.Runtime.Serialization.ISerializable</xsl:if><!--\n  --><xsl:if test=\"$optionObservable\">, global::System.ComponentModel.INotifyPropertyChanged</xsl:if><!--\n  --><xsl:if test=\"$optionPreObservable\">, global::System.ComponentModel.INotifyPropertyChanging</xsl:if>\n  { <!--     public <xsl:call-template name=\"pascal\"/>() {} -->\n    <xsl:apply-templates select=\"*\"/><xsl:if test=\"$optionBinary\">\n    protected <xsl:call-template name=\"pascal\"/>(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context)\n      : this() { global::ProtoBuf.Serializer.Merge(info, this); }\n    void global::System.Runtime.Serialization.ISerializable.GetObjectData(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context)\n      { global::ProtoBuf.Serializer.Serialize(info, this); }\n    </xsl:if><xsl:if test=\"$optionObservable\">\n    public event global::System.ComponentModel.PropertyChangedEventHandler PropertyChanged;\n    protected virtual void OnPropertyChanged(string propertyName)\n      { if(PropertyChanged != null) PropertyChanged(this, new global::System.ComponentModel.PropertyChangedEventArgs(propertyName)); }\n    </xsl:if><xsl:if test=\"$optionPreObservable\">\n    public event global::System.ComponentModel.PropertyChangingEventHandler PropertyChanging;\n    protected virtual void OnPropertyChanging(string propertyName)\n    { if(PropertyChanging != null) PropertyChanging(this, new global::System.ComponentModel.PropertyChangingEventArgs(propertyName)); }\n    </xsl:if>\n  }\n  </xsl:template>\n\n  <xsl:template match=\"DescriptorProto/name | DescriptorProto/extension_range | DescriptorProto/extension\"/>\n  \n  <xsl:template match=\"\n                FileDescriptorProto/message_type | FileDescriptorProto/enum_type | FileDescriptorProto/service\n                | DescriptorProto/enum_type | DescriptorProto/message_type\n                | DescriptorProto/nested_type | EnumDescriptorProto/value | ServiceDescriptorProto/method\">\n    <xsl:apply-templates select=\"*\"/>\n  </xsl:template>\n\n  <xsl:template match=\"DescriptorProto/field\">\n    <xsl:apply-templates select=\"*\"/>\n    <xsl:variable name=\"extName\" select=\"concat('.',(ancestor::FileDescriptorProto/package)[1],'.',../name)\"/>\n    <xsl:apply-templates select=\"//FieldDescriptorProto[extendee=$extName]\"/>\n  </xsl:template>\n\n  <xsl:template match=\"EnumDescriptorProto\">\n    [ProtoContract]\n    <xsl:if test=\"$optionDataContract\">[global::System.Runtime.Serialization.DataContract(Name=@\"<xsl:value-of select=\"name\"/>\")]\n    </xsl:if>\n    <xsl:if test=\"$optionXml\">[global::System.Xml.Serialization.XmlType(TypeName=@\"<xsl:value-of select=\"name\"/>\")]\n    </xsl:if><!--\n    -->public enum <xsl:call-template name=\"pascal\"/>\n    {\n      <xsl:apply-templates select=\"value\"/>\n    }\n  </xsl:template>\n\n  <xsl:template match=\"EnumValueDescriptorProto\">\n      <xsl:variable name=\"value\"><xsl:choose>\n        <xsl:when test=\"number\"><xsl:value-of select=\"number\"/></xsl:when>\n        <xsl:otherwise>0</xsl:otherwise>\n      </xsl:choose></xsl:variable>      \n      [ProtoEnum(Value=<xsl:value-of select=\"$value\"/>)]<!--\n      --><xsl:if test=\"$optionDataContract\">\n      [global::System.Runtime.Serialization.EnumMember(Value=@\"<xsl:value-of select=\"name\"/>\")]</xsl:if><!--\n      --><xsl:if test=\"$optionXml\">\n      [global::System.Xml.Serialization.XmlEnum(@\"<xsl:value-of select=\"name\"/>\")]</xsl:if><!--\n      --><xsl:text disable-output-escaping=\"yes\">\n      </xsl:text><xsl:call-template name=\"pascal\"/><xsl:text xml:space=\"preserve\"> = </xsl:text><xsl:value-of select=\"$value\"/><xsl:if test=\"position()!=last()\">,\n      </xsl:if>\n  </xsl:template>\n\n  <xsl:template match=\"FieldDescriptorProto\" mode=\"field\">\n    <xsl:variable name=\"field\"><xsl:choose>\n      <xsl:when test=\"$optionFixCase\"><xsl:call-template name=\"toCamelCase\">\n          <xsl:with-param name=\"value\" select=\"name\"/>\n        </xsl:call-template></xsl:when>\n      <xsl:otherwise><xsl:value-of select=\"name\"/></xsl:otherwise>\n    </xsl:choose></xsl:variable>\n    <xsl:call-template name=\"escapeKeyword\">\n      <xsl:with-param name=\"value\"><xsl:choose>\n      <xsl:when test=\"not(key('fieldNames',concat('_',$field)))\"><xsl:value-of select=\"concat('_',$field)\"/></xsl:when>\n      <xsl:when test=\"not(key('fieldNames',concat($field,'Field')))\"><xsl:value-of select=\"concat($field,'Field')\"/></xsl:when>\n      <xsl:otherwise><xsl:value-of select=\"concat('_',generate-id())\"/></xsl:otherwise>\n    </xsl:choose></xsl:with-param>\n    </xsl:call-template>\n  </xsl:template>\n\n  <xsl:template name=\"escapeKeyword\">\n    <xsl:param name=\"value\"/>\n    <xsl:if test=\"contains($keywords,concat('|',$value,'|'))\">@</xsl:if><xsl:value-of select=\"$value\"/>\n  </xsl:template>\n  <xsl:variable name=\"keywords\">|abstract|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|</xsl:variable>\n\n  <xsl:template match=\"FieldDescriptorProto\" mode=\"format\">\n    <xsl:choose>\n      <xsl:when test=\"type='TYPE_DOUBLE' or type='TYPE_FLOAT'\n                or type='TYPE_FIXED32' or type='TYPE_FIXED64'\n                or type='TYPE_SFIXED32' or type='TYPE_SFIXED64'\">FixedSize</xsl:when>\n      <xsl:when test=\"type='TYPE_GROUP'\">Group</xsl:when>\n      <xsl:when test=\"not(type) or type='TYPE_INT32' or type='TYPE_INT64'\n                or type='TYPE_UINT32' or type='TYPE_UINT64'\n                or type='TYPE_ENUM'\">TwosComplement</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT32' or type='TYPE_SINT64'\">ZigZag</xsl:when>\n      <xsl:otherwise>Default</xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n  <xsl:template match=\"FieldDescriptorProto\" mode=\"primitiveType\">\n    <xsl:choose>\n      <xsl:when test=\"not(type)\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_DOUBLE'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_FLOAT'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_INT64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_INT32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_BOOL'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_STRING'\">class</xsl:when>\n      <xsl:when test=\"type='TYPE_BYTES'\">class</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_ENUM'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_GROUP' or type='TYPE_MESSAGE'\">none</xsl:when>\n      <xsl:otherwise>\n        <xsl:message terminate=\"yes\">\n          Field type not implemented: <xsl:value-of select=\"type\"/> (<xsl:value-of select=\"../../name\"/>.<xsl:value-of select=\"name\"/>)\n        </xsl:message>\n      </xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n  <xsl:template match=\"FieldDescriptorProto\" mode=\"type\">\n    <xsl:choose>\n      <xsl:when test=\"not(type)\">double</xsl:when>\n      <xsl:when test=\"type='TYPE_DOUBLE'\">double</xsl:when>\n      <xsl:when test=\"type='TYPE_FLOAT'\">float</xsl:when>\n      <xsl:when test=\"type='TYPE_INT64'\">long</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT64'\">ulong</xsl:when>\n      <xsl:when test=\"type='TYPE_INT32'\">int</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED64'\">ulong</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED32'\">uint</xsl:when>\n      <xsl:when test=\"type='TYPE_BOOL'\">bool</xsl:when>\n      <xsl:when test=\"type='TYPE_STRING'\">string</xsl:when>\n      <xsl:when test=\"type='TYPE_BYTES'\">byte[]</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT32'\">uint</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED32'\">int</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED64'\">long</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT32'\">int</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT64'\">long</xsl:when>\n      <xsl:when test=\"type='TYPE_GROUP' or type='TYPE_MESSAGE' or type='TYPE_ENUM'\"><xsl:call-template name=\"pascal\">\n        <xsl:with-param name=\"value\" select=\"substring-after(type_name,'.')\"/>\n      </xsl:call-template></xsl:when>\n      <xsl:otherwise>\n        <xsl:message terminate=\"yes\">\n          Field type not implemented: <xsl:value-of select=\"type\"/> (<xsl:value-of select=\"../../name\"/>.<xsl:value-of select=\"name\"/>)\n        </xsl:message>\n      </xsl:otherwise>\n    </xsl:choose>\n    \n  </xsl:template>\n\n  <xsl:template match=\"FieldDescriptorProto[default_value]\" mode=\"defaultValue\">\n    <xsl:choose>\n      <xsl:when test=\"type='TYPE_STRING'\">@\"<xsl:value-of select=\"default_value\"/>\"</xsl:when>\n      <xsl:when test=\"type='TYPE_ENUM'\"><xsl:apply-templates select=\".\" mode=\"type\"/>.<xsl:call-template name=\"pascal\">\n        <xsl:with-param name=\"value\" select=\"default_value\"/>\n      </xsl:call-template></xsl:when>\n      <xsl:when test=\"type='TYPE_BYTES'\"> /* \n        <xsl:value-of select=\"default_value\"/>\n        */ null </xsl:when>\n      <xsl:otherwise>(<xsl:apply-templates select=\".\" mode=\"type\"/>)<xsl:value-of select=\"default_value\"/></xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n\n  <!--\n    We need to find the first enum value given .foo.bar.SomeEnum - but the enum itself\n    only knows about SomeEnum; we need to look at all parent DescriptorProto nodes, and\n    the FileDescriptorProto for the namespace.\n    \n    This does an annoying up/down recursion... a bit expensive, but *generally* OK.\n    Could perhaps index the last part of the enum name to reduce overhead?\n  -->\n  <xsl:template name=\"GetFirstEnumValue\">\n    <xsl:variable name=\"hunt\" select=\"type_name\"/>\n    <xsl:for-each select=\"//EnumDescriptorProto\">\n      <xsl:variable name=\"fullName\">\n        <xsl:for-each select=\"ancestor::FileDescriptorProto[package!='']\">.<xsl:value-of select=\"package\"/></xsl:for-each>\n        <xsl:for-each select=\"ancestor::DescriptorProto\">.<xsl:value-of select=\"name\"/></xsl:for-each>\n        <xsl:value-of select=\"'.'\"/>\n        <xsl:call-template name=\"pascal\"/>\n      </xsl:variable>\n      <xsl:if test=\"$fullName=$hunt\"><xsl:value-of select=\"(value/EnumValueDescriptorProto)[1]/name\"/></xsl:if>\n    </xsl:for-each>\n  </xsl:template>\n  \n  <xsl:template match=\"FieldDescriptorProto[not(default_value)]\" mode=\"defaultValue\">\n    <xsl:choose>\n      <xsl:when test=\"type='TYPE_STRING'\">\"\"</xsl:when>\n      <xsl:when test=\"type='TYPE_MESSAGE'\">null</xsl:when>\n      <xsl:when test=\"type='TYPE_BYTES'\">null</xsl:when>\n      <xsl:when test=\"type='TYPE_ENUM'\"><xsl:apply-templates select=\".\" mode=\"type\"/>.<xsl:call-template name=\"GetFirstEnumValue\"/></xsl:when>\n      <xsl:otherwise>default(<xsl:apply-templates select=\".\" mode=\"type\"/>)</xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n\n  <xsl:template match=\"FieldDescriptorProto\" mode=\"checkDeprecated\"><!--\n    --><xsl:if test=\"options/deprecated='true'\">global::System.Obsolete, </xsl:if><!--\n  --></xsl:template>\n  <xsl:template match=\"FieldDescriptorProto[label='LABEL_OPTIONAL' or not(label)]\">\n    <xsl:variable name=\"propType\"><xsl:apply-templates select=\".\" mode=\"type\"/></xsl:variable>\n    <xsl:variable name=\"format\"><xsl:apply-templates select=\".\" mode=\"format\"/></xsl:variable>\n    <xsl:variable name=\"primitiveType\"><xsl:apply-templates select=\".\" mode=\"primitiveType\"/></xsl:variable>\n    <xsl:variable name=\"defaultValue\"><xsl:apply-templates select=\".\" mode=\"defaultValue\"/></xsl:variable>\n    <xsl:variable name=\"field\"><xsl:apply-templates select=\".\" mode=\"field\"/></xsl:variable>\n    <xsl:variable name=\"specified\" select=\"$optionDetectMissing and ($primitiveType='struct' or $primitiveType='class')\"/>\n    <xsl:variable name=\"fieldType\"><xsl:value-of select=\"$propType\"/><xsl:if test=\"$specified and $primitiveType='struct'\">?</xsl:if></xsl:variable>\n    [<xsl:apply-templates select=\".\" mode=\"checkDeprecated\"/>ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired = false, DataFormat = DataFormat.<xsl:value-of select=\"$format\"/>)]<!--\n    --><xsl:if test=\"not($specified)\">\n    [global::System.ComponentModel.DefaultValue(<xsl:value-of select=\"$defaultValue\"/>)]</xsl:if><!--\n    --><xsl:if test=\"$optionXml\">\n    [global::System.Xml.Serialization.XmlElement(@\"<xsl:value-of select=\"name\"/>\", Order = <xsl:value-of select=\"number\"/>)]\n    </xsl:if><xsl:if test=\"$optionDataContract\">\n    [global::System.Runtime.Serialization.DataMember(Name=@\"<xsl:value-of select=\"name\"/>\", Order = <xsl:value-of select=\"number\"/>, IsRequired = false)]\n    </xsl:if><xsl:call-template name=\"WriteGetSet\">\n      <xsl:with-param name=\"fieldType\" select=\"$fieldType\"/>\n      <xsl:with-param name=\"propType\" select=\"$propType\"/>\n      <xsl:with-param name=\"name\"><xsl:call-template name=\"pascal\"/></xsl:with-param>\n      <xsl:with-param name=\"field\" select=\"$field\"/>\n      <xsl:with-param name=\"defaultValue\" select=\"$defaultValue\"/>\n      <xsl:with-param name=\"specified\" select=\"$specified\"/>\n    </xsl:call-template>\n  </xsl:template>\n  \n  <xsl:template match=\"FieldDescriptorProto[label='LABEL_REQUIRED']\">\n    <xsl:variable name=\"type\"><xsl:apply-templates select=\".\" mode=\"type\"/></xsl:variable>\n    <xsl:variable name=\"format\"><xsl:apply-templates select=\".\" mode=\"format\"/></xsl:variable>\n    <xsl:variable name=\"field\"><xsl:apply-templates select=\".\" mode=\"field\"/></xsl:variable>\n    [<xsl:apply-templates select=\".\" mode=\"checkDeprecated\"/>ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired = true, DataFormat = DataFormat.<xsl:value-of select=\"$format\"/>)]<!--\n    --><xsl:if test=\"$optionXml\">\n    [global::System.Xml.Serialization.XmlElement(@\"<xsl:value-of select=\"name\"/>\", Order = <xsl:value-of select=\"number\"/>)]\n    </xsl:if><xsl:if test=\"$optionDataContract\">\n    [global::System.Runtime.Serialization.DataMember(Name=@\"<xsl:value-of select=\"name\"/>\", Order = <xsl:value-of select=\"number\"/>, IsRequired = true)]\n    </xsl:if><xsl:call-template name=\"WriteGetSet\">\n      <xsl:with-param name=\"fieldType\" select=\"$type\"/>\n      <xsl:with-param name=\"propType\" select=\"$type\"/>\n      <xsl:with-param name=\"name\"><xsl:call-template name=\"pascal\"/></xsl:with-param>\n      <xsl:with-param name=\"field\" select=\"$field\"/>\n    </xsl:call-template>    \n  </xsl:template>\n\n  <xsl:template name=\"stripKeyword\">\n    <xsl:param name=\"value\"/>\n    <xsl:choose>\n      <xsl:when test=\"starts-with($value,'@')\"><xsl:value-of select=\"substring-after($value,'@')\"/></xsl:when>\n      <xsl:otherwise><xsl:value-of select=\"$value\"/></xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n  \n  <xsl:template name=\"WriteGetSet\">\n    <xsl:param name=\"fieldType\"/>\n    <xsl:param name=\"propType\"/>\n    <xsl:param name=\"name\"/>\n    <xsl:param name=\"field\"/>\n    <xsl:param name=\"specified\" select=\"false()\"/>\n    <xsl:param name=\"defaultValue\"/>\n    <xsl:variable name=\"nameNoKeyword\">\n      <xsl:call-template name=\"stripKeyword\">\n        <xsl:with-param name=\"value\" select=\"$name\"/>\n      </xsl:call-template></xsl:variable>\n    public <xsl:value-of select=\"concat($propType,' ',$name)\"/> { get; set; }\n    <xsl:if test=\"$optionPartialMethods\">\n    partial void On<xsl:value-of select=\"$nameNoKeyword\"/>Changing(<xsl:value-of select=\"$propType\"/> value);\n    partial void On<xsl:value-of select=\"$nameNoKeyword\"/>Changed();</xsl:if><xsl:if test=\"$specified\">\n    [global::System.Xml.Serialization.XmlIgnore]\n    <xsl:if test=\"$optionFullFramework\">[global::System.ComponentModel.Browsable(false)]</xsl:if>\n    public bool <xsl:value-of select=\"$nameNoKeyword\"/>Specified\n    {\n      get { return this.<xsl:value-of select=\"$field\"/> != null; }\n      set { if (value == (this.<xsl:value-of select=\"$field\"/>== null)) this.<xsl:value-of select=\"$field\"/> = value ? this.<xsl:value-of select=\"$name\"/> : (<xsl:value-of select=\"$fieldType\"/>)null; }\n    }\n    private bool ShouldSerialize<xsl:value-of select=\"$nameNoKeyword\"/>() { return <xsl:value-of select=\"$nameNoKeyword\"/>Specified; }\n    private void Reset<xsl:value-of select=\"$nameNoKeyword\"/>() { <xsl:value-of select=\"$nameNoKeyword\"/>Specified = false; }\n    </xsl:if>\n  </xsl:template>\n  <xsl:template match=\"FieldDescriptorProto[label='LABEL_REPEATED']\">\n    <xsl:variable name=\"type\"><xsl:apply-templates select=\".\" mode=\"type\"/></xsl:variable>\n    <xsl:variable name=\"format\"><xsl:apply-templates select=\".\" mode=\"format\"/></xsl:variable>\n    <xsl:variable name=\"field\"><xsl:apply-templates select=\".\" mode=\"field\"/></xsl:variable>\n    [<xsl:apply-templates select=\".\" mode=\"checkDeprecated\"/>ProtoMember(<xsl:value-of select=\"number\"/>, DataFormat = DataFormat.<xsl:value-of select=\"$format\"/><xsl:if test=\"options/packed='true'\">, Options = global::ProtoBuf.MemberSerializationOptions.Packed</xsl:if>)]<!--\n    --><xsl:if test=\"$optionDataContract\">\n    [global::System.Runtime.Serialization.DataMember(Name=@\"<xsl:value-of select=\"name\"/>\", Order = <xsl:value-of select=\"number\"/>, IsRequired = false)]\n    </xsl:if><xsl:if test=\"$optionXml\">\n    [global::System.Xml.Serialization.XmlElement(@\"<xsl:value-of select=\"name\"/>\", Order = <xsl:value-of select=\"number\"/>)]\n    </xsl:if>\n    public List&lt;<xsl:value-of select=\"$type\" />&gt; <xsl:call-template name=\"pascal\"/> { get; set; } = new List&lt;<xsl:value-of select=\"$type\"/>&gt;();\n  </xsl:template>\n\n  <xsl:template match=\"ServiceDescriptorProto\">\n    <xsl:if test=\"($optionClientProxy or $optionDataContract)\">\n    [global::System.ServiceModel.ServiceContract(Name = @\"<xsl:value-of select=\"name\"/>\")]</xsl:if>\n    public interface I<xsl:value-of select=\"name\"/>\n    {\n      <xsl:apply-templates select=\"method\"/>\n    }\n    \n    <xsl:if test=\"$optionProtoRpc\">\n    public class <xsl:value-of select=\"name\"/>Client : global::ProtoBuf.ServiceModel.RpcClient\n    {\n      public <xsl:value-of select=\"name\"/>Client() : base(typeof(I<xsl:value-of select=\"name\"/>)) { }\n      <xsl:apply-templates select=\"method/MethodDescriptorProto\" mode=\"protoRpc\"/>\n    }\n    </xsl:if>\n    <xsl:apply-templates select=\".\" mode=\"clientProxy\"/>\n    \n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto\">\n    <xsl:if test=\"($optionClientProxy or $optionDataContract)\">\n        [global::System.ServiceModel.OperationContract(Name = @\"<xsl:value-of select=\"name\"/>\")]\n        <xsl:if test=\"$optionFullFramework\">[global::ProtoBuf.ServiceModel.ProtoBehavior]</xsl:if>\n    </xsl:if>\n        <xsl:apply-templates select=\"output_type\"/><xsl:text xml:space=\"preserve\"> </xsl:text><xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request);\n    <xsl:if test=\"$optionAsynchronous and ($optionClientProxy or $optionDataContract)\">\n        [global::System.ServiceModel.OperationContract(AsyncPattern = true, Name = @\"<xsl:value-of select=\"name\"/>\")]\n        global::System.IAsyncResult Begin<xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request, global::System.AsyncCallback callback, object state);\n    <xsl:apply-templates select=\"output_type\"/> End<xsl:value-of select=\"name\"/>(global::System.IAsyncResult ar);\n    </xsl:if>\n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto\" mode=\"protoRpc\">\n        <xsl:apply-templates select=\"output_type\"/><xsl:text xml:space=\"preserve\"> </xsl:text><xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request)\n        {\n            return (<xsl:apply-templates select=\"output_type\"/>) Send(@\"<xsl:value-of select=\"name\"/>\", request);\n        }\n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto/input_type | MethodDescriptorProto/output_type\">\n    <xsl:value-of select=\"substring-after(.,'.')\"/>\n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto\" mode=\"CompleteEvent\">\n  <xsl:if test=\"$optionAsynchronous and $optionDataContract\">\n    public partial class <xsl:value-of select=\"name\"/>CompletedEventArgs : global::System.ComponentModel.AsyncCompletedEventArgs\n    {\n        private object[] results;\n\n        public <xsl:value-of select=\"name\"/>CompletedEventArgs(object[] results, global::System.Exception exception, bool cancelled, object userState)\n            : base(exception, cancelled, userState) \n        {\n            this.results = results;\n        }\n        \n        public <xsl:apply-templates select=\"output_type\"/> Result\n        {\n            get { \n                base.RaiseExceptionIfNecessary();\n                return (<xsl:apply-templates select=\"output_type\"/>)(this.results[0]); \n            }\n        }\n    }\n  </xsl:if>\n  </xsl:template>\n\n  <xsl:template match=\"ServiceDescriptorProto\" mode=\"clientProxy\">\n  <xsl:if test=\"$optionAsynchronous and $optionDataContract and $optionClientProxy\">\n    <xsl:apply-templates select=\"method/MethodDescriptorProto\" mode=\"CompleteEvent\"/>\n    \n    [global::System.Diagnostics.DebuggerStepThroughAttribute()]\n    public partial class <xsl:value-of select=\"name\"/>Client : global::System.ServiceModel.ClientBase&lt;I<xsl:value-of select=\"name\"/>&gt;, I<xsl:value-of select=\"name\"/>\n    {\n\n        public <xsl:value-of select=\"name\"/>Client()\n        {}\n        public <xsl:value-of select=\"name\"/>Client(string endpointConfigurationName) \n            : base(endpointConfigurationName) \n        {}\n        public <xsl:value-of select=\"name\"/>Client(string endpointConfigurationName, string remoteAddress) \n            : base(endpointConfigurationName, remoteAddress)\n        {}\n        public <xsl:value-of select=\"name\"/>Client(string endpointConfigurationName, global::System.ServiceModel.EndpointAddress remoteAddress)\n            : base(endpointConfigurationName, remoteAddress)\n        {}\n        public <xsl:value-of select=\"name\"/>Client(global::System.ServiceModel.Channels.Binding binding, global::System.ServiceModel.EndpointAddress remoteAddress)\n            : base(binding, remoteAddress)\n        {}\n\n        <xsl:apply-templates select=\"method/MethodDescriptorProto\" mode=\"clientProxy\"/>\n    }  \n  </xsl:if>\n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto\" mode=\"clientProxy\">\n  <xsl:if test=\"$optionAsynchronous and $optionDataContract and $optionClientProxy\">\n        private BeginOperationDelegate onBegin<xsl:value-of select=\"name\"/>Delegate;\n        private EndOperationDelegate onEnd<xsl:value-of select=\"name\"/>Delegate;\n        private global::System.Threading.SendOrPostCallback on<xsl:value-of select=\"name\"/>CompletedDelegate;\n\n        public event global::System.EventHandler&lt;<xsl:value-of select=\"name\"/>CompletedEventArgs&gt; <xsl:value-of select=\"name\"/>Completed;\n\n        public <xsl:apply-templates select=\"output_type\"/><xsl:text xml:space=\"preserve\"> </xsl:text><xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request)\n        {\n            return base.Channel.<xsl:value-of select=\"name\"/>(request);\n        }\n\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        public global::System.IAsyncResult Begin<xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request, global::System.AsyncCallback callback, object asyncState)\n        {\n            return base.Channel.Begin<xsl:value-of select=\"name\"/>(request, callback, asyncState);\n        }\n\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        public <xsl:apply-templates select=\"output_type\"/> End<xsl:value-of select=\"name\"/>(global::System.IAsyncResult result)\n        {\n            return base.Channel.End<xsl:value-of select=\"name\"/>(result);\n        }\n\n        private global::System.IAsyncResult OnBegin<xsl:value-of select=\"name\"/>(object[] inValues, global::System.AsyncCallback callback, object asyncState)\n        {\n            <xsl:apply-templates select=\"input_type\"/> request = ((<xsl:apply-templates select=\"input_type\"/>)(inValues[0]));\n            return this.Begin<xsl:value-of select=\"name\"/>(request, callback, asyncState);\n        }\n\n        private object[] OnEnd<xsl:value-of select=\"name\"/>(global::System.IAsyncResult result)\n        {\n            <xsl:apply-templates select=\"output_type\"/> retVal = this.End<xsl:value-of select=\"name\"/>(result);\n            return new object[] {\n                retVal};\n        }\n\n        private void On<xsl:value-of select=\"name\"/>Completed(object state)\n        {\n            if ((this.<xsl:value-of select=\"name\"/>Completed != null))\n            {\n                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));\n                this.<xsl:value-of select=\"name\"/>Completed(this, new <xsl:value-of select=\"name\"/>CompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));\n            }\n        }\n\n        public void <xsl:value-of select=\"name\"/>Async(<xsl:apply-templates select=\"input_type\"/> request)\n        {\n            this.<xsl:value-of select=\"name\"/>Async(request, null);\n        }\n\n        public void <xsl:value-of select=\"name\"/>Async(<xsl:apply-templates select=\"input_type\"/> request, object userState)\n        {\n            if ((this.onBegin<xsl:value-of select=\"name\"/>Delegate == null))\n            {\n                this.onBegin<xsl:value-of select=\"name\"/>Delegate = new BeginOperationDelegate(this.OnBegin<xsl:value-of select=\"name\"/>);\n            }\n            if ((this.onEnd<xsl:value-of select=\"name\"/>Delegate == null))\n            {\n                this.onEnd<xsl:value-of select=\"name\"/>Delegate = new EndOperationDelegate(this.OnEnd<xsl:value-of select=\"name\"/>);\n            }\n            if ((this.on<xsl:value-of select=\"name\"/>CompletedDelegate == null))\n            {\n                this.on<xsl:value-of select=\"name\"/>CompletedDelegate = new global::System.Threading.SendOrPostCallback(this.On<xsl:value-of select=\"name\"/>Completed);\n            }\n            base.InvokeAsync(this.onBegin<xsl:value-of select=\"name\"/>Delegate, new object[] {\n                    request}, this.onEnd<xsl:value-of select=\"name\"/>Delegate, this.on<xsl:value-of select=\"name\"/>CompletedDelegate, userState);\n        }\n    </xsl:if>\n    </xsl:template>\n</xsl:stylesheet>\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/descriptor.proto",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// http://code.google.com/p/protobuf/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: kenton@google.com (Kenton Varda)\n//  Based on original Protocol Buffers design by\n//  Sanjay Ghemawat, Jeff Dean, and others.\n//\n// The messages in this file describe the definitions found in .proto files.\n// A valid .proto file can be translated directly to a FileDescriptorProto\n// without any other information (e.g. without reading its imports).\n\n\n\npackage google.protobuf;\noption java_package = \"com.google.protobuf\";\noption java_outer_classname = \"DescriptorProtos\";\n\n// descriptor.proto must be optimized for speed because reflection-based\n// algorithms don't work during bootstrapping.\noption optimize_for = SPEED;\n\n// The protocol compiler can output a FileDescriptorSet containing the .proto\n// files it parses.\nmessage FileDescriptorSet {\n  repeated FileDescriptorProto file = 1;\n}\n\n// Describes a complete .proto file.\nmessage FileDescriptorProto {\n  optional string name = 1;       // file name, relative to root of source tree\n  optional string package = 2;    // e.g. \"foo\", \"foo.bar\", etc.\n\n  // Names of files imported by this file.\n  repeated string dependency = 3;\n\n  // All top-level definitions in this file.\n  repeated DescriptorProto message_type = 4;\n  repeated EnumDescriptorProto enum_type = 5;\n  repeated ServiceDescriptorProto service = 6;\n  repeated FieldDescriptorProto extension = 7;\n\n  optional FileOptions options = 8;\n\n  // This field contains optional information about the original source code.\n  // You may safely remove this entire field whithout harming runtime\n  // functionality of the descriptors -- the information is needed only by\n  // development tools.\n  optional SourceCodeInfo source_code_info = 9;\n}\n\n// Describes a message type.\nmessage DescriptorProto {\n  optional string name = 1;\n\n  repeated FieldDescriptorProto field = 2;\n  repeated FieldDescriptorProto extension = 6;\n\n  repeated DescriptorProto nested_type = 3;\n  repeated EnumDescriptorProto enum_type = 4;\n\n  message ExtensionRange {\n    optional int32 start = 1;\n    optional int32 end = 2;\n  }\n  repeated ExtensionRange extension_range = 5;\n\n  optional MessageOptions options = 7;\n}\n\n// Describes a field within a message.\nmessage FieldDescriptorProto {\n  enum Type {\n    // 0 is reserved for errors.\n    // Order is weird for historical reasons.\n    TYPE_DOUBLE         = 1;\n    TYPE_FLOAT          = 2;\n    TYPE_INT64          = 3;   // Not ZigZag encoded.  Negative numbers\n                               // take 10 bytes.  Use TYPE_SINT64 if negative\n                               // values are likely.\n    TYPE_UINT64         = 4;\n    TYPE_INT32          = 5;   // Not ZigZag encoded.  Negative numbers\n                               // take 10 bytes.  Use TYPE_SINT32 if negative\n                               // values are likely.\n    TYPE_FIXED64        = 6;\n    TYPE_FIXED32        = 7;\n    TYPE_BOOL           = 8;\n    TYPE_STRING         = 9;\n    TYPE_GROUP          = 10;  // Tag-delimited aggregate.\n    TYPE_MESSAGE        = 11;  // Length-delimited aggregate.\n\n    // New in version 2.\n    TYPE_BYTES          = 12;\n    TYPE_UINT32         = 13;\n    TYPE_ENUM           = 14;\n    TYPE_SFIXED32       = 15;\n    TYPE_SFIXED64       = 16;\n    TYPE_SINT32         = 17;  // Uses ZigZag encoding.\n    TYPE_SINT64         = 18;  // Uses ZigZag encoding.\n  };\n\n  enum Label {\n    // 0 is reserved for errors\n    LABEL_OPTIONAL      = 1;\n    LABEL_REQUIRED      = 2;\n    LABEL_REPEATED      = 3;\n    // TODO(sanjay): Should we add LABEL_MAP?\n  };\n\n  optional string name = 1;\n  optional int32 number = 3;\n  optional Label label = 4;\n\n  // If type_name is set, this need not be set.  If both this and type_name\n  // are set, this must be either TYPE_ENUM or TYPE_MESSAGE.\n  optional Type type = 5;\n\n  // For message and enum types, this is the name of the type.  If the name\n  // starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping\n  // rules are used to find the type (i.e. first the nested types within this\n  // message are searched, then within the parent, on up to the root\n  // namespace).\n  optional string type_name = 6;\n\n  // For extensions, this is the name of the type being extended.  It is\n  // resolved in the same manner as type_name.\n  optional string extendee = 2;\n\n  // For numeric types, contains the original text representation of the value.\n  // For booleans, \"true\" or \"false\".\n  // For strings, contains the default text contents (not escaped in any way).\n  // For bytes, contains the C escaped value.  All bytes >= 128 are escaped.\n  // TODO(kenton):  Base-64 encode?\n  optional string default_value = 7;\n\n  optional FieldOptions options = 8;\n}\n\n// Describes an enum type.\nmessage EnumDescriptorProto {\n  optional string name = 1;\n\n  repeated EnumValueDescriptorProto value = 2;\n\n  optional EnumOptions options = 3;\n}\n\n// Describes a value within an enum.\nmessage EnumValueDescriptorProto {\n  optional string name = 1;\n  optional int32 number = 2;\n\n  optional EnumValueOptions options = 3;\n}\n\n// Describes a service.\nmessage ServiceDescriptorProto {\n  optional string name = 1;\n  repeated MethodDescriptorProto method = 2;\n\n  optional ServiceOptions options = 3;\n}\n\n// Describes a method of a service.\nmessage MethodDescriptorProto {\n  optional string name = 1;\n\n  // Input and output type names.  These are resolved in the same way as\n  // FieldDescriptorProto.type_name, but must refer to a message type.\n  optional string input_type = 2;\n  optional string output_type = 3;\n\n  optional MethodOptions options = 4;\n}\n\n// ===================================================================\n// Options\n\n// Each of the definitions above may have \"options\" attached.  These are\n// just annotations which may cause code to be generated slightly differently\n// or may contain hints for code that manipulates protocol messages.\n//\n// Clients may define custom options as extensions of the *Options messages.\n// These extensions may not yet be known at parsing time, so the parser cannot\n// store the values in them.  Instead it stores them in a field in the *Options\n// message called uninterpreted_option. This field must have the same name\n// across all *Options messages. We then use this field to populate the\n// extensions when we build a descriptor, at which point all protos have been\n// parsed and so all extensions are known.\n//\n// Extension numbers for custom options may be chosen as follows:\n// * For options which will only be used within a single application or\n//   organization, or for experimental options, use field numbers 50000\n//   through 99999.  It is up to you to ensure that you do not use the\n//   same number for multiple options.\n// * For options which will be published and used publicly by multiple\n//   independent entities, e-mail kenton@google.com to reserve extension\n//   numbers.  Simply tell me how many you need and I'll send you back a\n//   set of numbers to use -- there's no need to explain how you intend to\n//   use them.  If this turns out to be popular, a web service will be set up\n//   to automatically assign option numbers.\n\n\nmessage FileOptions {\n\n  // Sets the Java package where classes generated from this .proto will be\n  // placed.  By default, the proto package is used, but this is often\n  // inappropriate because proto packages do not normally start with backwards\n  // domain names.\n  optional string java_package = 1;\n\n\n  // If set, all the classes from the .proto file are wrapped in a single\n  // outer class with the given name.  This applies to both Proto1\n  // (equivalent to the old \"--one_java_file\" option) and Proto2 (where\n  // a .proto always translates to a single class, but you may want to\n  // explicitly choose the class name).\n  optional string java_outer_classname = 8;\n\n  // If set true, then the Java code generator will generate a separate .java\n  // file for each top-level message, enum, and service defined in the .proto\n  // file.  Thus, these types will *not* be nested inside the outer class\n  // named by java_outer_classname.  However, the outer class will still be\n  // generated to contain the file's getDescriptor() method as well as any\n  // top-level extensions defined in the file.\n  optional bool java_multiple_files = 10 [default=false];\n\n  // If set true, then the Java code generator will generate equals() and\n  // hashCode() methods for all messages defined in the .proto file. This is\n  // purely a speed optimization, as the AbstractMessage base class includes\n  // reflection-based implementations of these methods.\n  optional bool java_generate_equals_and_hash = 20 [default=false];\n\n  // Generated classes can be optimized for speed or code size.\n  enum OptimizeMode {\n    SPEED = 1;        // Generate complete code for parsing, serialization,\n                      // etc.\n    CODE_SIZE = 2;    // Use ReflectionOps to implement these methods.\n    LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.\n  }\n  optional OptimizeMode optimize_for = 9 [default=SPEED];\n\n\n\n\n  // Should generic services be generated in each language?  \"Generic\" services\n  // are not specific to any particular RPC system.  They are generated by the\n  // main code generators in each language (without additional plugins).\n  // Generic services were the only kind of service generation supported by\n  // early versions of proto2.\n  //\n  // Generic services are now considered deprecated in favor of using plugins\n  // that generate code specific to your particular RPC system.  Therefore,\n  // these default to false.  Old code which depends on generic services should\n  // explicitly set them to true.\n  optional bool cc_generic_services = 16 [default=false];\n  optional bool java_generic_services = 17 [default=false];\n  optional bool py_generic_services = 18 [default=false];\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage MessageOptions {\n  // Set true to use the old proto1 MessageSet wire format for extensions.\n  // This is provided for backwards-compatibility with the MessageSet wire\n  // format.  You should not use this for any other reason:  It's less\n  // efficient, has fewer features, and is more complicated.\n  //\n  // The message must be defined exactly as follows:\n  //   message Foo {\n  //     option message_set_wire_format = true;\n  //     extensions 4 to max;\n  //   }\n  // Note that the message cannot have any defined fields; MessageSets only\n  // have extensions.\n  //\n  // All extensions of your type must be singular messages; e.g. they cannot\n  // be int32s, enums, or repeated messages.\n  //\n  // Because this is an option, the above two restrictions are not enforced by\n  // the protocol compiler.\n  optional bool message_set_wire_format = 1 [default=false];\n\n  // Disables the generation of the standard \"descriptor()\" accessor, which can\n  // conflict with a field of the same name.  This is meant to make migration\n  // from proto1 easier; new code should avoid fields named \"descriptor\".\n  optional bool no_standard_descriptor_accessor = 2 [default=false];\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage FieldOptions {\n  // The ctype option instructs the C++ code generator to use a different\n  // representation of the field than it normally would.  See the specific\n  // options below.  This option is not yet implemented in the open source\n  // release -- sorry, we'll try to include it in a future version!\n  optional CType ctype = 1 [default = STRING];\n  enum CType {\n    // Default mode.\n    STRING = 0;\n\n    CORD = 1;\n\n    STRING_PIECE = 2;\n  }\n  // The packed option can be enabled for repeated primitive fields to enable\n  // a more efficient representation on the wire. Rather than repeatedly\n  // writing the tag and type for each element, the entire array is encoded as\n  // a single length-delimited blob.\n  optional bool packed = 2;\n\n\n  // Is this field deprecated?\n  // Depending on the target platform, this can emit Deprecated annotations\n  // for accessors, or it will be completely ignored; in the very least, this\n  // is a formalization for deprecating fields.\n  optional bool deprecated = 3 [default=false];\n\n  // EXPERIMENTAL.  DO NOT USE.\n  // For \"map\" fields, the name of the field in the enclosed type that\n  // is the key for this map.  For example, suppose we have:\n  //   message Item {\n  //     required string name = 1;\n  //     required string value = 2;\n  //   }\n  //   message Config {\n  //     repeated Item items = 1 [experimental_map_key=\"name\"];\n  //   }\n  // In this situation, the map key for Item will be set to \"name\".\n  // TODO: Fully-implement this, then remove the \"experimental_\" prefix.\n  optional string experimental_map_key = 9;\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage EnumOptions {\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage EnumValueOptions {\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage ServiceOptions {\n\n  // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC\n  //   framework.  We apologize for hoarding these numbers to ourselves, but\n  //   we were already using them long before we decided to release Protocol\n  //   Buffers.\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\nmessage MethodOptions {\n\n  // Note:  Field numbers 1 through 32 are reserved for Google's internal RPC\n  //   framework.  We apologize for hoarding these numbers to ourselves, but\n  //   we were already using them long before we decided to release Protocol\n  //   Buffers.\n\n  // The parser stores options it doesn't recognize here. See above.\n  repeated UninterpretedOption uninterpreted_option = 999;\n\n  // Clients can define custom options in extensions of this message. See above.\n  extensions 1000 to max;\n}\n\n// A message representing a option the parser does not recognize. This only\n// appears in options protos created by the compiler::Parser class.\n// DescriptorPool resolves these when building Descriptor objects. Therefore,\n// options protos in descriptor objects (e.g. returned by Descriptor::options(),\n// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions\n// in them.\nmessage UninterpretedOption {\n  // The name of the uninterpreted option.  Each string represents a segment in\n  // a dot-separated name.  is_extension is true iff a segment represents an\n  // extension (denoted with parentheses in options specs in .proto files).\n  // E.g.,{ [\"foo\", false], [\"bar.baz\", true], [\"qux\", false] } represents\n  // \"foo.(bar.baz).qux\".\n  message NamePart {\n    required string name_part = 1;\n    required bool is_extension = 2;\n  }\n  repeated NamePart name = 2;\n\n  // The value of the uninterpreted option, in whatever type the tokenizer\n  // identified it as during parsing. Exactly one of these should be set.\n  optional string identifier_value = 3;\n  optional uint64 positive_int_value = 4;\n  optional int64 negative_int_value = 5;\n  optional double double_value = 6;\n  optional bytes string_value = 7;\n  optional string aggregate_value = 8;\n}\n\n// ===================================================================\n// Optional source code info\n\n// Encapsulates information about the original source file from which a\n// FileDescriptorProto was generated.\nmessage SourceCodeInfo {\n  // A Location identifies a piece of source code in a .proto file which\n  // corresponds to a particular definition.  This information is intended\n  // to be useful to IDEs, code indexers, documentation generators, and similar\n  // tools.\n  //\n  // For example, say we have a file like:\n  //   message Foo {\n  //     optional string foo = 1;\n  //   }\n  // Let's look at just the field definition:\n  //   optional string foo = 1;\n  //   ^       ^^     ^^  ^  ^^^\n  //   a       bc     de  f  ghi\n  // We have the following locations:\n  //   span   path               represents\n  //   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.\n  //   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).\n  //   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).\n  //   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).\n  //   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).\n  //\n  // Notes:\n  // - A location may refer to a repeated field itself (i.e. not to any\n  //   particular index within it).  This is used whenever a set of elements are\n  //   logically enclosed in a single code segment.  For example, an entire\n  //   extend block (possibly containing multiple extension definitions) will\n  //   have an outer location whose path refers to the \"extensions\" repeated\n  //   field without an index.\n  // - Multiple locations may have the same path.  This happens when a single\n  //   logical declaration is spread out across multiple places.  The most\n  //   obvious example is the \"extend\" block again -- there may be multiple\n  //   extend blocks in the same scope, each of which will have the same path.\n  // - A location's span is not always a subset of its parent's span.  For\n  //   example, the \"extendee\" of an extension declaration appears at the\n  //   beginning of the \"extend\" block and is shared by all extensions within\n  //   the block.\n  // - Just because a location's span is a subset of some other location's span\n  //   does not mean that it is a descendent.  For example, a \"group\" defines\n  //   both a type and a field in a single declaration.  Thus, the locations\n  //   corresponding to the type and field and their components will overlap.\n  // - Code which tries to interpret locations should probably be designed to\n  //   ignore those that it doesn't understand, as more types of locations could\n  //   be recorded in the future.\n  repeated Location location = 1;\n  message Location {\n    // Identifies which part of the FileDescriptorProto was defined at this\n    // location.\n    //\n    // Each element is a field number or an index.  They form a path from\n    // the root FileDescriptorProto to the place where the definition.  For\n    // example, this path:\n    //   [ 4, 3, 2, 7, 1 ]\n    // refers to:\n    //   file.message_type(3)  // 4, 3\n    //       .field(7)         // 2, 7\n    //       .name()           // 1\n    // This is because FileDescriptorProto.message_type has field number 4:\n    //   repeated DescriptorProto message_type = 4;\n    // and DescriptorProto.field has field number 2:\n    //   repeated FieldDescriptorProto field = 2;\n    // and FieldDescriptorProto.name has field number 1:\n    //   optional string name = 1;\n    //\n    // Thus, the above path gives the location of a field name.  If we removed\n    // the last element:\n    //   [ 4, 3, 2, 7 ]\n    // this path refers to the whole field declaration (from the beginning\n    // of the label to the terminating semicolon).\n    repeated int32 path = 1 [packed=true];\n\n    // Always has exactly three or four elements: start line, start column,\n    // end line (optional, otherwise assumed same as start line), end column.\n    // These are packed into a single field for efficiency.  Note that line\n    // and column numbers are zero-based -- typically you will want to add\n    // 1 to each before displaying to a user.\n    repeated int32 span = 2 [packed=true];\n\n    // TODO(kenton):  Record comments appearing before and after the\n    // declaration.\n  }\n}\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/protobuf-net.xml",
    "content": "<?xml version=\"1.0\"?>\n<doc>\n    <assembly>\n        <name>protobuf-net</name>\n    </assembly>\n    <members>\n        <member name=\"T:ProtoBuf.BclHelpers\">\n            <summary>\n            Provides support for common .NET types that do not have a direct representation\n            in protobuf, using the definitions from bcl.proto\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.GetUninitializedObject(System.Type)\">\n            <summary>\n            Creates a new instance of the specified type, bypassing the constructor.\n            </summary>\n            <param name=\"type\">The type to create</param>\n            <returns>The new instance</returns>\n            <exception cref=\"T:System.NotSupportedException\">If the platform does not support constructor-skipping</exception>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.WriteTimeSpan(System.TimeSpan,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a TimeSpan to a protobuf stream\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.ReadTimeSpan(ProtoBuf.ProtoReader)\">\n            <summary>\n            Parses a TimeSpan from a protobuf stream\n            </summary>        \n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.ReadDateTime(ProtoBuf.ProtoReader)\">\n            <summary>\n            Parses a DateTime from a protobuf stream\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.WriteDateTime(System.DateTime,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a DateTime to a protobuf stream, excluding the <c>Kind</c>\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.WriteDateTimeWithKind(System.DateTime,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a DateTime to a protobuf stream, including the <c>Kind</c>\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.ReadDecimal(ProtoBuf.ProtoReader)\">\n            <summary>\n            Parses a decimal from a protobuf stream\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.WriteDecimal(System.Decimal,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a decimal to a protobuf stream\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.WriteGuid(System.Guid,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a Guid to a protobuf stream\n            </summary>        \n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.ReadGuid(ProtoBuf.ProtoReader)\">\n            <summary>\n            Parses a Guid from a protobuf stream\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.ReadNetObject(System.Object,ProtoBuf.ProtoReader,System.Int32,System.Type,ProtoBuf.BclHelpers.NetObjectOptions)\">\n            <summary>\n            Reads an *implementation specific* bundled .NET object, including (as options) type-metadata, identity/re-use, etc.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.BclHelpers.WriteNetObject(System.Object,ProtoBuf.ProtoWriter,System.Int32,ProtoBuf.BclHelpers.NetObjectOptions)\">\n            <summary>\n            Writes an *implementation specific* bundled .NET object, including (as options) type-metadata, identity/re-use, etc.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.BclHelpers.NetObjectOptions\">\n            <summary>\n            Optional behaviours that introduce .NET-specific functionality\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.BclHelpers.NetObjectOptions.None\">\n            <summary>\n            No special behaviour\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.BclHelpers.NetObjectOptions.AsReference\">\n            <summary>\n            Enables full object-tracking/full-graph support.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.BclHelpers.NetObjectOptions.DynamicType\">\n            <summary>\n            Embeds the type information into the stream, allowing usage with types not known in advance.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.BclHelpers.NetObjectOptions.UseConstructor\">\n            <summary>\n            If false, the constructor for the type is bypassed during deserialization, meaning any field initializers\n            or other initialization code is skipped.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.BclHelpers.NetObjectOptions.LateSet\">\n            <summary>\n            Should the object index be reserved, rather than creating an object promptly\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.BufferExtension\">\n            <summary>\n            Provides a simple buffer-based implementation of an <see cref=\"T:ProtoBuf.IExtension\">extension</see> object.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.IExtension\">\n            <summary>\n            Provides addition capability for supporting unexpected fields during\n            protocol-buffer serialization/deserialization. This allows for loss-less\n            round-trip/merge, even when the data is not fully understood.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.IExtension.BeginAppend\">\n            <summary>\n            Requests a stream into which any unexpected fields can be persisted.\n            </summary>\n            <returns>A new stream suitable for storing data.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.IExtension.EndAppend(System.IO.Stream,System.Boolean)\">\n            <summary>\n            Indicates that all unexpected fields have now been stored. The\n            implementing class is responsible for closing the stream. If\n            \"commit\" is not true the data may be discarded.\n            </summary>\n            <param name=\"stream\">The stream originally obtained by BeginAppend.</param>\n            <param name=\"commit\">True if the append operation completed successfully.</param>\n        </member>\n        <member name=\"M:ProtoBuf.IExtension.BeginQuery\">\n            <summary>\n            Requests a stream of the unexpected fields previously stored.\n            </summary>\n            <returns>A prepared stream of the unexpected fields.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.IExtension.EndQuery(System.IO.Stream)\">\n            <summary>\n            Indicates that all unexpected fields have now been read. The\n            implementing class is responsible for closing the stream.\n            </summary>\n            <param name=\"stream\">The stream originally obtained by BeginQuery.</param>\n        </member>\n        <member name=\"M:ProtoBuf.IExtension.GetLength\">\n            <summary>\n            Requests the length of the raw binary stream; this is used\n            when serializing sub-entities to indicate the expected size.\n            </summary>\n            <returns>The length of the binary stream representing unexpected data.</returns>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoBeforeSerializationAttribute\">\n            <summary>Specifies a method on the root-contract in an hierarchy to be invoked before serialization.</summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoAfterSerializationAttribute\">\n            <summary>Specifies a method on the root-contract in an hierarchy to be invoked after serialization.</summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoBeforeDeserializationAttribute\">\n            <summary>Specifies a method on the root-contract in an hierarchy to be invoked before deserialization.</summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoAfterDeserializationAttribute\">\n            <summary>Specifies a method on the root-contract in an hierarchy to be invoked after deserialization.</summary>\n        </member>\n        <member name=\"M:ProtoBuf.Compiler.CompilerContext.LoadNullRef\">\n            <summary>\n            Pushes a null reference onto the stack. Note that this should only\n            be used to return a null (or set a variable to null); for null-tests\n            use BranchIfTrue / BranchIfFalse.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Compiler.CompilerContext.UsingBlock.#ctor(ProtoBuf.Compiler.CompilerContext,ProtoBuf.Compiler.Local)\">\n            <summary>\n            Creates a new \"using\" block (equivalent) around a variable;\n            the variable must exist, and note that (unlike in C#) it is\n            the variables *final* value that gets disposed. If you need\n            *original* disposal, copy your variable first.\n            \n            It is the callers responsibility to ensure that the variable's\n            scope fully-encapsulates the \"using\"; if not, the variable\n            may be re-used (and thus re-assigned) unexpectedly.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoConverterAttribute\">\n            <summary>\n            Indicates that a static member should be considered the same as though\n            were an implicit / explicit conversion operator; in particular, this\n            is useful for conversions that operator syntax does not allow, such as\n            to/from interface types.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.DataFormat\">\n            <summary>\n            Sub-format to use when serializing/deserializing data\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.DataFormat.Default\">\n            <summary>\n            Uses the default encoding for the data-type.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.DataFormat.ZigZag\">\n            <summary>\n            When applied to signed integer-based data (including Decimal), this\n            indicates that zigzag variant encoding will be used. This means that values\n            with small magnitude (regardless of sign) take a small amount\n            of space to encode.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.DataFormat.TwosComplement\">\n            <summary>\n            When applied to signed integer-based data (including Decimal), this\n            indicates that two's-complement variant encoding will be used.\n            This means that any -ve number will take 10 bytes (even for 32-bit),\n            so should only be used for compatibility.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.DataFormat.FixedSize\">\n            <summary>\n            When applied to signed integer-based data (including Decimal), this\n            indicates that a fixed amount of space will be used.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.DataFormat.Group\">\n            <summary>\n            When applied to a sub-message, indicates that the value should be treated\n            as group-delimited.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Extensible\">\n            <summary>\n            Simple base class for supporting unexpected fields allowing\n            for loss-less round-tips/merge, even if the data is not understod.\n            The additional fields are (by default) stored in-memory in a buffer.\n            </summary>\n            <remarks>As an example of an alternative implementation, you might\n            choose to use the file system (temporary files) as the back-end, tracking\n            only the paths [such an object would ideally be IDisposable and use\n            a finalizer to ensure that the files are removed].</remarks>\n            <seealso cref=\"T:ProtoBuf.IExtensible\"/>\n        </member>\n        <member name=\"T:ProtoBuf.IExtensible\">\n            <summary>\n            Indicates that the implementing type has support for protocol-buffer\n            <see cref=\"T:ProtoBuf.IExtension\">extensions</see>.\n            </summary>\n            <remarks>Can be implemented by deriving from Extensible.</remarks>\n        </member>\n        <member name=\"M:ProtoBuf.IExtensible.GetExtensionObject(System.Boolean)\">\n            <summary>\n            Retrieves the <see cref=\"T:ProtoBuf.IExtension\">extension</see> object for the current\n            instance, optionally creating it if it does not already exist.\n            </summary>\n            <param name=\"createIfMissing\">Should a new extension object be\n            created if it does not already exist?</param>\n            <returns>The extension object if it exists (or was created), or null\n            if the extension object does not exist or is not available.</returns>\n            <remarks>The <c>createIfMissing</c> argument is false during serialization,\n            and true during deserialization upon encountering unexpected fields.</remarks>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.GetExtensionObject(System.Boolean)\">\n            <summary>\n            Retrieves the <see cref=\"T:ProtoBuf.IExtension\">extension</see> object for the current\n            instance, optionally creating it if it does not already exist.\n            </summary>\n            <param name=\"createIfMissing\">Should a new extension object be\n            created if it does not already exist?</param>\n            <returns>The extension object if it exists (or was created), or null\n            if the extension object does not exist or is not available.</returns>\n            <remarks>The <c>createIfMissing</c> argument is false during serialization,\n            and true during deserialization upon encountering unexpected fields.</remarks>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.GetExtensionObject(ProtoBuf.IExtension@,System.Boolean)\">\n            <summary>\n            Provides a simple, default implementation for <see cref=\"T:ProtoBuf.IExtension\">extension</see> support,\n            optionally creating it if it does not already exist. Designed to be called by\n            classes implementing <see cref=\"T:ProtoBuf.IExtensible\"/>.\n            </summary>\n            <param name=\"createIfMissing\">Should a new extension object be\n            created if it does not already exist?</param>\n            <param name=\"extensionObject\">The extension field to check (and possibly update).</param>\n            <returns>The extension object if it exists (or was created), or null\n            if the extension object does not exist or is not available.</returns>\n            <remarks>The <c>createIfMissing</c> argument is false during serialization,\n            and true during deserialization upon encountering unexpected fields.</remarks>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.AppendValue``1(ProtoBuf.IExtensible,System.Int32,``0)\">\n            <summary>\n            Appends the value as an additional (unexpected) data-field for the instance.\n            Note that for non-repeated sub-objects, this equates to a merge operation;\n            for repeated sub-objects this adds a new instance to the set; for simple\n            values the new value supercedes the old value.\n            </summary>\n            <remarks>Note that appending a value does not remove the old value from\n            the stream; avoid repeatedly appending values for the same field.</remarks>\n            <typeparam name=\"TValue\">The type of the value to append.</typeparam>\n            <param name=\"instance\">The extensible object to append the value to.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"value\">The value to append.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.AppendValue``1(ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat,``0)\">\n            <summary>\n            Appends the value as an additional (unexpected) data-field for the instance.\n            Note that for non-repeated sub-objects, this equates to a merge operation;\n            for repeated sub-objects this adds a new instance to the set; for simple\n            values the new value supercedes the old value.\n            </summary>\n            <remarks>Note that appending a value does not remove the old value from\n            the stream; avoid repeatedly appending values for the same field.</remarks>\n            <typeparam name=\"TValue\">The data-type of the field.</typeparam>\n            <param name=\"format\">The data-format to use when encoding the value.</param>\n            <param name=\"instance\">The extensible object to append the value to.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"value\">The value to append.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.GetValue``1(ProtoBuf.IExtensible,System.Int32)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            The value returned is the composed value after merging any duplicated content; if the\n            value is \"repeated\" (a list), then use GetValues instead.\n            </summary>\n            <typeparam name=\"TValue\">The data-type of the field.</typeparam>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <returns>The effective value of the field, or the default value if not found.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.GetValue``1(ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            The value returned is the composed value after merging any duplicated content; if the\n            value is \"repeated\" (a list), then use GetValues instead.\n            </summary>\n            <typeparam name=\"TValue\">The data-type of the field.</typeparam>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"format\">The data-format to use when decoding the value.</param>\n            <returns>The effective value of the field, or the default value if not found.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.TryGetValue``1(ProtoBuf.IExtensible,System.Int32,``0@)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            The value returned (in \"value\") is the composed value after merging any duplicated content;\n            if the value is \"repeated\" (a list), then use GetValues instead.\n            </summary>\n            <typeparam name=\"TValue\">The data-type of the field.</typeparam>\n            <param name=\"value\">The effective value of the field, or the default value if not found.</param>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <returns>True if data for the field was present, false otherwise.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.TryGetValue``1(ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat,``0@)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            The value returned (in \"value\") is the composed value after merging any duplicated content;\n            if the value is \"repeated\" (a list), then use GetValues instead.\n            </summary>\n            <typeparam name=\"TValue\">The data-type of the field.</typeparam>\n            <param name=\"value\">The effective value of the field, or the default value if not found.</param>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"format\">The data-format to use when decoding the value.</param>\n            <returns>True if data for the field was present, false otherwise.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.TryGetValue``1(ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat,System.Boolean,``0@)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            The value returned (in \"value\") is the composed value after merging any duplicated content;\n            if the value is \"repeated\" (a list), then use GetValues instead.\n            </summary>\n            <typeparam name=\"TValue\">The data-type of the field.</typeparam>\n            <param name=\"value\">The effective value of the field, or the default value if not found.</param>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"format\">The data-format to use when decoding the value.</param>\n            <param name=\"allowDefinedTag\">Allow tags that are present as part of the definition; for example, to query unknown enum values.</param>\n            <returns>True if data for the field was present, false otherwise.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.GetValues``1(ProtoBuf.IExtensible,System.Int32)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            Each occurrence of the field is yielded separately, making this usage suitable for \"repeated\"\n            (list) fields.\n            </summary>\n            <remarks>The extended data is processed lazily as the enumerator is iterated.</remarks>\n            <typeparam name=\"TValue\">The data-type of the field.</typeparam>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <returns>An enumerator that yields each occurrence of the field.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.GetValues``1(ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            Each occurrence of the field is yielded separately, making this usage suitable for \"repeated\"\n            (list) fields.\n            </summary>\n            <remarks>The extended data is processed lazily as the enumerator is iterated.</remarks>\n            <typeparam name=\"TValue\">The data-type of the field.</typeparam>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"format\">The data-format to use when decoding the value.</param>\n            <returns>An enumerator that yields each occurrence of the field.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.TryGetValue(ProtoBuf.Meta.TypeModel,System.Type,ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat,System.Boolean,System.Object@)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            The value returned (in \"value\") is the composed value after merging any duplicated content;\n            if the value is \"repeated\" (a list), then use GetValues instead.\n            </summary>\n            <param name=\"type\">The data-type of the field.</param>\n            <param name=\"model\">The model to use for configuration.</param>\n            <param name=\"value\">The effective value of the field, or the default value if not found.</param>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"format\">The data-format to use when decoding the value.</param>\n            <param name=\"allowDefinedTag\">Allow tags that are present as part of the definition; for example, to query unknown enum values.</param>\n            <returns>True if data for the field was present, false otherwise.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.GetValues(ProtoBuf.Meta.TypeModel,System.Type,ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat)\">\n            <summary>\n            Queries an extensible object for an additional (unexpected) data-field for the instance.\n            Each occurrence of the field is yielded separately, making this usage suitable for \"repeated\"\n            (list) fields.\n            </summary>\n            <remarks>The extended data is processed lazily as the enumerator is iterated.</remarks>\n            <param name=\"model\">The model to use for configuration.</param>\n            <param name=\"type\">The data-type of the field.</param>\n            <param name=\"instance\">The extensible object to obtain the value from.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"format\">The data-format to use when decoding the value.</param>\n            <returns>An enumerator that yields each occurrence of the field.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Extensible.AppendValue(ProtoBuf.Meta.TypeModel,ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat,System.Object)\">\n            <summary>\n            Appends the value as an additional (unexpected) data-field for the instance.\n            Note that for non-repeated sub-objects, this equates to a merge operation;\n            for repeated sub-objects this adds a new instance to the set; for simple\n            values the new value supercedes the old value.\n            </summary>\n            <remarks>Note that appending a value does not remove the old value from\n            the stream; avoid repeatedly appending values for the same field.</remarks>\n            <param name=\"model\">The model to use for configuration.</param>\n            <param name=\"format\">The data-format to use when encoding the value.</param>\n            <param name=\"instance\">The extensible object to append the value to.</param>\n            <param name=\"tag\">The field identifier; the tag should not be defined as a known data-field for the instance.</param>\n            <param name=\"value\">The value to append.</param>\n        </member>\n        <member name=\"T:ProtoBuf.ExtensibleUtil\">\n            <summary>\n            This class acts as an internal wrapper allowing us to do a dynamic\n            methodinfo invoke; an't put into Serializer as don't want on public\n            API; can't put into Serializer&lt;T&gt; since we need to invoke\n            accross classes, which isn't allowed in Silverlight)\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ExtensibleUtil.GetExtendedValues``1(ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat,System.Boolean,System.Boolean)\">\n            <summary>\n            All this does is call GetExtendedValuesTyped with the correct type for \"instance\";\n            this ensures that we don't get issues with subclasses declaring conflicting types -\n            the caller must respect the fields defined for the type they pass in.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ExtensibleUtil.GetExtendedValues(ProtoBuf.Meta.TypeModel,System.Type,ProtoBuf.IExtensible,System.Int32,ProtoBuf.DataFormat,System.Boolean,System.Boolean)\">\n            <summary>\n            All this does is call GetExtendedValuesTyped with the correct type for \"instance\";\n            this ensures that we don't get issues with subclasses declaring conflicting types -\n            the caller must respect the fields defined for the type they pass in.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Helpers\">\n            <summary>\n            Not all frameworks are created equal (fx1.1 vs fx2.0,\n            micro-framework, compact-framework,\n            silverlight, etc). This class simply wraps up a few things that would\n            otherwise make the real code unnecessarily messy, providing fallback\n            implementations if necessary.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoTypeCode\">\n            <summary>\n            Intended to be a direct map to regular TypeCode, but:\n            - with missing types\n            - existing on WinRT\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ImplicitFields\">\n            <summary>\n            Specifies the method used to infer field tags for members of the type\n            under consideration. Tags are deduced using the invariant alphabetic\n            sequence of the members' names; this makes implicit field tags very brittle,\n            and susceptible to changes such as field names (normally an isolated\n            change).\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.ImplicitFields.None\">\n            <summary>\n            No members are serialized implicitly; all members require a suitable\n            attribute such as [ProtoMember]. This is the recmomended mode for\n            most scenarios.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.ImplicitFields.AllPublic\">\n            <summary>\n            Public properties and fields are eligible for implicit serialization;\n            this treats the public API as a contract. Ordering beings from ImplicitFirstTag.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.ImplicitFields.AllFields\">\n            <summary>\n            Public and non-public fields are eligible for implicit serialization;\n            this acts as a state/implementation serializer. Ordering beings from ImplicitFirstTag.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.CallbackSet\">\n            <summary>\n            Represents the set of serialization callbacks to be used when serializing/deserializing a type.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.CallbackSet.BeforeSerialize\">\n            <summary>Called before serializing an instance</summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.CallbackSet.BeforeDeserialize\">\n            <summary>Called before deserializing an instance</summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.CallbackSet.AfterSerialize\">\n            <summary>Called after serializing an instance</summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.CallbackSet.AfterDeserialize\">\n            <summary>Called after deserializing an instance</summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.CallbackSet.NonTrivial\">\n            <summary>\n            True if any callback is set, else False\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.MetaType\">\n            <summary>\n            Represents a type at runtime for use with protobuf, allowing the field mappings (etc) to be defined\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.ToString\">\n            <summary>\n            Get the name of the type being represented\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.AddSubType(System.Int32,System.Type)\">\n            <summary>\n            Adds a known sub-type to the inheritance model\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.AddSubType(System.Int32,System.Type,ProtoBuf.DataFormat)\">\n            <summary>\n            Adds a known sub-type to the inheritance model\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.SetCallbacks(System.Reflection.MethodInfo,System.Reflection.MethodInfo,System.Reflection.MethodInfo,System.Reflection.MethodInfo)\">\n            <summary>\n            Assigns the callbacks to use during serialiation/deserialization.\n            </summary>\n            <param name=\"beforeSerialize\">The method (or null) called before serialization begins.</param>\n            <param name=\"afterSerialize\">The method (or null) called when serialization is complete.</param>\n            <param name=\"beforeDeserialize\">The method (or null) called before deserialization begins (or when a new instance is created during deserialization).</param>\n            <param name=\"afterDeserialize\">The method (or null) called when deserialization is complete.</param>\n            <returns>The set of callbacks.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.SetCallbacks(System.String,System.String,System.String,System.String)\">\n            <summary>\n            Assigns the callbacks to use during serialiation/deserialization.\n            </summary>\n            <param name=\"beforeSerialize\">The name of the method (or null) called before serialization begins.</param>\n            <param name=\"afterSerialize\">The name of the method (or null) called when serialization is complete.</param>\n            <param name=\"beforeDeserialize\">The name of the method (or null) called before deserialization begins (or when a new instance is created during deserialization).</param>\n            <param name=\"afterDeserialize\">The name of the method (or null) called when deserialization is complete.</param>\n            <returns>The set of callbacks.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.SetFactory(System.Reflection.MethodInfo)\">\n            <summary>\n            Designate a factory-method to use to create instances of this type\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.SetFactory(System.String)\">\n            <summary>\n            Designate a factory-method to use to create instances of this type\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.ThrowIfFrozen\">\n            <summary>\n            Throws an exception if the type has been made immutable\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.Add(System.Int32,System.String)\">\n            <summary>\n            Adds a member (by name) to the MetaType\n            </summary>        \n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.AddField(System.Int32,System.String)\">\n            <summary>\n            Adds a member (by name) to the MetaType, returning the ValueMember rather than the fluent API.\n            This is otherwise identical to Add.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.Add(System.String)\">\n            <summary>\n            Adds a member (by name) to the MetaType\n            </summary>     \n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.SetSurrogate(System.Type)\">\n            <summary>\n            Performs serialization of this type via a surrogate; all\n            other serialization options are ignored and handled\n            by the surrogate's configuration.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.Add(System.String[])\">\n            <summary>\n            Adds a set of members (by name) to the MetaType\n            </summary>     \n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.Add(System.Int32,System.String,System.Object)\">\n            <summary>\n            Adds a member (by name) to the MetaType\n            </summary>        \n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.Add(System.Int32,System.String,System.Type,System.Type)\">\n            <summary>\n            Adds a member (by name) to the MetaType, including an itemType and defaultType for representing lists\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.AddField(System.Int32,System.String,System.Type,System.Type)\">\n            <summary>\n            Adds a member (by name) to the MetaType, including an itemType and defaultType for representing lists, returning the ValueMember rather than the fluent API.\n            This is otherwise identical to Add.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.GetFields\">\n            <summary>\n            Returns the ValueMember instances associated with this type\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.GetSubtypes\">\n            <summary>\n            Returns the SubType instances associated with this type\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.MetaType.CompileInPlace\">\n            <summary>\n            Compiles the serializer for this type; this is *not* a full\n            standalone compile, but can significantly boost performance\n            while allowing additional types to be added.\n            </summary>\n            <remarks>An in-place compile can access non-public types / members</remarks>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.BaseType\">\n            <summary>\n            Gets the base-type for this type\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.IncludeSerializerMethod\">\n            <summary>\n            When used to compile a model, should public serialization/deserialzation methods\n            be included for this type?\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.AsReferenceDefault\">\n            <summary>\n            Should this type be treated as a reference by default?\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.HasCallbacks\">\n            <summary>\n            Indicates whether the current type has defined callbacks \n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.HasSubtypes\">\n            <summary>\n            Indicates whether the current type has defined subtypes\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.Callbacks\">\n            <summary>\n            Returns the set of callbacks defined for this type\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.Name\">\n            <summary>\n            Gets or sets the name of this contract.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.Type\">\n            <summary>\n            The runtime type that the meta-type represents\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.UseConstructor\">\n            <summary>\n            Gets or sets whether the type should use a parameterless constructor (the default),\n            or whether the type should skip the constructor completely. This option is not supported\n            on compact-framework.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.ConstructType\">\n            <summary>\n            The concrete type to create when a new instance of this type is needed; this may be useful when dealing\n            with dynamic proxies, or with interface-based APIs\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.Item(System.Int32)\">\n            <summary>\n            Returns the ValueMember that matchs a given field number, or null if not found\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.Item(System.Reflection.MemberInfo)\">\n            <summary>\n            Returns the ValueMember that matchs a given member (property/field), or null if not found\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.EnumPassthru\">\n            <summary>\n            Gets or sets a value indicating that an enum should be treated directly as an int/short/etc, rather\n            than enforcing .proto enum rules. This is useful *in particul* for [Flags] enums.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.MetaType.IgnoreListHandling\">\n            <summary>\n            Gets or sets a value indicating that this type should NOT be treated as a list, even if it has\n            familiar list-like characteristics (enumerable, add, etc)\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.RuntimeTypeModel\">\n            <summary>\n            Provides protobuf serialization support for a number of types that can be defined at runtime\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.TypeModel\">\n            <summary>\n            Provides protobuf serialization support for a number of types\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.SerializeDateTimeKind\">\n            <summary>\n            Should the <c>Kind</c> be included on date/time values?\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.MapType(System.Type)\">\n            <summary>\n            Resolve a System.Type to the compiler-specific type\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.MapType(System.Type,System.Boolean)\">\n            <summary>\n            Resolve a System.Type to the compiler-specific type\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.TrySerializeAuxiliaryType(ProtoBuf.ProtoWriter,System.Type,ProtoBuf.DataFormat,System.Int32,System.Object,System.Boolean)\">\n            <summary>\n            This is the more \"complete\" version of Serialize, which handles single instances of mapped types.\n            The value is written as a complete field, including field-header and (for sub-objects) a\n            length-prefix\n            In addition to that, this provides support for:\n             - basic values; individual int / string / Guid / etc\n             - IEnumerable sequences of any type handled by TrySerializeAuxiliaryType\n             \n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Serialize(System.IO.Stream,System.Object)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream.\n            </summary>\n            <param name=\"value\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"dest\">The destination stream to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Serialize(System.IO.Stream,System.Object,ProtoBuf.SerializationContext)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream.\n            </summary>\n            <param name=\"value\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"dest\">The destination stream to write to.</param>\n            <param name=\"context\">Additional information about this serialization operation.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Serialize(ProtoBuf.ProtoWriter,System.Object)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied writer.\n            </summary>\n            <param name=\"value\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"dest\">The destination writer to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.DeserializeWithLengthPrefix(System.IO.Stream,System.Object,System.Type,ProtoBuf.PrefixStyle,System.Int32)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed\n            data - useful with network IO.\n            </summary>\n            <param name=\"type\">The type being merged.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"fieldNumber\">The tag used as a prefix to each record (only used with base-128 style prefixes).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.DeserializeWithLengthPrefix(System.IO.Stream,System.Object,System.Type,ProtoBuf.PrefixStyle,System.Int32,ProtoBuf.Serializer.TypeResolver)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed\n            data - useful with network IO.\n            </summary>\n            <param name=\"type\">The type being merged.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"expectedField\">The tag used as a prefix to each record (only used with base-128 style prefixes).</param>\n            <param name=\"resolver\">Used to resolve types on a per-field basis.</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.DeserializeWithLengthPrefix(System.IO.Stream,System.Object,System.Type,ProtoBuf.PrefixStyle,System.Int32,ProtoBuf.Serializer.TypeResolver,System.Int32@)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed\n            data - useful with network IO.\n            </summary>\n            <param name=\"type\">The type being merged.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"expectedField\">The tag used as a prefix to each record (only used with base-128 style prefixes).</param>\n            <param name=\"resolver\">Used to resolve types on a per-field basis.</param>\n            <param name=\"bytesRead\">Returns the number of bytes consumed by this operation (includes length-prefix overheads and any skipped data).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.DeserializeItems(System.IO.Stream,System.Type,ProtoBuf.PrefixStyle,System.Int32,ProtoBuf.Serializer.TypeResolver)\">\n            <summary>\n            Reads a sequence of consecutive length-prefixed items from a stream, using\n            either base-128 or fixed-length prefixes. Base-128 prefixes with a tag\n            are directly comparable to serializing multiple items in succession\n            (use the <see cref=\"F:ProtoBuf.Serializer.ListItemTag\"/> tag to emulate the implicit behavior\n            when serializing a list/array). When a tag is\n            specified, any records with different tags are silently omitted. The\n            tag is ignored. The tag is ignores for fixed-length prefixes.\n            </summary>\n            <param name=\"source\">The binary stream containing the serialized records.</param>\n            <param name=\"style\">The prefix style used in the data.</param>\n            <param name=\"expectedField\">The tag of records to return (if non-positive, then no tag is\n            expected and all records are returned).</param>\n            <param name=\"resolver\">On a field-by-field basis, the type of object to deserialize (can be null if \"type\" is specified). </param>\n            <param name=\"type\">The type of object to deserialize (can be null if \"resolver\" is specified).</param>\n            <returns>The sequence of deserialized objects.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.DeserializeItems(System.IO.Stream,System.Type,ProtoBuf.PrefixStyle,System.Int32,ProtoBuf.Serializer.TypeResolver,ProtoBuf.SerializationContext)\">\n            <summary>\n            Reads a sequence of consecutive length-prefixed items from a stream, using\n            either base-128 or fixed-length prefixes. Base-128 prefixes with a tag\n            are directly comparable to serializing multiple items in succession\n            (use the <see cref=\"F:ProtoBuf.Serializer.ListItemTag\"/> tag to emulate the implicit behavior\n            when serializing a list/array). When a tag is\n            specified, any records with different tags are silently omitted. The\n            tag is ignored. The tag is ignores for fixed-length prefixes.\n            </summary>\n            <param name=\"source\">The binary stream containing the serialized records.</param>\n            <param name=\"style\">The prefix style used in the data.</param>\n            <param name=\"expectedField\">The tag of records to return (if non-positive, then no tag is\n            expected and all records are returned).</param>\n            <param name=\"resolver\">On a field-by-field basis, the type of object to deserialize (can be null if \"type\" is specified). </param>\n            <param name=\"type\">The type of object to deserialize (can be null if \"resolver\" is specified).</param>\n            <returns>The sequence of deserialized objects.</returns>\n            <param name=\"context\">Additional information about this serialization operation.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.DeserializeItems``1(System.IO.Stream,ProtoBuf.PrefixStyle,System.Int32)\">\n            <summary>\n            Reads a sequence of consecutive length-prefixed items from a stream, using\n            either base-128 or fixed-length prefixes. Base-128 prefixes with a tag\n            are directly comparable to serializing multiple items in succession\n            (use the <see cref=\"F:ProtoBuf.Serializer.ListItemTag\"/> tag to emulate the implicit behavior\n            when serializing a list/array). When a tag is\n            specified, any records with different tags are silently omitted. The\n            tag is ignored. The tag is ignores for fixed-length prefixes.\n            </summary>\n            <typeparam name=\"T\">The type of object to deserialize.</typeparam>\n            <param name=\"source\">The binary stream containing the serialized records.</param>\n            <param name=\"style\">The prefix style used in the data.</param>\n            <param name=\"expectedField\">The tag of records to return (if non-positive, then no tag is\n            expected and all records are returned).</param>\n            <returns>The sequence of deserialized objects.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.DeserializeItems``1(System.IO.Stream,ProtoBuf.PrefixStyle,System.Int32,ProtoBuf.SerializationContext)\">\n            <summary>\n            Reads a sequence of consecutive length-prefixed items from a stream, using\n            either base-128 or fixed-length prefixes. Base-128 prefixes with a tag\n            are directly comparable to serializing multiple items in succession\n            (use the <see cref=\"F:ProtoBuf.Serializer.ListItemTag\"/> tag to emulate the implicit behavior\n            when serializing a list/array). When a tag is\n            specified, any records with different tags are silently omitted. The\n            tag is ignored. The tag is ignores for fixed-length prefixes.\n            </summary>\n            <typeparam name=\"T\">The type of object to deserialize.</typeparam>\n            <param name=\"source\">The binary stream containing the serialized records.</param>\n            <param name=\"style\">The prefix style used in the data.</param>\n            <param name=\"expectedField\">The tag of records to return (if non-positive, then no tag is\n            expected and all records are returned).</param>\n            <returns>The sequence of deserialized objects.</returns>\n            <param name=\"context\">Additional information about this serialization operation.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.SerializeWithLengthPrefix(System.IO.Stream,System.Object,System.Type,ProtoBuf.PrefixStyle,System.Int32)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream,\n            with a length-prefix. This is useful for socket programming,\n            as DeserializeWithLengthPrefix can be used to read the single object back\n            from an ongoing stream.\n            </summary>\n            <param name=\"type\">The type being serialized.</param>\n            <param name=\"value\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"dest\">The destination stream to write to.</param>\n            <param name=\"fieldNumber\">The tag used as a prefix to each record (only used with base-128 style prefixes).</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.SerializeWithLengthPrefix(System.IO.Stream,System.Object,System.Type,ProtoBuf.PrefixStyle,System.Int32,ProtoBuf.SerializationContext)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream,\n            with a length-prefix. This is useful for socket programming,\n            as DeserializeWithLengthPrefix can be used to read the single object back\n            from an ongoing stream.\n            </summary>\n            <param name=\"type\">The type being serialized.</param>\n            <param name=\"value\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"dest\">The destination stream to write to.</param>\n            <param name=\"fieldNumber\">The tag used as a prefix to each record (only used with base-128 style prefixes).</param>\n            <param name=\"context\">Additional information about this serialization operation.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Deserialize(System.IO.Stream,System.Object,System.Type)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (which may be null).\n            </summary>\n            <param name=\"type\">The type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Deserialize(System.IO.Stream,System.Object,System.Type,ProtoBuf.SerializationContext)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (which may be null).\n            </summary>\n            <param name=\"type\">The type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n            <param name=\"context\">Additional information about this serialization operation.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Deserialize(System.IO.Stream,System.Object,System.Type,System.Int32)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (which may be null).\n            </summary>\n            <param name=\"type\">The type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <param name=\"length\">The number of bytes to consume.</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Deserialize(System.IO.Stream,System.Object,System.Type,System.Int32,ProtoBuf.SerializationContext)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (which may be null).\n            </summary>\n            <param name=\"type\">The type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <param name=\"length\">The number of bytes to consume (or -1 to read to the end of the stream).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n            <param name=\"context\">Additional information about this serialization operation.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Deserialize(ProtoBuf.ProtoReader,System.Object,System.Type)\">\n            <summary>\n            Applies a protocol-buffer reader to an existing instance (which may be null).\n            </summary>\n            <param name=\"type\">The type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The reader to apply to the instance (cannot be null).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.TryDeserializeAuxiliaryType(ProtoBuf.ProtoReader,ProtoBuf.DataFormat,System.Int32,System.Type,System.Object@,System.Boolean,System.Boolean,System.Boolean,System.Boolean)\">\n            <summary>\n            This is the more \"complete\" version of Deserialize, which handles single instances of mapped types.\n            The value is read as a complete field, including field-header and (for sub-objects) a\n            length-prefix..kmc  \n            \n            In addition to that, this provides support for:\n             - basic values; individual int / string / Guid / etc\n             - IList sets of any type handled by TryDeserializeAuxiliaryType\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Create\">\n            <summary>\n            Creates a new runtime model, to which the caller\n            can add support for a range of types. A model\n            can be used \"as is\", or can be compiled for\n            optimal performance.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.ResolveProxies(System.Type)\">\n            <summary>\n            Applies common proxy scenarios, resolving the actual type to consider\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.IsDefined(System.Type)\">\n            <summary>\n            Indicates whether the supplied type is explicitly modelled by the model\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.GetKey(System.Type@)\">\n            <summary>\n            Provides the key that represents a given type in the current model.\n            The type is also normalized for proxies at the same time.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.GetKeyImpl(System.Type)\">\n            <summary>\n            Provides the key that represents a given type in the current model.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Serialize(System.Int32,System.Object,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream.\n            </summary>\n            <param name=\"key\">Represents the type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"dest\">The destination stream to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.Deserialize(System.Int32,System.Object,ProtoBuf.ProtoReader)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (which may be null).\n            </summary>\n            <param name=\"key\">Represents the type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.DeepClone(System.Object)\">\n            <summary>\n            Create a deep clone of the supplied instance; any sub-items are also cloned.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.ThrowUnexpectedSubtype(System.Type,System.Type)\">\n            <summary>\n            Indicates that while an inheritance tree exists, the exact type encountered was not\n            specified in that hierarchy and cannot be processed.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.ThrowUnexpectedType(System.Type)\">\n            <summary>\n            Indicates that the given type was not expected, and cannot be processed.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.ThrowCannotCreateInstance(System.Type)\">\n            <summary>\n            Indicates that the given type cannot be constructed; it may still be possible to \n            deserialize into existing instances.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.CanSerializeContractType(System.Type)\">\n            <summary>\n            Returns true if the type supplied is either a recognised contract type,\n            or a *list* of a recognised contract type. \n            </summary>\n            <remarks>Note that primitives always return false, even though the engine\n            will, if forced, try to serialize such</remarks>\n            <returns>True if this type is recognised as a serializable entity, else false</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.CanSerialize(System.Type)\">\n            <summary>\n            Returns true if the type supplied is a basic type with inbuilt handling,\n            a recognised contract type, or a *list* of a basic / contract type. \n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.CanSerializeBasicType(System.Type)\">\n            <summary>\n            Returns true if the type supplied is a basic type with inbuilt handling,\n            or a *list* of a basic type with inbuilt handling\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.GetSchema(System.Type)\">\n            <summary>\n            Suggest a .proto definition for the given type\n            </summary>\n            <param name=\"type\">The type to generate a .proto definition for, or <c>null</c> to generate a .proto that represents the entire model</param>\n            <returns>The .proto definition as a string</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.TypeModel.CreateFormatter(System.Type)\">\n            <summary>\n            Creates a new IFormatter that uses protocol-buffer [de]serialization.\n            </summary>\n            <returns>A new IFormatter to be used during [de]serialization.</returns>\n            <param name=\"type\">The type of object to be [de]deserialized by the formatter.</param>\n        </member>\n        <member name=\"E:ProtoBuf.Meta.TypeModel.DynamicTypeFormatting\">\n            <summary>\n            Used to provide custom services for writing and parsing type names when using dynamic types. Both parsing and formatting\n            are provided on a single API as it is essential that both are mapped identically at all times.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.TypeModel.CallbackType\">\n            <summary>\n            Indicates the type of callback to be used\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.Meta.TypeModel.CallbackType.BeforeSerialize\">\n            <summary>\n            Invoked before an object is serialized\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.Meta.TypeModel.CallbackType.AfterSerialize\">\n            <summary>\n            Invoked after an object is serialized\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.Meta.TypeModel.CallbackType.BeforeDeserialize\">\n            <summary>\n            Invoked before an object is deserialized (or when a new instance is created)\n            </summary>            \n        </member>\n        <member name=\"F:ProtoBuf.Meta.TypeModel.CallbackType.AfterDeserialize\">\n            <summary>\n            Invoked after an object is deserialized\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.SerializeDateTimeKind\">\n            <summary>\n            Should the <c>Kind</c> be included on date/time values?\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.GetTypes\">\n            <summary>\n            Returns a sequence of the Type instances that can be\n            processed by this model.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.GetSchema(System.Type)\">\n            <summary>\n            Suggest a .proto definition for the given type\n            </summary>\n            <param name=\"type\">The type to generate a .proto definition for, or <c>null</c> to generate a .proto that represents the entire model</param>\n            <returns>The .proto definition as a string</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.Add(System.Type,System.Boolean)\">\n            <summary>\n            Adds support for an additional type in this model, optionally\n            appplying inbuilt patterns. If the type is already known to the\n            model, the existing type is returned **without** applying\n            any additional behaviour.\n            </summary>\n            <remarks>Inbuilt patterns include:\n            [ProtoContract]/[ProtoMember(n)]\n            [DataContract]/[DataMember(Order=n)]\n            [XmlType]/[XmlElement(Order=n)]\n            [On{Des|S}erializ{ing|ed}]\n            ShouldSerialize*/*Specified\n            </remarks>\n            <param name=\"type\">The type to be supported</param>\n            <param name=\"applyDefaultBehaviour\">Whether to apply the inbuilt configuration patterns (via attributes etc), or\n            just add the type with no additional configuration (the type must then be manually configured).</param>\n            <returns>The MetaType representing this type, allowing\n            further configuration.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.ThrowIfFrozen\">\n            <summary>\n            Verifies that the model is still open to changes; if not, an exception is thrown\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.Freeze\">\n            <summary>\n            Prevents further changes to this model\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.GetKeyImpl(System.Type)\">\n            <summary>\n            Provides the key that represents a given type in the current model.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.Serialize(System.Int32,System.Object,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream.\n            </summary>\n            <param name=\"key\">Represents the type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"dest\">The destination stream to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.Deserialize(System.Int32,System.Object,ProtoBuf.ProtoReader)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (which may be null).\n            </summary>\n            <param name=\"key\">Represents the type (including inheritance) to consider.</param>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.CompileInPlace\">\n            <summary>\n            Compiles the serializers individually; this is *not* a full\n            standalone compile, but can significantly boost performance\n            while allowing additional types to be added.\n            </summary>\n            <remarks>An in-place compile can access non-public types / members</remarks>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.Compile\">\n            <summary>\n            Fully compiles the current model into a static-compiled model instance\n            </summary>\n            <remarks>A full compilation is restricted to accessing public types / members</remarks>\n            <returns>An instance of the newly created compiled type-model</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.Compile(System.String,System.String)\">\n            <summary>\n            Fully compiles the current model into a static-compiled serialization dll\n            (the serialization dll still requires protobuf-net for support services).\n            </summary>\n            <remarks>A full compilation is restricted to accessing public types / members</remarks>\n            <param name=\"name\">The name of the TypeModel class to create</param>\n            <param name=\"path\">The path for the new dll</param>\n            <returns>An instance of the newly created compiled type-model</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.Compile(ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions)\">\n            <summary>\n            Fully compiles the current model into a static-compiled serialization dll\n            (the serialization dll still requires protobuf-net for support services).\n            </summary>\n            <remarks>A full compilation is restricted to accessing public types / members</remarks>\n            <returns>An instance of the newly created compiled type-model</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.SetDefaultFactory(System.Reflection.MethodInfo)\">\n            <summary>\n            Designate a factory-method to use to create instances of any type; note that this only affect types seen by the serializer *after* setting the factory.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.InferTagFromNameDefault\">\n            <summary>\n            Global default that\n            enables/disables automatic tag generation based on the existing name / order\n            of the defined members. See <seealso cref=\"P:ProtoBuf.ProtoContractAttribute.InferTagFromName\"/>\n            for usage and <b>important warning</b> / explanation.\n            You must set the global default before attempting to serialize/deserialize any\n            impacted type.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.AutoAddProtoContractTypesOnly\">\n            <summary>\n            Global default that determines whether types are considered serializable\n            if they have [DataContract] / [XmlType]. With this enabled, <b>ONLY</b>\n            types marked as [ProtoContract] are added automatically.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.UseImplicitZeroDefaults\">\n            <summary>\n            Global switch that enables or disables the implicit\n            handling of \"zero defaults\"; meanning: if no other default is specified,\n            it assumes bools always default to false, integers to zero, etc.\n            \n            If this is disabled, no such assumptions are made and only *explicit*\n            default values are processed. This is enabled by default to \n            preserve similar logic to v1.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.AllowParseableTypes\">\n            <summary>\n            Global switch that determines whether types with a <c>.ToString()</c> and a <c>Parse(string)</c>\n            should be serialized as strings.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.IncludeDateTimeKind\">\n            <summary>\n            Global switch that determines whether DateTime serialization should include the <c>Kind</c> of the date/time.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.Default\">\n            <summary>\n            The default model, used to support ProtoBuf.Serializer\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.Item(System.Type)\">\n            <summary>\n            Obtains the MetaType associated with a given Type for the current model,\n            allowing additional configuration.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.AutoCompile\">\n            <summary>\n            Should serializers be compiled on demand? It may be useful\n            to disable this for debugging purposes.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.AutoAddMissingTypes\">\n            <summary>\n            Should support for unexpected types be added automatically?\n            If false, an exception is thrown when unexpected types\n            are encountered.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.MetadataTimeoutMilliseconds\">\n            <summary>\n            The amount of time to wait if there are concurrent metadata access operations\n            </summary>\n        </member>\n        <member name=\"E:ProtoBuf.Meta.RuntimeTypeModel.LockContended\">\n            <summary>\n            If a lock-contention is detected, this event signals the *owner* of the lock responsible for the blockage, indicating\n            what caused the problem; this is only raised if the lock-owning code successfully completes.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions\">\n            <summary>\n            Represents configuration options for compiling a model to \n            a standalone assembly.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions.SetFrameworkOptions(ProtoBuf.Meta.MetaType)\">\n            <summary>\n            Import framework options from an existing type\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions.TargetFrameworkName\">\n            <summary>\n            The TargetFrameworkAttribute FrameworkName value to burn into the generated assembly\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions.TargetFrameworkDisplayName\">\n            <summary>\n            The TargetFrameworkAttribute FrameworkDisplayName value to burn into the generated assembly\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions.TypeName\">\n            <summary>\n            The name of the TypeModel class to create\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions.OutputPath\">\n            <summary>\n            The path for the new dll\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions.ImageRuntimeVersion\">\n            <summary>\n            The runtime version for the generated assembly\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions.MetaDataVersion\">\n            <summary>\n            The runtime version for the generated assembly\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.RuntimeTypeModel.CompilerOptions.Accessibility\">\n            <summary>\n            The acecssibility of the generated serializer\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.RuntimeTypeModel.Accessibility\">\n            <summary>\n            Type accessibility\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.Meta.RuntimeTypeModel.Accessibility.Public\">\n            <summary>\n            Available to all callers\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.Meta.RuntimeTypeModel.Accessibility.Internal\">\n            <summary>\n            Available to all callers in the same assembly, or assemblies specified via [InternalsVisibleTo(...)]\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.LockContentedEventArgs\">\n            <summary>\n            Contains the stack-trace of the owning code when a lock-contention scenario is detected\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.LockContentedEventArgs.OwnerStackTrace\">\n            <summary>\n            The stack-trace of the code that owned the lock when a lock-contention scenario occurred\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.LockContentedEventHandler\">\n            <summary>\n            Event-type that is raised when a lock-contention scenario is detected\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.SubType\">\n            <summary>\n            Represents an inherited type in a type hierarchy.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.SubType.#ctor(System.Int32,ProtoBuf.Meta.MetaType,ProtoBuf.DataFormat)\">\n            <summary>\n            Creates a new SubType instance.\n            </summary>\n            <param name=\"fieldNumber\">The field-number that is used to encapsulate the data (as a nested\n            message) for the derived dype.</param>\n            <param name=\"derivedType\">The sub-type to be considered.</param>\n            <param name=\"format\">Specific encoding style to use; in particular, Grouped can be used to avoid buffering, but is not the default.</param>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.SubType.FieldNumber\">\n            <summary>\n            The field-number that is used to encapsulate the data (as a nested\n            message) for the derived dype.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.SubType.DerivedType\">\n            <summary>\n            The sub-type to be considered.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.TypeFormatEventArgs\">\n            <summary>\n            Event arguments needed to perform type-formatting functions; this could be resolving a Type to a string suitable for serialization, or could\n            be requesting a Type from a string. If no changes are made, a default implementation will be used (from the assembly-qualified names).\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.TypeFormatEventArgs.Type\">\n            <summary>\n            The type involved in this map; if this is initially null, a Type is expected to be provided for the string in FormattedName.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.TypeFormatEventArgs.FormattedName\">\n            <summary>\n            The formatted-name involved in this map; if this is initially null, a formatted-name is expected from the type in Type.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.TypeFormatEventHandler\">\n            <summary>\n            Delegate type used to perform type-formatting functions; the sender originates as the type-model.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Meta.ValueMember\">\n            <summary>\n            Represents a member (property/field) that is mapped to a protobuf field\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.ValueMember.#ctor(ProtoBuf.Meta.RuntimeTypeModel,System.Type,System.Int32,System.Reflection.MemberInfo,System.Type,System.Type,System.Type,ProtoBuf.DataFormat,System.Object)\">\n            <summary>\n            Creates a new ValueMember instance\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.ValueMember.#ctor(ProtoBuf.Meta.RuntimeTypeModel,System.Int32,System.Type,System.Type,System.Type,ProtoBuf.DataFormat)\">\n            <summary>\n            Creates a new ValueMember instance\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Meta.ValueMember.SetSpecified(System.Reflection.MethodInfo,System.Reflection.MethodInfo)\">\n            <summary>\n            Specifies methods for working with optional data members.\n            </summary>\n            <param name=\"getSpecified\">Provides a method (null for none) to query whether this member should\n            be serialized; it must be of the form \"bool {Method}()\". The member is only serialized if the\n            method returns true.</param>\n            <param name=\"setSpecified\">Provides a method (null for none) to indicate that a member was\n            deserialized; it must be of the form \"void {Method}(bool)\", and will be called with \"true\"\n            when data is found.</param>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.FieldNumber\">\n            <summary>\n            The number that identifies this member in a protobuf stream\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.Member\">\n            <summary>\n            Gets the member (field/property) which this member relates to.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.ItemType\">\n            <summary>\n            Within a list / array / etc, the type of object for each item in the list (especially useful with ArrayList)\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.MemberType\">\n            <summary>\n            The underlying type of the member\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.DefaultType\">\n            <summary>\n            For abstract types (IList etc), the type of concrete object to create (if required)\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.ParentType\">\n            <summary>\n            The type the defines the member\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.DefaultValue\">\n            <summary>\n            The default value of the item (members with this value will not be serialized)\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.DataFormat\">\n            <summary>\n            Specifies the rules used to process the field; this is used to determine the most appropriate\n            wite-type, but also to describe subtypes <i>within</i> that wire-type (such as SignedVariant)\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.IsStrict\">\n            <summary>\n            Indicates whether this field should follow strict encoding rules; this means (for example) that if a \"fixed32\"\n            is encountered when \"variant\" is defined, then it will fail (throw an exception) when parsing. Note that\n            when serializing the defined type is always used.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.IsPacked\">\n            <summary>\n            Indicates whether this field should use packed encoding (which can save lots of space for repeated primitive values).\n            This option only applies to list/array data of primitive types (int, double, etc).\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.OverwriteList\">\n            <summary>\n            Indicates whether this field should *repace* existing values (the default is false, meaning *append*).\n            This option only applies to list/array data.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.IsRequired\">\n            <summary>\n            Indicates whether this field is mandatory.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.AsReference\">\n            <summary>\n            Enables full object-tracking/full-graph support.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.DynamicType\">\n            <summary>\n            Embeds the type information into the stream, allowing usage with types not known in advance.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.Name\">\n            <summary>\n            Gets the logical name for this member in the schema (this is not critical for binary serialization, but may be used\n            when inferring a schema).\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Meta.ValueMember.SupportNull\">\n            <summary>\n            Should lists have extended support for null values? Note this makes the serialization less efficient.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.PrefixStyle\">\n            <summary>\n            Specifies the type of prefix that should be applied to messages.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.PrefixStyle.None\">\n            <summary>\n            No length prefix is applied to the data; the data is terminated only be the end of the stream.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.PrefixStyle.Base128\">\n            <summary>\n            A base-128 length prefix is applied to the data (efficient for short messages).\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.PrefixStyle.Fixed32\">\n            <summary>\n            A fixed-length (little-endian) length prefix is applied to the data (useful for compatibility).\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.PrefixStyle.Fixed32BigEndian\">\n            <summary>\n            A fixed-length (big-endian) length prefix is applied to the data (useful for compatibility).\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoContractAttribute\">\n            <summary>\n            Indicates that a type is defined for protocol-buffer serialization.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.Name\">\n            <summary>\n            Gets or sets the defined name of the type.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.ImplicitFirstTag\">\n            <summary>\n            Gets or sets the fist offset to use with implicit field tags;\n            only uesd if ImplicitFields is set.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.UseProtoMembersOnly\">\n            <summary>\n            If specified, alternative contract markers (such as markers for XmlSerailizer or DataContractSerializer) are ignored.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.IgnoreListHandling\">\n            <summary>\n            If specified, do NOT treat this type as a list, even if it looks like one.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.ImplicitFields\">\n            <summary>\n            Gets or sets the mechanism used to automatically infer field tags\n            for members. This option should be used in advanced scenarios only.\n            Please review the important notes against the ImplicitFields enumeration.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.InferTagFromName\">\n            <summary>\n            Enables/disables automatic tag generation based on the existing name / order\n            of the defined members. This option is not used for members marked\n            with ProtoMemberAttribute, as intended to provide compatibility with\n            WCF serialization. WARNING: when adding new fields you must take\n            care to increase the Order for new elements, otherwise data corruption\n            may occur.\n            </summary>\n            <remarks>If not explicitly specified, the default is assumed from Serializer.GlobalOptions.InferTagFromName.</remarks>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.InferTagFromNameHasValue\">\n            <summary>\n            Has a InferTagFromName value been explicitly set? if not, the default from the type-model is assumed.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.DataMemberOffset\">\n            <summary>\n            Specifies an offset to apply to [DataMember(Order=...)] markers;\n            this is useful when working with mex-generated classes that have\n            a different origin (usually 1 vs 0) than the original data-contract.\n            \n            This value is added to the Order of each member.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.SkipConstructor\">\n            <summary>\n            If true, the constructor for the type is bypassed during deserialization, meaning any field initializers\n            or other initialization code is skipped.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.AsReferenceDefault\">\n            <summary>\n            Should this type be treated as a reference by default? Please also see the implications of this,\n            as recorded on ProtoMemberAttribute.AsReference\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.EnumPassthru\">\n            <summary>\n            Applies only to enums (not to DTO classes themselves); gets or sets a value indicating that an enum should be treated directly as an int/short/etc, rather\n            than enforcing .proto enum rules. This is useful *in particul* for [Flags] enums.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoContractAttribute.EnumPassthruHasValue\">\n            <summary>\n            Has a EnumPassthru value been explicitly set?\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoEnumAttribute\">\n            <summary>\n            Used to define protocol-buffer specific behavior for\n            enumerated values.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoEnumAttribute.HasValue\">\n            <summary>\n            Indicates whether this instance has a customised value mapping\n            </summary>\n            <returns>true if a specific value is set</returns>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoEnumAttribute.Value\">\n            <summary>\n            Gets or sets the specific value to use for this enum during serialization.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoEnumAttribute.Name\">\n            <summary>\n            Gets or sets the defined name of the enum, as used in .proto\n            (this name is not used during serialization).\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoException\">\n            <summary>\n            Indicates an error during serialization/deserialization of a proto stream.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoException.#ctor\">\n            <summary>Creates a new ProtoException instance.</summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoException.#ctor(System.String)\">\n            <summary>Creates a new ProtoException instance.</summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoException.#ctor(System.String,System.Exception)\">\n            <summary>Creates a new ProtoException instance.</summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)\">\n            <summary>Creates a new ProtoException instance.</summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoIgnoreAttribute\">\n            <summary>\n            Indicates that a member should be excluded from serialization; this\n            is only normally used when using implict fields.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoPartialIgnoreAttribute\">\n            <summary>\n            Indicates that a member should be excluded from serialization; this\n            is only normally used when using implict fields. This allows\n            ProtoIgnoreAttribute usage\n            even for partial classes where the individual members are not\n            under direct control.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoPartialIgnoreAttribute.#ctor(System.String)\">\n            <summary>\n            Creates a new ProtoPartialIgnoreAttribute instance.\n            </summary>\n            <param name=\"memberName\">Specifies the member to be ignored.</param>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoPartialIgnoreAttribute.MemberName\">\n            <summary>\n            The name of the member to be ignored.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoIncludeAttribute\">\n            <summary>\n            Indicates the known-types to support for an individual\n            message. This serializes each level in the hierarchy as\n            a nested message to retain wire-compatibility with\n            other protocol-buffer implementations.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoIncludeAttribute.#ctor(System.Int32,System.Type)\">\n            <summary>\n             Creates a new instance of the ProtoIncludeAttribute.\n             </summary>\n             <param name=\"tag\">The unique index (within the type) that will identify this data.</param>\n             <param name=\"knownType\">The additional type to serialize/deserialize.</param>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoIncludeAttribute.#ctor(System.Int32,System.String)\">\n            <summary>\n            Creates a new instance of the ProtoIncludeAttribute.\n            </summary>\n            <param name=\"tag\">The unique index (within the type) that will identify this data.</param>\n            <param name=\"knownTypeName\">The additional type to serialize/deserialize.</param>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoIncludeAttribute.Tag\">\n            <summary>\n            Gets the unique index (within the type) that will identify this data.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoIncludeAttribute.KnownTypeName\">\n            <summary>\n            Gets the additional type to serialize/deserialize.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoIncludeAttribute.KnownType\">\n            <summary>\n            Gets the additional type to serialize/deserialize.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoIncludeAttribute.DataFormat\">\n            <summary>\n            Specifies whether the inherited sype's sub-message should be\n            written with a length-prefix (default), or with group markers.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoMemberAttribute\">\n            <summary>\n            Declares a member to be used in protocol-buffer serialization, using\n            the given Tag. A DataFormat may be used to optimise the serialization\n            format (for instance, using zigzag encoding for negative numbers, or \n            fixed-length encoding for large values.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoMemberAttribute.CompareTo(System.Object)\">\n            <summary>\n            Compare with another ProtoMemberAttribute for sorting purposes\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoMemberAttribute.CompareTo(ProtoBuf.ProtoMemberAttribute)\">\n            <summary>\n            Compare with another ProtoMemberAttribute for sorting purposes\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoMemberAttribute.#ctor(System.Int32)\">\n            <summary>\n            Creates a new ProtoMemberAttribute instance.\n            </summary>\n            <param name=\"tag\">Specifies the unique tag used to identify this member within the type.</param>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.Name\">\n            <summary>\n            Gets or sets the original name defined in the .proto; not used\n            during serialization.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.DataFormat\">\n            <summary>\n            Gets or sets the data-format to be used when encoding this value.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.Tag\">\n            <summary>\n            Gets the unique tag used to identify this member within the type.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.IsRequired\">\n            <summary>\n            Gets or sets a value indicating whether this member is mandatory.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.IsPacked\">\n            <summary>\n            Gets a value indicating whether this member is packed.\n            This option only applies to list/array data of primitive types (int, double, etc).\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.OverwriteList\">\n            <summary>\n            Indicates whether this field should *repace* existing values (the default is false, meaning *append*).\n            This option only applies to list/array data.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.AsReference\">\n            <summary>\n            Enables full object-tracking/full-graph support.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.DynamicType\">\n            <summary>\n            Embeds the type information into the stream, allowing usage with types not known in advance.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoMemberAttribute.Options\">\n            <summary>\n            Gets or sets a value indicating whether this member is packed (lists/arrays).\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.MemberSerializationOptions\">\n            <summary>\n            Additional (optional) settings that control serialization of members\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.MemberSerializationOptions.None\">\n            <summary>\n            Default; no additional options\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.MemberSerializationOptions.Packed\">\n            <summary>\n            Indicates that repeated elements should use packed (length-prefixed) encoding\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.MemberSerializationOptions.Required\">\n            <summary>\n            Indicates that the given item is required\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.MemberSerializationOptions.AsReference\">\n            <summary>\n            Enables full object-tracking/full-graph support\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.MemberSerializationOptions.DynamicType\">\n            <summary>\n            Embeds the type information into the stream, allowing usage with types not known in advance\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.MemberSerializationOptions.OverwriteList\">\n            <summary>\n            Indicates whether this field should *repace* existing values (the default is false, meaning *append*).\n            This option only applies to list/array data.\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.MemberSerializationOptions.AsReferenceHasValue\">\n            <summary>\n            Determines whether the types AsReferenceDefault value is used, or whether this member's AsReference should be used\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoPartialMemberAttribute\">\n            <summary>\n            Declares a member to be used in protocol-buffer serialization, using\n            the given Tag and MemberName. This allows ProtoMemberAttribute usage\n            even for partial classes where the individual members are not\n            under direct control.\n            A DataFormat may be used to optimise the serialization\n            format (for instance, using zigzag encoding for negative numbers, or \n            fixed-length encoding for large values.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoPartialMemberAttribute.#ctor(System.Int32,System.String)\">\n            <summary>\n            Creates a new ProtoMemberAttribute instance.\n            </summary>\n            <param name=\"tag\">Specifies the unique tag used to identify this member within the type.</param>\n            <param name=\"memberName\">Specifies the member to be serialized.</param>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoPartialMemberAttribute.MemberName\">\n            <summary>\n            The name of the member to be serialized.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoReader\">\n            <summary>\n            A stateful reader, used to read a protobuf stream. Typical usage would be (sequentially) to call\n            ReadFieldHeader and (after matching the field) an appropriate Read* method.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.#ctor(System.IO.Stream,ProtoBuf.Meta.TypeModel,ProtoBuf.SerializationContext)\">\n            <summary>\n            Creates a new reader against a stream\n            </summary>\n            <param name=\"source\">The source stream</param>\n            <param name=\"model\">The model to use for serialization; this can be null, but this will impair the ability to deserialize sub-objects</param>\n            <param name=\"context\">Additional context about this serialization operation</param>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.#ctor(System.IO.Stream,ProtoBuf.Meta.TypeModel,ProtoBuf.SerializationContext,System.Int32)\">\n            <summary>\n            Creates a new reader against a stream\n            </summary>\n            <param name=\"source\">The source stream</param>\n            <param name=\"model\">The model to use for serialization; this can be null, but this will impair the ability to deserialize sub-objects</param>\n            <param name=\"context\">Additional context about this serialization operation</param>\n            <param name=\"length\">The number of bytes to read, or -1 to read until the end of the stream</param>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.Dispose\">\n            <summary>\n            Releases resources used by the reader, but importantly <b>does not</b> Dispose the \n            underlying stream; in many typical use-cases the stream is used for different\n            processes, so it is assumed that the consumer will Dispose their stream separately.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadUInt32\">\n            <summary>\n            Reads an unsigned 32-bit integer from the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadInt16\">\n            <summary>\n            Reads a signed 16-bit integer from the stream: Variant, Fixed32, Fixed64, SignedVariant\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadUInt16\">\n            <summary>\n            Reads an unsigned 16-bit integer from the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadByte\">\n            <summary>\n            Reads an unsigned 8-bit integer from the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadSByte\">\n            <summary>\n            Reads a signed 8-bit integer from the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadInt32\">\n            <summary>\n            Reads a signed 32-bit integer from the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadInt64\">\n            <summary>\n            Reads a signed 64-bit integer from the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadString\">\n            <summary>\n            Reads a string from the stream (using UTF8); supported wire-types: String\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ThrowEnumException(System.Type,System.Int32)\">\n            <summary>\n            Throws an exception indication that the given value cannot be mapped to an enum.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadDouble\">\n            <summary>\n            Reads a double-precision number from the stream; supported wire-types: Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadObject(System.Object,System.Int32,ProtoBuf.ProtoReader)\">\n            <summary>\n            Reads (merges) a sub-message from the stream, internally calling StartSubItem and EndSubItem, and (in between)\n            parsing the message in accordance with the model associated with the reader\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.EndSubItem(ProtoBuf.SubItemToken,ProtoBuf.ProtoReader)\">\n            <summary>\n            Makes the end of consuming a nested message in the stream; the stream must be either at the correct EndGroup\n            marker, or all fields of the sub-message must have been consumed (in either case, this means ReadFieldHeader\n            should return zero)\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.StartSubItem(ProtoBuf.ProtoReader)\">\n            <summary>\n            Begins consuming a nested message in the stream; supported wire-types: StartGroup, String\n            </summary>\n            <remarks>The token returned must be help and used when callining EndSubItem</remarks>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadFieldHeader\">\n            <summary>\n            Reads a field header from the stream, setting the wire-type and retuning the field number. If no\n            more fields are available, then 0 is returned. This methods respects sub-messages.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.TryReadFieldHeader(System.Int32)\">\n            <summary>\n            Looks ahead to see whether the next field in the stream is what we expect\n            (typically; what we've just finished reading - for example ot read successive list items)\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.Hint(ProtoBuf.WireType)\">\n            <summary>\n            Compares the streams current wire-type to the hinted wire-type, updating the reader if necessary; for example,\n            a Variant may be updated to SignedVariant. If the hinted wire-type is unrelated then no change is made.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.Assert(ProtoBuf.WireType)\">\n            <summary>\n            Verifies that the stream's current wire-type is as expected, or a specialized sub-type (for example,\n            SignedVariant) - in which case the current wire-type is updated. Otherwise an exception is thrown.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.SkipField\">\n            <summary>\n            Discards the data for the current field.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadUInt64\">\n            <summary>\n            Reads an unsigned 64-bit integer from the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadSingle\">\n            <summary>\n            Reads a single-precision number from the stream; supported wire-types: Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadBoolean\">\n            <summary>\n            Reads a boolean value from the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n            <returns></returns>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.AppendBytes(System.Byte[],ProtoBuf.ProtoReader)\">\n            <summary>\n            Reads a byte-sequence from the stream, appending them to an existing byte-sequence (which can be null); supported wire-types: String\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadLengthPrefix(System.IO.Stream,System.Boolean,ProtoBuf.PrefixStyle,System.Int32@)\">\n            <summary>\n            Reads the length-prefix of a message from a stream without buffering additional data, allowing a fixed-length\n            reader to be created.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.DirectReadLittleEndianInt32(System.IO.Stream)\">\n            <summary>\n            Reads a little-endian encoded integer. An exception is thrown if the data is not all available.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.DirectReadBigEndianInt32(System.IO.Stream)\">\n            <summary>\n            Reads a big-endian encoded integer. An exception is thrown if the data is not all available.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.DirectReadVarintInt32(System.IO.Stream)\">\n            <summary>\n            Reads a varint encoded integer. An exception is thrown if the data is not all available.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.DirectReadBytes(System.IO.Stream,System.Byte[],System.Int32,System.Int32)\">\n            <summary>\n            Reads a string (of a given lenth, in bytes) directly from the source into a pre-existing buffer. An exception is thrown if the data is not all available.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.DirectReadBytes(System.IO.Stream,System.Int32)\">\n            <summary>\n            Reads a given number of bytes directly from the source. An exception is thrown if the data is not all available.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.DirectReadString(System.IO.Stream,System.Int32)\">\n            <summary>\n            Reads a string (of a given lenth, in bytes) directly from the source. An exception is thrown if the data is not all available.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadLengthPrefix(System.IO.Stream,System.Boolean,ProtoBuf.PrefixStyle,System.Int32@,System.Int32@)\">\n            <summary>\n            Reads the length-prefix of a message from a stream without buffering additional data, allowing a fixed-length\n            reader to be created.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.TryReadUInt32Variant(System.IO.Stream,System.UInt32@)\">\n            <returns>The number of bytes consumed; 0 if no data available</returns>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.AppendExtensionData(ProtoBuf.IExtensible)\">\n            <summary>\n            Copies the current field into the instance as extension data\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.HasSubValue(ProtoBuf.WireType,ProtoBuf.ProtoReader)\">\n            <summary>\n            Indicates whether the reader still has data remaining in the current sub-item,\n            additionally setting the wire-type for the next field if there is more data.\n            This is used when decoding packed data.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.NoteObject(System.Object,ProtoBuf.ProtoReader)\">\n            <summary>\n            Utility method, not intended for public use; this helps maintain the root object is complex scenarios\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.ReadType\">\n            <summary>\n            Reads a Type from the stream, using the model's DynamicTypeFormatting if appropriate; supported wire-types: String\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoReader.Merge(ProtoBuf.ProtoReader,System.Object,System.Object)\">\n            <summary>\n            Merge two objects using the details from the current reader; this is used to change the type\n            of objects when an inheritance relationship is discovered later than usual during deserilazation.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoReader.FieldNumber\">\n            <summary>\n            Gets the number of the field being processed.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoReader.WireType\">\n            <summary>\n            Indicates the underlying proto serialization format on the wire.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoReader.InternStrings\">\n            <summary>\n            Gets / sets a flag indicating whether strings should be checked for repetition; if\n            true, any repeated UTF-8 byte sequence will result in the same String instance, rather\n            than a second instance of the same string. Enabled by default. Note that this uses\n            a <i>custom</i> interner - the system-wide string interner is not used.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoReader.Context\">\n            <summary>\n            Addition information about this deserialization operation.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoReader.Position\">\n            <summary>\n            Returns the position of the current reader (note that this is not necessarily the same as the position\n            in the underlying stream, if multiple readers are used on the same stream)\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoReader.Model\">\n            <summary>\n            Get the TypeModel associated with this reader\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ProtoWriter\">\n            <summary>\n            Represents an output stream for writing protobuf data.\n            \n            Why is the API backwards (static methods with writer arguments)?\n            See: http://marcgravell.blogspot.com/2010/03/last-will-be-first-and-first-will-be.html\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteObject(System.Object,System.Int32,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Write an encapsulated sub-object, using the supplied unique key (reprasenting a type).\n            </summary>\n            <param name=\"value\">The object to write.</param>\n            <param name=\"key\">The key that uniquely identifies the type within the model.</param>\n            <param name=\"writer\">The destination.</param>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteRecursionSafeObject(System.Object,System.Int32,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Write an encapsulated sub-object, using the supplied unique key (reprasenting a type) - but the\n            caller is asserting that this relationship is non-recursive; no recursion check will be\n            performed.\n            </summary>\n            <param name=\"value\">The object to write.</param>\n            <param name=\"key\">The key that uniquely identifies the type within the model.</param>\n            <param name=\"writer\">The destination.</param>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteFieldHeader(System.Int32,ProtoBuf.WireType,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a field-header, indicating the format of the next data we plan to write.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteBytes(System.Byte[],ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a byte-array to the stream; supported wire-types: String\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteBytes(System.Byte[],System.Int32,System.Int32,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a byte-array to the stream; supported wire-types: String\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.StartSubItem(System.Object,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Indicates the start of a nested record.\n            </summary>\n            <param name=\"instance\">The instance to write.</param>\n            <param name=\"writer\">The destination.</param>\n            <returns>A token representing the state of the stream; this token is given to EndSubItem.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.EndSubItem(ProtoBuf.SubItemToken,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Indicates the end of a nested record.\n            </summary>\n            <param name=\"token\">The token obtained from StartubItem.</param>\n            <param name=\"writer\">The destination.</param>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.#ctor(System.IO.Stream,ProtoBuf.Meta.TypeModel,ProtoBuf.SerializationContext)\">\n            <summary>\n            Creates a new writer against a stream\n            </summary>\n            <param name=\"dest\">The destination stream</param>\n            <param name=\"model\">The model to use for serialization; this can be null, but this will impair the ability to serialize sub-objects</param>\n            <param name=\"context\">Additional context about this serialization operation</param>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.Close\">\n            <summary>\n            Flushes data to the underlying stream, and releases any resources. The underlying stream is *not* disposed\n            by this operation.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.Flush(ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes any buffered data (if possible) to the underlying stream.\n            </summary>\n            <param name=\"writer\">The writer to flush</param>\n            <remarks>It is not always possible to fully flush, since some sequences\n            may require values to be back-filled into the byte-stream.</remarks>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteUInt32Variant(System.UInt32,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes an unsigned 32-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteString(System.String,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a string to the stream; supported wire-types: String\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteUInt64(System.UInt64,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes an unsigned 64-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteInt64(System.Int64,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a signed 64-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteUInt32(System.UInt32,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes an unsigned 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteInt16(System.Int16,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a signed 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteUInt16(System.UInt16,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes an unsigned 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteByte(System.Byte,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes an unsigned 8-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteSByte(System.SByte,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a signed 8-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteInt32(System.Int32,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a signed 32-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteDouble(System.Double,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a double-precision number to the stream; supported wire-types: Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteSingle(System.Single,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a single-precision number to the stream; supported wire-types: Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.ThrowEnumException(ProtoBuf.ProtoWriter,System.Object)\">\n            <summary>\n            Throws an exception indicating that the given enum cannot be mapped to a serialized value.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteBoolean(System.Boolean,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a boolean to the stream; supported wire-types: Variant, Fixed32, Fixed64\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.AppendExtensionData(ProtoBuf.IExtensible,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Copies any extension data stored for the instance to the underlying stream\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.SetPackedField(System.Int32,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Used for packed encoding; indicates that the next field should be skipped rather than\n            a field header written. Note that the field number must match, else an exception is thrown\n            when the attempt is made to write the (incorrect) field. The wire-type is taken from the\n            subsequent call to WriteFieldHeader. Only primitive types can be packed.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.SetRootObject(System.Object)\">\n            <summary>\n            Specifies a known root object to use during reference-tracked serialization\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ProtoWriter.WriteType(System.Type,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Writes a Type to the stream, using the model's DynamicTypeFormatting if appropriate; supported wire-types: String\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoWriter.Context\">\n            <summary>\n            Addition information about this serialization operation.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ProtoWriter.Model\">\n            <summary>\n            Get the TypeModel associated with this writer\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.SerializationContext\">\n            <summary>\n            Additional information about a serialization operation\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.SerializationContext.op_Implicit(ProtoBuf.SerializationContext)~System.Runtime.Serialization.StreamingContext\">\n            <summary>\n            Convert a SerializationContext to a StreamingContext\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.SerializationContext.op_Implicit(System.Runtime.Serialization.StreamingContext)~ProtoBuf.SerializationContext\">\n            <summary>\n            Convert a StreamingContext to a SerializationContext\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.SerializationContext.Context\">\n            <summary>\n            Gets or sets a user-defined object containing additional information about this serialization/deserialization operation.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.SerializationContext.Default\">\n            <summary>\n            A default SerializationContext, with minimal information.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.SerializationContext.State\">\n            <summary>\n            Gets or sets the source or destination of the transmitted data.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Serializer\">\n            <summary>\n            Provides protocol-buffer serialization capability for concrete, attributed types. This\n            is a *default* model, but custom serializer models are also supported.\n            </summary>\n            <remarks>\n            Protocol-buffer serialization is a compact binary format, designed to take\n            advantage of sparse data and knowledge of specific data types; it is also\n            extensible, allowing a type to be deserialized / merged even if some data is\n            not recognised.\n            </remarks>\n        </member>\n        <member name=\"F:ProtoBuf.Serializer.ListItemTag\">\n            <summary>\n            The field number that is used as a default when serializing/deserializing a list of objects.\n            The data is treated as repeated message with field number 1.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.GetProto``1\">\n            <summary>\n            Suggest a .proto definition for the given type\n            </summary>\n            <typeparam name=\"T\">The type to generate a .proto definition for</typeparam>\n            <returns>The .proto definition as a string</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.DeepClone``1(``0)\">\n            <summary>\n            Create a deep clone of the supplied instance; any sub-items are also cloned.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Merge``1(System.IO.Stream,``0)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance.\n            </summary>\n            <typeparam name=\"T\">The type being merged.</typeparam>\n            <param name=\"instance\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Deserialize``1(System.IO.Stream)\">\n            <summary>\n            Creates a new instance from a protocol-buffer stream\n            </summary>\n            <typeparam name=\"T\">The type to be created.</typeparam>\n            <param name=\"source\">The binary stream to apply to the new instance (cannot be null).</param>\n            <returns>A new, initialized instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Serialize``1(System.IO.Stream,``0)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream.\n            </summary>\n            <param name=\"instance\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"destination\">The destination stream to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.ChangeType``2(``0)\">\n            <summary>\n            Serializes a given instance and deserializes it as a different type;\n            this can be used to translate between wire-compatible objects (where\n            two .NET types represent the same data), or to promote/demote a type\n            through an inheritance hierarchy.\n            </summary>\n            <remarks>No assumption of compatibility is made between the types.</remarks>\n            <typeparam name=\"TFrom\">The type of the object being copied.</typeparam>\n            <typeparam name=\"TTo\">The type of the new object to be created.</typeparam>\n            <param name=\"instance\">The existing instance to use as a template.</param>\n            <returns>A new instane of type TNewType, with the data from TOldType.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Serialize``1(System.Runtime.Serialization.SerializationInfo,``0)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied SerializationInfo.\n            </summary>\n            <typeparam name=\"T\">The type being serialized.</typeparam>\n            <param name=\"instance\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"info\">The destination SerializationInfo to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Serialize``1(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext,``0)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied SerializationInfo.\n            </summary>\n            <typeparam name=\"T\">The type being serialized.</typeparam>\n            <param name=\"instance\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"info\">The destination SerializationInfo to write to.</param>\n            <param name=\"context\">Additional information about this serialization operation.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Serialize``1(System.Xml.XmlWriter,``0)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied XmlWriter.\n            </summary>\n            <typeparam name=\"T\">The type being serialized.</typeparam>\n            <param name=\"instance\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"writer\">The destination XmlWriter to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Merge``1(System.Xml.XmlReader,``0)\">\n            <summary>\n            Applies a protocol-buffer from an XmlReader to an existing instance.\n            </summary>\n            <typeparam name=\"T\">The type being merged.</typeparam>\n            <param name=\"instance\">The existing instance to be modified (cannot be null).</param>\n            <param name=\"reader\">The XmlReader containing the data to apply to the instance (cannot be null).</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Merge``1(System.Runtime.Serialization.SerializationInfo,``0)\">\n            <summary>\n            Applies a protocol-buffer from a SerializationInfo to an existing instance.\n            </summary>\n            <typeparam name=\"T\">The type being merged.</typeparam>\n            <param name=\"instance\">The existing instance to be modified (cannot be null).</param>\n            <param name=\"info\">The SerializationInfo containing the data to apply to the instance (cannot be null).</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.Merge``1(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext,``0)\">\n            <summary>\n            Applies a protocol-buffer from a SerializationInfo to an existing instance.\n            </summary>\n            <typeparam name=\"T\">The type being merged.</typeparam>\n            <param name=\"instance\">The existing instance to be modified (cannot be null).</param>\n            <param name=\"info\">The SerializationInfo containing the data to apply to the instance (cannot be null).</param>\n            <param name=\"context\">Additional information about this serialization operation.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.PrepareSerializer``1\">\n            <summary>\n            Precompiles the serializer for a given type.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.CreateFormatter``1\">\n            <summary>\n            Creates a new IFormatter that uses protocol-buffer [de]serialization.\n            </summary>\n            <typeparam name=\"T\">The type of object to be [de]deserialized by the formatter.</typeparam>\n            <returns>A new IFormatter to be used during [de]serialization.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.DeserializeItems``1(System.IO.Stream,ProtoBuf.PrefixStyle,System.Int32)\">\n            <summary>\n            Reads a sequence of consecutive length-prefixed items from a stream, using\n            either base-128 or fixed-length prefixes. Base-128 prefixes with a tag\n            are directly comparable to serializing multiple items in succession\n            (use the <see cref=\"F:ProtoBuf.Serializer.ListItemTag\"/> tag to emulate the implicit behavior\n            when serializing a list/array). When a tag is\n            specified, any records with different tags are silently omitted. The\n            tag is ignored. The tag is ignores for fixed-length prefixes.\n            </summary>\n            <typeparam name=\"T\">The type of object to deserialize.</typeparam>\n            <param name=\"source\">The binary stream containing the serialized records.</param>\n            <param name=\"style\">The prefix style used in the data.</param>\n            <param name=\"fieldNumber\">The tag of records to return (if non-positive, then no tag is\n            expected and all records are returned).</param>\n            <returns>The sequence of deserialized objects.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.DeserializeWithLengthPrefix``1(System.IO.Stream,ProtoBuf.PrefixStyle)\">\n            <summary>\n            Creates a new instance from a protocol-buffer stream that has a length-prefix\n            on data (to assist with network IO).\n            </summary>\n            <typeparam name=\"T\">The type to be created.</typeparam>\n            <param name=\"source\">The binary stream to apply to the new instance (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <returns>A new, initialized instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.DeserializeWithLengthPrefix``1(System.IO.Stream,ProtoBuf.PrefixStyle,System.Int32)\">\n            <summary>\n            Creates a new instance from a protocol-buffer stream that has a length-prefix\n            on data (to assist with network IO).\n            </summary>\n            <typeparam name=\"T\">The type to be created.</typeparam>\n            <param name=\"source\">The binary stream to apply to the new instance (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"fieldNumber\">The expected tag of the item (only used with base-128 prefix style).</param>\n            <returns>A new, initialized instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.MergeWithLengthPrefix``1(System.IO.Stream,``0,ProtoBuf.PrefixStyle)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance, using length-prefixed\n            data - useful with network IO.\n            </summary>\n            <typeparam name=\"T\">The type being merged.</typeparam>\n            <param name=\"instance\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.SerializeWithLengthPrefix``1(System.IO.Stream,``0,ProtoBuf.PrefixStyle)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream,\n            with a length-prefix. This is useful for socket programming,\n            as DeserializeWithLengthPrefix/MergeWithLengthPrefix can be used to read the single object back\n            from an ongoing stream.\n            </summary>\n            <typeparam name=\"T\">The type being serialized.</typeparam>\n            <param name=\"instance\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"destination\">The destination stream to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.SerializeWithLengthPrefix``1(System.IO.Stream,``0,ProtoBuf.PrefixStyle,System.Int32)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream,\n            with a length-prefix. This is useful for socket programming,\n            as DeserializeWithLengthPrefix/MergeWithLengthPrefix can be used to read the single object back\n            from an ongoing stream.\n            </summary>\n            <typeparam name=\"T\">The type being serialized.</typeparam>\n            <param name=\"instance\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"destination\">The destination stream to write to.</param>\n            <param name=\"fieldNumber\">The tag used as a prefix to each record (only used with base-128 style prefixes).</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.TryReadLengthPrefix(System.IO.Stream,ProtoBuf.PrefixStyle,System.Int32@)\">\n            <summary>Indicates the number of bytes expected for the next message.</summary>\n            <param name=\"source\">The stream containing the data to investigate for a length.</param>\n            <param name=\"style\">The algorithm used to encode the length.</param>\n            <param name=\"length\">The length of the message, if it could be identified.</param>\n            <returns>True if a length could be obtained, false otherwise.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.TryReadLengthPrefix(System.Byte[],System.Int32,System.Int32,ProtoBuf.PrefixStyle,System.Int32@)\">\n            <summary>Indicates the number of bytes expected for the next message.</summary>\n            <param name=\"buffer\">The buffer containing the data to investigate for a length.</param>\n            <param name=\"index\">The offset of the first byte to read from the buffer.</param>\n            <param name=\"count\">The number of bytes to read from the buffer.</param>\n            <param name=\"style\">The algorithm used to encode the length.</param>\n            <param name=\"length\">The length of the message, if it could be identified.</param>\n            <returns>True if a length could be obtained, false otherwise.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.FlushPool\">\n            <summary>\n            Releases any internal buffers that have been reserved for efficiency; this does not affect any serialization\n            operations; simply: it can be used (optionally) to release the buffers for garbage collection (at the expense\n            of having to re-allocate a new buffer for the next operation, rather than re-use prior buffers).\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Serializer.NonGeneric\">\n            <summary>\n            Provides non-generic access to the default serializer.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.NonGeneric.DeepClone(System.Object)\">\n            <summary>\n            Create a deep clone of the supplied instance; any sub-items are also cloned.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.NonGeneric.Serialize(System.IO.Stream,System.Object)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream.\n            </summary>\n            <param name=\"instance\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"dest\">The destination stream to write to.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.NonGeneric.Deserialize(System.Type,System.IO.Stream)\">\n            <summary>\n            Creates a new instance from a protocol-buffer stream\n            </summary>\n            <param name=\"type\">The type to be created.</param>\n            <param name=\"source\">The binary stream to apply to the new instance (cannot be null).</param>\n            <returns>A new, initialized instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.NonGeneric.Merge(System.IO.Stream,System.Object)\">\n            <summary>Applies a protocol-buffer stream to an existing instance.</summary>\n            <param name=\"instance\">The existing instance to be modified (cannot be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <returns>The updated instance</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.NonGeneric.SerializeWithLengthPrefix(System.IO.Stream,System.Object,ProtoBuf.PrefixStyle,System.Int32)\">\n            <summary>\n            Writes a protocol-buffer representation of the given instance to the supplied stream,\n            with a length-prefix. This is useful for socket programming,\n            as DeserializeWithLengthPrefix/MergeWithLengthPrefix can be used to read the single object back\n            from an ongoing stream.\n            </summary>\n            <param name=\"instance\">The existing instance to be serialized (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"destination\">The destination stream to write to.</param>\n            <param name=\"fieldNumber\">The tag used as a prefix to each record (only used with base-128 style prefixes).</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.NonGeneric.TryDeserializeWithLengthPrefix(System.IO.Stream,ProtoBuf.PrefixStyle,ProtoBuf.Serializer.TypeResolver,System.Object@)\">\n            <summary>\n            Applies a protocol-buffer stream to an existing instance (or null), using length-prefixed\n            data - useful with network IO.\n            </summary>\n            <param name=\"value\">The existing instance to be modified (can be null).</param>\n            <param name=\"source\">The binary stream to apply to the instance (cannot be null).</param>\n            <param name=\"style\">How to encode the length prefix.</param>\n            <param name=\"resolver\">Used to resolve types on a per-field basis.</param>\n            <returns>The updated instance; this may be different to the instance argument if\n            either the original instance was null, or the stream defines a known sub-type of the\n            original instance.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializer.NonGeneric.CanSerialize(System.Type)\">\n            <summary>\n            Indicates whether the supplied type is explicitly modelled by the model\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Serializer.GlobalOptions\">\n            <summary>\n            Global switches that change the behavior of protobuf-net\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Serializer.GlobalOptions.InferTagFromName\">\n            <summary>\n            <see cref=\"P:ProtoBuf.Meta.RuntimeTypeModel.InferTagFromNameDefault\"/>\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.Serializer.TypeResolver\">\n            <summary>\n            Maps a field-number to a type\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.Serializers.IProtoSerializer.Write(System.Object,ProtoBuf.ProtoWriter)\">\n            <summary>\n            Perform the steps necessary to serialize this data.\n            </summary>\n            <param name=\"value\">The value to be serialized.</param>\n            <param name=\"dest\">The writer entity that is accumulating the output data.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializers.IProtoSerializer.Read(System.Object,ProtoBuf.ProtoReader)\">\n            <summary>\n            Perform the steps necessary to deserialize this data.\n            </summary>\n            <param name=\"value\">The current value, if appropriate.</param>\n            <param name=\"source\">The reader providing the input data.</param>\n            <returns>The updated / replacement value.</returns>\n        </member>\n        <member name=\"M:ProtoBuf.Serializers.IProtoSerializer.EmitWrite(ProtoBuf.Compiler.CompilerContext,ProtoBuf.Compiler.Local)\">\n            <summary>Emit the IL necessary to perform the given actions\n            to serialize this data.\n            </summary>\n            <param name=\"ctx\">Details and utilities for the method being generated.</param>\n            <param name=\"valueFrom\">The source of the data to work against;\n            If the value is only needed once, then LoadValue is sufficient. If\n            the value is needed multiple times, then note that a \"null\"\n            means \"the top of the stack\", in which case you should create your\n            own copy - GetLocalWithValue.</param>\n        </member>\n        <member name=\"M:ProtoBuf.Serializers.IProtoSerializer.EmitRead(ProtoBuf.Compiler.CompilerContext,ProtoBuf.Compiler.Local)\">\n            <summary>\n            Emit the IL necessary to perform the given actions to deserialize this data.\n            </summary>\n            <param name=\"ctx\">Details and utilities for the method being generated.</param>\n            <param name=\"entity\">For nested values, the instance holding the values; note\n            that this is not always provided - a null means not supplied. Since this is always\n            a variable or argument, it is not necessary to consume this value.</param>\n        </member>\n        <member name=\"P:ProtoBuf.Serializers.IProtoSerializer.ExpectedType\">\n            <summary>\n            The type that this serializer is intended to work for.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Serializers.IProtoSerializer.RequiresOldValue\">\n            <summary>\n            Indicates whether a Read operation <em>replaces</em> the existing value, or\n            <em>extends</em> the value. If false, the \"value\" parameter to Read is\n            discarded, and should be passed in as null.\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.Serializers.IProtoSerializer.ReturnsValue\">\n            <summary>\n            Now all Read operations return a value (although most do); if false no\n            value should be expected.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ServiceModel.ProtoBehaviorAttribute\">\n            <summary>\n            Uses protocol buffer serialization on the specified operation; note that this\n            must be enabled on both the client and server.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ServiceModel.ProtoBehaviorExtension\">\n            <summary>\n            Configuration element to swap out DatatContractSerilaizer with the XmlProtoSerializer for a given endpoint.\n            </summary>\n            <seealso cref=\"T:ProtoBuf.ServiceModel.ProtoEndpointBehavior\"/>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.ProtoBehaviorExtension.#ctor\">\n            <summary>\n            Creates a new ProtoBehaviorExtension instance.\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.ProtoBehaviorExtension.CreateBehavior\">\n            <summary>\n            Creates a behavior extension based on the current configuration settings.\n            </summary>\n            <returns>The behavior extension.</returns>\n        </member>\n        <member name=\"P:ProtoBuf.ServiceModel.ProtoBehaviorExtension.BehaviorType\">\n            <summary>\n            Gets the type of behavior.\n            </summary>     \n        </member>\n        <member name=\"T:ProtoBuf.ServiceModel.ProtoEndpointBehavior\">\n            <summary>\n            Behavior to swap out DatatContractSerilaizer with the XmlProtoSerializer for a given endpoint.\n             <example>\n            Add the following to the server and client app.config in the system.serviceModel section:\n             <behaviors>\n               <endpointBehaviors>\n                 <behavior name=\"ProtoBufBehaviorConfig\">\n                   <ProtoBufSerialization/>\n                 </behavior>\n               </endpointBehaviors>\n             </behaviors>\n             <extensions>\n               <behaviorExtensions>\n                 <add name=\"ProtoBufSerialization\" type=\"ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net, Version=1.0.0.255, Culture=neutral, PublicKeyToken=257b51d87d2e4d67\"/>\n               </behaviorExtensions>\n             </extensions>\n            \n            Configure your endpoints to have a behaviorConfiguration as follows:\n            \n             <service name=\"TK.Framework.Samples.ServiceModel.Contract.SampleService\">\n               <endpoint address=\"http://myhost:9003/SampleService\" binding=\"basicHttpBinding\" behaviorConfiguration=\"ProtoBufBehaviorConfig\"\n                bindingConfiguration=\"basicHttpBindingConfig\" name=\"basicHttpProtoBuf\" contract=\"ISampleServiceContract\" />\n             </service>\n             <client>\n                 <endpoint address=\"http://myhost:9003/SampleService\" binding=\"basicHttpBinding\"\n                     bindingConfiguration=\"basicHttpBindingConfig\" contract=\"ISampleServiceContract\"\n                     name=\"BasicHttpProtoBufEndpoint\" behaviorConfiguration=\"ProtoBufBehaviorConfig\"/>\n              </client>\n            </example>\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ServiceModel.ProtoOperationBehavior\">\n            <summary>\n            Describes a WCF operation behaviour that can perform protobuf serialization\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.ProtoOperationBehavior.#ctor(System.ServiceModel.Description.OperationDescription)\">\n            <summary>\n            Create a new ProtoOperationBehavior instance\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.ProtoOperationBehavior.CreateSerializer(System.Type,System.Xml.XmlDictionaryString,System.Xml.XmlDictionaryString,System.Collections.Generic.IList{System.Type})\">\n            <summary>\n            Creates a protobuf serializer if possible (falling back to the default WCF serializer)\n            </summary>\n        </member>\n        <member name=\"P:ProtoBuf.ServiceModel.ProtoOperationBehavior.Model\">\n            <summary>\n            The type-model that should be used with this behaviour\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.ServiceModel.XmlProtoSerializer\">\n            <summary>\n            An xml object serializer that can embed protobuf data in a base-64 hunk (looking like a byte[])\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.XmlProtoSerializer.TryCreate(ProtoBuf.Meta.TypeModel,System.Type)\">\n            <summary>\n            Attempt to create a new serializer for the given model and type\n            </summary>\n            <returns>A new serializer instance if the type is recognised by the model; null otherwise</returns>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.XmlProtoSerializer.#ctor(ProtoBuf.Meta.TypeModel,System.Type)\">\n            <summary>\n            Creates a new serializer for the given model and type\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.XmlProtoSerializer.WriteEndObject(System.Xml.XmlDictionaryWriter)\">\n            <summary>\n            Ends an object in the output\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.XmlProtoSerializer.WriteStartObject(System.Xml.XmlDictionaryWriter,System.Object)\">\n            <summary>\n            Begins an object in the output\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.XmlProtoSerializer.WriteObjectContent(System.Xml.XmlDictionaryWriter,System.Object)\">\n            <summary>\n            Writes the body of an object in the output\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.XmlProtoSerializer.IsStartObject(System.Xml.XmlDictionaryReader)\">\n            <summary>\n            Indicates whether this is the start of an object we are prepared to handle\n            </summary>\n        </member>\n        <member name=\"M:ProtoBuf.ServiceModel.XmlProtoSerializer.ReadObject(System.Xml.XmlDictionaryReader,System.Boolean)\">\n            <summary>\n            Reads the body of an object\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.SubItemToken\">\n            <summary>\n            Used to hold particulars relating to nested objects. This is opaque to the caller - simply\n            give back the token you are given at the end of an object.\n            </summary>\n        </member>\n        <member name=\"T:ProtoBuf.WireType\">\n            <summary>\n            Indicates the encoding used to represent an individual value in a protobuf stream\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.WireType.None\">\n            <summary>\n            Represents an error condition\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.WireType.Variant\">\n            <summary>\n            Base-128 variant-length encoding\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.WireType.Fixed64\">\n            <summary>\n            Fixed-length 8-byte encoding\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.WireType.String\">\n            <summary>\n            Length-variant-prefixed encoding\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.WireType.StartGroup\">\n            <summary>\n            Indicates the start of a group\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.WireType.EndGroup\">\n            <summary>\n            Indicates the end of a group\n            </summary>\n        </member>\n        <member name=\"F:ProtoBuf.WireType.Fixed32\">\n            <summary>\n            Fixed-length 4-byte encoding\n            </summary>10\n        </member>\n        <member name=\"F:ProtoBuf.WireType.SignedVariant\">\n            <summary>\n            This is not a formal wire-type in the \"protocol buffers\" spec, but\n            denotes a variant integer that should be interpreted using\n            zig-zag semantics (so -ve numbers aren't a significant overhead)\n            </summary>\n        </member>\n    </members>\n</doc>\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/protoc-license.txt",
    "content": "Protocol Buffers - Google's data interchange format\nCopyright 2008 Google Inc.\nhttp://code.google.com/p/protobuf/\n\nThis package contains a precompiled Win32 binary version of the protocol buffer\ncompiler (protoc).  This binary is intended for Windows users who want to\nuse Protocol Buffers in Java or Python but do not want to compile protoc\nthemselves.  To install, simply place this binary somewhere in your PATH.\n\nThis binary was built using MinGW, but the output is the same regardless of\nthe C++ compiler used.\n\nYou will still need to download the source code package in order to obtain the\nJava or Python runtime libraries.  Get it from:\n  http://code.google.com/p/protobuf/downloads/\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/protogen.exe.config",
    "content": "<?xml version=\"1.0\"?>\n<configuration>\n<startup><supportedRuntime version=\"v2.0.50727\"/></startup></configuration>\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/vb.xslt",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xsl:stylesheet version=\"1.0\"\n    xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n    xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" exclude-result-prefixes=\"xsl msxsl\"\n>\n  <xsl:import href=\"common.xslt\"/>\n  <xsl:param name=\"help\"/>\n  <xsl:param name=\"xml\"/>\n  <xsl:param name=\"datacontract\"/>\n  <xsl:param name=\"binary\"/>\n  <xsl:param name=\"protoRpc\"/>\n  <xsl:param name=\"observable\"/>\n  <xsl:param name=\"preObservable\"/>\n  <xsl:param name=\"partialMethods\"/>\n  <xsl:param name=\"detectMissing\"/>\n  <xsl:param name=\"lightFramework\"/>\n  <xsl:param name=\"asynchronous\"/>\n  <xsl:param name=\"clientProxy\"/>\n  <xsl:param name=\"defaultNamespace\"/>\n  \n  \n  <xsl:key name=\"fieldNames\" match=\"//FieldDescriptorProto\" use=\"name\"/>\n  \n  <xsl:output method=\"text\" indent=\"no\" omit-xml-declaration=\"yes\"/>\n  <xsl:variable name=\"types\" select=\"//EnumDescriptorProto | //DescriptorProto\"/>\n  <xsl:variable name=\"optionXml\" select=\"$xml='true'\"/>\n  <xsl:variable name=\"optionDataContract\" select=\"$datacontract='true'\"/>\n  <xsl:variable name=\"optionBinary\" select=\"$binary='true'\"/>\n  <xsl:variable name=\"optionProtoRpc\" select=\"$protoRpc='true'\"/>\n  <xsl:variable name=\"optionObservable\" select=\"$observable='true'\"/>\n  <xsl:variable name=\"optionPreObservable\" select=\"$preObservable='true'\"/>\n  <xsl:variable name=\"optionPartialMethods\" select=\"$partialMethods='true'\"/>\n  <xsl:variable name=\"optionDetectMissing\" select=\"$detectMissing='true'\"/>\n  <xsl:variable name=\"optionFullFramework\" select=\"not($lightFramework='true')\"/>\n  <xsl:variable name=\"optionAsynchronous\" select=\"$asynchronous='true'\"/>\n  <xsl:variable name=\"optionClientProxy\" select=\"$clientProxy='true'\"/>\n  <xsl:variable name=\"optionFixCase\" select=\"$fixCase='true'\"/>  \n  \n  <xsl:template match=\"FileDescriptorSet\">\n    <xsl:if test=\"$help='true'\">\n      <xsl:message terminate=\"yes\">\n        VisualBasic template for protobuf-net.\n        Options:\n        General:\n          \"help\" - this page\n        Additional serializer support:\n          \"xml\" - enable explicit xml support (XmlSerializer)\n          \"datacontract\" - enable data-contract support (DataContractSerializer; requires .NET 3.0)\n          \"binary\" - enable binary support (BinaryFormatter; not supported on Silverlight)\n        Other:\n          \"protoRpc\" - enable proto-rpc client\n          \"observable\" - change notification (observer pattern) support\n          \"preObservable\" - pre-change notification (observer pattern) support (requires .NET 3.5)\n          \"partialMethods\" - provide partial methods for changes (requires C# 3.0)\n          \"detectMissing\" - provide *Specified properties to indicate whether fields are present\n          \"lightFramework\" - omit additional attributes not included in CF/Silverlight\n          \"asynchronous\" - emit asynchronous methods for use with WCF\n          \"clientProxy\" - emit asynchronous client proxy class\n      </xsl:message>\n    </xsl:if>\n\n    <xsl:if test=\"$optionXml and $optionDataContract\">\n      <xsl:message terminate=\"yes\">\n        Invalid options: xml and data-contract serialization are mutually exclusive.\n      </xsl:message>\n    </xsl:if>\n      ' Generated from <xsl:value-of select=\"name\"/>\n    <xsl:if test=\"$optionXml\">\n      ' Option: xml serialization ([XmlType]/[XmlElement]) enabled\n    </xsl:if><xsl:if test=\"$optionDataContract\">\n      ' Option: data-contract serialization ([DataContract]/[DataMember]) enabled\n    </xsl:if><xsl:if test=\"$optionBinary\">\n      ' Option: binary serialization (ISerializable) enabled\n    </xsl:if><xsl:if test=\"$optionObservable\">\n      ' Option: observable (OnPropertyChanged) enabled\n    </xsl:if><xsl:if test=\"$optionPreObservable\">\n      ' Option: pre-observable (OnPropertyChanging) enabled\n    </xsl:if><xsl:if test=\"$partialMethods\">\n      ' Option: partial methods (On*Changing/On*Changed) enabled\n    </xsl:if><xsl:if test=\"$detectMissing\">\n      ' Option: missing-value detection (*Specified/ShouldSerialize*/Reset*) enabled\n    </xsl:if><xsl:if test=\"not($optionFullFramework)\">\n      ' Option: light framework (CF/Silverlight) enabled\n    </xsl:if><xsl:if test=\"$optionProtoRpc\">\n      ' Option: proto-rpc enabled\n  </xsl:if>\n    <xsl:apply-templates select=\"file/FileDescriptorProto\"/>\n  </xsl:template>\n\n  <xsl:template match=\"FileDescriptorProto\">\n' Generated from: <xsl:value-of select=\"name\"/>\n    <xsl:apply-templates select=\"dependency/string[.!='']\"/>\n    <xsl:variable name=\"namespace\"><xsl:call-template name=\"PickNamespace\">\n      <xsl:with-param name=\"defaultNamespace\" select=\"$defaultNamespace\"/>\n        </xsl:call-template>\n      </xsl:variable>\n    <xsl:if test=\"string($namespace) != ''\">\nNamespace <xsl:value-of select=\"translate($namespace,':-/\\','__..')\"/>\n</xsl:if>\n    <xsl:apply-templates select=\"message_type | enum_type | service\"/>\n    <xsl:if test=\"string($namespace) != ''\">\nEnd Namespace</xsl:if></xsl:template>\n  \n<xsl:template match=\"FileDescriptorProto/dependency/string\">\n' Note: requires additional types generated from: <xsl:value-of select=\".\"/></xsl:template>\n\n<xsl:template match=\"DescriptorProto\">\n<xsl:choose>\n<xsl:when test=\"$optionDataContract\">\n&lt;Global.System.Serializable, Global.ProtoBuf.ProtoContract(Name:=\"<xsl:value-of select=\"name\"/>\")&gt; _\n&lt;Global.System.Runtime.Serialization.DataContract(Name:=\"<xsl:value-of select=\"name\"/>\")&gt; _\n</xsl:when>\n<xsl:when test=\"$optionXml\">\n&lt;Global.System.Serializable, Global.ProtoBuf.ProtoContract(Name:=\"<xsl:value-of select=\"name\"/>\")&gt; _\n&lt;Global.System.Xml.Serialization.XmlType(TypeName:=\"<xsl:value-of select=\"name\"/>\")&gt; _\n</xsl:when>\n<xsl:otherwise>\n&lt;Global.System.Serializable, Global.ProtoBuf.ProtoContract(Name:=\"<xsl:value-of select=\"name\"/>\")&gt; _\n</xsl:otherwise>\n</xsl:choose><!--\n-->Public Partial Class <xsl:call-template name=\"pascal\"/>\n    implements Global.ProtoBuf.IExtensible<!--\n    --><xsl:if test=\"$optionBinary\">, Global.System.Runtime.Serialization.ISerializable</xsl:if><!--\n    --><xsl:if test=\"$optionObservable\">, Global.System.ComponentModel.INotifyPropertyChanged</xsl:if><!--\n    --><xsl:if test=\"$optionPreObservable\">, Global.System.ComponentModel.INotifyPropertyChanging</xsl:if>\n\t\n\tPublic Sub New\n\tEnd Sub\n    <xsl:apply-templates select=\"*\"/><xsl:if test=\"$optionBinary\">\n    Protected Sub New(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext)\n          MyBase.New()\n          Global.ProtoBuf.Serializer.Merge(info, Me)\n    End Sub\n\t  \n\tSub GetObjectData(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext) implements Global.System.Runtime.Serialization.ISerializable.GetObjectData\n\t\tGlobal.ProtoBuf.Serializer.Serialize(info, Me)\n\tEnd Sub\n\t\n      </xsl:if><xsl:if test=\"$optionObservable\">\n    Public Event PropertyChanged As Global.System.ComponentModel.PropertyChangedEventHandler Implements Global.System.ComponentModel.INotifyPropertyChanged.PropertyChanged\n    Protected Overridable Sub OnPropertyChanged(ByVal propertyName As String)\n        RaiseEvent PropertyChanged(Me, New Global.System.ComponentModel.PropertyChangedEventArgs(propertyName))\n    End Sub\n    </xsl:if><xsl:if test=\"$optionPreObservable\">\n\tPublic Event PropertyChanging As Global.System.ComponentModel.PropertyChangingEventHandler Implements Global.System.ComponentModel.INotifyPropertyChanging.PropertyChanging\n\tProtected Overridable Sub OnPropertyChanging(ByVal propertyName As String)\n\t\tRaiseEvent PropertyChanging(Me, New Global.System.ComponentModel.PropertyChangingEventArgs(propertyName))\n\tEnd Sub\n\t</xsl:if>\n    Private extensionObject As Global.ProtoBuf.IExtension\n\t\tFunction GetExtensionObject(createIfMissing As Boolean) As Global.ProtoBuf.IExtension Implements Global.ProtoBuf.IExtensible.GetExtensionObject\n\t\t\tReturn Global.ProtoBuf.Extensible.GetExtensionObject(extensionObject, createIfMissing)\n\t\tEnd Function\nEnd Class\n  </xsl:template>\n\n  \n  \n  <xsl:template match=\"DescriptorProto/name | DescriptorProto/extension_range | DescriptorProto/extension\"/>\n  \n  <xsl:template match=\"\n                FileDescriptorProto/message_type | FileDescriptorProto/enum_type | FileDescriptorProto/service\n                | DescriptorProto/field | DescriptorProto/enum_type | DescriptorProto/message_type\n                | DescriptorProto/nested_type | EnumDescriptorProto/value | ServiceDescriptorProto/method\">\n    <xsl:apply-templates select=\"*\"/>\n  </xsl:template>\n\n  <xsl:template match=\"EnumDescriptorProto\">\n    Public Enum <xsl:call-template name=\"pascal\"/>\n      <xsl:apply-templates select=\"value\"/>\n    End Enum\n  </xsl:template>\n\n  <xsl:template match=\"EnumValueDescriptorProto\">\n\t  \t<xsl:text> \n\t\t</xsl:text>\n\t\t<xsl:value-of select=\"name\"/>\n\t\t<xsl:text xml:space=\"preserve\"> = </xsl:text><xsl:choose>\n\t      <xsl:when test=\"number\"><xsl:value-of select=\"number\"/></xsl:when>\n\t      <xsl:otherwise>0</xsl:otherwise>\n\t    </xsl:choose><xsl:if test=\"position()!=last()\">\n\t    </xsl:if>\n  </xsl:template>\n\n  <xsl:template match=\"FieldDescriptorProto\" mode=\"field\">\n    <xsl:choose>\n      <xsl:when test=\"not(key('fieldNames',concat('_',name)))\"><xsl:value-of select=\"concat('_',name)\"/></xsl:when>\n      <xsl:when test=\"not(key('fieldNames',concat(name,'Field')))\"><xsl:value-of select=\"concat(name,'Field')\"/></xsl:when>\n      <xsl:otherwise><xsl:value-of select=\"concat('_',generate-id())\"/></xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n  \n  <xsl:template match=\"FieldDescriptorProto\" mode=\"format\">\n    <xsl:choose>\n      <xsl:when test=\"type='TYPE_DOUBLE' or type='TYPE_FLOAT'\n                or type='TYPE_FIXED32' or type='TYPE_FIXED64'\n                or type='TYPE_SFIXED32' or type='TYPE_SFIXED64'\">FixedSize</xsl:when>\n      <xsl:when test=\"type='TYPE_GROUP'\">Group</xsl:when>\n      <xsl:when test=\"not(type) or type='TYPE_INT32' or type='TYPE_INT64'\n                or type='TYPE_UINT32' or type='TYPE_UINT64'\n                or type='TYPE_ENUM'\">TwosComplement</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT32' or type='TYPE_SINT64'\">ZigZag</xsl:when>\n      <xsl:otherwise>Default</xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n  <xsl:template match=\"FieldDescriptorProto\" mode=\"primitiveType\">\n    <xsl:choose>\n      <xsl:when test=\"not(type)\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_DOUBLE'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_FLOAT'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_INT64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_INT32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_BOOL'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_STRING'\">class</xsl:when>\n      <xsl:when test=\"type='TYPE_BYTES'\">class</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT32'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT64'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_ENUM'\">struct</xsl:when>\n      <xsl:when test=\"type='TYPE_GROUP' or type='TYPE_MESSAGE'\">none</xsl:when>\n      <xsl:otherwise>\n        <xsl:message terminate=\"yes\">\n          Field type not implemented: <xsl:value-of select=\"type\"/> (<xsl:value-of select=\"../../name\"/>.<xsl:value-of select=\"name\"/>)\n        </xsl:message>\n      </xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n  <xsl:template match=\"FieldDescriptorProto\" mode=\"type\">\n    <xsl:choose>\n      <xsl:when test=\"not(type)\">double</xsl:when>\n      <xsl:when test=\"type='TYPE_DOUBLE'\">Double</xsl:when>\n      <xsl:when test=\"type='TYPE_FLOAT'\">Single</xsl:when>\n      <xsl:when test=\"type='TYPE_INT64'\">Long</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT64'\">ULong</xsl:when>\n      <xsl:when test=\"type='TYPE_INT32'\">Integer</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED64'\">ULong</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED32'\">UInteger</xsl:when>\n      <xsl:when test=\"type='TYPE_BOOL'\">Boolean</xsl:when>\n      <xsl:when test=\"type='TYPE_STRING'\">String</xsl:when>\n      <xsl:when test=\"type='TYPE_BYTES'\">Byte()</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT32'\">UInteger</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED32'\">Integer</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED64'\">Long</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT32'\">Integer</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT64'\">Long</xsl:when>\n      <xsl:when test=\"type='TYPE_GROUP' or type='TYPE_MESSAGE' or type='TYPE_ENUM'\"><xsl:call-template name=\"pascal\">\n          <xsl:with-param name=\"value\" select=\"substring-after(type_name,'.')\"/>\n        </xsl:call-template></xsl:when>\n      <xsl:otherwise>\n        <xsl:message terminate=\"yes\">\n          Field type not implemented: <xsl:value-of select=\"type\"/> (<xsl:value-of select=\"../../name\"/>.<xsl:value-of select=\"name\"/>)\n        </xsl:message>\n      </xsl:otherwise>\n    </xsl:choose>\n    \n  </xsl:template>\n\n  <xsl:template match=\"FieldDescriptorProto[default_value]\" mode=\"defaultValue\">\n    <xsl:choose>\n      <xsl:when test=\"type='TYPE_STRING'\">\"<xsl:value-of select=\"default_value\"/>\"</xsl:when>\n      <xsl:when test=\"type='TYPE_ENUM'\"><xsl:apply-templates select=\".\" mode=\"type\"/>.<xsl:value-of select=\"default_value\"/></xsl:when>\n      <xsl:when test=\"type='TYPE_BYTES'\"> ' <xsl:value-of select=\"default_value\"/></xsl:when>\n      <xsl:otherwise>CType(<xsl:value-of select=\"default_value\"/>, <xsl:apply-templates select=\".\" mode=\"type\"/>)</xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n\n  <!--\n    We need to find the first enum value given .foo.bar.SomeEnum - but the enum itself\n    only knows about SomeEnum; we need to look at all parent DescriptorProto nodes, and\n    the FileDescriptorProto for the namespace.\n    \n    This does an annoying up/down recursion... a bit expensive, but *generally* OK.\n    Could perhaps index the last part of the enum name to reduce overhead?\n  -->\n  <xsl:template name=\"GetFirstEnumValue\">\n    <xsl:variable name=\"hunt\" select=\"type_name\"/>\n    <xsl:for-each select=\"//EnumDescriptorProto\">\n      <xsl:variable name=\"fullName\">\n        <xsl:for-each select=\"ancestor::FileDescriptorProto\">.<xsl:value-of select=\"package\"/></xsl:for-each>\n        <xsl:for-each select=\"ancestor::DescriptorProto\">.<xsl:value-of select=\"name\"/></xsl:for-each>\n        <xsl:value-of select=\"concat('.',name)\"/>\n      </xsl:variable>\n      <xsl:if test=\"$fullName=$hunt\"><xsl:value-of select=\"(value/EnumValueDescriptorProto)[1]/name\"/></xsl:if>\n    </xsl:for-each>\n  </xsl:template>\n  \n  <xsl:template match=\"FieldDescriptorProto[not(default_value)]\" mode=\"defaultValue\">\n    <xsl:choose>\n      <xsl:when test=\"type='TYPE_DOUBLE'\">0.0</xsl:when>\n      <xsl:when test=\"type='TYPE_FLOAT'\">0.0F</xsl:when>\n      <xsl:when test=\"type='TYPE_INT64'\">0L</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT64'\">0L</xsl:when>\n      <xsl:when test=\"type='TYPE_INT32'\">0</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED64'\">0L</xsl:when>\n      <xsl:when test=\"type='TYPE_FIXED32'\">0</xsl:when>\n      <xsl:when test=\"type='TYPE_BOOL'\">False</xsl:when>\n      <xsl:when test=\"type='TYPE_STRING'\">\"\"</xsl:when>\n      <xsl:when test=\"type='TYPE_BYTES'\">Nothing</xsl:when>\n      <xsl:when test=\"type='TYPE_UINT32'\">0</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED32'\">0</xsl:when>\n      <xsl:when test=\"type='TYPE_SFIXED64'\">0L</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT32'\">0</xsl:when>\n      <xsl:when test=\"type='TYPE_SINT64'\">0L</xsl:when>\n      <xsl:when test=\"type='TYPE_MESSAGE'\">Nothing</xsl:when>\n      <xsl:when test=\"type='TYPE_ENUM'\"><xsl:apply-templates select=\".\" mode=\"type\"/>.<xsl:call-template name=\"GetFirstEnumValue\"/></xsl:when>\n      <xsl:otherwise>Nothing</xsl:otherwise>\n    </xsl:choose>\n  </xsl:template>\n\n  <xsl:template match=\"FieldDescriptorProto[label='LABEL_OPTIONAL' or not(label)]\">\n    <xsl:variable name=\"propType\"><xsl:apply-templates select=\".\" mode=\"type\"/></xsl:variable>\n    <xsl:variable name=\"format\"><xsl:apply-templates select=\".\" mode=\"format\"/></xsl:variable>\n    <xsl:variable name=\"primitiveType\"><xsl:apply-templates select=\".\" mode=\"primitiveType\"/></xsl:variable>\n    <xsl:variable name=\"defaultValue\"><xsl:apply-templates select=\".\" mode=\"defaultValue\"/></xsl:variable>\n    <xsl:variable name=\"field\"><xsl:apply-templates select=\".\" mode=\"field\"/></xsl:variable>\n\t<xsl:variable name=\"specified\" select=\"$optionDetectMissing and ($primitiveType='struct' or $primitiveType='class')\"/>\n    <xsl:variable name=\"fieldType\"><xsl:if test=\"$specified and $primitiveType='struct'\">Nullable(Of </xsl:if><xsl:value-of select=\"$propType\"/><xsl:if test=\"$specified and $primitiveType='struct'\">)</xsl:if></xsl:variable>\n\n    <xsl:choose>\n\t  <xsl:when test=\"substring-after($fieldType, 'google.protobuf.')\">\n    Private <xsl:value-of select=\"concat($field,' As ',substring-after($fieldType, 'google.protobuf.'))\"/><xsl:if test=\"not($specified)\"> =<xsl:value-of select=\"$defaultValue\"/></xsl:if>\n\t  </xsl:when>\n\t  <xsl:otherwise>\n    Private <xsl:value-of select=\"concat($field,' As ',$fieldType)\"/><xsl:if test=\"not($specified)\"> =<xsl:value-of select=\"$defaultValue\"/></xsl:if>\n\t  </xsl:otherwise>\n\t</xsl:choose>\n\t<xsl:choose>\n\t\t<xsl:when test=\"not($specified) and $optionXml\">\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=False, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n\t<xsl:choose>\n\t\t<xsl:when test=\"substring-after($fieldType, 'google.protobuf.')\">\n    &lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select=\"$defaultValue\"/>, <xsl:value-of select=\"substring-after($fieldType, 'google.protobuf.')\"/>))&gt; _\n\t\t</xsl:when>\n\t\t<xsl:otherwise>\n    &lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select=\"$defaultValue\"/>, <xsl:value-of select=\"$fieldType\"/>))&gt; _\n\t\t</xsl:otherwise>\n\t</xsl:choose>\n    &lt;Global.System.Xml.Serialization.XmlElement(\"<xsl:value-of select=\"name\"/>\", Order:=<xsl:value-of select=\"number\"/>)&gt; _ <!--\n\t\t--></xsl:when>\n\t\t<xsl:when test=\"not($specified) and $optionDataContract\">\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=False, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n    <xsl:choose>\n\t\t<xsl:when test=\"substring-after($fieldType, 'google.protobuf.')\">\n    &lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select=\"$defaultValue\"/>, <xsl:value-of select=\"substring-after($fieldType, 'google.protobuf.')\"/>))&gt; _\n\t\t</xsl:when>\n\t\t<xsl:otherwise>\n    &lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select=\"$defaultValue\"/>, <xsl:value-of select=\"$fieldType\"/>))&gt; _\n\t\t</xsl:otherwise>\n\t</xsl:choose>\n    &lt;Global.System.Runtime.Serialization.DataMember(Name:=\"<xsl:value-of select=\"name\"/>\", Order:=<xsl:value-of select=\"number\"/>, IsRequired:=False)&gt; _ <!--\n\t\t--></xsl:when>\n\t\t<xsl:when test=\"not($specified)\">\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=False, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _ <!--\n    --><xsl:choose>\n\t\t<xsl:when test=\"substring-after($fieldType, 'google.protobuf.')\">\n    &lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select=\"$defaultValue\"/>, <xsl:value-of select=\"substring-after($fieldType, 'google.protobuf.')\"/>))&gt; _ <!--\n\t\t--></xsl:when>\n\t\t<xsl:otherwise>\n    &lt;Global.System.ComponentModel.DefaultValue(CType(<xsl:value-of select=\"$defaultValue\"/>, <xsl:value-of select=\"$fieldType\"/>))&gt; _ <!--\n\t\t--></xsl:otherwise>\n\t</xsl:choose><!--\n\t\t--></xsl:when>\n\t\t<xsl:when test=\"$optionDataContract\">\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=False, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n    &lt;Global.System.Runtime.Serialization.DataMember(Name:=\"<xsl:value-of select=\"name\"/>\", Order:=<xsl:value-of select=\"number\"/>, IsRequired:=False)&gt; _ <!--\n\t\t--></xsl:when>\n\t\t<xsl:when test=\"$optionXml\">\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=False, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n    &lt;Global.System.Xml.Serialization.XmlElement(\"<xsl:value-of select=\"name\"/>\", Order:=<xsl:value-of select=\"number\"/>)&gt; _ <!--\n\t\t--></xsl:when>\n\t\t<xsl:otherwise>\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=False, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _ <!--\n\t\t--></xsl:otherwise>\n\t</xsl:choose><!--\n\t--><xsl:call-template name=\"WriteGetSet\">\n      <xsl:with-param name=\"fieldType\" select=\"$fieldType\"/>\n      <xsl:with-param name=\"propType\" select=\"$propType\"/>\n      <xsl:with-param name=\"name\"><xsl:call-template name=\"pascalPropName\"/></xsl:with-param>\n      <xsl:with-param name=\"field\" select=\"$field\"/>\n      <xsl:with-param name=\"defaultValue\" select=\"$defaultValue\"/>\n      <xsl:with-param name=\"specified\" select=\"$specified\"/>\n    </xsl:call-template>\n  </xsl:template>\n\n  <xsl:template name=\"pascalPropName\">\n    <xsl:param name=\"value\" select=\"name\"/>\n    <xsl:param name=\"delimiter\" select=\"'_'\"/>\n    <xsl:variable name=\"valueUC\" select=\"translate($value,$alpha,$ALPHA)\"/>\n    <xsl:variable name=\"finalName\">\n      <xsl:choose>\n        <xsl:when test=\"$types[translate(name,$alpha,$ALPHA)=$valueUC]\"><xsl:value-of select=\"concat($value,$delimiter,'Property')\"/></xsl:when>\n        <xsl:otherwise><xsl:value-of select=\"$value\"/></xsl:otherwise>\n      </xsl:choose>\n    </xsl:variable>\n    <xsl:call-template name=\"pascal\">\n      <xsl:with-param name=\"value\" select=\"$finalName\"/>\n      <xsl:with-param name=\"delimiter\" select=\"$delimiter\"/>\n    </xsl:call-template>\n  </xsl:template>\n  \n  <xsl:template match=\"FieldDescriptorProto[label='LABEL_REQUIRED']\">\n    <xsl:variable name=\"type\"><xsl:apply-templates select=\".\" mode=\"type\"/></xsl:variable>\n    <xsl:variable name=\"format\"><xsl:apply-templates select=\".\" mode=\"format\"/></xsl:variable>\n    <xsl:variable name=\"field\"><xsl:apply-templates select=\".\" mode=\"field\"/></xsl:variable>\n    Private <xsl:value-of select=\"concat($field, ' As ', $type)\"/>\n\t<xsl:choose>\n\t\t<xsl:when test=\"$optionDataContract\">\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=True, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n    &lt;Global.System.Runtime.Serialization.DataMember(Name:=\"<xsl:value-of select=\"name\"/>\", Order:=<xsl:value-of select=\"number\"/>, IsRequired:=True)&gt; _ <!--\n\t\t--></xsl:when>\n\t\t<xsl:when test=\"$optionXml\">\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=True, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n    &lt;Global.System.Xml.Serialization.XmlElement(\"<xsl:value-of select=\"name\"/>\", Order:=<xsl:value-of select=\"number\"/>)&gt; _ <!--\n\t\t--></xsl:when>\n\t\t<xsl:otherwise>\n    &lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, IsRequired:=True, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _ <!--\n\t\t--></xsl:otherwise>\n\t</xsl:choose><!--\n    --><xsl:call-template name=\"WriteGetSet\">\n      <xsl:with-param name=\"fieldType\" select=\"$type\"/>\n      <xsl:with-param name=\"propType\" select=\"$type\"/>\n      <xsl:with-param name=\"name\" select=\"name\"/>\n      <xsl:with-param name=\"field\" select=\"$field\"/>\n    </xsl:call-template>    \n  </xsl:template>\n\n  <xsl:template name=\"WriteGetSet\">\n    <xsl:param name=\"fieldType\"/>\n    <xsl:param name=\"propType\"/>\n    <xsl:param name=\"name\"/>\n    <xsl:param name=\"field\"/>\n    <xsl:param name=\"specified\" select=\"false()\"/>\n    <xsl:param name=\"defaultValue\"/>\n\t<xsl:variable name=\"primitiveType\"><xsl:apply-templates select=\".\" mode=\"primitiveType\"/></xsl:variable>\n\t<xsl:choose>\n\t\t<xsl:when test=\"substring-after($fieldType, 'google.protobuf.')\">\n    Public Property <xsl:value-of select=\"concat($name,' As ',substring-after($fieldType, 'google.protobuf.'))\"/>\n\t\t</xsl:when>\n\t\t<xsl:otherwise>\n    Public Property <xsl:value-of select=\"concat($name,' As ',$fieldType)\"/>\n\t\t</xsl:otherwise>\n\t</xsl:choose>\n\t\tGet \n\t\t\t<xsl:choose>\n\t\t\t\t<xsl:when test=\"$specified and $primitiveType='struct'\"><!--\n\t\t\t\t\t-->Return <xsl:value-of select=\"$field\"/><!--\n\t\t\t\t\t--></xsl:when>\n\t\t\t\t<xsl:when test=\"$specified\">\n\t\t\tIf Not <xsl:value-of select=\"$field\"/> Is Nothing Then\n\t\t\t\tReturn <xsl:value-of select=\"$field\"/>\n\t\t\tElse\n\t\t\t\tReturn <xsl:value-of select=\"$defaultValue\"/>\n\t\t\tEnd If<!--\n\t\t\t\t--></xsl:when>\n\t\t\t\t<xsl:otherwise><!--\n\t\t\t-->Return <xsl:value-of select=\"$field\"/><!--\n\t\t\t\t--></xsl:otherwise>\n\t\t\t</xsl:choose>\n\t\tEnd Get\n\t<xsl:choose>\n\t\t<xsl:when test=\"substring-after($fieldType, 'google.protobuf.')\">\n\t\tSet(<xsl:value-of select=\"concat('value As ',substring-after($fieldType, 'google.protobuf.'))\"/>)\n\t\t</xsl:when>\n\t\t<xsl:otherwise>\n\t\tSet(<xsl:value-of select=\"concat('value As ',$fieldType)\"/>)\n\t\t</xsl:otherwise>\n\t</xsl:choose>\n\t\t\t<xsl:if test=\"$optionPartialMethods\">On<xsl:value-of select=\"$name\"/>Changing(value)\n\t\t\t</xsl:if><xsl:if test=\"$optionPreObservable\">OnPropertyChanging(\"<xsl:value-of select=\"$name\"/>\") \n\t\t\t</xsl:if><xsl:value-of select=\"$field\"/> = value \n\t\t\t<xsl:if test=\"$optionObservable\">OnPropertyChanged(\"<xsl:value-of select=\"$name\"/>\") </xsl:if><xsl:if test=\"$optionPartialMethods\">On<xsl:value-of select=\"$name\"/>Changed()</xsl:if>\n\t\tEnd Set\n\tEnd Property\n    <xsl:if test=\"$optionPartialMethods\">\n    partial void On<xsl:value-of select=\"$name\"/>Changing(<xsl:value-of select=\"$propType\"/> value);\n    partial void On<xsl:value-of select=\"$name\"/>Changed();</xsl:if><xsl:if test=\"$specified\">\n    &lt;Global.System.Xml.Serialization.XmlIgnore&gt; _\n    <xsl:if test=\"$optionFullFramework\">&lt;Global.System.ComponentModel.Browsable(false)&gt; _ </xsl:if>\n\t<xsl:choose>\n\t\t<xsl:when test=\"$specified and $primitiveType='struct'\">\n\tPublic Property <xsl:value-of select=\"$name\"/>Specified As Boolean\n        Get \n            Return <xsl:value-of select=\"$field\"/>.HasValue\n        End Get\n        Set (ByVal value As Boolean) \n            If Not <xsl:value-of select=\"$field\"/>.HasValue Then\n\t\t\t\tIf value = True then <xsl:value-of select=\"$field\"/> = <xsl:value-of select=\"$name\"/>\n\t\t\tElse\n\t\t\t\tIf value = False then <xsl:value-of select=\"$field\"/> = Nothing\n\t\t\tEnd If\n        End Set\n    End Property\n\t\t</xsl:when>\n\t\t<xsl:otherwise>\n\tPublic Property <xsl:value-of select=\"$name\"/>Specified As Boolean\n        Get \n            Return <xsl:value-of select=\"$field\"/> IsNot Nothing\n        End Get\n        Set (ByVal value As Boolean) \n            If <xsl:value-of select=\"$field\"/> Is Nothing Then\n\t\t\t\tIf value = True then <xsl:value-of select=\"$field\"/> = <xsl:value-of select=\"$name\"/>\n\t\t\tElse\n\t\t\t\tIf value = False then <xsl:value-of select=\"$field\"/> = Nothing\n\t\t\tEnd If\n        End Set\n    End Property\n\t\t</xsl:otherwise>\n\t</xsl:choose>\n\tPrivate Function ShouldSerialize<xsl:value-of select=\"$name\"/>() As Boolean\n\t\tReturn <xsl:value-of select=\"$name\"/>Specified \n\tEnd Function\n    Private Sub Reset<xsl:value-of select=\"$name\"/>()\n\t\t<xsl:value-of select=\"$name\"/>Specified = false\n\tEnd Sub\n    </xsl:if>\n  </xsl:template>\n  <xsl:template match=\"FieldDescriptorProto[label='LABEL_REPEATED']\">\n    <xsl:variable name=\"type\"><xsl:apply-templates select=\".\" mode=\"type\"/></xsl:variable>\n    <xsl:variable name=\"format\"><xsl:apply-templates select=\".\" mode=\"format\"/></xsl:variable>\n    <xsl:variable name=\"field\"><xsl:apply-templates select=\".\" mode=\"field\"/></xsl:variable>\n\t<xsl:choose>\n\t\t<xsl:when test=\"substring-after($type, 'google.protobuf.')\">\n    Private <xsl:if test=\"not($optionXml)\">ReadOnly </xsl:if> <xsl:value-of select=\"$field\"/> as Global.System.Collections.Generic.List(Of <xsl:value-of select=\"substring-after($type, 'google.protobuf.')\" />) = New Global.System.Collections.Generic.List(Of <xsl:value-of select=\"substring-after($type, 'google.protobuf.')\"/>)()\n\t\t</xsl:when>\n\t\t<xsl:otherwise>\n    Private <xsl:if test=\"not($optionXml)\">ReadOnly </xsl:if> <xsl:value-of select=\"$field\"/> as Global.System.Collections.Generic.List(Of <xsl:value-of select=\"$type\" />) = New Global.System.Collections.Generic.List(Of <xsl:value-of select=\"$type\"/>)()\n\t\t</xsl:otherwise>\n\t</xsl:choose>\n\t<xsl:choose>\n\t\t<xsl:when test=\"$optionDataContract\">\n\t&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n\t&lt;Global.System.Runtime.Serialization.DataMember(Name:=\"<xsl:value-of select=\"name\"/>\", Order:=<xsl:value-of select=\"number\"/>, IsRequired:=False)&gt; _ \n\t\t</xsl:when>\n\t\t<xsl:when test=\"$optionXml\">\n\t&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n\t&lt;Global.System.Xml.Serialization.XmlElement(\"<xsl:value-of select=\"name\"/>\", Order:=<xsl:value-of select=\"number\"/>)&gt; _\n\t\t</xsl:when>\n\t\t<xsl:otherwise>\n\t&lt;Global.ProtoBuf.ProtoMember(<xsl:value-of select=\"number\"/>, Name:=\"<xsl:value-of select=\"name\"/>\", DataFormat:=Global.ProtoBuf.DataFormat.<xsl:value-of select=\"$format\"/>)&gt; _\n\t\t</xsl:otherwise>\n\t</xsl:choose><!--\n\t--><xsl:choose>\n\t\t<xsl:when test=\"substring-after($type, 'google.protobuf.')\"><!--\n    -->Public <xsl:if test=\"not($optionXml)\">ReadOnly </xsl:if>Property <xsl:value-of select=\"name\"/> As Global.System.Collections.Generic.List(Of <xsl:value-of select=\"substring-after($type, 'google.protobuf.')\" />)\n\t\t</xsl:when>\n\t\t<xsl:otherwise><!--\n    -->Public <xsl:if test=\"not($optionXml)\">ReadOnly </xsl:if>Property <xsl:value-of select=\"name\"/> As Global.System.Collections.Generic.List(Of <xsl:value-of select=\"$type\" />)\n\t\t</xsl:otherwise>\n\t</xsl:choose>\n\t\tGet\n\t\t\tReturn <xsl:value-of select=\"$field\"/>\n\t\tEnd Get\n\t\t<!----><xsl:if test=\"$optionXml\">\n\t\t<xsl:choose>\n\t\t\t<xsl:when test=\"substring-after($type, 'google.protobuf.')\">\n\t\tSet (value As Global.System.Collections.Generic.List(Of <xsl:value-of select=\"substring-after($type, 'google.protobuf.')\" />))\n\t\t\t</xsl:when>\n\t\t\t<xsl:otherwise>\n\t\tSet (value As Global.System.Collections.Generic.List(Of <xsl:value-of select=\"$type\" />))\n\t\t\t</xsl:otherwise>\n\t\t</xsl:choose>\n\t\t\t<xsl:value-of select=\"$field\"/> = value \n\t\tEnd Set\n\t\t</xsl:if>\n\tEnd Property\n  </xsl:template>\n\n  <xsl:template match=\"ServiceDescriptorProto\">\n    <xsl:if test=\"($optionClientProxy or $optionDataContract)\">\n    &lt;Global.System.ServiceModel.ServiceContract(Name:=\"<xsl:value-of select=\"name\"/>\")&gt; _\n    </xsl:if>\n    Public Interface I<xsl:value-of select=\"name\"/>\n      <xsl:apply-templates select=\"method\"/>\n    End Interface\n    \n    <xsl:if test=\"$optionProtoRpc\">\n    Public Class <xsl:value-of select=\"name\"/>Client : Global.ProtoBuf.ServiceModel.RpcClient\n      public <xsl:value-of select=\"name\"/>Client() : base(typeof(I<xsl:value-of select=\"name\"/>)) { }\n\n      <xsl:apply-templates select=\"method/MethodDescriptorProto\" mode=\"protoRpc\"/>\n    End Class\n    </xsl:if>\n    <xsl:apply-templates select=\".\" mode=\"clientProxy\"/>\n    \n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto\">\n    <xsl:if test=\"$optionDataContract\">\n    &lt;Global.System.ServiceModel.OperationContract(Name:=\"<xsl:value-of select=\"name\"/>\")&gt; _\n    &lt;Global.ProtoBuf.ServiceModel.ProtoBehavior()&gt; _\n    </xsl:if>\n    <xsl:apply-templates select=\"output_type\"/><xsl:text xml:space=\"preserve\"> </xsl:text><xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request);\n    <xsl:if test=\"$optionAsynchronous and $optionDataContract\">\n    &lt;Global.System.ServiceModel.OperationContract(AsyncPattern:=True, Name:=\"<xsl:value-of select=\"name\"/>\")&gt; _\n    Global.System.IAsyncResult Begin<xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request, Global.System.AsyncCallback callback, object state);\n    <xsl:apply-templates select=\"output_type\"/> End<xsl:value-of select=\"name\"/>(Global.System.IAsyncResult ar);\n    </xsl:if>\n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto\" mode=\"protoRpc\">\n      <xsl:apply-templates select=\"output_type\"/><xsl:text xml:space=\"preserve\"> </xsl:text><xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request)\n      {\n        return (<xsl:apply-templates select=\"output_type\"/>) Send(\"<xsl:value-of select=\"name\"/>\", request);\n      }\n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto/input_type | MethodDescriptorProto/output_type\">\n    <xsl:value-of select=\"substring-after(.,'.')\"/>\n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto\" mode=\"CompleteEvent\">\n  <xsl:if test=\"$optionAsynchronous and $optionDataContract\">\n    Public Class <xsl:value-of select=\"name\"/>CompletedEventArgs : Global.System.ComponentModel.AsyncCompletedEventArgs\n        private object[] results;\n\n        public <xsl:value-of select=\"name\"/>CompletedEventArgs(object[] results, Global.System.Exception exception, bool cancelled, object userState)\n            : base(exception, cancelled, userState) \n        {\n            this.results = results;\n        }\n        \n        public <xsl:apply-templates select=\"output_type\"/> Result\n        {\n            get { \n                base.RaiseExceptionIfNecessary();\n                return (<xsl:apply-templates select=\"output_type\"/>)(this.results[0]); \n            }\n        }\n    End Class\n  </xsl:if>\n  </xsl:template>\n\n  <xsl:template match=\"ServiceDescriptorProto\" mode=\"clientProxy\">\n  <xsl:if test=\"$optionAsynchronous and $optionDataContract and $optionClientProxy\">\n    <xsl:apply-templates select=\"method/MethodDescriptorProto\" mode=\"CompleteEvent\"/>\n    \n    &lt;Global.System.Diagnostics.DebuggerStepThroughAttribute()&gt; _\n    public partial class <xsl:value-of select=\"name\"/>Client : Global.System.ServiceModel.ClientBase&lt;I<xsl:value-of select=\"name\"/>&gt;, I<xsl:value-of select=\"name\"/>\n    {\n\n        public <xsl:value-of select=\"name\"/>Client()\n        {}\n        public <xsl:value-of select=\"name\"/>Client(string endpointConfigurationName) \n            : base(endpointConfigurationName) \n        {}\n        public <xsl:value-of select=\"name\"/>Client(string endpointConfigurationName, string remoteAddress) \n            : base(endpointConfigurationName, remoteAddress)\n        {}\n        public <xsl:value-of select=\"name\"/>Client(string endpointConfigurationName, Global.System.ServiceModel.EndpointAddress remoteAddress)\n            : base(endpointConfigurationName, remoteAddress)\n        {}\n        public <xsl:value-of select=\"name\"/>Client(Global.System.ServiceModel.Channels.Binding binding, Global.System.ServiceModel.EndpointAddress remoteAddress)\n            : base(binding, remoteAddress)\n        {}\n\n        <xsl:apply-templates select=\"method/MethodDescriptorProto\" mode=\"clientProxy\"/>\n    }  \n  </xsl:if>\n  </xsl:template>\n\n  <xsl:template match=\"MethodDescriptorProto\" mode=\"clientProxy\">\n  <xsl:if test=\"$optionAsynchronous and $optionDataContract and $optionClientProxy\">\n        private BeginOperationDelegate onBegin<xsl:value-of select=\"name\"/>Delegate;\n        private EndOperationDelegate onEnd<xsl:value-of select=\"name\"/>Delegate;\n        private Global.System.Threading.SendOrPostCallback on<xsl:value-of select=\"name\"/>CompletedDelegate;\n\n        public event Global.System.EventHandler&lt;<xsl:value-of select=\"name\"/>CompletedEventArgs&gt; <xsl:value-of select=\"name\"/>Completed;\n\n        public <xsl:apply-templates select=\"output_type\"/><xsl:text xml:space=\"preserve\"> </xsl:text><xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request)\n        {\n            return base.Channel.<xsl:value-of select=\"name\"/>(request);\n        }\n\n        &lt;Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)&gt; _\n        public Global.System.IAsyncResult Begin<xsl:value-of select=\"name\"/>(<xsl:apply-templates select=\"input_type\"/> request, Global.System.AsyncCallback callback, object asyncState)\n        {\n            return base.Channel.Begin<xsl:value-of select=\"name\"/>(request, callback, asyncState);\n        }\n\n        &lt;Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)&gt; _\n        public <xsl:apply-templates select=\"output_type\"/> End<xsl:value-of select=\"name\"/>(Global.System.IAsyncResult result)\n        {\n            return base.Channel.End<xsl:value-of select=\"name\"/>(result);\n        }\n\n        private Global.System.IAsyncResult OnBegin<xsl:value-of select=\"name\"/>(object[] inValues, Global.System.AsyncCallback callback, object asyncState)\n        {\n            <xsl:apply-templates select=\"input_type\"/> request = ((<xsl:apply-templates select=\"input_type\"/>)(inValues[0]));\n            return this.Begin<xsl:value-of select=\"name\"/>(request, callback, asyncState);\n        }\n\n        private object[] OnEnd<xsl:value-of select=\"name\"/>(Global.System.IAsyncResult result)\n        {\n            <xsl:apply-templates select=\"output_type\"/> retVal = this.End<xsl:value-of select=\"name\"/>(result);\n            return new object[] {\n                retVal};\n        }\n\n        private void On<xsl:value-of select=\"name\"/>Completed(object state)\n        {\n            if ((this.<xsl:value-of select=\"name\"/>Completed != null))\n            {\n                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));\n                this.<xsl:value-of select=\"name\"/>Completed(this, new <xsl:value-of select=\"name\"/>CompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));\n            }\n        }\n\n        public void <xsl:value-of select=\"name\"/>Async(<xsl:apply-templates select=\"input_type\"/> request)\n        {\n            this.<xsl:value-of select=\"name\"/>Async(request, null);\n        }\n\n        public void <xsl:value-of select=\"name\"/>Async(<xsl:apply-templates select=\"input_type\"/> request, object userState)\n        {\n            if ((this.onBegin<xsl:value-of select=\"name\"/>Delegate == null))\n            {\n                this.onBegin<xsl:value-of select=\"name\"/>Delegate = new BeginOperationDelegate(this.OnBegin<xsl:value-of select=\"name\"/>);\n            }\n            if ((this.onEnd<xsl:value-of select=\"name\"/>Delegate == null))\n            {\n                this.onEnd<xsl:value-of select=\"name\"/>Delegate = new EndOperationDelegate(this.OnEnd<xsl:value-of select=\"name\"/>);\n            }\n            if ((this.on<xsl:value-of select=\"name\"/>CompletedDelegate == null))\n            {\n                this.on<xsl:value-of select=\"name\"/>CompletedDelegate = new Global.System.Threading.SendOrPostCallback(this.On<xsl:value-of select=\"name\"/>Completed);\n            }\n            base.InvokeAsync(this.onBegin<xsl:value-of select=\"name\"/>Delegate, new object[] {\n                    request}, this.onEnd<xsl:value-of select=\"name\"/>Delegate, this.on<xsl:value-of select=\"name\"/>CompletedDelegate, userState);\n        }\n    </xsl:if>\n    </xsl:template>\n  \n  <xsl:template name=\"escapeKeyword\"><xsl:param name=\"value\"/><xsl:choose>\n      <xsl:when test=\"contains($keywordsUpper,concat('|',translate($value, $alpha, $ALPHA),'|'))\">[<xsl:value-of select=\"$value\"/>]</xsl:when>\n      <xsl:otherwise><xsl:value-of select=\"$value\"/></xsl:otherwise>\n    </xsl:choose></xsl:template>\n  <xsl:variable name=\"keywords\">|AddHandler|AddressOf|Alias|And|AndAlso|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|CBool|CByte|CChar|CDate|CDec|CDbl|Char|CInt|Class|CLng|CObj|Const|Continue|CSByte|CShort|CSng|CStr|CType|CUInt|CULng|CUShort|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else|ElseIf|End|EndIf|Enum|Erase|Error|Event|Exit|False|Finally|For|Friend|Function|Get|GetType|GetXMLNamespace|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass|Namespace|Narrowing|New|Next|Not|Nothing|NotInheritable|NotOverridable|Object|Of|On|Operator|Option|Optional|Or|OrElse|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|REM|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|Short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|True|Try|TryCast|TypeOf|Variant|Wend|UInteger|ULong|UShort|Using|When|While|Widening|With|WithEvents|WriteOnly|Xor|</xsl:variable>\n  <xsl:variable name=\"keywordsUpper\" select=\"translate($keywords, $alpha, $ALPHA)\"/>\n\n</xsl:stylesheet>\n"
  },
  {
    "path": "Tools/ProtobufGen/protobuf-net/xml.xslt",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n    xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" exclude-result-prefixes=\"xsl msxsl\"\n>\n  <xsl:param name=\"help\"/>\n  <xsl:output method=\"xml\" indent=\"yes\"/>\n\n\n  <xsl:template match=\"/*\">\n    <xsl:if test=\"$help='true'\">\n      <xsl:message terminate=\"yes\">\n        Xml template for protobuf-net.\n        \n        This template writes the proto descriptor as xml.\n        No options available.\n      </xsl:message>\n    </xsl:if>\n    <xsl:call-template name=\"main\"/>\n  </xsl:template>\n  \n    <xsl:template match=\"@* | node()\" name=\"main\">\n        <xsl:copy>\n            <xsl:apply-templates select=\"@* | node()\"/>\n        </xsl:copy>\n    </xsl:template>\n</xsl:stylesheet>\n"
  },
  {
    "path": "Tools/ProtobufGen/protogen.bat",
    "content": "set Protocol=..\\..\\Assets\\CSharpLua\\Compiled\\Protocol\\\nset AutoGen=%Protocol%AutoGen\\\nset LuaProtocol=..\\..\\Assets\\Lua\\3rd\\pbc\\Protocol\\\n\nset cur=%cd%\ncd %Protocol%\n\nfor %%i in (*.proto) do (\n    %cur%\\protobuf-net\\protogen -i:%%i -o:AutoGen\\%%~ni.cs\n )\n\nfor %%i in (*.proto) do (\n    %cur%\\protobuf-net\\protoc %%i -o %cur%\\%LuaProtocol%%%~ni.pb\n )\n\n cd %cur%\n echo protogen success\n"
  },
  {
    "path": "Unity5.x/Assets/Plugins/Android/libs/armeabi-v7a/libtolua.so.meta",
    "content": "fileFormatVersion: 2\nguid: 4fb9a29f65e536b4293f7f9affd19158\nPluginImporter:\n  serializedVersion: 1\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  platformData:\n    Android:\n      enabled: 1\n      settings:\n        CPU: ARMv7\n    Any:\n      enabled: 0\n      settings: {}\n    Editor:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n        DefaultValueInitialized: true\n        OS: AnyOS\n    Linux:\n      enabled: 0\n      settings:\n        CPU: x86\n    Linux64:\n      enabled: 0\n      settings:\n        CPU: x86_64\n    OSXIntel:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    OSXIntel64:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Win:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Win64:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    iOS:\n      enabled: 0\n      settings:\n        CompileFlags: \n        FrameworkDependencies: \n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Unity5.x/Assets/Plugins/Android/libs/x86/libtolua.so.meta",
    "content": "fileFormatVersion: 2\nguid: b3f1ad25b4054b34d9105289ee492b57\ntimeCreated: 1471082297\nlicenseType: Pro\nPluginImporter:\n  serializedVersion: 1\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  platformData:\n    Android:\n      enabled: 1\n      settings:\n        CPU: x86\n    Any:\n      enabled: 0\n      settings: {}\n    Editor:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n        DefaultValueInitialized: true\n        OS: AnyOS\n    Linux:\n      enabled: 0\n      settings:\n        CPU: x86\n    Linux64:\n      enabled: 0\n      settings:\n        CPU: x86_64\n    OSXIntel:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    OSXIntel64:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Win:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Win64:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    iOS:\n      enabled: 0\n      settings:\n        CompileFlags: \n        FrameworkDependencies: \n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Unity5.x/Assets/Plugins/iOS/libtolua.a.meta",
    "content": "fileFormatVersion: 2\nguid: 54c35a8b7bc7347e0a91ff24faf55409\ntimeCreated: 1456833383\nlicenseType: Pro\nPluginImporter:\n  serializedVersion: 1\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  platformData:\n    Android:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Any:\n      enabled: 0\n      settings: {}\n    Editor:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n        DefaultValueInitialized: true\n        OS: AnyOS\n    Linux:\n      enabled: 0\n      settings:\n        CPU: x86\n    Linux64:\n      enabled: 0\n      settings:\n        CPU: x86_64\n    OSXIntel:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    OSXIntel64:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Win:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Win64:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    iOS:\n      enabled: 1\n      settings:\n        CompileFlags: \n        FrameworkDependencies: \n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Unity5.x/Assets/Plugins/tolua.bundle.meta",
    "content": "fileFormatVersion: 2\nguid: fd30d03bd8185a44ba7bc7fbfcca2201\nfolderAsset: yes\nPluginImporter:\n  serializedVersion: 1\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  platformData:\n    Android:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Any:\n      enabled: 0\n      settings: {}\n    Editor:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n        DefaultValueInitialized: true\n        OS: OSX\n    Linux:\n      enabled: 1\n      settings:\n        CPU: x86\n    Linux64:\n      enabled: 1\n      settings:\n        CPU: x86_64\n    LinuxUniversal:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    OSXIntel:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    OSXIntel64:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    OSXUniversal:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    Win:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    Win64:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    iOS:\n      enabled: 0\n      settings:\n        CompileFlags: \n        FrameworkDependencies: \n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Unity5.x/Assets/Plugins/x86/tolua.dll.meta",
    "content": "fileFormatVersion: 2\nguid: 8f4af3c74c7469d498c7c7c7a40ead91\nPluginImporter:\n  serializedVersion: 1\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  platformData:\n    Android:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Any:\n      enabled: 0\n      settings: {}\n    Editor:\n      enabled: 1\n      settings:\n        CPU: x86\n        DefaultValueInitialized: true\n        OS: Windows\n    Linux:\n      enabled: 1\n      settings:\n        CPU: x86\n    Linux64:\n      enabled: 0\n      settings:\n        CPU: None\n    LinuxUniversal:\n      enabled: 0\n      settings:\n        CPU: x86\n    OSXIntel:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    OSXIntel64:\n      enabled: 0\n      settings:\n        CPU: None\n    OSXUniversal:\n      enabled: 0\n      settings:\n        CPU: x86\n    Win:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    Win64:\n      enabled: 0\n      settings:\n        CPU: None\n    iOS:\n      enabled: 0\n      settings:\n        CompileFlags: \n        FrameworkDependencies: \n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Unity5.x/Assets/Plugins/x86_64/tolua.dll.meta",
    "content": "fileFormatVersion: 2\nguid: 82bce848ef6ade348a8220c2ada7da08\nPluginImporter:\n  serializedVersion: 1\n  iconMap: {}\n  executionOrder: {}\n  isPreloaded: 0\n  platformData:\n    Android:\n      enabled: 0\n      settings:\n        CPU: AnyCPU\n    Any:\n      enabled: 0\n      settings: {}\n    Editor:\n      enabled: 1\n      settings:\n        CPU: x86_64\n        DefaultValueInitialized: true\n        OS: Windows\n    Linux:\n      enabled: 0\n      settings:\n        CPU: None\n    Linux64:\n      enabled: 1\n      settings:\n        CPU: x86_64\n    LinuxUniversal:\n      enabled: 0\n      settings:\n        CPU: x86_64\n    OSXIntel:\n      enabled: 0\n      settings:\n        CPU: None\n    OSXIntel64:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    OSXUniversal:\n      enabled: 0\n      settings:\n        CPU: x86_64\n    Win:\n      enabled: 0\n      settings:\n        CPU: None\n    Win64:\n      enabled: 1\n      settings:\n        CPU: AnyCPU\n    iOS:\n      enabled: 0\n      settings:\n        CompileFlags: \n        FrameworkDependencies: \n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  }
]