From 72b00178f9ec35e407b45c357ed60711f09e4439 Mon Sep 17 00:00:00 2001 From: Jeija Date: Thu, 9 Aug 2012 08:27:47 +0200 Subject: Enable commentaries in the Microcontroller by using :commentary --- mesecons_microcontroller/init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mesecons_microcontroller') 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) -- cgit v1.2.3