Hi,
Indeed, there are two points for attaching red and green wires. This in order to be able to use one of the points in "reading" and the other in "writing"
These points are respectively named "right" and "left". Apis are dedicated to work with.
With the left point, there is:
- lan.readLeftSignals(wire)
- lan.writeLeftSignals(signals)
With the right point, there is:
- lan.readRightSignals(wire)
- lan.writeRightSignals(signals)
"wire" can mean the wire to read and can have several values :
- defines.wire_type.red
- defines.wire_type.green
(see http://lua-api.factorio.com/0.15.36/defines.html#defines.wire_type)
For writing, the target point behaves like a combinator
A small example to illustrate:
We consider that a signal is received on the left point with a red wire and we emit on the point of right (after modifying)
function loop()
local signals = lan.readLeftSignals(defines.wire_type.red)
-- signals like {{signal={type="item",name="uranium-fuel-cell"},count=1}}
term.write(signals) -- Show signal value on term
for _, signal in pairs(signals) do
signal.count = signal.count + 1
end
lan.writeRightSignals(signals) -- Write signal on right point
os.wait(loop, 1)
end
loop()
Does it help you?