Advertisement

Question about Script Arrays

Started by June 15, 2009 04:23 PM
3 comments, last by Wavesonics 15 years, 8 months ago
really simple question about Script Arrays: When calling resize(), is it smart enough to not do anything if the array is the proper size already? i.e. for array of length 5 does "arr.resize( 5 );" do anything?
==============================
A Developers Blog | Dark Rock Studios - My Site
Nope. It's something I can easily fix though. Thanks.




AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Ok, ya I was just wondering if I should do the check my self, but great if you add it to AS as well :)

On that note, when u call resize(). The old elements are copied to the new array right?
==============================
A Developers Blog | Dark Rock Studios - My Site
I've already checked in the change.

And yes, when resizing the array, the old elements are copied to the new buffer. And only the extra ones initialized, or those that don't fit destroyed.

You can see more detail in as_arrayobject.cpp.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Great, thanks WhitchLord!
==============================
A Developers Blog | Dark Rock Studios - My Site

This topic is closed to new replies.

Advertisement