for example, https://lua-api.factorio.com/latest/cla ... stic_point could trivially be a function with two overloads: fun():LuaLogisticPoint, fun(index):dictionary, and we could in turn generate overload tags for LuaLS to correctly determine which return it got from a given call by the arguments. there are many other functions like this where the return type depends only on the argument types for which function overloads are a *perfect* fit.
This would also help in many cases where the type of later arguments depend on the type (or enum value) of earlier arguments.
Use overload signatures where possible instead of union return types
-
- Filter Inserter
- Posts: 302
- Joined: Fri Mar 18, 2016 4:34 pm
- Contact:
Re: Use overload signatures where possible instead of union return types
Dealing with uncertain return types is a bother. This would be great to have.