Lua:floatToByteTable
Jump to navigation
Jump to search
function floatToByteTable(Number) : Table
Converts a single precision (32-bit) floating point number to a table of bytes.
Function Parameters
Parameter | Type | Description |
---|---|---|
Number | Number | The single precision floating point value to convert. |
Returns
Table — A table containing the bytes representing the float.
Examples
local bytes = floatToByteTable(3.14) for i, b in ipairs(bytes) do print(string.format("Byte %d: %02X", i, b)) end -- Output: 4 bytes representing the float in little-endian order
See also
Related Functions
- readBytes
- readSmallInteger
- readInteger
- readQword
- readPointer
- readFloat
- readDouble
- readString
- writeBytes
- writeSmallInteger
- 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
- byteTableToQword
- byteTableToFloat
- byteTableToDouble
- byteTableToString
- byteTableToWideString