LC equivalent of the JS eval() function

Andre Garzia andre at andregarzia.com
Sun Jul 24 12:38:09 EDT 2011


don't forget merge...

put the merge of "[[tAddress]]" into theContent

On Sun, Jul 24, 2011 at 1:25 PM, Richard Gaskin
<ambassador at fourthworld.com>wrote:

> 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.
>>
>
> As Mark suggested, the "do" command or the "value" function will do what
> you need.
>
> But this also seems a perfect fit for an array.
>
> Arrays are a great solution when you don't know the number of elements
> you'll need to store, or will need to access them by names you can't know in
> advance, e.g.:
>
>  put "202 Main Street" into tMyData[tAddress]
>  put "Slava Paperno" into tMyData[tName]
>
> --
>  Richard Gaskin
>  Fourth World
>  LiveCode training and consulting: http://www.fourthworld.com
>  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
>  LiveCode Journal blog: http://LiveCodejournal.com/**blog.irv<http://LiveCodejournal.com/blog.irv>
>
>
> ______________________________**_________________
> 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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list