diff options
author | sfan5 <sfan5@live.de> | 2017-01-28 11:54:27 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2017-01-28 11:54:27 +0100 |
commit | 2bc3c5d97c6227b4d93316e344dd2a312a872f7a (patch) | |
tree | 4a8597956ea5aaed7180ac3445c24aadf5ccfa93 | |
parent | 07d074075c82dd762fa9d6d3b1b5a466a77f177b (diff) | |
download | mesecons-2bc3c5d97c6227b4d93316e344dd2a312a872f7a.tar mesecons-2bc3c5d97c6227b4d93316e344dd2a312a872f7a.tar.gz mesecons-2bc3c5d97c6227b4d93316e344dd2a312a872f7a.tar.bz2 mesecons-2bc3c5d97c6227b4d93316e344dd2a312a872f7a.tar.xz mesecons-2bc3c5d97c6227b4d93316e344dd2a312a872f7a.zip |
fpga: Make formspec usage less prone to breakage
-rw-r--r-- | mesecons_fpga/init.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mesecons_fpga/init.lua b/mesecons_fpga/init.lua index 03beafc..6c462e6 100644 --- a/mesecons_fpga/init.lua +++ b/mesecons_fpga/init.lua @@ -142,7 +142,7 @@ plg.to_formspec_string = function(is) local function dropdown_action(x, y, name, val) local s = "dropdown[" .. tostring(x) .. "," .. tostring(y) .. ";" .. "1.125,0.5;" .. name .. ";" -- the height seems to be ignored? - s = s .. " , AND, OR, NOT, XOR,NAND, =,XNOR;" + s = s .. " , AND, OR, NOT, XOR,NAND, =,XNOR;" if val == nil then return s .. "0]" -- actually selects no field at all end @@ -203,14 +203,15 @@ plg.from_formspec_fields = function(fields) return nil end local mapping = { - [" AND"] = "and", - [" OR"] = "or", - [" NOT"] = "not", - [" XOR"] = "xor", + ["AND"] = "and", + ["OR"] = "or", + ["NOT"] = "not", + ["XOR"] = "xor", ["NAND"] = "nand", - [" ="] = "buf", + ["="] = "buf", ["XNOR"] = "xnor", } + s = s:gsub("^%s*", "") -- remove leading spaces return mapping[s] end local is = {} |