Referencing a variable?
Andre Garzia
soapdog at mac.com
Sun Nov 27 21:36:23 EST 2005
On Nov 27, 2005, at 11:49 PM, Richard Gaskin wrote:
> Turning the problem inside out, could it be stated that the goal is
> to be able to refer to a variable without knowing the variable's
> name in advance?
>
> If so, you might consider using array notation:
>
> put "MyName" into x
> put "123" into tBuffer[x]
Two solutions to this problems were quoted on previous mails. One
with array notation above this one, other with do command. The do
command will execute the string passed to it, beware that depending
on how you acquire/build this string can leave you with exploitable
code. For example if the user enter a string with quotes, your whole
string is now mixed, or worse enter transcript code, things will get
executed. Use do only when no other option is available and always
double check your routines so that no rogue string ever comes near
the do statement...
Cheers
andre
PS: ... and yes, I am paranoid. :P
More information about the use-livecode
mailing list