User Tools

Site Tools


mod-io-functions

Differences

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

Link to this comparison view

mod-io-functions [2020/05/06 16:12] (current)
maxime created
Line 1: Line 1:
 +====== Mod IO functions ======
 +
 +All these functions are available on your mod object
 +
 +===== fileExists =====
 +
 +Checks if a file exists in the mod directory.
 +
 +Returns ''​true''​ if the file is inside the mod directory and exists, ''​false''​ otherwise
 +
 +''​boolean **myMod:​fileExists**(//​filePath//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​filePath''//​ | ''​string''​ | the relative path to the file, inside the mod directory |
 +
 +----
 +
 +===== directoryExists =====
 +
 +Checks if a directory exists in the mod directory
 +
 +Returns ''​true''​ if the directory is inside the mod directory and exists, ''​false''​ otherwise
 +
 +''​boolean **myMod:​directoryExists**(//​directoryPath//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​directoryPath''//​ | ''​string''​ | the relative path to the directory, inside the mod directory |
 +
 +----
 +
 +===== readFileAsString =====
 +
 +Reads a whole file as a single string
 +
 +Returns ''​true''​ and the file content string if the file exists and it could be read. Else, it returns ''​false''​ and ''​nil''​
 +
 +''​boolean,​ string **myMod:​readFileAsString**(//​filePath//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​filePath''//​ | ''​string''​ | the relative path to the file, inside the mod directory |
 +
 +----
 +
 +===== writeFileAsString =====
 +
 +Writes a string in a file
 +
 +Returns ''​true''​ if the file writing succeeded, ''​false''​ otherwise
 +
 +''​boolean **myMod:​writeFileAsString**(//​filePath//,​ //​fileContent//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​filePath''//​ | ''​string''​ | the relative path to the file, inside the mod directory |
 +| //''​fileContent''//​ | ''​string''​ | the content to write in the file |
 +
 +----
 +
 +===== createDirectory =====
 +
 +Creates a directory in the mod directory
 +
 +Returns ''​true''​ if the directory creation succeeded, ''​false''​ otherwise
 +
 +''​boolean **myMod:​createDirectory**(//​directoryPath//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​directoryPath''//​ | ''​string''​ | the relative path to the directory, inside the mod directory |
 +
 +----
 +
 +===== moveFile =====
 +
 +Moves/​renames a file or directory within the mod directory
 +
 +Returns ''​true''​ if the moving/​renaming succeeded,''​false''​ otherwise
 +
 +''​boolean **myMod:​moveFile**(//​sourcePath//,​ //​destinationPath//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​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 |
 +
 +----
 +
 +===== deleteFile =====
 +
 +Deletes a file within the mod directory
 +
 +Returns ''​true''​ if the file was successfully deleted, ''​false''​ otherwise
 +
 +''​boolean **myMod:​deleteFile**(//​filePath//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​filePath''//​ | ''​string''​ | the relative path to the file to delete, inside the mod directory |
 +
 +----
 +
 +===== deleteDirectory =====
 +
 +Deletes a directory and all its content within the mod directory
 +
 +Returns ''​true''​ if the directory was successfully deleted, ''​false''​ otherwise
 +
 +''​boolean **myMod:​deleteDirectory**(//​directoryPath//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​directoryPath''//​ | ''​string''​ | the relative path to the directory to delete, inside the mod directory |
  
mod-io-functions.txt ยท Last modified: 2020/05/06 16:12 by maxime