Difference between revisions of "Lua:getFileList"

From Cheat Engine
Jump to navigation Jump to search
m
m (Syntax Highlighting.)
Line 31: Line 31:
  
 
===Examples===
 
===Examples===
<pre>
+
<syntaxhighlight lang="lua" line>
 
local files = getFileList(getAutorunPath(), "*.txt")
 
local files = getFileList(getAutorunPath(), "*.txt")
 
for i, name in ipairs(files) do
 
for i, name in ipairs(files) do
Line 42: Line 42:
 
   print(name)
 
   print(name)
 
end
 
end
</pre>
+
</syntaxhighlight>
  
== See also ==
+
{{LuaSeeAlso}}
* [[Lua:getDirectoryList|getDirectoryList]]
 

Revision as of 19:23, 25 June 2026

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

 1 local files = getFileList(getAutorunPath(), "*.txt")
 2 for i, name in ipairs(files) do
 3   print(name)
 4 end
 5 
 6 -- Search recursively for all .dll files
 7 local dlls = getFileList(getAutorunPath(), "*.dll", true)
 8 for i, name in ipairs(dlls) do
 9   print(name)
10 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine