Skip to content
This repository was archived by the owner on Jun 29, 2023. It is now read-only.

LUtilsFile reference

Lexize edited this page Sep 9, 2022 · 3 revisions

LUtilsFile

Submodule of utils used for work with files. Can be accessed with lutils.file. Can't be accessed outside host instance of script.
All paths you'll use in this submodule will be relative to your avatar data folder.


init(String folder_name)
Initializing file submodule.
Also creates data folder for your avatar.
Should be called before calling all other functions of submodule.
Can't be called more than once.

writeText(String filepath, String content, [Boolean append], [String charsetId])
Writing text into file.
You also can append text, and specify charset id (can be found in LUtilsMisc)
If you'll not specify charset, default (UTF8) will be used.

readText(String filepath, [String charsetId]): String
Reading text from file.
You also can specify charset id (can be found in LUtilsMisc)
If you'll not specify charset, default (UTF8) will be used.

openWriteStream(String filepath, [Boolean append]): LUtilsOutputStream
Opens output stream for specified file.

openReadStream(String filepath): LUtilsInputStream
Opens input stream for specified file.

remove(String path): Boolean
Removes folder/file by specified path.
Returns true if successful.

mkdir(String path): Boolean
Creates folder by specified path.
Returns true if successful.

exists(String path): Boolean
Returns true if folder/file with specified path exists.

isDirectory(String path): Boolean
Returns true if specified path is directory.

list(String path): String[]
Returns table with names of all files/folders inside specified path.


How to use:
later...

Clone this wiki locally