Use overload signatures where possible instead of union return types

Place to report issues and suggest improvements to the API documentation.
justarandomgeek
Filter Inserter
Filter Inserter
Posts: 302
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Use overload signatures where possible instead of union return types

Post by justarandomgeek »

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.
curiosity
Filter Inserter
Filter Inserter
Posts: 484
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Use overload signatures where possible instead of union return types

Post by curiosity »

Dealing with uncertain return types is a bother. This would be great to have.
Post Reply

Return to “Documentation Improvement Requests”