- Documentation
- Shared functions
- fileClose
Function
fileClose
Closes a file and writes its buffer to disk. The handle becomes invalid.
Syntax
bool fileClose(file theFile)Arguments
theFilefile- A file handle.
Returns
true on success.
Example
local file = fileCreate("test.txt")
fileWrite(file, "abc")
fileClose(file)
See also
fileOpenOpens an existing file for reading and writing (or read-only). On the server the path is relative to the resource folder and cannot leave it. On the client it first looks for the script's own files (written withfileCreate), then for<file>files sent by the server - those are read-only;":other/file"points to another resource's file. Close the file withfileClosewhen done.fileFlushWrites buffered file data to disk without closing it. Useful for logs that must survive a crash.