Using a variable for an array name

Ralph DiMola rdimola at evergreeninfo.net
Wed Feb 1 19:07:11 EST 2017


"Do" will do the trick.

Repeat with tVarNum = 1 to 4
 do "put"&&tArray&VarNum&"["&WrapQ("Text")&"] into tText"&tVarNum
 do "put"&&tArray&VarNum&"["&WrapQ("SomeOtherArrayValue")&"] into tSomeOtherArrayValue"&tVarNum
end repeat

function WrapQ pString
 return quote&pString&quote
end WrapQ

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Peter Bogdanoff via use-livecode
Sent: Wednesday, February 01, 2017 6:14 PM
To: How to use LiveCode
Cc: Peter Bogdanoff
Subject: Using a variable for an array name

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


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list