Bilal2453/luvit-meta

net.createServer incorrect args?

Closed this issue · 2 comments

https://github.com/Bilal2453/luvit-meta/blob/main/library/net.lua#L230
I'm fairly sure client is not a uv_tcp_t
I'm not sure what exact type it is (looks like a luvit.net.Socket) but :on() and other functions are used on it in the example which do not exist on uv_tcp_t, and are not annotated with these meta files.
https://github.com/luvit/luvit/blob/master/examples/tcp-echo-server-simple.lua#L12

The events are sadly not yet complete, a lot of events are missing all around the definitions, it is super hard to track all emitted events, and this was written before the era LuaLS was able to inherit events annotated this way, forcing me to repeat the definitions of the parent class events on every child (hence those events are partially annotated).

This is mistyped indeed. The proper type here should be Socket, when create a server and receive a connection, Luvit will create a new Socket, attach the handle to Socket.handle and pass the Socket object. Will attempt to fix it soon tm.

Fixed with 6cf70bd.

Sorry for the very late fix, there will be a release on the addon manager very soon as well.