Difference between revisions of "Lua:Class:MemoryRecord"

From Cheat Engine
Jump to navigation Jump to search
m (Link to GenericHotkey)
 
(12 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
MemoryRecord '''class''': ('''Inheritance''': ''[[Object]]'')
+
MemoryRecord '''class''': ('''Inheritance''': ''[[Lua:Class:Object|Object]]'')
  
The memory record objects are the entries you see in the address list.
+
The MemoryRecord class represents an entry in the Cheat Engine address list
 +
Each memory record can represent an address, pointer, script, or group header, and provides access to its properties, children, hotkeys, and events.
  
 
== Properties ==
 
== Properties ==
; ID : integer
+
{| class="wikitable" style="width:100%"
: Unique ID.
+
! Property
 +
! Type
 +
! Description
 +
|-
 +
| ID
 +
| Integer
 +
| Unique ID of the memory record.
 +
|-
 +
| Index
 +
| Integer
 +
| The index of this record in the address list (0 is top, ReadOnly).
 +
|-
 +
| Description
 +
| String
 +
| The description of the memory record.
 +
|-
 +
| Address
 +
| String
 +
| Get/set the interpretable address string.
 +
|-
 +
| AddressString
 +
| String
 +
| The address string shown in CE (ReadOnly).
 +
|-
 +
| OffsetCount
 +
| Integer
 +
| The number of offsets. Set to 0 for a normal address.
 +
|-
 +
| Offset[]
 +
| Integer
 +
| Array to access each offset.
 +
|-
 +
| OffsetText[]
 +
| String
 +
| Array to access each offset using interpretable text style.
 +
|-
 +
| CurrentAddress
 +
| Integer
 +
| The address the memory record points to.
 +
|-
 +
| VarType
 +
| ValueType (string)
 +
| The variable type of this record. See vtByte to vtCustom.
 +
|-
 +
| Type
 +
| ValueType (number)
 +
| The variable type of this record. See vtByte to vtCustom.
 +
|-
 +
| CustomTypeName
 +
| String
 +
| If the type is vtCustom, this contains the name of the CustomType.
 +
|-
 +
| Script
 +
| String
 +
| If the type is vtAutoAssembler, this contains the auto assembler script.
 +
|-
 +
| Value
 +
| String
 +
| The value in string form.
 +
|-
 +
| NumericalValue
 +
| Number
 +
| The value in numerical form, or nil if it cannot be parsed.
 +
|-
 +
| Selected
 +
| Boolean
 +
| True if selected (ReadOnly).
 +
|-
 +
| Active
 +
| Boolean
 +
| Set to true to activate/freeze, false to deactivate/unfreeze.
 +
|-
 +
| Color
 +
| Integer
 +
| The color of the memory record.
 +
|-
 +
| ShowAsHex
 +
| Boolean
 +
| Show value as hexadecimal.
 +
|-
 +
| ShowAsSigned
 +
| Boolean
 +
| Show value as signed.
 +
|-
 +
| AllowIncrease
 +
| Boolean
 +
| Allow value increasing; unfreeze resets to false.
 +
|-
 +
| AllowDecrease
 +
| Boolean
 +
| Allow value decreasing; unfreeze resets to false.
 +
|-
 +
| Collapsed
 +
| Boolean
 +
| Set to true to collapse this record, false to expand.
 +
|-
 +
| IsGroupHeader
 +
| Boolean
 +
| True if the record is a group header with no address or value info.
 +
|-
 +
| IsAddressGroupHeader
 +
| Boolean
 +
| True if the record is a group header with address.
 +
|-
 +
| IsReadable
 +
| Boolean
 +
| False if record contains an unreadable address (ReadOnly, set after value is accessed).
 +
|-
 +
| Options
 +
| String set
 +
| A string enclosed by square brackets with options separated by commas (e.g., [moHideChildren,moActivateChildrenAsWell]).
 +
|-
 +
| DropDownLinked
 +
| Boolean
 +
| True if dropdown list refers to another memory record's list.
 +
|-
 +
| DropDownLinkedMemrec
 +
| String
 +
| Description of linked memory record or empty string if not linked.
 +
|-
 +
| DropDownList
 +
| StringList
 +
| List of "value:description" lines; read-write.
 +
|-
 +
| DropDownReadOnly
 +
| Boolean
 +
| True if 'Disallow manual user input' is set.
 +
|-
 +
| DropDownDescriptionOnly
 +
| Boolean
 +
| Self-explanatory.
 +
|-
 +
| DisplayAsDropDownListItem
 +
| Boolean
 +
| Self-explanatory.
 +
|-
 +
| DropDownCount
 +
| Integer
 +
| Equivalent to .DropDownList.Count.
 +
|-
 +
| DropDownValue[index]
 +
| String
 +
| Array to access values in DropDownList (ReadOnly).
 +
|-
 +
| DropDownDescription[index]
 +
| String
 +
| Array to access descriptions in DropDownList (ReadOnly).
 +
|-
 +
| Count
 +
| Integer
 +
| Number of child records.
 +
|-
 +
| Child[index]
 +
| MemoryRecord
 +
| Array to access child records.
 +
|-
 +
| Parent
 +
| MemoryRecord
 +
| The parent of the memory record.
 +
|-
 +
| HotkeyCount
 +
| Integer
 +
| Number of hotkeys attached to this memory record.
 +
|-
 +
| Hotkey[index]
 +
| [[Lua:Class:GenericHotkey|GenericHotkey]]
 +
| Array to index the hotkeys.
 +
|-
 +
| Async
 +
| Boolean
 +
| Set to true if activating this entry will be asynchronous (only for AA/Lua scripts).
 +
|-
 +
| AsyncProcessing
 +
| Boolean
 +
| True when async is true and it's being processed.
 +
|-
 +
| AsyncProcessingTime
 +
| Qword
 +
| The time that it has been processing in milliseconds.
 +
|-
 +
| HasMouseOver
 +
| Boolean
 +
| True if the mouse is currently over it.
 +
|-
 +
| DontSave
 +
| Boolean
 +
| Don't save this memoryrecord and its children.
 +
|}
  
; Index : integer
+
=== Special Properties by Type ===
: The index ID for this record. 0 is top. (ReadOnly)
+
* '''vtString''': <code>String.Size</code>, <code>String.Unicode</code>, <code>String.Codepage</code>
 +
* '''vtBinary''': <code>Binary.Startbit</code>, <code>Binary.Size</code>
 +
* '''vtByteArray''': <code>Aob.Size</code>
  
; Description &#58; string- The description of the memory record.
+
== Variable Types ==
 +
{| class="wikitable" style="width:60%"
 +
! Constant
 +
! Value
 +
! Description
 +
|-
 +
| vtByte
 +
| 0
 +
| 1 byte (unsigned)
 +
|-
 +
| vtWord
 +
| 1
 +
| 2 bytes (unsigned)
 +
|-
 +
| vtDword
 +
| 2
 +
| 4 bytes (unsigned)
 +
|-
 +
| vtQword
 +
| 3
 +
| 8 bytes (unsigned)
 +
|-
 +
| vtSingle
 +
| 4
 +
| 4 bytes (float)
 +
|-
 +
| vtDouble
 +
| 5
 +
| 8 bytes (double/float)
 +
|-
 +
| vtString
 +
| 6
 +
| String (ASCII)
 +
|-
 +
| vtUnicodeString<br>vtWideString
 +
| 7
 +
| Unicode string (Only used by autoguess)
 +
|-
 +
| vtByteArray
 +
| 8
 +
| Array of bytes
 +
|-
 +
| vtBinary
 +
| 9
 +
| Binary (bitfield)
 +
|-
 +
| vtAll
 +
| 10
 +
| All types (used for scans)
 +
|-
 +
| vtAutoAssembler
 +
| 11
 +
| Auto Assembler script
 +
|-
 +
| vtPointer
 +
| 12
 +
| Pointer (Only used by autoguess and structures)
 +
|-
 +
| vtCustom
 +
| 13
 +
| Custom type
 +
|-
 +
| vtGrouped
 +
| 14
 +
| Grouped type
 +
|}
  
; Address &#58; string
+
== MemoryRecord Options ==
: Get/set the interpretable address string. Useful for simple address settings.
 
  
; OffsetCount &#58; integer
+
The following options can be set in the `Options` property of a MemoryRecord.
: The number of offsets. Set to 0 for a normal address.
+
The value is a string enclosed in square brackets, with options separated by commas (e.g., `[moHideChildren,moActivateChildrenAsWell]`).
  
; Offset[''index''] &#58; integer
+
{| class="wikitable" style="width:60%"
: Array to access each offset.
+
! Option
 
+
! Description
; CurrentAddress &#58; integer
+
|-
: The address the memoryrecord points to.
+
| moHideChildren
 
+
| Hides the child records of this memory record.
; Type &#58; integer
+
|-
: The variable type of this record. See vtByte to vtCustom
+
| moActivateChildrenAsWell
:* If the type is vtString then the following properties are available:
+
| Activating this record also activates its children.
:** String.Size: Number of characters in the string
+
|-
:** String.Unicode: boolean
+
| moDeactivateChildrenAsWell
:* If the type is vtBinary then the following properties are available
+
| Deactivating this record also deactivates its children.
:** Binary.Startbit: First bit to start reading from
+
|-
:** Binary.Size: Number of bits
+
| moRecursiveSetValue
:* If the type is vtByteArray then the following properties are available
+
| Setting the value will also set the value of all children recursively.
:** Aob.Size: Number of bytes
+
|-
:'''From ''defines.lua''''':
+
| moAllowManualCollapseAndExpand
vtByte=0
+
| Allows the user to manually collapse or expand this record in the address list.
vtWord=1
+
|-
vtDword=2
+
| moManualExpandCollapse
vtQword=3
+
| Enables manual expand/collapse behavior for this record.
vtSingle=4
+
|-
vtDouble=5
+
| moAlwaysHideChildren
vtString=6
+
| Always hides the children, regardless of other settings.
vtUnicodeString=7 --Only used by autoguess
+
|}
vtByteArray=8
 
vtBinary=9
 
vtAutoAssembler=11
 
vtPointer=12 --Only used by autoguess and structures
 
vtCustom=13
 
vtGrouped=14
 
 
 
; CustomTypeName &#58; string
 
: If the type is vtCustomType this will contain the name of the CustomType
 
 
 
; Script &#58; string
 
: If the type is vtAutoAssembler this will contain the auto assembler script
 
 
 
; Value &#58; string
 
: The value in stringform.
 
 
 
; Selected &#58; boolean
 
: Set to true if selected (ReadOnly)
 
 
 
; Active &#58; boolean
 
: Set to true to activate/freeze, false to deactivate/unfreeze
 
 
 
; Color &#58; integer
 
: The memory record's RBG color integer.
 
 
 
; ShowAsHex &#58; boolean
 
: Self explanatory
 
 
 
; ShowAsSigned &#58; boolean
 
: Self explanatory
 
 
 
; AllowIncrease &#58; boolean
 
: Allow value increasing, unfreeze will reset it to false
 
 
 
; AllowDecrease &#58; boolean
 
: Allow value decreasing, unfreeze will reset it to false
 
 
 
; Count &#58; integer
 
: Number of children
 
 
 
; Child[''index''] &#58; MemoryRecord
 
: Array to access the child records
 
 
 
; HotkeyCount &#58; integer
 
: Number of hotkeys attached to this memory record.
 
 
 
; Hotkey[''index''] &#58; [[GenericHotkey]]
 
: Array to index the hotkeys.
 
 
 
; OnActivate &#58; function(''memoryrecord'', ''before'', ''currentstate'') &#58; boolean
 
: The function to call when the memoryrecord will change (or changed) Active to true.
 
: If before is true, not returning true will cause the activation to stop.
 
 
 
; OnDeactivate &#58; function(memoryrecord,before,currentstate) &#58; boolean
 
: The function to call when the memoryrecord will change (or changed) Active to false.
 
: If before is true, not returning true will cause the deactivation to stop.
 
 
 
; OnDestroy &#58; function
 
: Called when the memoryrecord is destroyed.
 
 
 
; DontSave &#58; boolean
 
: Don't save this memoryrecord and it's children
 
  
 
== Methods ==
 
== Methods ==
; getDescription() &#58; string
+
{| class="wikitable" style="width:100%"
: Returns the memory record's dexcription.
+
! Method
 +
! Parameters
 +
! Returns
 +
! Description
 +
|-
 +
| getDescription
 +
| None
 +
| String
 +
| Gets the description.
 +
|-
 +
| setDescription
 +
| String
 +
| None
 +
| Sets the description.
 +
|-
 +
| getAddress
 +
| None
 +
| String, Table
 +
| Returns the interpretable address string. If pointer, returns a table of offsets as second result.
 +
|-
 +
| setAddress
 +
| String
 +
| None
 +
| Sets the interpretable address string (and offsets if pointer).
 +
|-
 +
| getOffsetCount
 +
| None
 +
| Integer
 +
| Returns the number of offsets.
 +
|-
 +
| setOffsetCount
 +
| Integer
 +
| None
 +
| Sets the number of offsets.
 +
|-
 +
| getOffset
 +
| Integer (index)
 +
| Integer
 +
| Gets the offset at the given index.
 +
|-
 +
| setOffset
 +
| Integer (index), Integer (value)
 +
| None
 +
| Sets the offset at the given index.
 +
|-
 +
| getCurrentAddress
 +
| None
 +
| Integer
 +
| Returns the current address as an integer.
 +
|-
 +
| appendToEntry
 +
| MemoryRecord
 +
| None
 +
| Appends the current memory record to the given memory record.
 +
|-
 +
| getHotkey
 +
| Integer (index)
 +
| MemoryRecordHotkey
 +
| Returns the hotkey from the hotkey array.
 +
|-
 +
| getHotkeyByID
 +
| Integer (id)
 +
| MemoryRecordHotkey
 +
| Returns the hotkey with the given id.
 +
|-
 +
| reinterpret
 +
| None
 +
| None
 +
| Reinterprets the memory record.
 +
|-
 +
| createHotkey
 +
| Table (keys), Integer (action), String (value, optional), String (description, optional)
 +
| MemoryRecordHotkey
 +
| Creates a hotkey object.
 +
|-
 +
| disableWithoutExecute
 +
| None
 +
| None
 +
| Sets the entry to disabled without executing the disable section.
 +
|-
 +
| beginEdit
 +
| None
 +
| None
 +
| Call when you wish to take a long time to edit a record.
 +
|-
 +
| endEdit
 +
| None
 +
| None
 +
| Marks the end of your long edit sequence.
 +
|}
  
; setDescription()
+
== Events / Callbacks ==
: Sets the memory record's dexcription.
+
{| class="wikitable" style="width:100%"
 +
! Event
 +
! Parameters
 +
! Description
 +
|-
 +
| OnActivate
 +
| function(memoryrecord, before, currentstate):boolean
 +
| Called when the memoryrecord will change (or changed) Active to true. If before is true, not returning true will cause the activation to stop.
 +
|-
 +
| OnDeactivate
 +
| function(memoryrecord, before, currentstate):boolean
 +
| Called when the memoryrecord will change (or changed) Active to false. If before is true, not returning true will cause the deactivation to stop.
 +
|-
 +
| OnActivationFailure
 +
| function(memoryrecord, reason, reasonText)
 +
| Called when activating a record fails. Return true to try again (be careful of infinite loops).
 +
|-
 +
| OnDestroy
 +
| function()
 +
| Called when the memoryrecord is destroyed.
 +
|-
 +
| OnGetDisplayValue
 +
| function(memoryrecord, valuestring):boolean,string
 +
| Called when rendering the value of a memory record. Return true and a new string to override the value shown.
 +
|-
 +
| OnValueChanged
 +
| function(memoryrecord, oldvalue, newvalue)
 +
| Called whenever the value of a memory record has changed.
 +
|-
 +
| OnValueChangedByUser
 +
| function(memoryrecord, oldvalue, newvalue)
 +
| Called whenever the value of a memory record has changed by the user.
 +
|}
  
; getAddress() &#58; integer - (integer, table)
+
== Global Events ==
: Returns the interpretable addressstring of this record.
+
<pre>
: If it is a pointer, it returns a second result as a table filled with the offsets
+
function onMemRecPreExecute(memoryrecord, newstate BOOLEAN)
 +
  -- Called before action is performed. Active property is about to change to newState.
 +
end
  
; setAddress(''string'')
+
function onMemRecPostExecute(memoryrecord, newState BOOLEAN, succeeded BOOLEAN)
: Sets the interpretable address string, and if offsets are provided make it a pointer
+
  -- Called after action is performed. Active property was supposed to change to newState.
 +
  -- If 'succeeded' is true, Active state has changed and is newState.
 +
end
 +
</pre>
  
; getOffsetCount() &#58; integer
+
== Examples ==
: Returns the number of offsets for this memoryrecord
+
<pre>
 
+
-- Get the first memory record in the address list
; setOffsetCount(''integer'')
+
local mr = AddressList[0]
: Lets you set the number of offsets
 
 
 
; getOffset(''index'') &#58; integer
 
: Gets the offset at the given index
 
 
 
; setOffset(''index'', ''value'')
 
: Sets the offset at the given index
 
 
 
; getCurrentAddress() &#58; integer
 
: Returns the current address as an integer (the final result of the interpretable address and pointer offsets)
 
  
; appendToEntry(''memrec'')
+
-- Print some basic properties
: Appends the current memory record to the given memory record
+
print("ID:", mr.ID)
 +
print("Description:", mr.Description)
 +
print("Address:", mr.Address)
 +
print("Current Value:", mr.Value)
 +
print("Active:", mr.Active)
  
; getHotkey(''index'') &#58; [[GenericHotkey]]
+
-- Change the value and activate the record
: Returns the hotkey from the hotkey array
+
mr.Value = "999"
 
+
mr.Active = true
; getHotkeyByID(''integer'') &#58; [[GenericHotkey]]
+
</pre>
: Returns the hotkey with the given id
 
 
 
; [''index''] : MemoryRecord
 
: Same as 'Child[''index'']'
 
: Default accessor.
 
 
 
== Examples ==
 
local addressList = getAddressList()
 
local mrHealth = addressList.getMemoryRecordByDescription('Health')
 
print(mrHealth.Description)
 
print(mrHealth.Active and 'Ture' or 'False')
 
  
== 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 ===
* [[Addresslist]]
+
* [[Lua:Class:Addresslist|Addresslist]]

Latest revision as of 13:39, 11 July 2025

MemoryRecord class: (Inheritance: Object)

The MemoryRecord class represents an entry in the Cheat Engine address list. Each memory record can represent an address, pointer, script, or group header, and provides access to its properties, children, hotkeys, and events.

Properties[edit]

Property Type Description
ID Integer Unique ID of the memory record.
Index Integer The index of this record in the address list (0 is top, ReadOnly).
Description String The description of the memory record.
Address String Get/set the interpretable address string.
AddressString String The address string shown in CE (ReadOnly).
OffsetCount Integer The number of offsets. Set to 0 for a normal address.
Offset[] Integer Array to access each offset.
OffsetText[] String Array to access each offset using interpretable text style.
CurrentAddress Integer The address the memory record points to.
VarType ValueType (string) The variable type of this record. See vtByte to vtCustom.
Type ValueType (number) The variable type of this record. See vtByte to vtCustom.
CustomTypeName String If the type is vtCustom, this contains the name of the CustomType.
Script String If the type is vtAutoAssembler, this contains the auto assembler script.
Value String The value in string form.
NumericalValue Number The value in numerical form, or nil if it cannot be parsed.
Selected Boolean True if selected (ReadOnly).
Active Boolean Set to true to activate/freeze, false to deactivate/unfreeze.
Color Integer The color of the memory record.
ShowAsHex Boolean Show value as hexadecimal.
ShowAsSigned Boolean Show value as signed.
AllowIncrease Boolean Allow value increasing; unfreeze resets to false.
AllowDecrease Boolean Allow value decreasing; unfreeze resets to false.
Collapsed Boolean Set to true to collapse this record, false to expand.
IsGroupHeader Boolean True if the record is a group header with no address or value info.
IsAddressGroupHeader Boolean True if the record is a group header with address.
IsReadable Boolean False if record contains an unreadable address (ReadOnly, set after value is accessed).
Options String set A string enclosed by square brackets with options separated by commas (e.g., [moHideChildren,moActivateChildrenAsWell]).
DropDownLinked Boolean True if dropdown list refers to another memory record's list.
DropDownLinkedMemrec String Description of linked memory record or empty string if not linked.
DropDownList StringList List of "value:description" lines; read-write.
DropDownReadOnly Boolean True if 'Disallow manual user input' is set.
DropDownDescriptionOnly Boolean Self-explanatory.
DisplayAsDropDownListItem Boolean Self-explanatory.
DropDownCount Integer Equivalent to .DropDownList.Count.
DropDownValue[index] String Array to access values in DropDownList (ReadOnly).
DropDownDescription[index] String Array to access descriptions in DropDownList (ReadOnly).
Count Integer Number of child records.
Child[index] MemoryRecord Array to access child records.
Parent MemoryRecord The parent of the memory record.
HotkeyCount Integer Number of hotkeys attached to this memory record.
Hotkey[index] GenericHotkey Array to index the hotkeys.
Async Boolean Set to true if activating this entry will be asynchronous (only for AA/Lua scripts).
AsyncProcessing Boolean True when async is true and it's being processed.
AsyncProcessingTime Qword The time that it has been processing in milliseconds.
HasMouseOver Boolean True if the mouse is currently over it.
DontSave Boolean Don't save this memoryrecord and its children.

Special Properties by Type[edit]

  • vtString: String.Size, String.Unicode, String.Codepage
  • vtBinary: Binary.Startbit, Binary.Size
  • vtByteArray: Aob.Size

Variable Types[edit]

Constant Value Description
vtByte 0 1 byte (unsigned)
vtWord 1 2 bytes (unsigned)
vtDword 2 4 bytes (unsigned)
vtQword 3 8 bytes (unsigned)
vtSingle 4 4 bytes (float)
vtDouble 5 8 bytes (double/float)
vtString 6 String (ASCII)
vtUnicodeString
vtWideString
7 Unicode string (Only used by autoguess)
vtByteArray 8 Array of bytes
vtBinary 9 Binary (bitfield)
vtAll 10 All types (used for scans)
vtAutoAssembler 11 Auto Assembler script
vtPointer 12 Pointer (Only used by autoguess and structures)
vtCustom 13 Custom type
vtGrouped 14 Grouped type

MemoryRecord Options[edit]

The following options can be set in the `Options` property of a MemoryRecord. The value is a string enclosed in square brackets, with options separated by commas (e.g., `[moHideChildren,moActivateChildrenAsWell]`).

Option Description
moHideChildren Hides the child records of this memory record.
moActivateChildrenAsWell Activating this record also activates its children.
moDeactivateChildrenAsWell Deactivating this record also deactivates its children.
moRecursiveSetValue Setting the value will also set the value of all children recursively.
moAllowManualCollapseAndExpand Allows the user to manually collapse or expand this record in the address list.
moManualExpandCollapse Enables manual expand/collapse behavior for this record.
moAlwaysHideChildren Always hides the children, regardless of other settings.

Methods[edit]

Method Parameters Returns Description
getDescription None String Gets the description.
setDescription String None Sets the description.
getAddress None String, Table Returns the interpretable address string. If pointer, returns a table of offsets as second result.
setAddress String None Sets the interpretable address string (and offsets if pointer).
getOffsetCount None Integer Returns the number of offsets.
setOffsetCount Integer None Sets the number of offsets.
getOffset Integer (index) Integer Gets the offset at the given index.
setOffset Integer (index), Integer (value) None Sets the offset at the given index.
getCurrentAddress None Integer Returns the current address as an integer.
appendToEntry MemoryRecord None Appends the current memory record to the given memory record.
getHotkey Integer (index) MemoryRecordHotkey Returns the hotkey from the hotkey array.
getHotkeyByID Integer (id) MemoryRecordHotkey Returns the hotkey with the given id.
reinterpret None None Reinterprets the memory record.
createHotkey Table (keys), Integer (action), String (value, optional), String (description, optional) MemoryRecordHotkey Creates a hotkey object.
disableWithoutExecute None None Sets the entry to disabled without executing the disable section.
beginEdit None None Call when you wish to take a long time to edit a record.
endEdit None None Marks the end of your long edit sequence.

Events / Callbacks[edit]

Event Parameters Description
OnActivate function(memoryrecord, before, currentstate):boolean Called when the memoryrecord will change (or changed) Active to true. If before is true, not returning true will cause the activation to stop.
OnDeactivate function(memoryrecord, before, currentstate):boolean Called when the memoryrecord will change (or changed) Active to false. If before is true, not returning true will cause the deactivation to stop.
OnActivationFailure function(memoryrecord, reason, reasonText) Called when activating a record fails. Return true to try again (be careful of infinite loops).
OnDestroy function() Called when the memoryrecord is destroyed.
OnGetDisplayValue function(memoryrecord, valuestring):boolean,string Called when rendering the value of a memory record. Return true and a new string to override the value shown.
OnValueChanged function(memoryrecord, oldvalue, newvalue) Called whenever the value of a memory record has changed.
OnValueChangedByUser function(memoryrecord, oldvalue, newvalue) Called whenever the value of a memory record has changed by the user.

Global Events[edit]

function onMemRecPreExecute(memoryrecord, newstate BOOLEAN)
  -- Called before action is performed. Active property is about to change to newState.
end

function onMemRecPostExecute(memoryrecord, newState BOOLEAN, succeeded BOOLEAN)
  -- Called after action is performed. Active property was supposed to change to newState.
  -- If 'succeeded' is true, Active state has changed and is newState.
end

Examples[edit]

-- Get the first memory record in the address list
local mr = AddressList[0]

-- Print some basic properties
print("ID:", mr.ID)
print("Description:", mr.Description)
print("Address:", mr.Address)
print("Current Value:", mr.Value)
print("Active:", mr.Active)

-- Change the value and activate the record
mr.Value = "999"
mr.Active = true

See also[edit]

Related Functions[edit]

Related Classes[edit]