[Gambas-user] Global multidimensional arrays

ML ml at ...973...
Sat May 7 18:33:35 CEST 2005


Hi Fernando,

first of all thanks for your reply.

On 07/05/2005 17:45, nando wrote:

> You cannot have what you want exactly.

(Maybe I should post this to gambas-devel...)
Does anybody know if this feature (that is global arrays) is foreseen to be 
implemented some time?

> You can do this...
[snip]
> Then make something like... PUBLIC SUB write_my_array (value as FLOAT,x AS
> INTEGER, y AS INTEGER ) '--the pass in the value to write and match the
> my_array subscripts
> 
> my_array [x,y] = value
> 
> END
> 
> -you can use the above anywhere in your project like write_my_array (23.5,
> 4, 66) 'which writes the value 23.5 into the array at [4,66]
> 
> Then make something like... PUBLIC SUB read_array (x AS INTEGER, y AS
> INTEGER)
> 
> RETURN my_array [x,y] END
> 
> -you can use the above anywhere in your project like label1.text =
> read_array (4, 66) 'which reads the value from [4, 66] and puts it in a
> label.

This is very similar to what I thought.
However I was a little skeptical about this approach because, since in my case 
the data contained in the array should be accessed quite many times, I am 
afraid that calling a function every time for reading/writing could have a hard 
impact on performance.

Anyway, if there isn't any other solution I'll give it a try.

Thanks a lot!
Piero




More information about the User mailing list