aboutsummaryrefslogtreecommitdiff
path: root/src/script/common
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2017-11-23 23:35:52 +0100
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commit7cc1a36b3c0ce3da66881b02fce7248543d20163 (patch)
tree9c2137e9d880c37e23171c6d3cea67d6364fa7d0 /src/script/common
parent3f1094475fd42bddc77c7e34265eb54bc2420cd0 (diff)
downloadminetest-7cc1a36b3c0ce3da66881b02fce7248543d20163.tar.gz
minetest-7cc1a36b3c0ce3da66881b02fce7248543d20163.tar.bz2
minetest-7cc1a36b3c0ce3da66881b02fce7248543d20163.zip
Hint at problematic code when logging deprecated calls
Diffstat (limited to 'src/script/common')
-rw-r--r--src/script/common/c_internal.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/script/common/c_internal.cpp b/src/script/common/c_internal.cpp
index b349f9dd1..3fa044172 100644
--- a/src/script/common/c_internal.cpp
+++ b/src/script/common/c_internal.cpp
@@ -178,9 +178,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);