Skip to content
Discussion options

You must be logged in to vote

Unfortunately I have no experience with socket.udp(). Maybe the problem you describe cannot be solved with a static type system. Are you describing a runtime problem?

Perhaps UDPSocketUnconnected | UDPSocketConnected should simply become UDPSocket?

I think you hit the nail. It might just not be possible.

I've ultimately decided to return both (UDPSocketUnconnected | UDPSocketConnected). Unfortunately some functions are dependent on whether its connected or not, so I can't just return a generic.

Take a look at LuaCATS/luasocket#6.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@masakk1
Comment options

Answer selected by masakk1
@masakk1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants