//LuaFunction _call = null; public LuaEvent(LuaTable table) { self = table; luaState = table.GetLuaState(); self.AddRef(); _add = self.RawGetLuaFunction("Add"); _remove = self.RawGetLuaFunction("Remove"); //_call = self.RawGetLuaFunction("__call"); }
//LuaFunction _call = null; public LuaBeatEvent(LuaTable table) { self = table; luaState = table.GetLuaState(); self.AddRef(); _add = self.GetLuaFunction("Add"); _remove = self.GetLuaFunction("Remove"); //_call = self.GetLuaFunction("__call"); }
public void AddRef() { ++count; //Debugger.Log("LuaDelegate {0} AddRef {1}", reference, count); func.AddRef(); if (self != null) { self.AddRef(); } }
//LuaFunction _call = null; public LuaEvent(LuaTable table) { self = table; luaState = table.GetLuaState(); self.AddRef(); LuaTable meta = self.GetMetaTable(); _add = meta.RawGetLuaFunction("Add"); _remove = meta.RawGetLuaFunction("Remove"); meta.Dispose(); meta = null; //_call = self.RawGetLuaFunction("__call"); }
//LuaFunction _call = null; #region constructor public LuaBeatEvent(LuaTable table) { self = table; // 获取参数 table 的 luaState 字段的值 luaState = table.GetLuaState(); // 增加引用计数 self.AddRef(); // 获取 self 中的 Add 和 Remove 方法 _add = self.GetLuaFunction("Add"); _remove = self.GetLuaFunction("Remove"); //_call = self.GetLuaFunction("__call"); }
public LuaDictTable(LuaTable table) { table.AddRef(); this.table = table; this.state = table.GetLuaState(); }
public LuaArrayTable(LuaTable table) { table.AddRef(); this.table = table; this.state = table.GetGLuaState(); }
public LuaTable GetTable(string fullPath, bool beLogMiss = true) { WeakReference weak = null; if (funcMap.TryGetValue(fullPath, out weak)) { if (weak.IsAlive) { LuaTable table = weak.Target as LuaTable; if (table.IsAlive) { table.AddRef(); RemoveFromGCList(table.GetReference()); return(table); } } funcMap.Remove(fullPath); } if (PushLuaTable(fullPath, false)) { int reference = ToLuaRef(); LuaTable table = null; if (funcRefMap.TryGetValue(reference, out weak)) { if (weak.IsAlive) { table = weak.Target as LuaTable; if (table.IsAlive) { funcMap.Add(fullPath, weak); table.AddRef(); RemoveFromGCList(reference); return(table); } } funcRefMap.Remove(reference); } table = new LuaTable(reference, this); table.name = fullPath; funcMap.Add(fullPath, new WeakReference(table)); funcRefMap.Add(reference, new WeakReference(table)); if (LogGC) { Debugger.Log("Alloc LuaTable name {0}, id {1}", fullPath, reference); } RemoveFromGCList(reference); return(table); } if (beLogMiss) { Debugger.LogWarning("Lua table {0} not exists", fullPath); } return(null); }