Difference between revisions of "Lua:writeFloat"

From Cheat Engine
Jump to navigation Jump to search
m (Syntax Highlighting.)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''function''' writeFloat(''Address'', ''Value'')
+
[[Category:Lua]]
 +
{{CodeBox|'''function''' writeFloat(''Address'', ''Value'') ''':''' Boolean}}
  
Writes 4 bytes at the given address representing the value you have given as a single precision floating point
+
Writes a single precision (32-bit) floating point value to the specified address in the currently opened (target) process. 
 +
Returns true on success.
  
 
===Function Parameters===
 
===Function Parameters===
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 10: Line 12:
 
|-
 
|-
 
|Address
 
|Address
|[[CEAddressString]] or Integer
+
|Integer or [[CEAddressString]]
|The address of the target process to write to
+
|The address in the target process to write to.
 
|-
 
|-
 
|Value
 
|Value
|Float
+
|Number
|The value to write to the process
+
|The single precision floating point value to write.
 
|}
 
|}
  
 +
===Returns===
 +
Boolean — true if the write was successful, false otherwise.
  
== See also ==
+
===Examples===
* [[readFloat]]
+
<syntaxhighlight lang="lua" line>
* [[writeBytes]]
+
-- Write a float to address 0x123456
* [[writeInteger]]
+
local success = writeFloat(0x123456, 3.14)
* [[writeDouble]]
+
print("Write successful:", success)
* [[writeString]]
+
 
* [[Lua]]
+
-- Write to a CEAddressString
 +
writeFloat("game.exe+1234", 2.718)
 +
</syntaxhighlight>
 +
 
 +
{{LuaSeeAlso}}
 +
 
 +
{{ReadWriteMemory}}

Latest revision as of 15:42, 25 June 2026

<> Lua API Reference

function writeFloat(Address, Value) : Boolean

Writes a single precision (32-bit) floating point value to the specified address in the currently opened (target) process. Returns true on success.

Function Parameters[edit]

Parameter Type Description
Address Integer or CEAddressString The address in the target process to write to.
Value Number The single precision floating point value to write.

Returns[edit]

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

Examples[edit]

1 -- Write a float to address 0x123456
2 local success = writeFloat(0x123456, 3.14)
3 print("Write successful:", success)
4 
5 -- Write to a CEAddressString
6 writeFloat("game.exe+1234", 2.718)

Main Pages

Core Lua documentation entry points

Lua
Script Engine