Selecting a Variable name by Script

Alex Tweedly alex at tweedly.net
Sun May 1 20:42:38 EDT 2005


Dennis Brown wrote:

> I have been trying to get the example in the Rev documentation to work 
> in my script:
>
> global gVariable1
> on test
>   put 1 into x
>   put 50 into ("gVariable"&x)
> end test
>
> it won't "Apply". It gives me a bad destination error.
>
> it works fine with things like field names, but not variables.
>
> I have 10 buttons that I want to use to save or recall info from ten 
> sets of arrays.  I just wanted to write one script to do the work 
> instead of duplicating the script ten times in each button with just 
> the number after the variable name different (the ten button work a 
> bit like radio buttons).  However, I can't figure out how to do this 
> in Rev if the above method will not work.
>
> Any Ideas?

global gVariable1
on mouseUp
  put 1 into x
  put 2 into gVariable1    -- just to be sure it does get changed :-)
  do "put 50 into gVariable"&x
  put "we got " & gVariable1 into msg
end mouseUp

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.4 - Release Date: 27/04/2005



More information about the Use-livecode mailing list