private string UF_GetLuaRefCSObject() { ObjectTranslator objectTranslator = GLuaState.GetTranslator(System.IntPtr.Zero); Dictionary <System.Type, int> dicRefState = new Dictionary <System.Type, int> (); List <KeyValuePair <System.Type, int> > lstSort = new List <KeyValuePair <System.Type, int> > (); foreach (KeyValuePair <object, int> item in objectTranslator.objectsBackMap) { System.Type t = item.Key.GetType(); if (dicRefState.ContainsKey(t)) { dicRefState [t] += 1; } else { dicRefState.Add(t, 1); } } foreach (var item in dicRefState) { lstSort.Add(item); } lstSort.Sort((x, y) => - x.Value.CompareTo(y.Value)); string msg = ""; foreach (var each in lstSort) { msg += each.Key.ToString() + " : " + each.Value.ToString() + "\n"; } return(msg); }
static int Destroy(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject(L, 1); ToLua.Destroy(L); UnityEngine.Object.Destroy(arg0); return(0); } else if (count == 2) { float arg1 = (float)LuaDLL.luaL_checknumber(L, 2); int udata = LuaDLL.tolua_rawnetobj(L, 1); ObjectTranslator translator = GLuaState.GetTranslator(L); translator.DelayDestroy(udata, arg1); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: Object.Destroy")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private string UF_GetLuaRefUnityObject() { string msg = ""; ObjectTranslator objectTranslator = GLuaState.GetTranslator(System.IntPtr.Zero); Dictionary <string, int> mDicUnityObject = new Dictionary <string, int> (); foreach (KeyValuePair <object, int> item in objectTranslator.objectsBackMap) { Object uobj = item.Key as Object; if (uobj != null) { string key = uobj.name + "(" + uobj.GetType().ToString() + ")"; if (!mDicUnityObject.ContainsKey(key)) { mDicUnityObject.Add(key, 1); } else { mDicUnityObject [key] += 1; } } } foreach (KeyValuePair <string, int> item in mDicUnityObject) { msg = msg + item.Key + " | " + item.Value + "\n"; } return(msg); }
public static ObjectTranslator Get(IntPtr L) { #if !MULTI_STATE return(_translator); #else return(GLuaState.GetTranslator(L)); #endif }