diff options
author | sapier <sapier@users.noreply.github.com> | 2017-01-15 13:36:53 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-01-15 13:36:53 +0100 |
commit | f5070b44542edba97a20445c3774c221077cc4a2 (patch) | |
tree | 57f66ce352d868945234065e093fdca2adf2b95f /src/script/common | |
parent | e12019cfd9ff4e9afa1d7dd326a0094b15fb9b2b (diff) | |
download | minetest-f5070b44542edba97a20445c3774c221077cc4a2.tar.gz minetest-f5070b44542edba97a20445c3774c221077cc4a2.tar.bz2 minetest-f5070b44542edba97a20445c3774c221077cc4a2.zip |
Added lua tracebacks to some errors where you have been blind to what… (#5043)
* Added lua tracebacks to some errors where you have been blind to what actually went wrong
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_converter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp index f36298915..fc516d56a 100644 --- a/src/script/common/c_converter.cpp +++ b/src/script/common/c_converter.cpp @@ -26,15 +26,17 @@ extern "C" { #include "util/serialize.h" #include "util/string.h" #include "common/c_converter.h" +#include "common/c_internal.h" #include "constants.h" #define CHECK_TYPE(index, name, type) do { \ int t = lua_type(L, (index)); \ if (t != (type)) { \ + std::string traceback = script_get_backtrace(L); \ throw LuaError(std::string("Invalid ") + (name) + \ " (expected " + lua_typename(L, (type)) + \ - " got " + lua_typename(L, t) + ")."); \ + " got " + lua_typename(L, t) + ").\n" + traceback); \ } \ } while(0) #define CHECK_POS_COORD(name) CHECK_TYPE(-1, "position coordinate '" name "'", LUA_TNUMBER) |