LuauExecutionSessionTask
A LuauExecutionSessionTask ("task" for short) executes a given Luau script
in the context of a specific version of a place.
In a task, physics simulation does not run. Server and local scripts within
the place also do not automatically run.
The script may access and update the data model of the place, including
invoking any module scripts. However, data model changes are local to the
task and cannot be persisted.
The script can also invoke engine APIs that read and/or modify data stored in
the cloud, such as those for DataStores. Exercise caution when using these
APIs.
Scripts can be up to 4 MB in size and run for up to 5 minutes. Scripts that
run for longer than the time limit terminate with an error.
Scripts are executed as-is and do not need to be wrapped in a function.
Scripts can return values (using the Luau return keyword). Return values
are serialized to JSON and can be retrieved with the Get LuauExecutionSessionTask API after the task completes. The total size of the
return values after JSON serialization must not exceed 4 MB. If the limit is
exceeded, the task terminates with an error.
If the script raises an unhandled error, the task terminates. The error
information can be retrieved with the GetLuauExecutionSessionTask API.
Standard output (generated by the Luau print function) can be retrieved
with the ListLuauExecutionSessionTaskLogs method after the task completes.
A maximum of 450 KB of logs are retained. If the amount of logs exceeds the
limit, older logs are discarded.
Information about a task is retained for 24 hours after task completion.
At most ten incomplete tasks are allowed per place. Attempting to create more
tasks while the first ten are incomplete results in a HTTP 429 response.
- /cloud/v2/universes/{universe_id}/places/{place_id}/luau-execution-session-tasks
- /cloud/v2/universes/{universe_id}/places/{place_id}/versions/{version_id}/luau-execution-session-tasks
- /cloud/v2/universes/{universe_id}/places/{place_id}/luau-execution-sessions/{luau_execution_session_id}/tasks
- /cloud/v2/universes/{universe_id}/places/{place_id}/versions/{version_id}/luau-execution-sessions/{luau_execution_session_id}/tasks
Attributes
The resource path of the luau execution session task.
Formats:
universes/{universe_id}/places/{place_id}/luau-execution-session-tasks/{luau_execution_session_task_id}
universes/{universe_id}/places/{place_id}/versions/{place_version_id}/luau-execution-session-tasks/{luau_execution_session_task_id}
universes/{universe_id}/places/{place_id}/luau-execution-sessions/{luau_execution_session_id}/tasks/{luau_execution_session_task_id}
universes/{universe_id}/places/{place_id}/versions/{place_version_id}/luau-execution-sessions/{luau_execution_session_id}/tasks/{luau_execution_session_task_id}.
Time when this task was created. This string is formatted as a Timestamp.
Time when this task's state last changed. This string is formatted as a Timestamp.
The user that created the API key that was used to create this task.
The task's state. See the State enum for information about each possible
value.
Possible values:
STATE_UNSPECIFIED | UNSPECIFIED |
QUEUED | The Task is waiting to be processed. |
PROCESSING | The Task has been picked up for processing. |
CANCELLED | The Task has been stopped by the user. |
COMPLETE | The Task has finished processing. The output field contains the output. |
FAILED | The Task failed. The error field contains details about the error. |
The script to be run as part of this task.
For example:
local x = 3
local y = 4
return x + y
```.
Limit for how long the script can run.
The task fails if the script does not complete within the
specified duration.
Defaults to 5 minutes.
Present when the task execution fails. Contains details about the error
that caused the failure.
Present when the task execution succeeds. Contains the output of the
execution.