Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Code Block
objarray new <type> (-values {<value_1> ... <value_n>}) | (<size> ?<fill_value>?) | (-binary <data>)

return a new objarray

<type>: chararray shortarray intarray longarray longlongarray floatarray doublearray

<value_i> must be numeric values compatible with the <type>

<size>: integer > 0 to create an array of this size. If <fill_value> is provided the array items are set to this value.

<data> is an arbitrary array of bytes (unsigned char)

e.g.

Code Block
set obj [objarray new intarray 3] 
-> 1518360 1518610 0 (3 random unitialized values) 
set obj [objarray new intarray 5 1] 
-> 1 1 1 1 1 (5 values intialized to 1) 
set obj [objarray new intarray -values {6 3 8}] 
-> 6 3 8 
set obj [ objarray new intarray -binary [ binary decode base64 AQAAAAIAAAADAAAABAAAAA==]] 
-> 1 2 3 4 
set obj2 [ objarray new intarray -binary [ objarray get_binary $obj]] 
-> 1 2 3 4