summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2013-03-15 17:07:15 -0400
committerAnthony Zhang <azhang9@gmail.com>2013-03-15 17:07:15 -0400
commite1211729ccea38a2ef5a77c544ae122ff40db14a (patch)
treec9da758eaeae0af9d7c2305889917dbfacb36e3d
parent588e41c786e4f741f5e45e6487fc0893df504fae (diff)
downloadmesecons-e1211729ccea38a2ef5a77c544ae122ff40db14a.tar
mesecons-e1211729ccea38a2ef5a77c544ae122ff40db14a.tar.gz
mesecons-e1211729ccea38a2ef5a77c544ae122ff40db14a.tar.bz2
mesecons-e1211729ccea38a2ef5a77c544ae122ff40db14a.tar.xz
mesecons-e1211729ccea38a2ef5a77c544ae122ff40db14a.zip
Avoid borking the luacontroller if the code uses square brackets. When the next stable MT is released, uncomment the formspec_escape call to take advantave of formspec escaping.
-rw-r--r--mesecons_luacontroller/init.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua
index 41763bf..41bfb5f 100644
--- a/mesecons_luacontroller/init.lua
+++ b/mesecons_luacontroller/init.lua
@@ -284,9 +284,13 @@ 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 "")
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]"..