Lua:getFileList

From Cheat Engine
Revision as of 19:16, 11 July 2025 by Leunsel (talk | contribs)
Jump to navigation Jump to search

function getFileList(Path, [SearchMask], [SearchSubDirs], [DirAttrib]) : Table

Returns an indexed table containing the names of files in the specified path.

Function Parameters

Parameter Type Description
Path String The directory path to search.
SearchMask String (optional) A file mask (e.g., "*.exe") to filter results. Default is "*".
SearchSubDirs Boolean (optional) If true, searches subdirectories recursively. Default is false.
DirAttrib Integer (optional) Directory attribute filter. Default is 0.

Returns

Table — An indexed table with the names of files found.

Examples

local files = getFileList(getAutorunPath(), "*.txt")
for i, name in ipairs(files) do
  print(name)
end

-- Search recursively for all .dll files
local dlls = getFileList(getAutorunPath(), "*.dll", true)
for i, name in ipairs(dlls) do
  print(name)
end

See also