mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Improve script_log_add_source: Log full path for files
This commit is contained in:
@@ -119,8 +119,10 @@ void script_error(lua_State *L, int pcall_result, const char *mod, const char *f
|
|||||||
lua_Debug ar;
|
lua_Debug ar;
|
||||||
if (lua_getstack(L, stack_depth, &ar)) {
|
if (lua_getstack(L, stack_depth, &ar)) {
|
||||||
FATAL_ERROR_IF(!lua_getinfo(L, "Sl", &ar), "lua_getinfo() failed");
|
FATAL_ERROR_IF(!lua_getinfo(L, "Sl", &ar), "lua_getinfo() failed");
|
||||||
ret.append(" (at ").append(ar.short_src).append(":"
|
ret.append(" (at ");
|
||||||
+ std::to_string(ar.currentline) + ")");
|
// Use the full path for files, only use the shortened source for strings
|
||||||
|
ret.append(ar.source[0] == '@' ? &ar.source[1] : ar.short_src);
|
||||||
|
ret.append(":" + std::to_string(ar.currentline) + ")");
|
||||||
} else {
|
} else {
|
||||||
ret.append(" (at ?:?)");
|
ret.append(" (at ?:?)");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user