Difference between revisions of "Lua:doubleToByteTable"

From Cheat Engine
Jump to navigation Jump to search
 
(One intermediate revision by one other user not shown)
Line 56: Line 56:
  
  
== 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]]
 
* [[floatToByteTable]]
 
* [[stringToByteTable]]
 
* [[wideStringToByteTable]]
 
* [[byteTableToWord]]
 
* [[byteTableToDword]]
 
* [[byteTableToQword]]
 
* [[byteTableToFloat]]
 
* [[byteTableToDouble]]
 
* [[byteTableToString]]
 
* [[byteTableToWideString]]
 

Latest revision as of 00:07, 25 January 2018

function doubleToByteTable(Number) : table

Converts a QWORD (8 bytes), interpreted as a double 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 = doubleToByteTable(100.0)
 writeBytes('00123ABC', bt)


Code:

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

Output:

 0 00 
 1 00 
 2 00 
 3 00 
 4 00 
 5 00 
 6 24 
 7 40 


Code:

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

Output:

 0 CD 
 1 CC 
 2 CC 
 3 CC 
 4 CC 
 5 CC 
 6 25 
 7 40 


See also[edit]

Related Functions[edit]