contents   index   previous   next



Buffer[] Array

syntax:

buffer[offset]

return:

number - the value in a buffer at the index or offset specified. If a value is being assigned to this position, the value assigned is returned.

 

description:

This is an arraylike version of the Buffer getValue() and Buffer putValue() methods, which works only with bytes. A user may either get or set these values, such as goo = foo[5] or foo[5] = goo. Every get/put operation uses byte types, that is, SWORD8. If offset is less than 0, then 0 is used. If offset is beyond the end of a buffer, the size of the buffer is extended with NULL bytes to accommodate it.

 

Every time an index value is used, the Buffer cursor property for an object is set to the next index, as with Buffer putValue() and Buffer getValue().

 

see:

Buffer getValue(), Buffer putValue()

 

example:

var b = new Buffer("ABC");

// b.cursor == 0

Screen.writeln(b[1]); // 66 - ASCII code for "B"

// now b.cursor == 2

b[0] = 68; // "DBC"

// now b.cursor == 1

 


Buffer object instance methods