Difference between revisions of "Lua:byteTableToDouble"
Jump to navigation
Jump to search
m (Added CodeBox Template.) |
m (Syntax Highlighting.) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 24: | Line 24: | ||
===Examples=== | ===Examples=== | ||
| − | < | + | <syntaxhighlight lang="lua" line> |
local doubleValue = byteTableToDouble({0x1F, 0x85, 0xEB, 0x51, 0xB8, 0x1E, 0x09, 0x40}) | local doubleValue = byteTableToDouble({0x1F, 0x85, 0xEB, 0x51, 0xB8, 0x1E, 0x09, 0x40}) | ||
print(doubleValue) -- Output: 3.14 | print(doubleValue) -- Output: 3.14 | ||
| − | </ | + | </syntaxhighlight> |
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
| − | |||
{{ReadWriteMemory}} | {{ReadWriteMemory}} | ||
Latest revision as of 15:48, 25 June 2026
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]
1 local doubleValue = byteTableToDouble({0x1F, 0x85, 0xEB, 0x51, 0xB8, 0x1E, 0x09, 0x40})
2 print(doubleValue) -- Output: 3.14