I published some time ago a way to dynamically creates arrays at program runtime and handling each of them with just a 32bit LONG.
This open the road to many possibilities especially for handling arrays inside UDT without knowing array size.
Find here attached a copy of the source code with example.
Feel free to use code as you prefer. Code is similar to the one I use internally in thinBasic language to store variable (global or local). Execution is quite fast so even big arrays can be handled quite easily.
The biggest dark side with this approach is that programmer has responsability to deallocate allocate arrays.
Ciao
Eros
---
Max dimensions: 3. Any numeric type, dynamic strings, UDT.
All array information are stored in a structure and a pointer to array structure is returned. This allows easy inclusion of arrays inside UDT or any other data structure. Just a 32bit variable is needed.
Eros, I can't figure out how to use your dynarrays doing something like the following:
type poly_type
x as double
y as double
z as double
s as byte
r as integer
g as integer
b as integer
m as long
u as double
v as double
l as long
end type
type m15_type
number_of_vertices as long
number_of_layers as long
layers() as string 'layers
number_of_polys as long
p() as poly_type
number_of_textures as long
texture_handles() as dword
end type
The m15 would have some arrays that need to be redimmed at runtime once it reads the file. Looking at your example, I couldn't figure out how to make it work in a UDT as I need.
Thanks for any help.
Hi Ken.
I think I've replied to this one here: http://www.jose.it-berater.org/smfforum/index.php?topic=1487.msg4644#msg4644
Ciao
Eros
Thanks Eros. Your examples will really help.
You know what... an article about dynarrays for pcopy would be very neat!!
Thanks again!!