ReferenceFilesystem

writefileasync

Creates or replaces a workspace file. It has the same behavior as writefile.

Syntax

writefileasync(path: string, data: string): ()

Parameters

ParameterTypeDescription
pathstringWorkspace-relative file.
datastringBytes to write or append.

Description

Use writefile for the full path, error and return contract. The Async spelling does not grant access outside the workspace and does not mean that a callback argument is required. It suspends the calling thread once before running, so a thread started with task.spawn is still alive when task.spawn returns.

Example

writefileasync("example.txt", "hello")

These are Game executor contracts. Check build requirements and session lifetimes before using them.