aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/misc.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/misc.lua b/builtin/misc.lua
index e018aff85..496435b33 100644
--- a/builtin/misc.lua
+++ b/builtin/misc.lua
@@ -99,3 +99,10 @@ function minetest.setting_get_pos(name)
return minetest.string_to_pos(value)
end
+function minetest.formspec_escape(str)
+ str = string.gsub(str, "\\", "\\\\")
+ str = string.gsub(str, "%[", "\\[")
+ str = string.gsub(str, "%]", "\\]")
+ return str
+end
+