Topic was automatically imported from the old Question2Answer platform.
Asked By
abelgutierrez99
I think Array lacks of some basic functions for my project (intersections, get random element/index…). Is there anyway to create my own type of array? I think defining a new variable that inherits array methods and properties is a good option, instead of defining functions somewhere.
It’s a good idea, but I want to preserve all methods of Array to avoid problems. So it’s hard to make that.
abelgutierrez99 | 2021-05-09 19:21
I’d thinked about modifying the engine, but I don’t know C++, only Python, so I decided to ask. What I was doing before that question is that you said, use a singleton. Maybe in a future I try the first option. Thanks!
abelgutierrez99 | 2021-05-09 19:23
Simpler than you think you can do a comparison with all of array’s methods like I did with the append function above or call it directly like this SuperArray.contents.append(). So basically SuperArray is just a fancy class to manipulate a regular array
Wakatta | 2021-05-11 20:08
Since I don’t know C++, I will try your solution @Wakatta, but I still think that it would be better to modify Array, so that other people can benefit from it.
abelgutierrez99 | 2021-05-15 12:49
Agreed. Maybe post a feature request as there are other classes with missing stuff but can’t be extended either like Marshall