Data Sheet

dScript
dScript User Manual v2.15
String byte arrays
Strings can be used as byte variable arrays. Array elements are unsigned bytes and can hold
positive values between 0 and 255. Strings used as byte arrays cannot store negative values.
string myByteArray[10]
The individual elements of this string may be accessed by
myByteArray[0] = 5
which will load the number 5 into the first element of the array. The elements of the 10 byte
array are numbered 0 to 9. Note that the size of the index is checked at run time, not compile
time.
string myByteArray[10]
var idx
var x
myByteArray[idx] = 5
x = myByteArray[idx]
The runtime module will check the value in idx is within the range for the string. Outside of this
limit the instruction will do nothing in the first case and load x with zero in the second.
Copyright © 2016, Devantech Ltd.
All rights reserved.
www.robot-electronics.co.uk
14