Using a field list to act as variables?

Glen Bojsza gbojsza at mac.com
Thu Apr 8 19:31:26 EDT 2004


An explanation always helps...thanks


On Thursday, April 8, 2004, at 05:59 PM, Cubist at aol.com wrote:

> sez gbojsza at mac.com:
>> I am experimenting with the following and was hoping someone can tell
>> me why it doesn't work...
>>
>> I have a field nOribit with 3 lines
>>
>> yt1
>> yt2
>> yt3
>>
>> on mouseUp
>> put empty into tSolar
>> repeat for each line L in field "nOrbit"
>> put L & cr after tSolar
>> end repeat
>> delete last char of tSolar
>>
>> put "1,2,3" into yt1
>> put "4,5,6,7" into yt2
>> put "9,8,7" into yt3
>>
>> put tSolar  -- this gives yt1,yt2,yt3 and not the values
>>
>> if I do the following
>>
>> put yt1 & cr & yt2 & cr & yt3 into tSolar
>>
>> put tSolar -- this gives the values
>>
>> Yes, I know that an array would work but I'm trying to understand if
>> there is a way for the above to work.
>    Marttin Baxter's solution looks like it should work, but just in 
> case
> you're curious, here's why you had the problem in the first place: In 
> your first
> attempt, Rev believes that "yt1" & etc are just generic character 
> strings that
> you're pouring into the variable tSolar; Rev has no clue that those 
> strings
> are supposed to be the names of variables. Granted, you later use 
> those strings
> *as* variable names, but that later act does not alter the contents of 
> tSolar.
>    In your second attempt, Rev knows right from the start that you're 
> playing
> with variables, thus you get the result you want.
>    Hope this helps...
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list