Fix crash when skeleton kills player using bow

Commit 5252952555 used string.gsub() to
strip newlines from tools in death messages. The second return value of
string.gsub() (the number of substitutions) was erroneously returned too
by get_tool_name(). This bug caused a crash whenever a skeleton killed a
player using its bow.
This commit is contained in:
cora 2021-12-05 03:06:33 +01:00 committed by Nils Dagsson Moskopp
parent d70c05e92c
commit f9e3c4fd6d
Signed by untrusted user who does not match committer: erle
GPG Key ID: A3BC671C35191080
1 changed files with 2 additions and 1 deletions

View File

@ -7,7 +7,8 @@ local function get_tool_name(item)
local def = item:get_definition()
name=def._tt_original_description or def.description
end
return name:gsub("[\r\n]"," ")
local sanitized_name, substitution_count = name:gsub("[\r\n]"," ")
return sanitized_name
end
mcl_death_messages = {}