update logic functions to remove metatable OOP
This commit is contained in:
@ -20,5 +20,5 @@ return function(gate, argv)
|
||||
end
|
||||
queueBit(false)
|
||||
|
||||
gate:queue(0)
|
||||
Gate.queue(gate, 0)
|
||||
end
|
||||
|
@ -2,9 +2,9 @@
|
||||
return function(gate)
|
||||
if #gate.queueBits~=0 then
|
||||
local bit = table.remove(gate.queueBits, #gate.queueBits)
|
||||
gate.ports[1]:setstate(bit)
|
||||
gate:queue(1)
|
||||
Gate.setportstate(gate, 1, bit)
|
||||
Gate.queue(gate, 1)
|
||||
else
|
||||
gate.ports[1]:setstate(false)
|
||||
Gate.setportstate(gate, 1, false)
|
||||
end
|
||||
end
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
return function(gate, argv)
|
||||
if #argv == 1 then
|
||||
gate.ports[1]:setstate(toboolean(argv[1]))
|
||||
gate.ports[2]:setstate(toboolean(argv[1]))
|
||||
gate.switchstate = toboolean(argv[1])
|
||||
else
|
||||
gate.ports[1]:setstate(not gate.ports[1].state)
|
||||
gate.ports[2]:setstate(not gate.ports[2].state)
|
||||
gate.switchstate = not gate.switchstate
|
||||
end
|
||||
gate:cb(bool_to_int[gate.ports[1].state])
|
||||
Gate.setportstate(gate, 1, gate.switchstate)
|
||||
Gate.setportstate(gate, 2, gate.switchstate)
|
||||
Gate.cb(gate, bool_to_int[gate.ports[1].state])
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ datablock fxDTSBrickData(LogicGate_Switch_Data)
|
||||
isLogicGate = 1;
|
||||
isLogicInput = 1;
|
||||
|
||||
logicInit = "return function(gate) gate.switchstate = false end";
|
||||
logicInput = lualogic_readfile($LuaLogic::Path @ "bricks/inputs/switch-input.lua");
|
||||
|
||||
numLogicPorts = 2;
|
||||
|
Reference in New Issue
Block a user