LC equivalent of the JS eval() function

Ken Ray kray at sonsothunder.com
Sun Jul 24 12:50:46 EDT 2011


On Jul 24, 2011, at 11:20 AM, Mark Schonewille wrote:

> Hi Slava,
> 
> The do command and the value function could be what you are looking for.

And just to be clear on use, it would be like this:


put "MyCustomVariable" into tVarToFill
put "202 Main Street" into tStreet
do "put tStreet into" && tVarToFill
put MyCustomVariable
--> 202 Main Street

Hope this helps,


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/	

> On 24 jul 2011, at 18:10, Slava Paperno wrote:
> 
>> I'm looking for the LC equivalent to the JavaScript eval() function. For
>> example, if I have a variable called "tAddress" and I want an LC statement
>> to assign a value to it, I'd like to say something like put "202 Main
>> Street" into eval("tAddress").
>> 
>> That may sound silly because if I, the programmer, know the name of the
>> variable, I should say put "202 Main Street" into tAddress. But I don't know
>> the name of the variable because it will be generated by a handler. For
>> example, if my handler reads a name-value pair from some file:
>> 
>> LastKnownAddress="202 Main Street"
>> 
>> then I want to create a variable called LastKnownAddress and set its value
>> to "202 Main Street".
>> 
>> In JS, I would use eval(). What can I use in LC? It's hard to find things
>> like that in the docs when you don't know what they are called.
>> 
>> Thanks!
>> 
>> Slava
>> 
>> 
> 
> 
> _______________________________________________
> 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