Difference between revisions of "Lua:writeBytesLocal"

From Cheat Engine
Jump to navigation Jump to search
m
m (Syntax Highlighting.)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' writeBytesLocal(''Address'', ''Byte1'', [''Byte2'', ...])
+
{{CodeBox|'''function''' writeBytesLocal(''Address'', ''Byte1'', [''Byte2'', ...])}}
  
'''function''' writeBytesLocal(''Address'', ''Table'', [''Count''])
+
{{CodeBox|'''function''' writeBytesLocal(''Address'', ''Table'', [''Count''])}}
  
Writes bytes to the specified address in Cheat Engine's own process memory (not the target 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.
 
This is similar to [[writeBytes]], but operates on Cheat Engine itself.
  
 
===Function Parameters===
 
===Function Parameters===
 +
'''writeBytesLocal(address, byte1, [byte2, ...])'''
 
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
Line 14: Line 15:
 
|-
 
|-
 
|Address
 
|Address
|Integer
+
|[[CEAddressString]] or Integer
 
|The address in Cheat Engine's memory to write to.
 
|The address in Cheat Engine's memory to write to.
 
|-
 
|-
Line 20: Line 21:
 
|Integer
 
|Integer
 
|The bytes to write (as separate arguments).
 
|The bytes to write (as separate arguments).
 +
|}
 +
 +
'''writeBytesLocal(address, table, [count])'''
 +
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 +
!align="left"|Parameter
 +
!align="left"|Type
 +
!style="width: 80%;background-color:white;" align="left"|Description
 +
|-
 +
|Address
 +
|[[CEAddressString]] or Integer
 +
|The address in Cheat Engine's memory to write to.
 
|-
 
|-
 
|Table
 
|Table
Line 34: Line 46:
  
 
===Examples===
 
===Examples===
<pre>
+
<syntaxhighlight lang="lua" line>
 
-- Write 4 bytes to a local address
 
-- Write 4 bytes to a local address
 
writeBytesLocal(0x123456, 0x90, 0x90, 0x90, 0x90)
 
writeBytesLocal(0x123456, 0x90, 0x90, 0x90, 0x90)
Line 44: Line 56:
 
-- Write only the first 2 bytes from the table
 
-- Write only the first 2 bytes from the table
 
writeBytesLocal(0x654321, bytes, 2)
 
writeBytesLocal(0x654321, bytes, 2)
</pre>
+
</syntaxhighlight>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}
  
=== Related Functions ===
 
 
{{ReadWriteMemory}}
 
{{ReadWriteMemory}}

Latest revision as of 15:43, 25 June 2026

<> Lua API Reference

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

<> Lua API Reference

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]

1 -- Write 4 bytes to a local address
2 writeBytesLocal(0x123456, 0x90, 0x90, 0x90, 0x90)
3 
4 -- Write bytes from a table
5 local bytes = {0xDE, 0xAD, 0xBE, 0xEF}
6 writeBytesLocal(0x654321, bytes)
7 
8 -- Write only the first 2 bytes from the table
9 writeBytesLocal(0x654321, bytes, 2)

Main Pages

Core Lua documentation entry points

Lua
Script Engine