The combinator labeled IO represents anything external connected to my PLC entity. Out is where the output is set. It is ignored by the change detection because of the multiply combinator hooked up with green wire. If the signal from IO changes, the circuit network connected to chg will have a signal for one tick.
The options I'm looking at are:
1. Check if LuaCircuitNetwork.signals on the circuit network connected to chg is not null. This is the version I'm currently testing. The polling doesn't cause too much impact to update time, but i'd still like to reduce it as much as possible.
2. Check if LuaLampControlBehavior.disabled on the lamp is false
3. Place an item for the inserter to pick up, register it with register_on_object_destroyed() and wait for on_object_destroyed() event to fire
Is there any performance difference between doing a nil check on a LuaCircuitNetwork.signals, vs a true/false check on LuaLampControlBehaviour.disabled?
I'm thinking I can call get_circuit_network() or get_control_behaviour() once, and keep the result in storage.
If i use a condition on an inserter, then I don't have to do polling.
The documentation for on_object_destroyed states
If an entity on the ground is picked up by an inserter, is there any consistency as to when the on_onject_destroyed() will be called?Depending on when a given object is destroyed, this event will be fired at the end of the current tick or at the end of the next tick. The event's timing is independent of the in-world object being destroyed.