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

@@ -15,11 +15,15 @@ datablock fxDTSBrickData(LogicGate_FullAdder_Data)
logicUIName = "Full Adder";
logicUIDesc = "Adds A and B with carry in";
logicUpdate = "return function(gate) local a, b, c = bool_to_int[gate.ports[1].state], bool_to_int[gate.ports[2].state], bool_to_int[gate.ports[3].state] " @
"gate.ports[4]:setstate(bit.bxor(bit.bxor(a, b), c) == 1) " @
"gate.ports[5]:setstate(bit.bor(bit.bor(bit.band(b, c), bit.band(a, c)), bit.band(a, b)) == 1) end";
logicUpdate =
"return function(gate) " @
" local a, b, c = bool_to_int[Gate.getportstate(gate, 1)], bool_to_int[Gate.getportstate(gate, 2)], bool_to_int[Gate.getportstate(gate, 3)] " @
" Gate.setportstate(gate, 4, bit.bxor(bit.bxor(a, b), c) == 1) " @
" Gate.setportstate(gate, 5, bit.bor(bit.bor(bit.band(b, c), bit.band(a, c)), bit.band(a, b)) == 1) " @
"end"
;
numLogicPorts = 5;
logicPortType[0] = 1;