Difference between revisions of "Lua:getAutoAttachList"
Jump to navigation
Jump to search
m (added page reference) |
(Major overhaul of the post.) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | '''function''' getAutoAttachList() ''':''' | + | {{CodeBox|'''function''' getAutoAttachList() ''':''' StringList}} |
| − | Returns the | + | Returns the Auto Attach [[Lua:Class:Stringlist|Stringlist]] object. |
| − | + | The returned list contains process names that Cheat Engine can automatically attach to. The object can be controlled with the StringList routines and properties, but it should not be destroyed. | |
| − | == | + | ===Function Parameters=== |
| − | + | This function has no parameters. | |
| − | |||
| − | |||
| − | + | ===Returns=== | |
| + | [[Lua:Class:Stringlist|Stringlist]] — The Auto Attach string list object. | ||
| + | |||
| + | ===Examples=== | ||
| + | |||
| + | ====Get the Auto Attach list==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| + | |||
| + | print("Auto Attach entries: " .. tostring(autoAttachList.Count)) | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ====Add a process name==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| + | |||
| + | autoAttachList.add("game.exe") | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ====Add a process name only if it is missing==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| + | local processName = "game.exe" | ||
| + | |||
| + | if autoAttachList.IndexOf(processName) == -1 then | ||
| + | autoAttachList.add(processName) | ||
| + | end | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ====Print all Auto Attach entries==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| + | |||
| + | for i = 0, autoAttachList.Count - 1 do | ||
| + | print(autoAttachList[i]) | ||
| + | end | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ====Remove a process name==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| + | local index = autoAttachList.IndexOf("game.exe") | ||
| + | |||
| + | if index ~= -1 then | ||
| + | autoAttachList.delete(index) | ||
| + | end | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ====Clear the Auto Attach list==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| + | |||
| + | autoAttachList.clear() | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ====Set multiple Auto Attach entries==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| + | |||
| + | autoAttachList.clear() | ||
| + | autoAttachList.add("game.exe") | ||
| + | autoAttachList.add("game_dx12.exe") | ||
| + | autoAttachList.add("game_win64_shipping.exe") | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ====Use Text to replace the list==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| + | |||
| + | autoAttachList.Text = [[game.exe | ||
| + | game_dx12.exe | ||
| + | game_win64_shipping.exe]] | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ====Check whether a process is in the Auto Attach list==== | ||
| + | <syntaxhighlight lang="lua" line highlight="1"> | ||
| + | local autoAttachList = getAutoAttachList() | ||
| − | = | + | if autoAttachList.IndexOf("game.exe") ~= -1 then |
| − | + | print("game.exe is in the Auto Attach list") | |
| + | end | ||
| + | </syntaxhighlight> | ||
| − | + | {{LuaSeeAlso}} | |
| − | |||
Latest revision as of 19:52, 25 June 2026
Returns the Auto Attach Stringlist object.
The returned list contains process names that Cheat Engine can automatically attach to. The object can be controlled with the StringList routines and properties, but it should not be destroyed.
Contents
- 1 Function Parameters
- 2 Returns
- 3 Examples
- 3.1 Get the Auto Attach list
- 3.2 Add a process name
- 3.3 Add a process name only if it is missing
- 3.4 Print all Auto Attach entries
- 3.5 Remove a process name
- 3.6 Clear the Auto Attach list
- 3.7 Set multiple Auto Attach entries
- 3.8 Use Text to replace the list
- 3.9 Check whether a process is in the Auto Attach list
Function Parameters[edit]
This function has no parameters.
Returns[edit]
Stringlist — The Auto Attach string list object.
Examples[edit]
Get the Auto Attach list[edit]
1 local autoAttachList = getAutoAttachList()
2
3 print("Auto Attach entries: " .. tostring(autoAttachList.Count))
Add a process name[edit]
1 local autoAttachList = getAutoAttachList()
2
3 autoAttachList.add("game.exe")
Add a process name only if it is missing[edit]
1 local autoAttachList = getAutoAttachList()
2 local processName = "game.exe"
3
4 if autoAttachList.IndexOf(processName) == -1 then
5 autoAttachList.add(processName)
6 end
Print all Auto Attach entries[edit]
1 local autoAttachList = getAutoAttachList()
2
3 for i = 0, autoAttachList.Count - 1 do
4 print(autoAttachList[i])
5 end
Remove a process name[edit]
1 local autoAttachList = getAutoAttachList()
2 local index = autoAttachList.IndexOf("game.exe")
3
4 if index ~= -1 then
5 autoAttachList.delete(index)
6 end
Clear the Auto Attach list[edit]
1 local autoAttachList = getAutoAttachList()
2
3 autoAttachList.clear()
Set multiple Auto Attach entries[edit]
1 local autoAttachList = getAutoAttachList()
2
3 autoAttachList.clear()
4 autoAttachList.add("game.exe")
5 autoAttachList.add("game_dx12.exe")
6 autoAttachList.add("game_win64_shipping.exe")
Use Text to replace the list[edit]
1 local autoAttachList = getAutoAttachList()
2
3 autoAttachList.Text = [[game.exe
4 game_dx12.exe
5 game_win64_shipping.exe]]
Check whether a process is in the Auto Attach list[edit]
1 local autoAttachList = getAutoAttachList()
2
3 if autoAttachList.IndexOf("game.exe") ~= -1 then
4 print("game.exe is in the Auto Attach list")
5 end