]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
core.formspec_escape: Restore backwards compat
authorLars Müller <34514239+appgurueu@users.noreply.github.com>
Mon, 6 Jun 2022 16:32:28 +0000 (18:32 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Jun 2022 16:32:28 +0000 (18:32 +0200)
Support numbers as arguments by using `string.gsub(text, ...)` instead of `text:gsub(...)` which will coerce `text` to a string

builtin/common/misc_helpers.lua

index d2356b50572cedd04e6923ec3b796ea67acba9cf..467f188049614df3a40328bb6ae58095e4d6bd10 100644 (file)
@@ -254,7 +254,7 @@ local formspec_escapes = {
 }
 function core.formspec_escape(text)
        -- 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