aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2013-02-24 16:00:35 -0500
committerkwolekr <kwolekr@minetest.net>2013-03-05 23:25:02 -0500
commitba78194636a9a498f6979cc21cd39399f23d658a (patch)
tree7cad8f0234fe4f7ff45807364b4c275296982805 /builtin
parentbdbdeab0053d9ebbaffea17effeba777b710d390 (diff)
downloadminetest-ba78194636a9a498f6979cc21cd39399f23d658a.tar.gz
minetest-ba78194636a9a498f6979cc21cd39399f23d658a.tar.bz2
minetest-ba78194636a9a498f6979cc21cd39399f23d658a.zip
Allow any character in formspec strings with escape char
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
+