diff options
-rw-r--r-- | mesecons_microcontroller/init.lua | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua index 2d0e134..6f665e0 100644 --- a/mesecons_microcontroller/init.lua +++ b/mesecons_microcontroller/init.lua @@ -190,16 +190,14 @@ function yc_command_if_parsecondition(cond, L) cond = string.gsub(cond, "!0", "1") cond = string.gsub(cond, "!1", "0") - print(cond) local i = 2 local l = string.len(cond) while i<=l do local s = cond:sub(i,i) local b = tonumber(cond:sub(i-1, i-1)) local a = tonumber(cond:sub(i+1, i+1)) - if a == "" then print ("ERROR") break end + if cond:sub(i+1, i+1) == nil then break end if s == "=" then - print(b.."="..a.."?") if a == b then buf = "1" end if a ~= b then buf = "0" end cond = string.gsub(cond, b..s..a, buf) @@ -208,7 +206,6 @@ function yc_command_if_parsecondition(cond, L) end i = i + 1 end - print(cond) local i = 2 local l = string.len(cond) @@ -216,7 +213,7 @@ function yc_command_if_parsecondition(cond, L) local s = cond:sub(i,i) local b = tonumber(cond:sub(i-1, i-1)) local a = tonumber(cond:sub(i+1, i+1)) - if a == "" then break end + if cond:sub(i+1, i+1) == nil then break end if s == "&" then local buf = ((a==1) and (b==1)) if buf == true then buf = "1" end @@ -243,7 +240,6 @@ function yc_command_if_parsecondition(cond, L) end i = i + 1 end - print(cond) return cond end |