fileCreate
Shared
Creates an empty file and opens it for reading and writing. A file that already exists is wiped and made again; missing folders are created.
file|false fileCreate(string path)
Parameters
| Name | Type | Description |
|---|---|---|
| path | string | A path inside the calling resource. |
Returns
The open file, or false if it could not be created.
A path may not contain .., \ or :, nor start with /. Another resource's files can only be read; an invalid path logs a warning and the function returns false. The file is closed when the resource stops.
Example
local file = fileCreate("logs/session.txt")
if file then
fileWrite(file, "started at ", tostring(getRealTime().timestamp), "\n")
fileClose(file)
end