readfile
Reads a file from Workspace.
Syntax
Signature
readfile(Path: string) -> stringAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Path | string | Path relative to the sandboxed Workspace. |
Returns
| Type | Description |
|---|---|
string | Complete file contents. |
Notes
Files larger than 16 MiB and invalid or unreadable paths raise errors.
Example
Luau
local Path = "Examples/Message.txt"
writefile(Path, "Hello from Workspace")
if isfile(Path) then
local Text = readfile(Path)
print(Text)
end