Repeat variable name changing

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sat Mar 8 11:46:02 EST 2008


Hi Jim,

Le 8 mars 08 à 15:50, Jim Hamlyn a écrit :

> I need the repeat loop to effectively instantiate a new variable  
> each time
> it loops with a name I can reference through the same script.
>
> Or
>
> I need the script to create a variable for each line in the field  
> which I
> can reference from the same script.
>
> Does this make any sense?

Asking a Saturday at daylight time in Europa is not the better thing  
unless you are in a hurry :-)
Difficult to understand your purpose but I assume the 'do' command  
should help you.
I'm going to tell you an example: may be, it will get you some idea:

repeat with i = 1 to x
   do "put line i of fld" && quote & "MyField" & quote && "into  
tempVar" & i
  -- then every line of your field is now in a local variable
   <doSomeStuffWithThisTempVar>
end repeat

Such a method is used for instance to retrieve all scripts of a stack  
into vars when you don't know in advance how many cards, objects,  
etc. the stack may contain.

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the Use-livecode mailing list