Difference between revisions of "RawData.byte"
Jump to navigation
Jump to search
(Created page with "<c>RawData.byte</c> gets one unsigned byte from a RawData buffer. {| class="wikitable" |- ! Parameter Name !! Type !! Default Value !! Meaning |- | ''offset'' || numb...") |
(No difference)
|
Latest revision as of 00:37, 30 January 2025
RawData.byte
gets one unsigned byte from a RawData buffer.
Parameter Name | Type | Default Value | Meaning |
---|---|---|---|
offset | number | 0 | position in buffer at which get the value |
Example
PNG_HEADER = [137, 80, 78, 71, 13, 10, 26, 10]
filePath = "/sys/pics/tank.png"
rawImg = file.loadRaw(filePath)
isPNG = true
for i in range (0, PNG_HEADER.len - 1)
isPNG = isPNG and PNG_HEADER[i] == rawImg.byte(i)
end for
if isPNG then
print filePath + " is a PNG file"
end if
This example loads a file as a RawData buffer, and then checks the first 8 bytes to determine if it is a PNG file.
See also : RawData.setByte