public void Close() { if (L != IntPtr.Zero) { if (LuaState.main == this) { Logger.Log("Finalizing Lua State."); // be careful, if you close lua vm, make sure you don't use lua state again, // comment this line as default for avoid unexpected crash. LuaDLL.lua_close(L); ObjectCache.del(L); ObjectCache.clear(); statemap.Clear(); oldptr = IntPtr.Zero; oldstate = null; L = IntPtr.Zero; LuaState.main = null; LuaDLLNativeRuntime.UnEstablish(); } } }
void Close() { destroyGameObject(); LuaTimer.DeleteAll(L); if (L != IntPtr.Zero) { Logger.Log("Finalizing Lua State."); // be careful, if you close lua vm, make sure you don't use lua state again, // comment this line as default for avoid unexpected crash. LuaDLL.lua_close(L); ObjectCache.del(L); ObjectCache.clear(); LuaDLLNativeRuntime.UnEstablish(); statemap.Remove(L); oldptr = IntPtr.Zero; oldstate = null; L = IntPtr.Zero; } }