| BYTEARRAY | |
| Syntax | BYTEARRAY number BYTEARRAY list (BYTEARRAY number list) (BYTEARRAY list list) |
| Explanation | BYTEARRAY creates a byte array, a
special array in which numbers between 0 and 255 can be
stored. If BYTEARRAY has a number as an input, a
one-dimensional array of the specified size is created.
The elements of the array may be accessed by numbers
between 0 and the specified size less 1. Each element of
a one-dimensional byte array corresponds to one byte in
memory; therefore, a byte array may also be used to
transfer data to Windows API calls (see .WINDOWS). The TEXTARRAY command can be used
to convert the contents of a one-dimensional byte array
to a Logo word. If BYTEARRAY has a list of numbers as input, each number in the list corresponds to the size of one dimension of the array. To access an element of a multi-dimensional byte array, a list of numbers must be supplied to the AGET and ASET primitives with each number in the range from 0 to the number supplied for the corresponding dimension less 1. If a list is supplied as an optional second input to BYTEARRAY, the contents of this list are used to initialize the array elements. See also ARRAY and BYTEARRAY?. |
| Examples | MAKE "A BYTEARRAY [2
2] ASET :A [1 0] [HELLO WORLD] [HELLO WORLD] is not a number ASET :A [1 0] 255 AGET :A [1 0] Result: 255 AGET :A [2 0] 2 is not inside the allowed range of 0 to 1 for dimension 1 |