Split is Behaves Unexpectedly?

chris bohnert chris at altuit.com
Mon Feb 18 21:15:17 EST 2008


from the docs on repeat foreach:

  Important!  You cannot change the labelVariable in a statement inside the
loop. Doing so will cause a script error. You can change the content of the
container, but doing so will probably produce unexpected results.


--
cb

On Feb 18, 2008 7:40 PM, Sivakatirswami <katir at hindu.org> wrote:

> go stack url
> "http://www.himalayanacademy.com/runrev/stacks/TestSplitData.rev"
>
> turns out it is skipping every other line in the input data.
>
>
> Sivakatirswami wrote:
> > Chipp Walters wrote:
> >> Katirswami,
> >>
> >> If you don't get any answers, I'd suggest creating a 'stack version'
> >> of the
> >> problem, then post it and others can take a look. Most of us don't
> >> have a
> >> Rev server available to test scripts on.
> >>
> >> -Chipp
> >>
> >
> > right... good idea  --- also we get to see if we can reproduce in a
> > different context
> >
> > bad news is : yes... appears to be broken
> >
> > we are running 2.6.1 for Linux on the web server and
> >
> > this is also broken in 2.9
> >
> > go stack url
> > "http://www.himalayanacademy.com/runrev/stacks/TestSplitData.rev"
> >
> > on mouseUp
> >  # Test Split
> >
> > put  fld "dataIn" into testData
> >
> > ------------
> >> 1|2|3|4
> >> 5|6|7|8
> >> 9|10|11|23
> >> ------------
> >
> >
> >
> > repeat for each line thisline in testdata
> > split thisline by "|"
> > put thisline[1] & cr after tOutput
> > put thisline[2]  & cr after tOutput
> > put thisline[3]  & cr after tOutput
> > end repeat
> > put tOutput into fld "OutPut"
> >
> > end mouseUp
> >
> > #output:
> >
> >
> >
> > 1
> > 2
> > 3
> >
> >
> > 9
> > 10
> > 11
> >
> > it's skipping line 2 of the input data
> >
> >
> >> On Feb 18, 2008 12:43 PM, Sivakatirswami <katir at hindu.org> wrote:
> >>
> >>
> >>> I dunno... I will submit this to the Omniscient Revolution Users List
> >>>
> >>> Some wizard will know...
> >>>
> >>> -------
> >>> Namaste, Swami
> >>>
> >>> This is either a bug report, or, the split comand has changed?  Do you
> >>> still have a copy of the old "mc" ?
> >>>
> >>> Running the identical program on my old "mc" interpreter at work,
> >>> versus
> >>> running it on the "revolution" interpreter on vel, I get the correct
> >>> results at work, and incorrect results on vel.
> >>>
> >>> Aum Aum
> >>>
> >>> *_Vel:
> >>>
> >>>
> >>> _*------------
> >>> code
> >>> ------------
> >>> #!/usr/local/bin/revolution
> >>>
> >>> on startup
> >>>     read from stdin until empty
> >>>     put it into testdata
> >>>
> >>>     repeat for each line thisline in testdata
> >>>          split thisline by "|"
> >>>          put thisline[1]
> >>>          put thisline[2]
> >>>          put thisline[3]
> >>>     end repeat
> >>>
> >>> end startup
> >>> ------------
> >>> data
> >>> ------------
> >>> 1|2|3|4
> >>> 5|6|7|8
> >>> 9|10|11|23
> >>> ------------
> >>> results
> >>> ------------
> >>> 1
> >>> 2
> >>> 3
> >>> 9
> >>> 10
> >>> 11
> >>>
> >>>
> >>> *_Work
> >>>
> >>>
> >>> _*
> >>>
> >>> code
> >>> ..........
> >>> #!/usr/local/bin/mc
> >>>
> >>> on startup
> >>>     read from stdin until empty
> >>>     put it into testdata
> >>>
> >>>     repeat for each line thisline in testdata
> >>>
> >>> split thisline by "|"
> >>>          put
> >>> thisline[1]
> >>>          put
> >>> thisline[2]
> >>>          put
> >>> thisline[3]
> >>>     end repeat
> >>>
> >>> end startup
> >>> ..........
> >>> data
> >>> ..........
> >>> 1|2|3|4
> >>> 5|6|7|8
> >>> 9|10|11|23
> >>> ..........
> >>> results
> >>> ..........
> >>> 1
> >>> 2
> >>> 3
> >>> 5
> >>> 6
> >>> 7
> >>> 9
> >>> 10
> >>> 11
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> use-revolution mailing list
> >>> use-revolution at lists.runrev.com
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-revolution
> >>>
> >>>
> >> _______________________________________________
> >> use-revolution mailing list
> >> use-revolution at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-revolution
> >>
> >>
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>



More information about the use-livecode mailing list