possible to make expandable arrays/lists
BlitzMax Forums/BlitzMax Beginners Area/possible to make expandable arrays/lists
| ||
is it possible to make expandable arrays or lists? |
| ||
err, i mean arrays, not lists :) |
| ||
Yes. Arrays can be expanded by using slices. However it is a very expensive operation, and if done often, a List, an associative array (TMap) or HashMap may be a better datastructure to use, in terms of speed. |
| ||
ok ill look into it, only using it for the beginning of the program, no while it is running. thx |
| ||
You could create a list, do any expansion at the beginning of the program then use ListToArray for use within the game/app. |
| ||
A quite fast way to do dynamic arrays is doing *2 /2 in slicing whenever needed (*2 if you need more slots than your array has, /2 if the half or less is used) |