Using a variable for an array name

Bob Sneidar bobsneidar at iotecdigital.com
Wed Feb 1 19:03:43 EST 2017


This is called macro substitution in other languages. You would use the form array&tvar in Foxpro for instance. LC has no macro Substitution. Instead:

put "put tArray" & tVar & "[temp] into tText" & tVar into tCommand
replace "temp" with quote & "text" & quote in tCommand
do tCommand
(untested)

bob s


On Feb 1, 2017, at 15:13 , Peter Bogdanoff via use-livecode <use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>> wrote:

I have arrays:
tArray1
tArray2
tArray3
tArray4


I want to get data from one of them:

put “tArray” & “1” into tVar
put tVar [“Text”] into tText1

tText1 is empty.



Is there a way to get the data from the arrays without doing this kind of thing for each array:

put tArray1 [“Text”] into tText1
put tArray2 [“Text”] into tText2

Thanks!

Peter Bogdanoff



More information about the use-livecode mailing list