Append() for Dynamic Arrays

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Append() for Dynamic Arrays

Re: Append() for Dynamic Arrays

by Major Cooke » Mon Aug 12, 2019 6:07 pm

Because otherwise, you have to repeat code and it gets messy.

Re: Append() for Dynamic Arrays

by Apeirogon » Mon Aug 12, 2019 1:05 pm

Just curious.

Re: Append() for Dynamic Arrays

by Graf Zahl » Mon Aug 12, 2019 12:32 pm

Does it matter? It's merely an export of an already existing function.

Re: Append() for Dynamic Arrays

by Apeirogon » Mon Aug 12, 2019 12:29 pm

That not what I meant. I mint "why you need to append several arrays into one?"

Re: Append() for Dynamic Arrays

by Graf Zahl » Sat Aug 10, 2019 10:41 am

No need to delay this.

Re: Append() for Dynamic Arrays

by _mental_ » Sat Aug 10, 2019 8:31 am

Actually, it's pretty simple. I thing you could do it yourself. Made PR because I wasn't sure about its inclusion in upcoming release.

Re: Append() for Dynamic Arrays

by Major Cooke » Sat Aug 10, 2019 8:23 am

Oooh, thank you! :mrgreen:

Re: Append() for Dynamic Arrays

by _mental_ » Sat Aug 10, 2019 7:39 am

Re: Append() for Dynamic Arrays

by Major Cooke » Sat Aug 10, 2019 6:30 am

The biggest boon on top of that is the performance optimization.

Re: Append() for Dynamic Arrays

by Matt » Fri Aug 09, 2019 6:00 pm

Also makes the code a lot easier to read if we're not having to set up for loops each time.

Re: Append() for Dynamic Arrays

by Major Cooke » Fri Aug 09, 2019 2:21 pm

Apeirogon wrote:Just curious, why you need to do this?
Major Cooke wrote:This is still a huge concern for performance. The use case here is basically to traverse multiple arrays at once without needing to repeat code, which can become problematic if there's quite a few arrays involved as it makes code organization a bit messy.

Re: Append() for Dynamic Arrays

by Apeirogon » Fri Aug 09, 2019 1:19 pm

A function that copies all the data of another array and puts it on the tail end of the calling array
Just curious, why you need to do this?

Append() for Dynamic Arrays

by Major Cooke » Fri Aug 09, 2019 9:48 am

Append(Array <other>)

A function that copies all the data of another array and puts it on the tail end of the calling array.

When it comes to larger arrays, this will be useful if done on the engine side instead of the scripting side where Push would be needed for every element of the array we wish to append.

Right now, the most efficient manner I'm using is to use a temporary array that Copy()s the largest array, then manually pushes each member of other arrays whose data I want, but this is still a huge concern for performance. The use case here is basically to traverse multiple arrays at once without needing to repeat code, which can become problematic if there's quite a few arrays involved as it makes code organization a bit messy.

Top