update logic functions to remove metatable OOP
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user