Difference between revisions of "Lua:writeBytesLocal"

From Cheat Engine
Jump to navigation Jump to search
(no need to warn for obsolete CE builds)
m
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' writeBytesLocal(''Address'', ''Byte1'', ''Byte2'', ''Byte3'', ... )
+
'''function''' writeBytesLocal(''Address'', ''Byte1'', [''Byte2'', ...])
  
'''function''' writeBytesLocal(''Address'', ''Table'', ''Count'' )
+
'''function''' writeBytesLocal(''Address'', ''Table'', [''Count''])
 
 
Write the bytes to the given address in Cheat Engine's memory.
 
 
 
Note: The value written will be in the Cheat Engine process instead of the targeted process.
 
  
 +
Writes bytes to the specified address in Cheat Engine's own process memory (not the target process). 
 +
This is similar to [[writeBytes]], but operates on Cheat Engine itself.
  
 
===Function Parameters===
 
===Function Parameters===
'''function''' writeBytes(''Address'', ''Byte1'', ''Byte2'', ''Byte3'', ... )
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="1"
 
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 17: Line 14:
 
|-
 
|-
 
|Address
 
|Address
|[[CEAddressString]] or Integer
 
|The address to write to
 
|-
 
|Byte1
 
|Integer
 
|The first byte
 
|-
 
|Byte2
 
 
|Integer
 
|Integer
|The second byte
+
|The address in Cheat Engine's memory to write to.
 
|-
 
|-
|...
+
|Byte1, Byte2, ...
 
|Integer
 
|Integer
|All the other bytes (Max around 20)
+
|The bytes to write (as separate arguments).
|}
 
<br>
 
'''function''' writeBytes(''Address'', ''Table'')
 
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="1"
 
!align="left"|Parameter
 
!align="left"|Type
 
!style="width: 80%;background-color:white;" align="left"|Description
 
|-
 
|Address
 
|[[CEAddressString]] or Integer
 
|The address to write to
 
 
|-
 
|-
 
|Table
 
|Table
 
|Table
 
|Table
|A table consisting of integers to be written to
+
|A table containing the bytes to write.
 +
|-
 +
|Count
 +
|Integer (optional)
 +
|The number of bytes to write from the table.
 
|}
 
|}
 +
 +
'''Note:''' 
 +
The value written will be in the Cheat Engine process instead of the targeted process.
 +
 +
===Examples===
 +
<pre>
 +
-- Write 4 bytes to a local address
 +
writeBytesLocal(0x123456, 0x90, 0x90, 0x90, 0x90)
 +
 +
-- Write bytes from a table
 +
local bytes = {0xDE, 0xAD, 0xBE, 0xEF}
 +
writeBytesLocal(0x654321, bytes)
 +
 +
-- Write only the first 2 bytes from the table
 +
writeBytesLocal(0x654321, bytes, 2)
 +
</pre>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}

Revision as of 15:53, 11 July 2025

function writeBytesLocal(Address, Byte1, [Byte2, ...])

function writeBytesLocal(Address, Table, [Count])

Writes bytes to the specified address in Cheat Engine's own process memory (not the target process). This is similar to writeBytes, but operates on Cheat Engine itself.

Function Parameters

Parameter Type Description
Address Integer The address in Cheat Engine's memory to write to.
Byte1, Byte2, ... Integer The bytes to write (as separate arguments).
Table Table A table containing the bytes to write.
Count Integer (optional) The number of bytes to write from the table.

Note: The value written will be in the Cheat Engine process instead of the targeted process.

Examples

-- Write 4 bytes to a local address
writeBytesLocal(0x123456, 0x90, 0x90, 0x90, 0x90)

-- Write bytes from a table
local bytes = {0xDE, 0xAD, 0xBE, 0xEF}
writeBytesLocal(0x654321, bytes)

-- Write only the first 2 bytes from the table
writeBytesLocal(0x654321, bytes, 2)

See also

Related Functions