Enable commentaries in the Microcontroller by using :commentary

This commit is contained in:
Jeija 2012-08-09 08:27:47 +02:00
parent 89edd2ce63
commit 72b00178f9

@ -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)