2 dimensional Arrays

Otto Hansen otto at larshansenphoto.com
Wed Mar 14 04:33:28 EDT 2007


Thanks for that, the site made rev's arrays a little more understandable.

the method you sent me didn't seem to work but I managed to hack 
together some code that works:
put character 2 to the length of leftVar - 1 of leftVar into L
put character 2 to the length of rightVar - 1 of rightVar into R
answer myArray[L,R]

This just strips away the quotation marks from leftVar and rightVar 
which after seeing that I site I realized to be the problem

Thanks,
Otto


Henk van der Velden wrote:
> Hi Otto,
>
> Rev doesn't support 2 dimensional arrays, so you have to kind of fake 
> them. That can be done by naming the keys the way you do. But if you 
> want to get the value of a specific  key, you should use:
> myArray["x" & comma & "y"]
> instead of
> myArray["x","y"]
>
> Hope this helps.
>
> You can also take a look at
> http://www.sonsothunder.com/devres/revolution/tips/arry001.htm
>
> Kind regards,
>
> Henk
> --------------------------
> Henk v.d. Velden
> iGlow Media
> Magda Janssenslaan 36
> 3584 GR  UTRECHT
> Netherlands
>
> 0031 (0)6 16 024 337
> www.iglow-media.nl
>
>
>> I have a two dimensional array in my program and I am having some 
>> trouble
>> getting values to come out of it.
>>
>> The array is keyed in both dimentions by entries such as "s1","s1" 
>> "s1","s2"
>> etc. (the quotes are included in the key for various reasons but they 
>> could
>> potentially be removed)
>>
>> the values in the array are either empty or 1
>>
>> if I call for a value using something like:
>> answer myArray["s1","s2"]
>> I will get the value returned to me but if I try to use variables it 
>> doesnt
>> work right.
>> If I have a variable leftVar that contains "s1" and rightVar that 
>> contains
>> "s2" (both with quotes) and I say
>> answer myArray[leftVar,rightVar]
>> I get returned an empty message.
>>
>> I dont seem to have this problem when calling a single dimension 
>> array, only
>> in my 2-dimension one.
>>
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list