RawData.setByte
Jump to navigation
Jump to search
RawData.setByte
writes an unsigned byte into a RawData buffer.
Arguments
Parameter Name | Type | Default Value | Meaning |
---|---|---|---|
offset | number | 0 | position in buffer at which to start writing |
value | number | 0 | unsigned byte to write |
Example
data = [13, 32, 47, 92, 95, 47, 92, 13, 40, 32, 111, 46, 111, 32, 41, 13, 32, 62, 32, 94, 32, 60, 13, 32, 77, 69, 79, 87, 33, 13]
a = new RawData
a.resize data.len
for i in range (0, data.len - 1)
a.setByte i, data[i]
end for
print a.utf8
This example creates a RawData buffer, sizes it to length of data array, and then writes each byte of data array in the buffer, and finally print the buffer as an UTF-8 string (here : a little ASCII art of a cat).