Indirect variable reference
Cubist at aol.com
Cubist at aol.com
Wed Jun 11 04:35:00 EDT 2003
sez bornstein at designeq.com:
>Is there a way to reference a variable through another variable in
>Transcript?
>IOW, I'd like to do something like this:
>
>Repeat with i = 1 to 5
> put "List"&i into theList
> put i into value(theList)
>end repeat
>
>The idea is that I construct 5 variables, named list1, list2, list3,
>list4, and list5 in the variable theList. Then I put a value in each of
>these variables through the referencing variable (theList).
>
>The Value function is sort of what I have in mind (it first evaluates the
>expression) but, of course, it doesn't work in this fashion. Is there
>another way to do this (am I missing something obvious) or is this not
>possible in Transcript?
Not sure about Transcript, but in HyperTalk, the DO keyword does what you
want:
repeat with K1 = 1 to (the number of items in ListOfVariables)
do ("put item K1 of TheData into" && item K1 of ListOfVariables)
end repeat
Hope this helps...
More information about the use-livecode
mailing list