Difference between revisions of "Lua:writeStringLocal"

From Cheat Engine
Jump to navigation Jump to search
m
m (Syntax Highlighting.)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' writeStringLocal(''Address'', ''String'', [''WideChar'']) ''':''' Boolean
+
{{CodeBox|'''function''' writeStringLocal(''Address'', ''String'', [''WideChar'']) ''':''' Boolean}}
  
 
Writes a string to the specified address in Cheat Engine's own process memory (not the target process).   
 
Writes a string to the specified address in Cheat Engine's own process memory (not the target process).   
Line 29: Line 29:
  
 
===Examples===
 
===Examples===
<pre>
+
<syntaxhighlight lang="lua" line>
 
-- Write an ASCII string to address 0x123456 in CE's memory
 
-- Write an ASCII string to address 0x123456 in CE's memory
 
local success = writeStringLocal(0x123456, "Hello, Cheat Engine!")
 
local success = writeStringLocal(0x123456, "Hello, Cheat Engine!")
Line 36: Line 36:
 
-- Write a widechar (Unicode) string to a CEAddressString
 
-- Write a widechar (Unicode) string to a CEAddressString
 
writeStringLocal("00400000+10", "Unicode Text", true)
 
writeStringLocal("00400000+10", "Unicode Text", true)
</pre>
+
</syntaxhighlight>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}
  
=== Related Functions ===
+
{{RelatedStrings}}
* [[ansiToUtf8]]
+
 
* [[utf8ToAnsi]]
 
* [[translate]]
 
 
{{ReadWriteMemory}}
 
{{ReadWriteMemory}}

Latest revision as of 15:44, 25 June 2026

<> Lua API Reference

function writeStringLocal(Address, String, [WideChar]) : Boolean

Writes a string to the specified address in Cheat Engine's own process memory (not the target process). Set WideChar to true to write the string as widechar (UTF-16/Unicode). Returns true on success.

Function Parameters[edit]

Parameter Type Description
Address Integer or CEAddressString The address in Cheat Engine's memory to write to.
String String The string to write.
WideChar Boolean (optional) Set to true to write as a widechar (UTF-16/Unicode) string. Default is false (ASCII/ANSI).

Returns[edit]

Boolean — true if the write was successful, false otherwise.

Examples[edit]

1 -- Write an ASCII string to address 0x123456 in CE's memory
2 local success = writeStringLocal(0x123456, "Hello, Cheat Engine!")
3 print("Write successful:", success)
4 
5 -- Write a widechar (Unicode) string to a CEAddressString
6 writeStringLocal("00400000+10", "Unicode Text", true)

Main Pages

Core Lua documentation entry points

Lua
Script Engine

String Related Lua Functions

Encoding conversion and localized text helpers