File

From Crumbled World Wiki
Revision as of 14:22, 5 July 2025 by Anders (talk | contribs) (Created page with "{{:FileExampleCode}} ==Constructor== {| class="wikitable" !|function !|description |- |File(string filePath) |Load a file. |- |File(string fileNodePath, string filePath) |Load a file located in a map. load the file from the map with the name filePath. |- |} ==Functions== {| class="wikitable" !|return !|function !|description |- |string |getName() |Returns the file name. |- |string |getPath() |Returns the file path. |-...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

FileExampleCode

Constructor

function description
File(string filePath) Load a file.
File(string fileNodePath, string filePath) Load a file located in a map. load the file from the map with the name filePath.

Functions

return function description
string getName() Returns the file name.
string getPath() Returns the file path.
int getSize() Returns the file size.
int getLastWriteTime() Returns the time when the file was last updated.
bool isDirectory() Returns true if it is a directory,
bool exist() Returns if the file exist.
bool isFile() Returns true if it is a file.
string getContent() Returns the file content.
{File()} getFiles() Returns all files in the directory.
string getHash() Returns a hash of the file.
string saveToFile(string filePath) Save to file, The file will be saved in "Data/Dynamic" by default no fiole generated by lua can be saved in any other location.
string remove() Remove the file.