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, Smart Artillery Wagons
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
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.