Syntax
appendfile(path: string, content: string)Aliases
appendfileasyncArguments
| Name | Type | Description |
|---|---|---|
path | string | Workspace-relative path to the file or folder. |
content | string | Text or byte string to write. |
Description
Appends content to a workspace file without replacing the existing contents.
Call it with 2 parameter(s): path, content. The argument table explains which values are required and which ones only refine the behavior.
It does not return data. Treat the call as an action and handle errors around the call site when needed.
Example
Append content without replacing the existing file.
local path = "workspace/examples/log.txt"
writefile(path, "first entry")
appendfile(path, string.char(10) .. "second entry")
print(readfile(path))