HDD - Hard Disk Drive
This peripheral gives access to LIKO-12's virtual drives.
- Version: v1.0.0
- Available since: LIKO-12 v0.6.0
- Last updated in: LIKO-12 v0.8.0
Methods:
HDD.append
Appends content to the end of a file.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
HDD.append(file, text)
Arguments:
- <file> (string): File to append to.
- <text> (string): Text to append.
HDD.delete
Deletes a file.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
HDD.delete(file)
Arguments:
- <file> (string): File to delete.
HDD.drive
Changes the current drive.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
HDD.drive(drive)
Arguments:
- <drive> (string): Drive to change to.
HDD.exists
Returns true if a file or directory exists.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
existent = HDD.exists(file)
Arguments:
- <file> (string): File to check.
Returns:
- existent (boolean): Existence of file or directory.
HDD.getDirectoryItems
Returns a table containing items in a directory.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
files = HDD.getDirectoryItems(directory)
Arguments:
- <directory> (string): Directory to list items of.
Returns:
- files (table): List of files in the directory.
HDD.getLastModified
Returns the Unix timestamp of a file.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
timestamp = HDD.getLastModified(file)
Arguments:
- <file> (string): File to get timestamp of.
Returns:
- timestamp (number): Unix timestamp of the file.
HDD.isDirectory
Returns true if the path given represents a directory.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
isDirectory = HDD.isDirectory(file)
Arguments:
- <file> (string): File to check if it is a directory.
Returns:
- isDirectory (boolean): True if it is a directory, false otherwise.
HDD.isFile
Returns true if the path given represents a file.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
isFile = HDD.isFile(file)
Arguments:
- <file> (string): Checks if it is a file.
Returns:
- isFile (boolean): True if it is a file, false otherwise.
HDD.load
Loads the contents of a Lua script as a function.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
chunk, ok = HDD.load(file)
Arguments:
- <file> (string): File to load.
Returns:
- chunk (function, nil): Loaded file function, nil when fails to load.
- ok (string, nil): The error message when failed to load.
HDD.newDirectory
Creates a directory.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
HDD.newDirectory(path)
Arguments:
- <path> (string): Path to new directory.
HDD.read
Returns the content of a file.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
data = HDD.read(file)
Arguments:
- <file> (string): File to read.
Returns:
- data (string): The content of the file.
HDD.size
Gets the size of a file in bytes.
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
size = HDD.size(file)
Arguments:
- <file> (string): File to get size of.
Returns:
- size (number): The size of the file in bytes.
HDD.write
Writes content to a file (Will override anything in the file).
- Available since: HDD: v1.0.0, LIKO-12: v0.6.0
- Last updated in: HDD: v1.0.0, LIKO-12: v0.6.0
HDD.write(file, text)
Arguments:
- <file> (string): File to write to.
- <text> (string): Text to write.