mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Improve script_log_add_source: Log full path for files
This commit is contained in:
parent
ce2380b58e
commit
8e03e94ea9
1 changed files with 4 additions and 2 deletions
|
@ -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 ?:?)");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue