Difference between revisions of "Lua:writeBytesLocal"

From Cheat Engine
Jump to navigation Jump to search
m (Added CodeBox Template.)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' writeBytesLocal(''Address'', ''Byte1'', ''Byte2'', ''Byte3'', ... )
+
{{CodeBox|'''function''' writeBytesLocal(''Address'', ''Byte1'', [''Byte2'', ...])}}
  
'''function''' writeBytesLocal(''Address'', ''Table'', ''Count'' )
+
{{CodeBox|'''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'', ... )
+
'''writeBytesLocal(address, byte1, [byte2, ...])'''
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="1"
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 18: Line 16:
 
|Address
 
|Address
 
|[[CEAddressString]] or Integer
 
|[[CEAddressString]] or Integer
|The address to write to
+
|The address in Cheat Engine's memory to write to.
|-
 
|Byte1
 
|Integer
 
|The first byte
 
|-
 
|Byte2
 
|Integer
 
|The second byte
 
 
|-
 
|-
|...
+
|Byte1, Byte2, ...
 
|Integer
 
|Integer
|All the other bytes (Max around 20)
+
|The bytes to write (as separate arguments).
 
|}
 
|}
<br>
+
 
'''function''' writeBytes(''Address'', ''Table'') <span style="color:#ff0000">Warning: Bugged in CE 6.1</span>
+
'''writeBytesLocal(address, table, [count])'''
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="1"
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 41: Line 31:
 
|Address
 
|Address
 
|[[CEAddressString]] or Integer
 
|[[CEAddressString]] or Integer
|The address to write to
+
|The address in Cheat Engine's memory 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.
 
|}
 
|}
  
== See also ==
+
'''Note:''' 
* [[Lua]]
+
The value written will be in the Cheat Engine process instead of the targeted process.
* [[Help_File:Script engine|Script engine]]
+
 
 +
===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}}
  
 
=== Related Functions ===
 
=== Related Functions ===
* [[readBytes]]
+
{{ReadWriteMemory}}
* [[readInteger]]
 
* [[readQword]]
 
* [[readPointer]]
 
* [[readFloat]]
 
* [[readDouble]]
 
* [[readString]]
 
* [[writeBytes]]
 
* [[writeInteger]]
 
* [[writeQword]]
 
* [[writeFloat]]
 
* [[writeDouble]]
 
* [[writeString]]
 
* [[readBytesLocal]]
 
* [[readIntegerLocal]]
 
* [[readQwordLocal]]
 
* [[readPointerLocal]]
 
* [[readFloatLocal]]
 
* [[readDoubleLocal]]
 
* [[readStringLocal]]
 
* [[writeIntegerLocal]]
 
* [[writeQwordLocal]]
 
* [[writeFloatLocal]]
 
* [[writeDoubleLocal]]
 
* [[writeStringLocal]]
 
* [[wordToByteTable]]
 
* [[dwordToByteTable]]
 
* [[qwordToByteTable]]
 
* [[floatToByteTable]]
 
* [[doubleToByteTable]]
 
* [[stringToByteTable]]
 
* [[wideStringToByteTable]]
 
* [[byteTableToWord]]
 
* [[byteTableToDword]]
 
* [[byteTableToQword]]
 
* [[byteTableToFloat]]
 
* [[byteTableToDouble]]
 
* [[byteTableToString]]
 
* [[byteTableToWideString]]
 

Latest revision as of 23:04, 4 December 2025

<> Function

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

<> Function

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[edit]

writeBytesLocal(address, byte1, [byte2, ...])

Parameter Type Description
Address CEAddressString or Integer The address in Cheat Engine's memory to write to.
Byte1, Byte2, ... Integer The bytes to write (as separate arguments).

writeBytesLocal(address, table, [count])

Parameter Type Description
Address CEAddressString or Integer The address in Cheat Engine's memory to write to.
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[edit]

-- 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[edit]

Lua
Script Engine

Related Functions[edit]

Read Functions
readBytes
readSmallInteger
readInteger
readQword
readPointer
readFloat
readDouble
readString
Read Functions (Local Process)
readBytesLocal
readIntegerLocal
readQwordLocal
readPointerLocal
readFloatLocal
readDoubleLocal
readStringLocal
Write Functions
writeBytes
writeSmallInteger
writeInteger
writeQword
writeFloat
writeDouble
writeString
Write Functions (Local Process)
writeBytesLocal
writeIntegerLocal
writeQwordLocal
writeFloatLocal
writeDoubleLocal
writeStringLocal
Byte Table Conversions (Value → Byte Table)
wordToByteTable
dwordToByteTable
qwordToByteTable
floatToByteTable
doubleToByteTable
stringToByteTable
wideStringToByteTable
Byte Table Conversions (Byte Table → Value)
byteTableToWord
byteTableToDword
byteTableToQword
byteTableToFloat
byteTableToDouble
byteTableToString
byteTableToWideString