summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2013-03-15 17:21:16 -0400
committerAnthony Zhang <azhang9@gmail.com>2013-03-15 17:21:16 -0400
commit5fd1cf5c806352b65892d0354e7f1da9be4af59d (patch)
treede5d73fbd144e7abbbb64a1621e5dffdd46a465e
parente1211729ccea38a2ef5a77c544ae122ff40db14a (diff)
downloadmesecons-5fd1cf5c806352b65892d0354e7f1da9be4af59d.tar
mesecons-5fd1cf5c806352b65892d0354e7f1da9be4af59d.tar.gz
mesecons-5fd1cf5c806352b65892d0354e7f1da9be4af59d.tar.bz2
mesecons-5fd1cf5c806352b65892d0354e7f1da9be4af59d.tar.xz
mesecons-5fd1cf5c806352b65892d0354e7f1da9be4af59d.zip
Use formspec_escape when available.
-rw-r--r--mesecons_luacontroller/init.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua
index 41bfb5f..a88984b 100644
--- a/mesecons_luacontroller/init.lua
+++ b/mesecons_luacontroller/init.lua
@@ -283,14 +283,15 @@ end
local reset_meta = function(pos, code, errmsg)
local meta = minetest.env:get_meta(pos)
- code = code or "";
- code = string.gsub(code, "%[", "(") -- would otherwise
- code = string.gsub(code, "%]", ")") -- corrupt formspec
- errmsg = errmsg or "";
- errmsg = string.gsub(errmsg, "%[", "(") -- would otherwise
- errmsg = string.gsub(errmsg, "%]", ")") -- corrupt formspec
- --code = minetest.formspec_escape(code or "")
- --errmsg = minetest.formspec_escape(errmsg or "")
+ if minetest.formspec_escape then
+ code = minetest.formspec_escape(code or "")
+ errmsg = minetest.formspec_escape(errmsg or "")
+ else
+ code = string.gsub(code or "", "%[", "(") -- would otherwise
+ code = string.gsub(code, "%]", ")") -- corrupt formspec
+ errmsg = string.gsub(errmsg or "", "%[", "(") -- would otherwise
+ errmsg = string.gsub(errmsg, "%]", ")") -- corrupt formspec
+ end
meta:set_string("code", code)
meta:set_string("formspec", "size[10,8]"..
"background[-0.2,-0.25;10.4,8.75;jeija_luac_background.png]"..