Difference between revisions of "Lua:floatToByteTable"

From Cheat Engine
Jump to navigation Jump to search
(Created page with ''''function''' floatToByteTable(''Number'') Converts a DWORD (4 bytes), interpreted as a single precision floating point, to a byte table. === Function Parameters === {|width=…')
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''function''' floatToByteTable(''Number'')
+
[[Category:Lua]]
 +
'''function''' floatToByteTable(''Number'') ''':''' table
  
 
Converts a DWORD (4 bytes), interpreted as a single precision floating point, to a byte table.
 
Converts a DWORD (4 bytes), interpreted as a single precision floating point, to a byte table.
Line 47: Line 48:
  
  
== See also ==
+
{{LuaSeeAlso}}
* [[Lua]]
 
* [[Help_File:Script engine|Script engine]]
 
  
 
=== 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]]
 
* [[writeBytesLocal]]
 
* [[writeIntegerLocal]]
 
* [[writeQwordLocal]]
 
* [[writeFloatLocal]]
 
* [[writeDoubleLocal]]
 
* [[writeStringLocal]]
 
* [[wordToByteTable]]
 
* [[dwordToByteTable]]
 
* [[qwordToByteTable]]
 
* [[doubleToByteTable]]
 
* [[stringToByteTable]]
 
* [[wideStringToByteTable]]
 
* [[byteTableToWord]]
 
* [[byteTableToDword]]
 
* [[byteTableToQword]]
 
* [[byteTableToFloat]]
 
* [[byteTableToDouble]]
 
* [[byteTableToString]]
 
* [[byteTableToWideString]]
 

Latest revision as of 00:06, 25 January 2018

function floatToByteTable(Number) : table

Converts a DWORD (4 bytes), interpreted as a single precision floating point, to a byte table.


Function Parameters[edit]

Parameter Type Description
Number number The number to convert to a byte table


Examples[edit]

 local bt = floatToByteTable(100.0)
 writeBytes('00123ABC', bt)


Code:

 local bt = floatToByteTable(10)
 for i, v in ipairs(bt) do
   print(i - 1, string.format('%02X', v))
 end

Output:

 0 00 
 1 00 
 2 20 
 3 41


Code:

 local bt = floatToByteTable(10.9)
 for i, v in ipairs(bt) do
   print(i - 1, string.format('%02X', v))
 end

Output:

 0 66 
 1 66 
 2 2E 
 3 41 


See also[edit]

Related Functions[edit]