#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; #else using LuaAPI = XLua.LuaDLL.Lua; using RealStatePtr = System.IntPtr; using LuaCSFunction = XLua.LuaDLL.lua_CSFunction; #endif using XLua; using System.Collections.Generic; namespace XLua.CSObjectWrap { using Utils = XLua.Utils; public class SystemCollectionsHashtableWrap { public static void __Register(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(System.Collections.Hashtable); Utils.BeginObjectRegister(type, L, translator, 0, 13, 7, 0); Utils.RegisterFunc(L, Utils.METHOD_IDX, "get_Item", _m_get_Item); Utils.RegisterFunc(L, Utils.METHOD_IDX, "set_Item", _m_set_Item); Utils.RegisterFunc(L, Utils.METHOD_IDX, "CopyTo", _m_CopyTo); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Add", _m_Add); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Clear", _m_Clear); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Contains", _m_Contains); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetEnumerator", _m_GetEnumerator); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Remove", _m_Remove); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ContainsKey", _m_ContainsKey); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ContainsValue", _m_ContainsValue); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Clone", _m_Clone); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetObjectData", _m_GetObjectData); Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnDeserialization", _m_OnDeserialization); Utils.RegisterFunc(L, Utils.GETTER_IDX, "Count", _g_get_Count); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsSynchronized", _g_get_IsSynchronized); Utils.RegisterFunc(L, Utils.GETTER_IDX, "SyncRoot", _g_get_SyncRoot); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsFixedSize", _g_get_IsFixedSize); Utils.RegisterFunc(L, Utils.GETTER_IDX, "IsReadOnly", _g_get_IsReadOnly); Utils.RegisterFunc(L, Utils.GETTER_IDX, "Keys", _g_get_Keys); Utils.RegisterFunc(L, Utils.GETTER_IDX, "Values", _g_get_Values); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0); Utils.RegisterFunc(L, Utils.CLS_IDX, "Synchronized", _m_Synchronized_xlua_st_); Utils.EndClassRegister(type, L, translator); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if(LuaAPI.lua_gettop(L) == 1) { var gen_ret = new System.Collections.Hashtable(); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { int _capacity = LuaAPI.xlua_tointeger(L, 2); float _loadFactor = (float)LuaAPI.lua_tonumber(L, 3); var gen_ret = new System.Collections.Hashtable(_capacity, _loadFactor); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { int _capacity = LuaAPI.xlua_tointeger(L, 2); var gen_ret = new System.Collections.Hashtable(_capacity); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 3 && translator.Assignable(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { System.Collections.IDictionary _d = (System.Collections.IDictionary)translator.GetObject(L, 2, typeof(System.Collections.IDictionary)); float _loadFactor = (float)LuaAPI.lua_tonumber(L, 3); var gen_ret = new System.Collections.Hashtable(_d, _loadFactor); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 2 && translator.Assignable(L, 2)) { System.Collections.IDictionary _d = (System.Collections.IDictionary)translator.GetObject(L, 2, typeof(System.Collections.IDictionary)); var gen_ret = new System.Collections.Hashtable(_d); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 3 && translator.Assignable(L, 2) && translator.Assignable(L, 3)) { System.Collections.IDictionary _d = (System.Collections.IDictionary)translator.GetObject(L, 2, typeof(System.Collections.IDictionary)); System.Collections.IEqualityComparer _equalityComparer = (System.Collections.IEqualityComparer)translator.GetObject(L, 3, typeof(System.Collections.IEqualityComparer)); var gen_ret = new System.Collections.Hashtable(_d, _equalityComparer); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 4 && translator.Assignable(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable(L, 4)) { System.Collections.IDictionary _d = (System.Collections.IDictionary)translator.GetObject(L, 2, typeof(System.Collections.IDictionary)); float _loadFactor = (float)LuaAPI.lua_tonumber(L, 3); System.Collections.IEqualityComparer _equalityComparer = (System.Collections.IEqualityComparer)translator.GetObject(L, 4, typeof(System.Collections.IEqualityComparer)); var gen_ret = new System.Collections.Hashtable(_d, _loadFactor, _equalityComparer); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 2 && translator.Assignable(L, 2)) { System.Collections.IEqualityComparer _equalityComparer = (System.Collections.IEqualityComparer)translator.GetObject(L, 2, typeof(System.Collections.IEqualityComparer)); var gen_ret = new System.Collections.Hashtable(_equalityComparer); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable(L, 3)) { int _capacity = LuaAPI.xlua_tointeger(L, 2); System.Collections.IEqualityComparer _equalityComparer = (System.Collections.IEqualityComparer)translator.GetObject(L, 3, typeof(System.Collections.IEqualityComparer)); var gen_ret = new System.Collections.Hashtable(_capacity, _equalityComparer); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable(L, 4)) { int _capacity = LuaAPI.xlua_tointeger(L, 2); float _loadFactor = (float)LuaAPI.lua_tonumber(L, 3); System.Collections.IEqualityComparer _equalityComparer = (System.Collections.IEqualityComparer)translator.GetObject(L, 4, typeof(System.Collections.IEqualityComparer)); var gen_ret = new System.Collections.Hashtable(_capacity, _loadFactor, _equalityComparer); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Hashtable constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_get_Item(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object key = translator.GetObject(L, 2, typeof(object)); translator.PushAny(L, gen_to_be_invoked[key]); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_set_Item(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object key = translator.GetObject(L, 2, typeof(object)); object gen_value = translator.GetObject(L, 3, typeof(object)); gen_to_be_invoked[key] = gen_value; return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_CopyTo(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { System.Array _array = (System.Array)translator.GetObject(L, 2, typeof(System.Array)); int _arrayIndex = LuaAPI.xlua_tointeger(L, 3); gen_to_be_invoked.CopyTo( _array, _arrayIndex ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Add(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object _key = translator.GetObject(L, 2, typeof(object)); object _value = translator.GetObject(L, 3, typeof(object)); gen_to_be_invoked.Add( _key, _value ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Clear(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Clear( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Contains(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object _key = translator.GetObject(L, 2, typeof(object)); var gen_ret = gen_to_be_invoked.Contains( _key ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetEnumerator(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { var gen_ret = gen_to_be_invoked.GetEnumerator( ); translator.PushAny(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Remove(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object _key = translator.GetObject(L, 2, typeof(object)); gen_to_be_invoked.Remove( _key ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_ContainsKey(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object _key = translator.GetObject(L, 2, typeof(object)); var gen_ret = gen_to_be_invoked.ContainsKey( _key ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_ContainsValue(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object _value = translator.GetObject(L, 2, typeof(object)); var gen_ret = gen_to_be_invoked.ContainsValue( _value ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Clone(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { var gen_ret = gen_to_be_invoked.Clone( ); translator.PushAny(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetObjectData(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { System.Runtime.Serialization.SerializationInfo _info = (System.Runtime.Serialization.SerializationInfo)translator.GetObject(L, 2, typeof(System.Runtime.Serialization.SerializationInfo)); System.Runtime.Serialization.StreamingContext _context;translator.Get(L, 3, out _context); gen_to_be_invoked.GetObjectData( _info, _context ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_OnDeserialization(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); { object _sender = translator.GetObject(L, 2, typeof(object)); gen_to_be_invoked.OnDeserialization( _sender ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Synchronized_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { System.Collections.Hashtable _table = (System.Collections.Hashtable)translator.GetObject(L, 1, typeof(System.Collections.Hashtable)); var gen_ret = System.Collections.Hashtable.Synchronized( _table ); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_Count(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Count); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsSynchronized(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsSynchronized); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_SyncRoot(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); translator.PushAny(L, gen_to_be_invoked.SyncRoot); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsFixedSize(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsFixedSize); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_IsReadOnly(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsReadOnly); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_Keys(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); translator.PushAny(L, gen_to_be_invoked.Keys); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_Values(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Collections.Hashtable gen_to_be_invoked = (System.Collections.Hashtable)translator.FastGetCSObj(L, 1); translator.PushAny(L, gen_to_be_invoked.Values); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } } }