diff options
author | sfan5 <sfan5@live.de> | 2017-11-23 23:35:52 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-11-27 01:28:39 +0000 |
commit | 813d819d153c78eb81893c208ba73c56237ea3d4 (patch) | |
tree | 52605f6e84c7fe60e94dae1f92561e28b79925ef /src/script/common | |
parent | 03c11a73d86b2cd6fd204f9eef1cdb9d33ab88c6 (diff) | |
download | minetest-813d819d153c78eb81893c208ba73c56237ea3d4.tar.gz minetest-813d819d153c78eb81893c208ba73c56237ea3d4.tar.bz2 minetest-813d819d153c78eb81893c208ba73c56237ea3d4.zip |
Hint at problematic code when logging deprecated calls
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_internal.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/script/common/c_internal.cpp b/src/script/common/c_internal.cpp index 0b388e383..3d766a955 100644 --- a/src/script/common/c_internal.cpp +++ b/src/script/common/c_internal.cpp @@ -150,9 +150,15 @@ void log_deprecated(lua_State *L, const std::string &message) } if (do_log) { - warningstream << message << std::endl; - // L can be NULL if we get called by log_deprecated(const std::string &msg) - // from scripting_game.cpp. + warningstream << message; + if (L) { // L can be NULL if we get called from scripting_game.cpp + lua_Debug ar; + FATAL_ERROR_IF(!lua_getstack(L, 2, &ar), "lua_getstack() failed"); + FATAL_ERROR_IF(!lua_getinfo(L, "Sl", &ar), "lua_getinfo() failed"); + warningstream << " (at " << ar.short_src << ":" << ar.currentline << ")"; + } + warningstream << std::endl; + if (L) { if (do_error) script_error(L, LUA_ERRRUN, NULL, NULL); |