Jump to content
  • 0

[Vectorscript] passing dynarrays to procedures/functions.


Dieter @ DWorks

Question

The inability of passing dynarrays to procedures/functions is making some scripts extremely difficult. If we could do this, it would be easier to write own subprocedures.

As an example, the IntersectSurface function returns only the first object. I wanted to make my own procedure to always return all objects, but because I can't know how many there will be returned, I can't make the procedure. I first did return a group, but this give too many problems.

Link to comment

2 answers to this question

Recommended Posts

  • 0

You can pass dynarrays to procedures & functions after you allocate the size of the array.

I usually create a structure for an object and then declare a dynarray of the structure so I can have a list of the objects.

I know this is double work but you have to create a function that will count the object total first, allocate the array, and then pass the dynarray to a function for further processing of the list of objects.

Link to comment
  • 0
You can pass dynarrays to procedures & functions after you allocate the size of the array.

I usually create a structure for an object and then declare a dynarray of the structure so I can have a list of the objects.

I know this is double work but you have to create a function that will count the object total first, allocate the array, and then pass the dynarray to a function for further processing of the list of objects.

That's what I'm doing now. It was exaclty my point that I don't want to allocate/count first before.

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  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...