User Tools

Site Tools


mod-functions:io

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

mod-functions:io [2019/05/29 11:13] – external edit 127.0.0.1mod-functions:io [2020/05/06 16:16] (current) – removed maxime
Line 1: Line 1:
-====== IO functions ====== 
  
-===== fileExists ===== 
- 
-Checks if a file exists in the mod directory 
- 
-<code lua> 
-local success = myMod:fileExists(filePath) 
-</code> 
- 
-Parameters: 
-  * ''filePath'' (string): the relative path to the file, inside the mod directory 
- 
-Return: 
-  * ''success'' (boolean): true if the file is inside the mod directory and exists, false otherwise 
- 
----- 
- 
-===== directoryExists ===== 
- 
-Checks if a directory exists in the mod directory 
- 
-<code lua> 
-local success = myMod:directoryExists(directoryPath) 
-</code> 
- 
-Parameters: 
-  * ''filePath'' (string): the relative path to the directory, inside the mod directory 
- 
-Return: 
-  * ''success'' (boolean): true if the directory is inside the mod directory and exists, false otherwise 
- 
----- 
- 
-===== readFileAsString ===== 
- 
-Reads a whole file as a single string 
- 
-<code lua> 
-local success, content = myMod:readFileAsString(filePath) 
-</code> 
- 
-Parameters: 
-  * ''filePath'' (string): the relative path to the file, inside the mod directory 
- 
-Return: 
-  * ''success'' (boolean): true if the file exists and it could be read, false otherwise 
-  * ''content'' (string): the file content 
- 
----- 
- 
-===== writeFileAsString ===== 
- 
-Writes a string in a file 
- 
-<code lua> 
-local success = myMod:writeFileAsString(filePath, fileContent) 
-</code> 
- 
-Parameters: 
-  * ''filePath'' (string): the relative path to the file, inside the mod directory 
-  * ''fileContent'' (string): the content to write in the file 
- 
-Return: 
-  * ''success'' (boolean): true if the file writing succeeded, false otherwise 
- 
----- 
- 
-===== createDirectory ===== 
- 
-Creates a directory in the mod directory 
- 
-<code lua> 
-local success = myMod:createDirectory(directoryPath) 
-</code> 
- 
-Parameters: 
-  * ''directoryPath'' (string): the relative path to the directory, inside the mod directory 
- 
-Return: 
-  * ''success'' (boolean): true if the directory creation succeeded, false otherwise 
- 
----- 
- 
-===== moveFile ===== 
- 
-Moves/renames a file or directory within the mod directory 
- 
-<code lua> 
-local success = myMod:moveFile(sourcePath, destinationPath) 
-</code> 
- 
-Parameters: 
-  * ''sourcePath'' (string): the relative path to the file to move/rename, inside the mod directory 
-  * ''destinationPath'' (string): the relative path to the destination, inside the mod directory 
- 
-Return: 
-  * ''success'' (boolean): true if the moving/renaming succeeded, false otherwise 
- 
----- 
- 
-===== deleteFile ===== 
- 
-Deletes a file within the mod directory 
- 
-<code lua> 
-local success = myMod:deleteFile(filePath) 
-</code> 
- 
-Parameters: 
-  * ''filePath'' (string): the relative path to the file to delete, inside the mod directory 
- 
-Return: 
-  * ''success'' (boolean): true if the file was successfully deleted, false otherwise 
- 
----- 
- 
-===== deleteDirectory ===== 
- 
-Deletes a directory and all its content within the mod directory 
- 
-<code lua> 
-local success = myMod:deleteDirectory(directoryPath) 
-</code> 
- 
-Parameters: 
-  * ''directoryPath'' (string): the relative path to the directory to delete, inside the mod directory 
- 
-Return: 
-  * ''success'' (boolean): true if the directory was successfully deleted, false otherwise 
mod-functions/io.1559142834.txt.gz · Last modified: 2019/05/29 11:13 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki