-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|741|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Variables


 
JL235
Created : 07 December 2006
Edited : 08 December 2006
System : Windows
Language : Blitz

Dynamic Array v.1.2

Dynamic Arrays in Blitz

I've said this before, 'one of the main problems with Blitz is the lack of dynamic arrays', so I decided just to sit down and create a system of dynamic arrays. There are other implementations I have though of to create these, probably faster, but this is far more stable then other method which is based on resizing arrays. That method may also be far more limiting. It's pretty self explanatory, and no variables need to be created or anything.

I started this almost 2 hours ago, and since then fixed it's one major problem. You could only have one dynamic array! Now that is fixed, have 2, have 5, have plenty!

Just create the array as a normal global (or local or array) value and then use the 'dynamicArrayAdd' and 'dynamicArrayGet' functions to add and get values.

DON'T iterate through the types as it holds internal types within itself as many times as it needs to. This means when you iterate through the dynamic arrays you receive the internal arrays too, as well as the main ones. Use it like a variable not a type.

Edit: A Blitz Max variation is planned.


 

Comments


Friday, 08 December 2006, 09:18
hyruleknight
EDIT: wrong spot

and good work on this
Friday, 08 December 2006, 09:21
Jayenkai
^ it's Blitz.. The other one's BlitzMax.