getactorthreads
Returns a list of threads that you can execute code inside of.
function getactorthreads(): table<number, thread>Synopsis
How it works
Returns all active Luau threads (
lua_State*) associated with a given Actor instance. In Parallel LuauParallel LuauRoblox's threading model that allows multiple Luau scripts to run concurrently in isolated Actor contexts. Actors have separate lua_States and can only share data through message channels., each Actor maintains its own set of threads that can run concurrently. This function walks the Actor's thread list and returns them as coroutineCoroutineA cooperatively-scheduled thread of execution in Luau. Each coroutine has its own lua_State (stack + call frames). Can be suspended with coroutine.yield() and resumed with coroutine.resume(). Roblox's task library uses coroutines internally. objects.Parallel Luau model
Each
Actor wraps an isolated execution context. Threads within the same Actor share state but are isolated from other Actors. The VM scheduler round-robins through Actors, running their threads in parallel when possible.Usage
Iterate threads
for index, thread in getactorthreads() do
print(index, thread)
endReturns
table<number, thread> An array of threads available for code execution.