How to use (tFile_ & i) to return values of variables

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

How to use (tFile_ & i) to return values of variables

Post by alex298 » Sun May 24, 2009 1:19 pm

Hi,

How can I get the values of the variables of tFile_1 and tFile_2 as shown below:
on mouseUp
put "This is File one" into tFile_1
put "This is File two" into tFile_2

Repeat with i = 1 to 2
## answer tFile_ & i return tFile_1
## answer (tFile_ & i) also return tFile_1
## answer ("tFile_" & i) also return tFile_1
##
## How to get the string variable of tFile_1 and tFile_2
end Repeat
end mouseUp
I used it before but I suddently forgot it. Oh.... the memory of an old man is really very short :cry:

Please help.

Thanks and best regards
Alex
Nice to meet all of you.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Sun May 24, 2009 3:43 pm

Alex,

try value() as in this

Code: Select all

on mouseUp
   put "This is File one" into tFile_1
   put "This is File two" into tFile_2
   
   Repeat with i = 1 to 2
      answer value (tFile_ & i)
   end Repeat
end mouseUp
with kind regards and respect for an 'old' man from a not so young man

Bernd

alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Post by alex298 » Mon May 25, 2009 2:59 am

Dear Bernd,

Thanks for your help~~~ It works!

Best regards
Alex
Nice to meet all of you.

Post Reply