getactors() → {Instance}
All Actor Instances that currently have a live Lua VM.
aliasesget_actors
lua
for _, actor in ipairs(getactors()) do print(actor:GetFullName()) end
getactorthreads() → {thread}
Mainthreads of every live Actor VM. Values are foreign
lua_States — safe to pass to run_on_thread, but NEVER resume or xmove from the caller's VM (breaks cross-VM GC invariants).aliasesget_actor_threads
lua
for _, t in ipairs(getactorthreads()) do run_on_thread(t, [[ print("hi from actor VM") ]]) end
isparallel() → boolean
true if the current thread is running in a desynchronized (parallel) state.aliasescheckparallel, inparallel
lua
if isparallel() then task.synchronize() end
run_on_actor(actor: Instance, source: string, ...args)
Compile and run a script on the target Actor's VM. Args are deep-marshaled cross-VM (primitives, Instances, tables incl. cycles & shared refs). Fires-and-forgets; script errors propagate as a Lua error to the caller.
aliasesrunonactor
lua
local actor = getactors()[1] run_on_actor(actor, [[ local greet, target = ... print(greet, target.Name) ]], "hi", game.Players.LocalPlayer)
run_on_thread(thread: thread, source: string, ...args)
Same dispatch semantics as
run_on_actor, but takes a raw actor-mainthread pointer (as returned by getactorthreads) instead of an Instance. Useful when you already have the thread handle and want to skip the Actor→thread resolution step.aliasesrunonthread
lua
local threads = getactorthreads() run_on_thread(threads[1], [[ print(select(1, ...)) ]], "hello")
create_comm_channel() → number, BindableEvent
Allocate a new comm channel. Returns
(id, event) — the id is portable across VMs, the event is the local BindableEvent handle.
lua
local id, event = create_comm_channel() event.Event:Connect(function(msg) print("main got:", msg) end) -- pass id to an actor via run_on_actor, then it fires event.
get_comm_channel(id: number) → BindableEvent?
Resolve a channel id to its BindableEvent on the caller's VM. Same-VM callers get the identical userdata (identity preserved); cross-VM callers get a fresh userdata pointing at the same underlying Instance.
lua
-- inside an actor: local event = get_comm_channel(theId) event:Fire("hello from actor")