diff --git a/src/script/lua_api/l_base.cpp b/src/script/lua_api/l_base.cpp index 8c2affe815..c25c807247 100644 --- a/src/script/lua_api/l_base.cpp +++ b/src/script/lua_api/l_base.cpp @@ -123,14 +123,18 @@ int ModApiBase::l_deprecated_function(lua_State *L, const char *good, const char u64 start_time = porting::getTimeUs(); lua_Debug ar; + std::string backtrace; // Get caller name with line and script backtrace - FATAL_ERROR_IF(!lua_getstack(L, 1, &ar), "lua_getstack() failed"); - FATAL_ERROR_IF(!lua_getinfo(L, "Sl", &ar), "lua_getinfo() failed"); + if (lua_getstack(L, 1, &ar) && lua_getinfo(L, "Sl", &ar)) { + // Get backtrace and hash it to reduce the warning flood + backtrace = ar.short_src; + backtrace.append(":").append(std::to_string(ar.currentline)); + } else { + backtrace = " "; + backtrace.append(script_get_backtrace(L)); + } - // Get backtrace and hash it to reduce the warning flood - std::string backtrace = ar.short_src; - backtrace.append(":").append(std::to_string(ar.currentline)); u64 hash = murmur_hash_64_ua(backtrace.data(), backtrace.length(), 0xBADBABE); if (std::find(deprecated_logged.begin(), deprecated_logged.end(), hash)