update logic functions to remove metatable OOP

This commit is contained in:
Redo
2020-09-10 12:58:25 -05:00
parent 4095d193ff
commit ab19de7333
206 changed files with 22726 additions and 3544 deletions

View File

@@ -16,16 +16,20 @@ datablock fxDTSBrickData(LogicGate_8bitAdder_Data)
logicUIName = "8bit Adder";
logicUIDesc = "";
logicUpdate = "return function(gate) local c = bool_to_int[gate.ports[17].state] " @
"local a = 0 " @
"local b = 0 " @
"for i = 1, 8 do " @
"a = bool_to_int[gate.ports[i].state] " @
"b = bool_to_int[gate.ports[i+8].state] " @
"gate.ports[i+17]:setstate(bit.bxor(bit.bxor(a, b), c) == 1) " @
"c = bit.bor(bit.band(a, b), bit.band(c, bit.bor(a, b))) " @
"end " @
"gate.ports[26]:setstate(c == 1) end";
logicUpdate =
"return function(gate) " @
" local c = bool_to_int[Gate.getportstate(gate, 17)] " @
" local a = 0 " @
" local b = 0 " @
" for i = 1, 8 do " @
" a = bool_to_int[Gate.getportstate(gate, i )] " @
" b = bool_to_int[Gate.getportstate(gate, i+8)] " @
" Gate.setportstate(gate, i+17, bit.bxor(bit.bxor(a, b), c) == 1) " @
" c = bit.bor(bit.band(a, b), bit.band(c, bit.bor(a, b))) " @
" end " @
" Gate.setportstate(gate, 26, c == 1) " @
"end"
;
numLogicPorts = 26;