Difference between revisions of "RawData"

From MiniScript Wiki
Jump to navigation Jump to search
Line 18: Line 18:
 
| <c>len</c> || returns the length of the raw data buffer, in bytes
 
| <c>len</c> || returns the length of the raw data buffer, in bytes
 
|-
 
|-
| <c>[[RawData.resize|resize]](bytes=32)</c> || change the size of the raw data buffer
+
| <c>[[RawData.resize|resize]](''bytes=32'')</c> || change the size of the raw data buffer
 
|-
 
|-
 
| <c>[[RawData.byte|byte]](''self, offset=0'')</c> || get one unsigned byte of data
 
| <c>[[RawData.byte|byte]](''self, offset=0'')</c> || get one unsigned byte of data

Revision as of 21:44, 26 March 2020

The RawData class in Mini Micro represents a buffer of raw bytes. Interpretation of these bytes is entirely up to the programmer.

Properties

Property Name Type Default Value Meaning
littleEndian number (boolean) true whether multi-byte values are stored with least significant byte first


Methods

Method Description
len returns the length of the raw data buffer, in bytes
resize(bytes=32) change the size of the raw data buffer
byte(self, offset=0) get one unsigned byte of data
setByte(self, offset=0, value=0) set one unsigned byte value
sbyte(self, offset=0) get one signed byte of data
setSbyte(self, offset=0, value=0) set one signed byte value
ushort(self, offset=0) get an unsigned 16-bit integer value
setUshort(self, offset=0, value=0) set an unsigned 16-bit integer value
short(self, offset=0) get a signed 16-bit integer value
setShort(self, offset=0, value=0) set a signed 16-bit integer value
uint(self, offset=0) get an unsigned 32-bit integer value
setUint(self, offset=0, value=0) set an unsigned 32-bit integer value
int(self, offset=0) get a signed 32-bit integer value
setInt(self, offset=0, value=0) set a signed 32-bit integer value
float(self, offset=0) get a 32-bit floating-point value
setFloat(self, offset=0, value=0) set a 32-bit floating-point value
double(self, offset=0) get a 64-bit floating-point value
setDouble(self, offset=0, value=0) set a 64-bit floating-point value
utf8(self, offset=0, bytes=-1) get a string of ASCII or UTF-8 text
setUtf8(self, offset=0, value="") set a string as UTF-8