1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix set_bone_position regression (error on passing none)

This commit is contained in:
Lars Müller 2023-12-21 18:55:12 +01:00 committed by GitHub
parent cb38b841af
commit cad8e895f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View file

@ -124,8 +124,10 @@ void script_error(lua_State *L, int pcall_result, const char *mod, const char *f
static void script_log_add_source(lua_State *L, std::string &message, int stack_depth)
{
lua_Debug ar;
if (stack_depth <= 0)
return;
lua_Debug ar;
if (lua_getstack(L, stack_depth, &ar)) {
FATAL_ERROR_IF(!lua_getinfo(L, "Sl", &ar), "lua_getinfo() failed");
message.append(" (at " + std::string(ar.short_src) + ":"
@ -172,15 +174,18 @@ DeprecatedHandlingMode get_deprecated_handling_mode()
return ret;
}
void log_deprecated(lua_State *L, std::string message, int stack_depth)
void log_deprecated(lua_State *L, std::string message, int stack_depth, bool once)
{
DeprecatedHandlingMode mode = get_deprecated_handling_mode();
if (mode == DeprecatedHandlingMode::Ignore)
return;
if (stack_depth >= 0)
if (once) {
script_log_unique(L, message, warningstream, stack_depth);
} else {
script_log_add_source(L, message, stack_depth);
warningstream << message << std::endl;
warningstream << message << std::endl;
}
if (mode == DeprecatedHandlingMode::Error)
script_error(L, LUA_ERRRUN, NULL, NULL);