Lua:getAutoAttachList

From Cheat Engine
Revision as of 19:52, 25 June 2026 by Leunsel (talk | contribs) (Major overhaul of the post.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<> Lua API Reference

function getAutoAttachList() : StringList

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.

Function Parameters

This function has no parameters.

Returns

Stringlist — The Auto Attach string list object.

Examples

Get the Auto Attach list

1 local autoAttachList = getAutoAttachList()
2 
3 print("Auto Attach entries: " .. tostring(autoAttachList.Count))

Add a process name

1 local autoAttachList = getAutoAttachList()
2 
3 autoAttachList.add("game.exe")

Add a process name only if it is missing

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

1 local autoAttachList = getAutoAttachList()
2 
3 for i = 0, autoAttachList.Count - 1 do
4   print(autoAttachList[i])
5 end

Remove a process name

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

1 local autoAttachList = getAutoAttachList()
2 
3 autoAttachList.clear()

Set multiple Auto Attach entries

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

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

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

Main Pages

Core Lua documentation entry points

Lua
Script Engine