From: sto.mar@...
Date: 2012-06-20T03:44:49+09:00
Subject: Re: Access array data - problem
Am 19.06.2012 20:10, schrieb Rasmus Sorensen:
> I'm having a problem with my array:
>
> UI.messagebox ("layers: " + YV_layer_array.to_s)
> =>output will be: "layers: 108, 190, 95"
> (which is what I expected)
>
> But when I try to access the individual items it seems to fail
> UI.messagebox ("layer: " + YV_layer_array[0].to_s)
> =>output will be: "layer: 57"
> (which is wrong. It should be 108. I have no idea where 57 comes from)
Hi Rasmus,
I am not able to reproduce your output:
irb(main):001:0> YV_layer_array = [108, 190, 95]
=> [108, 190, 95]
irb(main):002:0> 'layers: ' + YV_layer_array.to_s
=> "layers: [108, 190, 95]"
irb(main):003:0> YV_layer_array[0].to_s
=> "108"
irb(main):004:0> YV_layer_array.class
=> Array
How is your YV_layer_array defined?
Regards,
Marcus
--