Skip to content

Commit

Permalink
fpga: Make formspec usage less prone to breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Jan 28, 2017
1 parent 07d0740 commit 2bc3c5d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mesecons_fpga/init.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {}
Expand Down

0 comments on commit 2bc3c5d

Please sign in to comment.