File¶
A File represents an entry to a system file.
Note
Currently it is not possible to Delete or Rename files, that will be added for a future update.
Note
This is a server side class. It is not possible to open files from outsite the server folder. All path must be relative to the Server’s executable folder. All files are opened as binary file by default.
Example¶
local configuration_file = File("my_awesome_configuration.json")
local configuration_file_json = JSON.parse(configuration_file:Read(configuration_file:Size()))
Functions¶
Returns |
Name |
Description |
Close() |
Closes the file |
|
Flush() |
Flushes content to the file |
|
IsEOF() |
Checks if the file status is End of File |
|
IsBad() |
Checks if the file status is Bad |
|
IsGood() |
Checks if the file status is Good |
|
HasFailed() |
Checks if the last operation has Failed |
|
Read(number Length = 0) |
Reads n (Length) characters from the File and returns it. Also moves the file pointer to the latest read position. Pass 0 to read the whole file |
|
ReadLine() |
Reads and returns the next file line |
|
Seek(number Position) |
Sets the file pointer to a specific position |
|
Size() |
Returns the size of the file |
|
Size() |
Returns the size of the file |
|
Skip(number Amount) |
Skips n (Amount) positions from the current file pointer position |
|
Tell() |
Returns the current file pointer position |
|
Write(string Data) |
Writes the Data at the current position of the file |