Page 1 of 1

LuaEntity.get_merged_signals_filtered()

Posted: Thu Feb 07, 2019 7:03 am
by Optera
What?
LuaEntity.get_merged_signals_filtered(circuit_connector, type, name)
Parameters:
circuit_connector :: defines.circuit_connector_id (optional)
type :: string(optional): "item", "fluid", or "virtual".
name :: string (optional): Name of the item, fluid or virtual signal.

Why?

I often need to treat read signals different depending if they are virtual, item or fluid.
Currently for a one or two number of signals entity.get_circuit_network(defines.wire_type.green) + entity.get_circuit_network(defines.wire_type.red) has decent performance is an option, but it quickly looses performance.
For more than a few signals we have to loop through a potentially huge list returned by get_merged_signals(). I know the proposed call would do nothing else than this loop, but it'd execute a lot quicker in C than lua.