getallthreads Synchronous

Take a snapshot of live Luau threads in the current VM. It is handy for a debugger that wants to inspect active coroutines without keeping them alive.

Syntax
Luau
getallthreads() -> {thread}

Parameters

This function takes no arguments.

Returns

{thread}

An array-like table of thread references with weak values.

Usage notes

The values are weak: a thread can disappear after collection, so traverse the returned table promptly and do not rely on a fixed length.

Example

Example
Luau
local threads = getallthreads()
for index, thread in pairs(threads) do
    print(index, coroutine.status(thread))
end
Kawaii documentation