Page 1 of 1
Variable that holds the name of another variable
Posted: Fri Apr 03, 2015 10:44 pm
by croivo
This is the code:
Code: Select all
on mouseUp
put "My Text" into myVariable77
put ("myVariable" & "77") into variableThatHoldsTheNameOfOriginalVariable
answer variableThatHoldsTheNameOfOriginalVariable
end mouseUp
How to make it answer "My Text" ?
Re: Variable that holds the name of another variable
Posted: Fri Apr 03, 2015 11:28 pm
by Klaus
Hi croivo,
just DO it!
Code: Select all
on mouseUp
put "My Text" into myVariable77
put ("myVariable" & "77") into variableThatHoldsTheNameOfOriginalVariable
DO ("answer" && variableThatHoldsTheNameOfOriginalVariable)
end mouseUp
Best
Klaus
Re: Variable that holds the name of another variable
Posted: Fri Apr 03, 2015 11:43 pm
by croivo
That's it
But... What if I have something like this
Code: Select all
put "My Text" into myVariable77
put ("myVariable" & "77") into variableThatHoldsTheNameOfOriginalVariable
put ("The content of the variable is: " & variableThatHoldsTheNameOfOriginalVariable) into myVariable
How to use 'DO' now?
Re: Variable that holds the name of another variable
Posted: Sat Apr 04, 2015 12:44 am
by SparkOut
Don't, instead use value(theVariable)
Re: Variable that holds the name of another variable
Posted: Sat Apr 04, 2015 12:46 am
by FourthWorld
What are you doing with that variable?
Re: Variable that holds the name of another variable
Posted: Sat Apr 04, 2015 12:17 pm
by SparkOut
See here for more detail, and a demo of how to use value()
http://forums.livecode.com/viewtopic.ph ... 31#p123699
(scroll to the bottom of the thread)