Indirect variable reference

Martin Baxter martin at harbourtown.co.uk
Wed Jun 11 04:15:01 EDT 2003


Howard,

I'd probably do something like this:

  Repeat with i = 1 to 5
    put "List"&i into line i of theList
    put "put "&i&" into "&line i of thelist into todo
    do todo
  end repeat

  repeat with i = 1 to 5
    put "put List"&i&"&return after var" into todo
    do todo
  end repeat
  put var

you have to watch the quotes carefully but it works

martin baxter

>Howard Bornstein wrote
>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?
>
>TIA,
>
>Howard Bornstein





More information about the use-livecode mailing list