public object Create(Type t, params object[] args) { List <object> pool = null; if (_pool.ContainsKey(t)) { pool = _pool[t]; } else { pool = new List <object>(); } if (pool.Count > 0) { ILua res = pool[0] as ILua; pool.RemoveAt(0); res.OnCreateLua(); return(res); } else { ILua res = Activator.CreateInstance(t, args) as ILua; res.OnCreateLua(); return(res); } }