Page 1 of 1
Mark Signal.signal as optional
Posted: Sat Sep 14, 2024 11:38 pm
by sparr
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
Posted: Sun Sep 15, 2024 5:43 am
by curiosity
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)
Re: Mark Signal.signal as optional
Posted: Sun Sep 15, 2024 10:35 am
by robot256
Right, the docs should be changed so that the return type of "get_signal" is "Signal or { }" for example.
Re: Mark Signal.signal as optional
Posted: Mon Sep 30, 2024 10:09 am
by Bilka
This is solved for 2.0.