runonthread
Submits source to an eligible observed Actor thread.
Syntax
runonthread(thread: thread, source: string, ...: any) -> ()
Also available as
run_on_thread
Parameters
| Parameter | Type | Description |
|---|---|---|
thread | thread | Handle obtained through getactorthreads. |
source | string | Luau source to submit. |
... | any | Supported transferred chunk arguments. |
Description
This is a state submission, not coroutine.resume on a foreign thread. Source must be a nonempty string; extra arguments are transferred to the submitted chunk. The operation does not return the chunk’s results. Source is limited to 1 MiB and at most 64 extra arguments. Stale handles and unsupported argument values raise errors.
Example
local thread = getactorthreads()[1]
if thread then
runonthread(thread, "print(...)", "hello")
end
These are Game executor contracts. Check build requirements and session lifetimes before using them.
