public void Close() { if (this.L != IntPtr.Zero && LuaState.main == this) { SLogger.Log("Finalizing Lua State."); LuaDLL.pua_close(this.L); ObjectCache.del(this.L); ObjectCache.clear(); LuaState.statemap.Clear(); LuaState.oldptr = IntPtr.Zero; LuaState.oldstate = null; this.L = IntPtr.Zero; LuaState.main = null; } }
public void Close() { if (L != IntPtr.Zero) { if (LuaState.main == this) { SLogger.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.pua_close(L); ObjectCache.del(L); ObjectCache.clear(); statemap.Clear(); oldptr = IntPtr.Zero; oldstate = null; L = IntPtr.Zero; LuaState.main = null; } } }