From bb3821df456e4bd2473e2ba8186bfc80e9b94b09 Mon Sep 17 00:00:00 2001 From: "T.J. McGrath-Daly" Date: Sat, 27 Nov 2021 14:40:25 +0800 Subject: [PATCH] Fix: Lua breakpoint error Signed-off-by: T.J. McGrath-Daly --- Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp index e28a289c9e..b03e0279ab 100644 --- a/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp +++ b/Code/Framework/AzCore/AzCore/Script/ScriptContextDebug.cpp @@ -105,6 +105,8 @@ void ScriptContextDebug::ConnectHook() void ScriptContextDebug::DisconnectHook() { lua_sethook(m_context.NativeContext(), nullptr, 0, 0); + m_currentStackLevel = -1; + m_stepStackLevel = -1; } //========================================================================= @@ -651,6 +653,11 @@ void AZ::LuaHook(lua_State* l, lua_Debug* ar) context->PopCallstack(); } context->m_currentStackLevel--; + + if (context->m_currentStackLevel == -1) + { + context->m_stepStackLevel = -1; + } } else if (ar->event == LUA_HOOKLINE) {