<> Function
function copyMemory(sourceAddress, size, destinationAddress, Method) : integer or nil
|
Copies memory from the given source address to the destination address.
If destinationAddress is omitted or nil, Cheat Engine will allocate a random destination address for the copy.
The Method parameter controls whether the source and destination addresses are interpreted as target process memory or Cheat Engine memory.
Function Parameters[edit]
| Parameter
|
Type
|
Description
|
| sourceAddress
|
Integer or CEAddressString
|
The source address to copy memory from.
|
| size
|
Integer
|
The number of bytes to copy.
|
| destinationAddress
|
Integer or CEAddressString (semi-optional)
|
The destination address to copy memory to. If omitted or nil, Cheat Engine will allocate a random destination address.
|
| Method
|
Integer (optional)
|
The copy method to use. If omitted or nil, method 0 is used.
|
Method Values[edit]
| Value
|
Method
|
Description
|
| nil or 0
|
Target process to target process
|
Copies memory from the target process to the target process.
|
| 1
|
Target process to Cheat Engine memory
|
Copies memory from the target process to Cheat Engine memory.
|
| 2
|
Cheat Engine memory to target process
|
Copies memory from Cheat Engine memory to the target process.
|
| 3
|
Cheat Engine memory to Cheat Engine memory
|
Copies memory from Cheat Engine memory to Cheat Engine memory.
|
Returns[edit]
integer or nil — The address of the copied memory on success, or nil on failure.
Examples[edit]
local source = getAddress("game.exe")
local copiedAddress = copyMemory(source, 1024)
if copiedAddress ~= nil then
print("Copied memory to: " .. string.format("%X", copiedAddress))
else
print("Failed to copy memory")
end
local source = getAddress("game.exe")
local destination = allocateMemory(1024)
local copiedAddress = copyMemory(source, 1024, destination)
if copiedAddress ~= nil then
print("Copied memory to: " .. string.format("%X", copiedAddress))
end
local source = getAddress("game.exe")
-- Copy memory from the target process to Cheat Engine memory
local copiedAddress = copyMemory(source, 1024, nil, 1)
if copiedAddress ~= nil then
print("Copied memory to CE memory: " .. string.format("%X", copiedAddress))
end
See also[edit]