Difference between revisions of "Lua:Class:Addresslist"

From Cheat Engine
Jump to navigation Jump to search
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Addresslist '''class''': ('''Inheritance''': ''[[Panel]]''->''[[WinControl]]''->''[[Control]]''->''[[Component]]''->''[[Object]]'')
+
[[Category:Lua]]
 +
Addresslist '''class''': ('''Inheritance''': ''[[Lua:Class:Panel|Panel]]''->''[[Lua:Class:WinControl|WinControl]]''->''[[Lua:Class:Control|Control]]''->''[[Lua:Class:Component|Component]]''->''[[Lua:Class:Object|Object]]'')
  
Class for manipulating the Cheat Engine form's address list.
+
The AddressList class represents the list of memory records (cheat entries) in Cheat Engine
 +
It provides access to all records, selection, appearance, and event handling for the address list.
  
 
== Properties ==
 
== Properties ==
; Count : integer
+
{| class="wikitable" style="width:100%"
: The number of records in the table.
+
! Property
 
+
! Type
; SelCount : integer
+
! Description
: The number of records that are selected.
+
|-
 
+
| LoadedTableVersion
; SelectedRecord : [[MemoryRecord]]
+
| Integer
: The main selected record.
+
| Returns the tableVersion of the last loaded table.
 
+
|-
; MemoryRecord[''index''] : [[MemoryRecord]]
+
| Count
: Array to access the individual memory records.
+
| Integer
 
+
| The number of records in the table.
; [''index''] : [[MemoryRecord]]
+
|-
: Default accessor.
+
| SelCount
 +
| Integer
 +
| The number of records that are selected.
 +
|-
 +
| SelectedRecord
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| The main selected record.
 +
|-
 +
| MemoryRecord[]
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Array to access the individual memory records.
 +
|-
 +
| [index]
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Default accessor for memory records.
 +
|-
 +
| CheckboxActiveSelectedColor
 +
| Color
 +
| Color for active and selected checkboxes.
 +
|-
 +
| CheckboxActiveColor
 +
| Color
 +
| Color for active checkboxes.
 +
|-
 +
| CheckboxSelectedColor
 +
| Color
 +
| Color for selected checkboxes.
 +
|-
 +
| CheckboxColor
 +
| Color
 +
| Color for checkboxes.
 +
|-
 +
| SelectedBackgroundColor
 +
| Color
 +
| Color for the selected row background.
 +
|-
 +
| SelectedSecondaryBackgroundColor
 +
| Color
 +
| Secondary color for selected row background.
 +
|-
 +
| ExpandSignColor
 +
| Color
 +
| Color for the expand/collapse sign.
 +
|-
 +
| IncreaseArrowColor
 +
| Color
 +
| Color for the increase arrow.
 +
|-
 +
| DecreaseArrowColor
 +
| Color
 +
| Color for the decrease arrow.
 +
|}
  
 
== Methods ==
 
== Methods ==
; getCount() : integer
+
{| class="wikitable" style="width:100%"
: Returns the number of memory records in the address list.
+
! Method
 +
! Parameters
 +
! Returns
 +
! Description
 +
|-
 +
| getCount
 +
| None
 +
| Integer
 +
| Returns the number of memory records.
 +
|-
 +
| getMemoryRecord
 +
| Integer (index)
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Returns the memory record at the given index.
 +
|-
 +
| getMemoryRecordByDescription
 +
| String (description)
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Returns the memory record with the given description.
 +
|-
 +
| getMemoryRecordByID
 +
| Integer (ID)
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Returns the memory record with the given ID.
 +
|-
 +
| createMemoryRecord
 +
| None
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Creates a generic cheat table entry and adds it to the list.
 +
|-
 +
| getSelectedRecords
 +
| None
 +
| Table of [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Returns a table containing all the selected records.
 +
|-
 +
| doDescriptionChange
 +
| None
 +
| None
 +
| Shows the GUI window to change the description of the selected entry.
 +
|-
 +
| doAddressChange
 +
| None
 +
| None
 +
| Shows the GUI window to change the address of the selected entry.
 +
|-
 +
| doTypeChange
 +
| None
 +
| None
 +
| Shows the GUI window to change the type of the selected entries.
 +
|-
 +
| doValueChange
 +
| None
 +
| None
 +
| Shows the GUI window to change the value of the selected entries.
 +
|-
 +
| getSelectedRecord
 +
| None
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Gets the main selected memory record.
 +
|-
 +
| setSelectedRecord
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| None
 +
| Sets the currently selected memory record (unselects all others).
 +
|-
 +
| disableAllWithoutExecute
 +
| None
 +
| None
 +
| Disables all memory records without executing their [Disable] section.
 +
|-
 +
| rebuildDescriptionCache
 +
| None
 +
| None
 +
| Rebuilds the description-to-record lookup table.
 +
|}
  
; getMemoryRecord(''index'') : [[MemoryRecord]]
+
== Events / Callbacks ==
: returns a [[MemoryRecord]] object based on it's index.
+
{| class="wikitable" style="width:100%"
 +
! Event
 +
! Parameters
 +
! Description
 +
|-
 +
| OnDescriptionChange
 +
| function(addresslist, memrec):boolean
 +
| Called when the user initiates a description column change on a record. Return true if you handle it, false for normal behaviour.
 +
|-
 +
| OnAddressChange
 +
| function(addresslist, memrec):boolean
 +
| Called when the user initiates an address column change on a record. Return true if you handle it, false for normal behaviour.
 +
|-
 +
| OnTypeChange
 +
| function(addresslist, memrec):boolean
 +
| Called when the user initiates a type column change on a record. Return true if you handle it, false for normal behaviour.
 +
|-
 +
| OnValueChange
 +
| function(addresslist, memrec):boolean
 +
| Called when the user initiates a value column change on a record. Return true if you handle it, false for normal behaviour.
 +
|-
 +
| OnAutoAssemblerEdit
 +
| function(addresslist, memrec)
 +
| Called when the user initiates a memory record AA script edit. This function will be responsible for changing the memory record.
 +
|}
  
; getMemoryRecordByDescription(''description'') : [[MemoryRecord]]
+
== Other Functions ==
: returns a [[MemoryRecord]] object based on it's description.
+
* '''MouseHighlightedRecord()''' — Returns the memory record that the mouse points at, or nil if nothing.
  
; getMemoryRecordByID(''ID'') : [[MemoryRecord]]
+
== Examples ==
: returns a [[MemoryRecord]] object based on it's ID.
+
<pre>
 
+
-- Print all memory record descriptions
; createMemoryRecord() &#58; [[MemoryRecord]]
+
for i = 0, AddressList.Count - 1 do
: creates an generic cheat table entry and add it to the list
+
  print(AddressList[i].Description)
 
+
end
; getSelectedRecords() &#58; [[MemoryRecord]]
 
: Returns a table containing all the selected records
 
 
 
; doDescriptionChange()
 
: Will show the GUI window to change the description of the selected entry
 
 
 
; doAddressChange()
 
: Will show the GUI window to change the address of the selected entry
 
 
 
; doTypeChange()
 
: Will show the GUI window to change the type of the selected entries
 
  
; doValueChange()
+
-- Create a new memory record
: Will show the GUI window to change the value of the selected entries
+
local newrec = AddressList:createMemoryRecord()
 +
newrec.Description = "My New Entry"
 +
newrec.Address = "00400000"
  
; getSelectedRecord() &#58; [[MemoryRecord]]
+
-- Get all selected records
: Gets the main selected memory record.
+
local selected = AddressList:getSelectedRecords()
 +
for i, rec in ipairs(selected) do
 +
  print("Selected:", rec.Description)
 +
end
  
; setSelectedRecord(''memrec'')
+
-- Change the selected record
: Sets the currently selected memory record. This will unselect all other entries.
+
AddressList:setSelectedRecord(AddressList[0])
 
+
</pre>
== Examples ==
 
local addressList = getAddressList()
 
if addressList.Count >= 1 then
 
  local mrHealth = addressList.getMemoryRecordByDescription('Health')
 
end
 
local mrMana = addressList.createMemoryRecord()
 
  
== See also ==
+
{{LuaSeeAlso}}
* [[Lua]]
 
* [[Help_File:Script engine|Script engine]]
 
  
 
=== Related Functions ===
 
=== Related Functions ===
* [[getMainForm]]
+
* [[Lua:getMainForm|getMainForm]]
* [[getAddressList]]
+
* [[Lua:getAddressList|getAddressList]]
  
 
=== Related Classes ===
 
=== Related Classes ===
* [[MemoryRecord]]
+
* [[Lua:Class:MemoryRecord|MemoryRecord]]

Latest revision as of 13:46, 11 July 2025

Addresslist class: (Inheritance: Panel->WinControl->Control->Component->Object)

The AddressList class represents the list of memory records (cheat entries) in Cheat Engine. It provides access to all records, selection, appearance, and event handling for the address list.

Properties[edit]

Property Type Description
LoadedTableVersion Integer Returns the tableVersion of the last loaded table.
Count Integer The number of records in the table.
SelCount Integer The number of records that are selected.
SelectedRecord MemoryRecord The main selected record.
MemoryRecord[] MemoryRecord Array to access the individual memory records.
[index] MemoryRecord Default accessor for memory records.
CheckboxActiveSelectedColor Color Color for active and selected checkboxes.
CheckboxActiveColor Color Color for active checkboxes.
CheckboxSelectedColor Color Color for selected checkboxes.
CheckboxColor Color Color for checkboxes.
SelectedBackgroundColor Color Color for the selected row background.
SelectedSecondaryBackgroundColor Color Secondary color for selected row background.
ExpandSignColor Color Color for the expand/collapse sign.
IncreaseArrowColor Color Color for the increase arrow.
DecreaseArrowColor Color Color for the decrease arrow.

Methods[edit]

Method Parameters Returns Description
getCount None Integer Returns the number of memory records.
getMemoryRecord Integer (index) MemoryRecord Returns the memory record at the given index.
getMemoryRecordByDescription String (description) MemoryRecord Returns the memory record with the given description.
getMemoryRecordByID Integer (ID) MemoryRecord Returns the memory record with the given ID.
createMemoryRecord None MemoryRecord Creates a generic cheat table entry and adds it to the list.
getSelectedRecords None Table of MemoryRecord Returns a table containing all the selected records.
doDescriptionChange None None Shows the GUI window to change the description of the selected entry.
doAddressChange None None Shows the GUI window to change the address of the selected entry.
doTypeChange None None Shows the GUI window to change the type of the selected entries.
doValueChange None None Shows the GUI window to change the value of the selected entries.
getSelectedRecord None MemoryRecord Gets the main selected memory record.
setSelectedRecord MemoryRecord None Sets the currently selected memory record (unselects all others).
disableAllWithoutExecute None None Disables all memory records without executing their [Disable] section.
rebuildDescriptionCache None None Rebuilds the description-to-record lookup table.

Events / Callbacks[edit]

Event Parameters Description
OnDescriptionChange function(addresslist, memrec):boolean Called when the user initiates a description column change on a record. Return true if you handle it, false for normal behaviour.
OnAddressChange function(addresslist, memrec):boolean Called when the user initiates an address column change on a record. Return true if you handle it, false for normal behaviour.
OnTypeChange function(addresslist, memrec):boolean Called when the user initiates a type column change on a record. Return true if you handle it, false for normal behaviour.
OnValueChange function(addresslist, memrec):boolean Called when the user initiates a value column change on a record. Return true if you handle it, false for normal behaviour.
OnAutoAssemblerEdit function(addresslist, memrec) Called when the user initiates a memory record AA script edit. This function will be responsible for changing the memory record.

Other Functions[edit]

  • MouseHighlightedRecord() — Returns the memory record that the mouse points at, or nil if nothing.

Examples[edit]

-- Print all memory record descriptions
for i = 0, AddressList.Count - 1 do
  print(AddressList[i].Description)
end

-- Create a new memory record
local newrec = AddressList:createMemoryRecord()
newrec.Description = "My New Entry"
newrec.Address = "00400000"

-- Get all selected records
local selected = AddressList:getSelectedRecords()
for i, rec in ipairs(selected) do
  print("Selected:", rec.Description)
end

-- Change the selected record
AddressList:setSelectedRecord(AddressList[0])

See also[edit]

Related Functions[edit]

Related Classes[edit]