aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hdb/lua-script.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index 56e0ead5e8..f5f00930ff 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -667,8 +667,10 @@ bool LuaScript::initScript(Common::SeekableReadStream *stream, int32 length) {
// Place the error handler function in the Lua registry, and remember the index
_pcallErrorhandlerRegistryIndex = luaL_ref(_state, LUA_REGISTRYINDEX);
- // Initialize debugging callback
- lua_sethook(_state, debugHook, LUA_MASKCALL | LUA_MASKLINE, 0);
+ if (gDebugLevel >= 8) {
+ // Initialize debugging callback
+ lua_sethook(_state, debugHook, LUA_MASKCALL | LUA_MASKLINE, 0);
+ }
// Load GLOBAL_LUA and execute it