コード例 #1
0
        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;
            }
        }
コード例 #2
0
 public static void lua_close(IntPtr luaState)
 {
     if (LuaProfiler.mainL == luaState)
     {
         LuaProfiler.mainL = IntPtr.Zero;
         HookSetup.Uninstall();
     }
 }