diff options
| author | ame <[email protected]> | 2026-05-07 02:41:35 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2026-05-07 02:41:35 -0500 |
| commit | 01de3fbcc49ea6baa311e2f358e3b540325f0e45 (patch) | |
| tree | 15b71da30553e7fa6e20ebd99d28a14eb42e8983 | |
| parent | 215a31d4eef417e1f6a29fba23eab830f7630634 (diff) | |
async:detach() docs
| -rw-r--r-- | docs/thread/async.md | 7 | ||||
| -rw-r--r-- | library/lullaby/thread.lua | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/docs/thread/async.md b/docs/thread/async.md index a13b18b..60c764a 100644 --- a/docs/thread/async.md +++ b/docs/thread/async.md @@ -49,3 +49,10 @@ waits for the thread to internally call res:testclose or exit async:clean() calls the __gc metamethod, will call async:kill() if it is still running + +### async:detach + +async:detach() + +prevents lua from discarding the thread on its own (removes __gc) and runs the code after the thread has exited instead. +this has the side effect of not allowing async:await() to be called when the thread is done diff --git a/library/lullaby/thread.lua b/library/lullaby/thread.lua index fc29e90..2da4a74 100644 --- a/library/lullaby/thread.lua +++ b/library/lullaby/thread.lua @@ -26,6 +26,11 @@ function async.close(T) end ---@return nil function async.kill(T) end +---removes gc, instead collecting after it has been run +---@param T async-table +---@return nil +function async.kill(T) end + ---contains data for the thread ---@deprecated ---@type lightuserdata |
