Syntax
getactors(): {Instance}Returns
| Name | Type | Description |
|---|---|---|
actors | {Instance} | Array table of Actor Instances whose actor weak references are still valid. |
Description
Returns an array table of live Actor Instances resolved from the ScriptContext actor thread list. The function takes no arguments. It walks the actor thread list, decrypts each actor Lua state, keeps entries that are valid threads, then reads each thread's thread data and the associated Actor weak reference. Only non-expired actor references are pushed as Instances. Entries without a container, without Actor reference, with reference count <= 0, or with an expired actor reference are skipped.
Call it without parameters. The function reads the needed context from the current runtime state.
It returns actors ({Instance}). Use the returns table to separate successful values from nil results and recoverable errors.
Example
List live Actor Instances resolved from actor threads.
for _, actor in ipairs(getactors()) do
print(actor)
end