Difference between revisions of "Lua:getDirectoryList"

From Cheat Engine
Jump to navigation Jump to search
(Created page with "r = getDirectoryList("C:\\CE\\autorun", true) require 'pl.pretty'.dump(r) { "C:\\CE\\autorun\\ce-plugins", "C:\\CE\\autorun\\ceshare", "C:\\CE\\autorun\\dlls", "C:\\...")
 
m
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
r = getDirectoryList("C:\\CE\\autorun", true)  
+
[[Category:Lua]]
require 'pl.pretty'.dump(r)
+
'''function''' getDirectoryList(''Path'', [''SearchSubDirs'']) ''':''' Table
  
{
+
Returns an indexed table containing the names of directories in the specified path.
  "C:\\CE\\autorun\\ce-plugins",
+
 
  "C:\\CE\\autorun\\ceshare",
+
===Function Parameters===
  "C:\\CE\\autorun\\dlls",
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
  "C:\\CE\\autorun\\forms",
+
!align="left"|Parameter
  "C:\\CE\\autorun\\images",
+
!align="left"|Type
  "C:\\CE\\autorun\\xml",
+
!style="width: 80%;background-color:white;" align="left"|Description
  "C:\\CE\\autorun\\ce-plugins\\.git",
+
|-
  "C:\\CE\\autorun\\ce-plugins\\images",
+
|Path
  "C:\\CE\\autorun\\ceshare\\forms",
+
|String
   "C:\\CE\\autorun\\ceshare\\images",
+
|The directory path to search.
  "C:\\CE\\autorun\\dlls\\32",
+
|-
  "C:\\CE\\autorun\\dlls\\64",
+
|SearchSubDirs
  "C:\\CE\\autorun\\dlls\\src",
+
|Boolean (optional)
   "C:\\CE\\autorun\\dlls\\src\\Common",
+
|If true, searches subdirectories recursively. Default is false.
  "C:\\CE\\autorun\\dlls\\src\\Java",
+
|}
  "C:\\CE\\autorun\\dlls\\src\\Mono",
+
 
  "C:\\CE\\autorun\\dlls\\src\\Java\\CEJVMTI",
+
===Returns===
  "C:\\CE\\autorun\\dlls\\src\\Java\\CEJVMTI\\CEJVMTI",
+
Table — An indexed table with the names of directories found.
  "C:\\CE\\autorun\\dlls\\src\\Mono\\MonoDataCollector"
+
 
}
+
===Examples===
 +
<pre>
 +
local dirs = getDirectoryList(getAutorunPath())
 +
for i, name in ipairs(dirs) do
 +
   print(name)
 +
end
 +
 
 +
-- Search recursively
 +
local allDirs = getDirectoryList(getAutorunPath(), true)
 +
for i, name in ipairs(allDirs) do
 +
   print(name)
 +
end
 +
</pre>
 +
 
 +
== See also ==
 +
* [[Lua:getFileList|getFileList]]

Latest revision as of 19:13, 11 July 2025

function getDirectoryList(Path, [SearchSubDirs]) : Table

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

Function Parameters[edit]

Parameter Type Description
Path String The directory path to search.
SearchSubDirs Boolean (optional) If true, searches subdirectories recursively. Default is false.

Returns[edit]

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

Examples[edit]

local dirs = getDirectoryList(getAutorunPath())
for i, name in ipairs(dirs) do
  print(name)
end

-- Search recursively
local allDirs = getDirectoryList(getAutorunPath(), true)
for i, name in ipairs(allDirs) do
  print(name)
end

See also[edit]