Mark Signal.signal as optional
Mark Signal.signal as optional
https://lua-api.factorio.com/latest/cla ... get_signal says "Returned Signal will not contain signal if none is set for the index." but https://lua-api.factorio.com/latest/con ... tml#Signal doesn't mark the signal field as optional. I think the type of Signal.signal should be SignalID? instead of SignalID
Re: Mark Signal.signal as optional
Absolutely not. Other places guarantee the signal field exists, not to mention it's mandatory for write. The function should return a different type.
(although I question the utility of returning anything other than nil in that case, but that's an API change)
(although I question the utility of returning anything other than nil in that case, but that's an API change)
Re: Mark Signal.signal as optional
Right, the docs should be changed so that the return type of "get_signal" is "Signal or { }" for example.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Re: Mark Signal.signal as optional
This is solved for 2.0.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.