summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesecons_microcontroller/init.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua
index 2ff6596..bb040f1 100644
--- a/mesecons_microcontroller/init.lua
+++ b/mesecons_microcontroller/init.lua
@@ -66,6 +66,7 @@ end
function update_yc(pos)
local meta = minetest.env:get_meta(pos)
local code = meta:get_string("code")
+ code = yc_code_remove_commentary(code)
code = string.gsub(code, " ", "") --Remove all spaces
code = string.gsub(code, " ", "") --Remove all tabs
if parse_yccode(code, pos) == nil then
@@ -75,6 +76,15 @@ function update_yc(pos)
end
end
+function yc_code_remove_commentary(code)
+ for i = 1, #code do
+ if code:sub(i, i) == ":" then
+ return code:sub(1, i-1)
+ end
+ end
+ return code
+end
+
function parse_yccode(code, pos)
local endi = 1
local L = yc_get_portstates(pos)