diff options
Diffstat (limited to 'library/lullaby')
| -rw-r--r-- | library/lullaby/net.lua | 13 | ||||
| -rw-r--r-- | library/lullaby/thread.lua | 17 |
2 files changed, 19 insertions, 11 deletions
diff --git a/library/lullaby/net.lua b/library/lullaby/net.lua index 416851f..080c73d 100644 --- a/library/lullaby/net.lua +++ b/library/lullaby/net.lua @@ -19,6 +19,7 @@ function res_table.send(T, value) end ---autosets Content-Type and sends contents of file to client and closes socket ---@param T res-table ---@param value string +---@return error | nil error function res_table.sendfile(T, value) end ---sends value to client and doesn't close the socket @@ -125,6 +126,10 @@ function server_table.PATCH(T, route, callback) end ---@param callback fun(res: res-table, req: req-table) function server_table.all(T, route, callback) end +---sends a signal to stop accepting requests, server will shutdown, but already accepted ones will still continue +---@param T server-table +function server_table.close(T) end + ---@param server server-table local function listen_callback(server) end @@ -146,6 +151,14 @@ function net.listen(callback, port) end ---@return request-return | error function net.srequest(url, content, header, request) end +---creates an http request +---@param url string +---@param content string | nil +---@param header table<string, string> | nil +---@param request string | nil +---@return request-return | error +function net.request(url, content, header, request) end + ---@class wss-table local wss = {} diff --git a/library/lullaby/thread.lua b/library/lullaby/thread.lua index 6015a0b..7a1888c 100644 --- a/library/lullaby/thread.lua +++ b/library/lullaby/thread.lua @@ -16,11 +16,16 @@ function async.await(T) end ---@return nil function async.clean(T) end ----stops the thread +---stops the thread, may be unavaliable on some systems (android) and will call async:kill instead ---@param T async-table ---@return nil function async.close(T) end +---stops the thread forcefully, may cause problems, likely not thread-safe +---@param T async-table +---@return nil +function async.kill(T) end + ---contains data for the thread ---@deprecated ---@type lightuserdata @@ -56,16 +61,6 @@ function buffer.mod(T, fun) end ---@return buffer-table function thread.buffer(value) end ----locks any thread reaching this lock id until a corresponding unlock is met ----@param tid integer ----@return nil -function thread.lock(tid) end - ----unlocks a lock id ----@param tid integer ----@return nil -function thread.unlock(tid) end - ---@deprecated function thread.testcopy() end |
