Difference between revisions of "Lua:byteTableToDouble"
Jump to navigation
Jump to search
m |
m (Added CodeBox Template.) |
||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | '''function''' byteTableToDouble(''Table'') ''':''' Number | + | {{CodeBox|'''function''' byteTableToDouble(''Table'') ''':''' Number}} |
Converts a table of bytes to a double precision (64-bit) floating point number. | Converts a table of bytes to a double precision (64-bit) floating point number. | ||
Latest revision as of 23:12, 4 December 2025
| <> Function function byteTableToDouble(Table) : Number |
Converts a table of bytes to a double precision (64-bit) floating point number.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| Table | Table | A table containing the bytes to convert (least significant byte first). |
Returns[edit]
Number — The resulting double precision floating point value.
Explanation[edit]
The function takes a table of bytes (e.g., {0x1F, 0x85, 0xEB, 0x51, 0xB8, 0x1E, 0x09, 0x40}) and interprets them as a 64-bit double in little-endian order.
For example, byteTableToDouble({0x1F, 0x85, 0xEB, 0x51, 0xB8, 0x1E, 0x09, 0x40}) returns 3.14.
Examples[edit]
local doubleValue = byteTableToDouble({0x1F, 0x85, 0xEB, 0x51, 0xB8, 0x1E, 0x09, 0x40})
print(doubleValue) -- Output: 3.14
See also[edit]
| Lua |
| Script Engine |
Related Functions[edit]
| Read Functions |
|---|
| readBytes |
| readSmallInteger |
| readInteger |
| readQword |
| readPointer |
| readFloat |
| readDouble |
| readString |
| Read Functions (Local Process) |
| readBytesLocal |
| readIntegerLocal |
| readQwordLocal |
| readPointerLocal |
| readFloatLocal |
| readDoubleLocal |
| readStringLocal |
| Write Functions |
| writeBytes |
| writeSmallInteger |
| writeInteger |
| writeQword |
| writeFloat |
| writeDouble |
| writeString |
| Write Functions (Local Process) |
| writeBytesLocal |
| writeIntegerLocal |
| writeQwordLocal |
| writeFloatLocal |
| writeDoubleLocal |
| writeStringLocal |
| Byte Table Conversions (Value → Byte Table) |
| wordToByteTable |
| dwordToByteTable |
| qwordToByteTable |
| floatToByteTable |
| doubleToByteTable |
| stringToByteTable |
| wideStringToByteTable |
| Byte Table Conversions (Byte Table → Value) |
| byteTableToWord |
| byteTableToDword |
| byteTableToQword |
| byteTableToFloat |
| byteTableToDouble |
| byteTableToString |
| byteTableToWideString |