Runrev bug, or I have made an error ?

Damien Girard dam-pro.girard at laposte.net
Thu Jun 30 09:36:51 EDT 2005


Le Jeudi 30 Juin 2005 15:08, Klaus Major a écrit :
> Bonjour Damien,
>
> > Hi all,
> >
> > I am using runrev 2.6 under linux, and I have a strange bug.
> >
> > I need to get a list of font, and put a tab before each line of the
> > fontlist
> > (is it for a font menu).
> >
> > This is my script :
> >
> >   put fontnames() into TheList
> >   sort TheList
> >
> >   put "0" into LineToDo
> >   repeat for each line 1 in TheList
> >     put LineToDo +1 into LineToDo
> >     put tab before line LineToDo of TheList
> >   end repeat
> >
> > And the problem is in the result :
> >
> > -------- The Result
> >
> >     andale sans
> >  ...
> >     urw chancery l
> >     urw gothic l
> > urw palladio l
> > utopia
> >
> > -------- /The Result
> >
> > The problem, is that all font have got a tab before it, but not 2
> > last line :
> > urw palladio l
> > utopia
> >
> > For me, I didn't see any bug in the script, but this seem to
> > doesn't work...
>
> actually the "repeat for each" control stucture is meant to be READ-
> only!
> And thus there may be strange results if you try to change the lines...
> And your syntax is not quite correct.
>
> Try this:
> ...
>    put fontnames() into TheList
>    sort TheList
>    repeat for each line L in TheList
>       put TAB & L & CR after new_list
>    end repeat
>    delete char -1 of new_list
>    ## delete trailing CR
>    ## c'est ça :-)
>   ...
>
> Hope that helps...
>
> > Thanks.
>
> Regards
>
> Klaus Major
> klaus at major-k.de
> http://www.major-k.de
>
> _______________________________________________

I have learn something in the repeat (I have learn Revolution alone !)

repeat for each <Variable name and not a line !(1)> in Thelist

I have found the problem, for have my script work :

  put fontnames() into TheList
  sort TheList
  put the number of lines of TheList into TheCounter
  
  put "0" into LineToDo
  repeat for TheCounter Times
    put LineToDo +1 into LineToDo
    put tab before line LineToDo of TheList
  end repeat

Now, this work fine. (I think this script is well writted for me)

-- 
----------------------------------------
Girard Damien
Email: dam-pro.girard at laposte.net



More information about the use-livecode mailing list