public static void SetMainLuaEnv(LuaState env) { if (LuaDeepProfilerSetting.Instance.isDeepProfiler) { if (env != null) { env.BeginModule(null); env.BeginModule("MikuLuaProfiler"); MikuLuaProfiler_LuaProfilerWrap.Register(env); env.EndModule(); env.EndModule(); env.DoString(@" BeginMikuSample = MikuLuaProfiler.LuaProfiler.BeginSample EndMikuSample = MikuLuaProfiler.LuaProfiler.EndSample function miku_unpack_return_value(...) EndMikuSample() return ... end "); HookSetup.HookLuaFuns(); } } if (env == null) { HookSetup.Uninstall(); LuaProfiler.mainL = IntPtr.Zero; } }
public static void lua_close(IntPtr luaState) { if (LuaProfiler.mainL == luaState) { LuaProfiler.mainL = IntPtr.Zero; HookSetup.Uninstall(); } }