Lua:getAutoAttachList
(Redirected from getAutoAttachList)
Jump to navigation
Jump to search
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