Lua:getAutoAttachList

From Cheat Engine
(Redirected from getAutoAttachList)
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[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

Main Pages

Core Lua documentation entry points

Lua
Script Engine