Available since Version 1.0.
Scans a directory and returns a table containing the names of all files and subdirectories within it.
Syntax
Directory.Scan( path, [pattern] )Arguments
- path (string): The path of the directory to scan. This can be an absolute path or a path relative to the mod's directory.
- pattern (string, optional): A pattern to match file names against. Defaults to "*" if not specified.
Return Values
- (table): A table containing the names of all files and subdirectories within the specified directory. The keys of the table are integers starting from 1, and the values are strings representing the names of the files and subdirectories.
Examples
local scannedFiles = Directory.Scan("events", "*.lua")
for i = 1, #scannedFiles do
File.RequireOnce(scannedFiles[i])
end