summaryrefslogtreecommitdiff
path: root/mesecons_microcontroller
diff options
context:
space:
mode:
authorcornernote <cornernote@gmail.com>2012-10-07 13:08:01 -0400
committerAnthony Zhang <azhang9@gmail.com>2012-10-07 13:08:01 -0400
commit931ac23ff390ef5440386e39e4617357dc1538c8 (patch)
tree5b819de77d5b5e653ddd30abe5037a3048841bed /mesecons_microcontroller
parentdcd2f94ba95a3cf9203de12e0b2e650494ef4e5c (diff)
downloadmesecons-931ac23ff390ef5440386e39e4617357dc1538c8.tar
mesecons-931ac23ff390ef5440386e39e4617357dc1538c8.tar.gz
mesecons-931ac23ff390ef5440386e39e4617357dc1538c8.tar.bz2
mesecons-931ac23ff390ef5440386e39e4617357dc1538c8.tar.xz
mesecons-931ac23ff390ef5440386e39e4617357dc1538c8.zip
Improve T-FF code and add a reset pin on C.
Diffstat (limited to 'mesecons_microcontroller')
-rw-r--r--mesecons_microcontroller/init.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua
index d585c2f..121eb25 100644
--- a/mesecons_microcontroller/init.lua
+++ b/mesecons_microcontroller/init.lua
@@ -81,7 +81,7 @@ minetest.register_node(nodename, {
elseif fields.bnand then
fields.code = "sbi(C, !A|!B) :A and B are inputs, C is output"
elseif fields.btflop then
- fields.code = "if(A)sbi(1,1); if(!A&#1&B)off(B)sbi(1,0); if(!A&#1&!B)on(B)sbi(1,0); :A is input, B is output (Q), toggles with falling edge"
+ fields.code = "if(A)sbi(1,1);if(!A&#1)sbi(B,!B)sbi(1,0); if(C)off(B,1); :A is input, B is output (Q), C is reset, toggles with falling edge"
elseif fields.brsflop then
fields.code = "if(A)on(C);if(B)off(C); :A is S (Set), B is R (Reset), C is output (R dominates)"
elseif fields.program or fields.code then --nothing
@@ -171,9 +171,8 @@ function yc_code_remove_commentary(code)
is_string = false
for i = 1, #code do
if code:sub(i, i) == '"' then
- is_string = (is_string==false) --toggle is_string
- end
- if code:sub(i, i) == ":" and is_string==false then
+ is_string = not is_string --toggle is_string
+ elseif code:sub(i, i) == ":" and not is_string then
return code:sub(1, i-1)
end
end