readfileasync
Reads the complete contents of a workspace file. It has the same result as readfile.
Syntax
readfileasync(path: string): string
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | Workspace-relative file. |
Returns
| Type | Description |
|---|---|
string | File contents. |
Description
Use readfile 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
local result = readfileasync("example.luau")
print(result)
These are Game executor contracts. Check build requirements and session lifetimes before using them.
