vlax-safearray-get-element (AutoLISP/ActiveX)

Returns an element from an array

Supported Platforms: Windows only

Signature

(vlax-safearray-get-element var element ...)
var

Type: safearray

A variable containing a safearray.

element ...

Type: Integer

Numeric values specifying the indexes of the element to be retrieved. For an array with one dimension, specify a single integer. For multi-dimension arrays, specify as many indexes as there are dimensions.

Return Values

Type: Integer, Real, String, VLA-object, safearray, variant, T, or nil

The value of the element.

Examples

Create an array with two dimensions, each dimension starting at index 1:

(setq matrix (vlax-make-safearray vlax-vbString '(1 . 2) '(1 . 2) ))
#<safearray...>

Use vlax-safearray-put-element to populate the array:

(vlax-safearray-put-element matrix 1 1 "a")
"a"

(vlax-safearray-put-element matrix 1 2 "b")
"b"

(vlax-safearray-put-element matrix 2 1 "c")
"c"

(vlax-safearray-put-element matrix 2 2 "d")
"d"

Use vlax-safearray-get-element to retrieve the second element in the first dimension of the array:

(vlax-safearray-get-element matrix 1 2)
"b"