fileClose
Client-side
Server-side
Shared
Closes a file handle obtained by fileCreate or fileOpen.
It is important to remember to close a file after you've finished all your operations on it, especially if you've been writing to the file. If you don't close a file and your resource crashes, all changes to the file may be lost.
OOP Syntax Help! I don't understand this!
- Method: file:close(...)
Syntax
bool fileClose ( file theFile )
Required Arguments
- theFile: The file handle to close.
Returns
- bool: result
Returns true if successful, false otherwise.
Code Examples
shared
This example creates a text file and writes a string to it.
local newFile = fileCreate("test.txt") -- attempt to create a new fileif newFile then -- check if the creation succeeded fileWrite(newFile, "This is a test file!") -- write a text line fileClose(newFile) -- close the file once you're done with itend