Jump to content

Array size from reference


Mellberg

Recommended Posts

Hello!

Is there any possibility to get the size of an array from a reference to the array?

What is an Array? (see next)

Shaun's answer provides the number of visible elements for an Array control.

However you could get the 'Value' of the array control, that would return a Variant with the OpenG function Array Size(s) the actual size of the data stored in the control:

Array_Size(s).png

Ton

  • Like 1
Link to comment
  • 1 month later...

Thanks Ton, looks like what I was looking for!

Please not that this is not exactly a cheap way of determining an array size. The value extraction will create a copy of the array, potentially using quite some memory and also costing performance to do the copy. No problem if your array contains only a few 100 elements but definitely something to think of with an array that could contain 1 million values.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.