core.formspec_escape: Restore backwards compat

Support numbers as arguments by using `string.gsub(text, ...)` instead of `text:gsub(...)` which will coerce `text` to a string
This commit is contained in:
Lars Müller 2022-06-06 18:32:28 +02:00 committed by GitHub
parent 951604e29f
commit edc7df5480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -254,7 +254,7 @@ local formspec_escapes = {
} }
function core.formspec_escape(text) function core.formspec_escape(text)
-- Use explicit character set instead of dot here because it doubles the performance -- Use explicit character set instead of dot here because it doubles the performance
return text and text:gsub("[\\%[%];,]", formspec_escapes) return text and string.gsub(text, "[\\%[%];,]", formspec_escapes)
end end