end the current profile scope * * End the current profile scope. * @note Calling this without a matching `profiler.scope_begin()` raises a Lua error. * @name profiler.scope_end * */
| 782 | * |
| 783 | */ |
| 784 | static int ProfilerScopeEnd(lua_State* L) |
| 785 | { |
| 786 | DM_LUA_STACK_CHECK(L, 0); |
| 787 | LuaProfilerScope scope = {0}; |
| 788 | LuaProfilerScopeState* state = PopLuaProfilerScope(L, &scope); |
| 789 | if (state == 0) |
| 790 | { |
| 791 | return DM_LUA_ERROR("profiler.scope_end() called without a matching profiler.scope_begin()"); |
| 792 | } |
| 793 | |
| 794 | const char* name = GetLuaProfilerScopeName(state, &scope); |
| 795 | ProfileScopeEnd(name, scope.m_NameHash); |
| 796 | state->m_Names.SetSize(scope.m_NameOffset); |
| 797 | if (state->m_Scopes.Empty() && !state->m_IsMainThread) |
| 798 | { |
| 799 | DeleteLuaProfilerScopeState(state); |
| 800 | } |
| 801 | return 0; |
| 802 | } |
| 803 | |
| 804 | |
| 805 | /*# continously show latest frame |
nothing calls this directly
no test coverage detected