Difference between revisions of "Lua:byteTableToQword"

From Cheat Engine
Jump to navigation Jump to search
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''function''' byteTableToQword(''Table'') ''':''' integer
+
[[Category:Lua]]
 +
'''function''' byteTableToQword(''Table'') ''':''' Number
  
Converts a byte table to a QWORD (8 bytes), interpreting them as an integer.
+
Converts a table of bytes to a 64-bit qword (integer).
  
 
+
===Function Parameters===
=== Function Parameters ===
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
 
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 11: Line 11:
 
|-
 
|-
 
|Table
 
|Table
|table
+
|Table
|The table of bytes to convert
+
|A table containing the bytes to convert (least significant byte first).
 
|}
 
|}
  
 +
===Returns===
 +
Number — The resulting 64-bit qword (integer).
  
== Examples ==
+
===Explanation===
Code:
+
The function takes a table of bytes (e.g., <code>{0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11}</code>) and combines them into a single 64-bit value.
  local bt = { 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
+
The first element is the least significant byte (little-endian order).
  local value = byteTableToQword(bt)
 
  print(string.format('0x%0X', value))
 
  print(value)
 
  
Output:
+
For example, <code>byteTableToQword({0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11})</code> returns <code>0x1122334455667788</code>.
  0x64
 
  100
 
  
 +
===Examples===
 +
<pre>
 +
local qword = byteTableToQword({0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11})
 +
print(string.format("0x%X", qword)) -- Output: 0x1122334455667788
 +
</pre>
  
== 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]]
 
* [[doubleToByteTable]]
 
* [[stringToByteTable]]
 
* [[wideStringToByteTable]]
 
* [[byteTableToWord]]
 
* [[byteTableToDword]]
 
* [[byteTableToFloat]]
 
* [[byteTableToDouble]]
 
* [[byteTableToString]]
 
* [[byteTableToWideString]]
 

Latest revision as of 17:38, 11 July 2025

function byteTableToQword(Table) : Number

Converts a table of bytes to a 64-bit qword (integer).

Function Parameters[edit]

Parameter Type Description
Table Table A table containing the bytes to convert (least significant byte first).

Returns[edit]

Number — The resulting 64-bit qword (integer).

Explanation[edit]

The function takes a table of bytes (e.g., {0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11}) and combines them into a single 64-bit value. The first element is the least significant byte (little-endian order).

For example, byteTableToQword({0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11}) returns 0x1122334455667788.

Examples[edit]

local qword = byteTableToQword({0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11})
print(string.format("0x%X", qword)) -- Output: 0x1122334455667788

See also[edit]

Related Functions[edit]