diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-05-10 17:44:34 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-05-10 17:44:34 +0800 |
commit | 7318bbba9808b94c59202d301ac4faf4dc7f1f5a (patch) | |
tree | 9d82c000652aa31d9770677ba41eadb36874c938 /script/meta/bee | |
parent | d7e59826b5dec2d6f4b9ba59f6d64af42c078edd (diff) | |
download | lua-language-server-7318bbba9808b94c59202d301ac4faf4dc7f1f5a.zip |
support connecting by socket with `--socket=PORT`
Diffstat (limited to 'script/meta/bee')
-rw-r--r-- | script/meta/bee/socket.lua | 62 | ||||
-rw-r--r-- | script/meta/bee/thread.lua | 33 |
2 files changed, 95 insertions, 0 deletions
diff --git a/script/meta/bee/socket.lua b/script/meta/bee/socket.lua new file mode 100644 index 00000000..b77c498b --- /dev/null +++ b/script/meta/bee/socket.lua @@ -0,0 +1,62 @@ +---@meta + +---@alias bee.socket.protocol +---| 'tcp' +---| 'udp' +---| 'unix' +---| 'tcp6' +---| 'udp6' + +---@class bee.socket +---@overload fun(protocol: bee.socket.protocol): bee.socket.fd?, string? +local socket = {} + +---@param readfds? bee.socket.fd[] +---@param writefds? bee.socket.fd[] +---@param timeout number +---@return bee.socket.fd[] # readfds +---@return bee.socket.fd[] # writefds +function socket.select(readfds, writefds, timeout) end + +---@param handle lightuserdata +---@return bee.socket.fd +function socket.fd(handle) end + +---@class bee.socket.fd +local fd = {} + +---@param addr string +---@param port? integer +---@return boolean +---@return string? +function fd:bind(addr, port) end + +function fd:close() end + +---@return boolean +---@return string? +function fd:listen() end + +---@param addr string +---@param port integer +---@return boolean +---@return string? +function fd:connect(addr, port) end + +---@param len? integer +---@return string | false +function fd:recv(len) end + +---@param content string +function fd:send(content) end + +---@return lightuserdata +function fd:handle() end + +---@return boolean +function fd:status() end + +---@return bee.socket.fd +function fd:accept() end + +return socket diff --git a/script/meta/bee/thread.lua b/script/meta/bee/thread.lua new file mode 100644 index 00000000..6b4323a4 --- /dev/null +++ b/script/meta/bee/thread.lua @@ -0,0 +1,33 @@ +---@meta + +---@class bee.thread +local thread = {} + +---@param time number +function thread.sleep(time) end + +---@param name string +function thread.newchannel(name) end + +---@param name string +---@return bee.thread.channel +function thread.channel(name) end + +---@param script string +---@return bee.thread.thread +function thread.thread(script) end + +---@class bee.thread.channel +local channel = {} + +function channel:push(...) end + +---@return ... +function channel:pop() end + +---@return ... +function channel:bpop() end + +---@class bee.thread.thread + +return thread |