Difference between revisions of "Lua:floatToByteTable"
Jump to navigation
Jump to search
| Line 48: | Line 48: | ||
| − | + | {{LuaSeeAlso}} | |
| − | |||
| − | |||
=== Related Functions === | === Related Functions === | ||
| − | + | {{ReadWriteMemory}} | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Revision as of 09:26, 4 July 2017
function floatToByteTable(Number) : table
Converts a DWORD (4 bytes), interpreted as a single precision floating point, to a byte table.
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| Number | number | The number to convert to a byte table |
Examples
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
Main Pages
Related Functions
Memory Access Related Lua Functions
Read Functions
Read Functions (Local Process)
Write Functions
Write Functions (Local Process)
Byte Table Conversions (Value → Byte Table)
Byte Table Conversions (Byte Table → Value)