Page 1 of 1

Lineoffset list

Posted: Thu Jun 21, 2012 4:29 pm
by laurpapo
Hi,

I'm very *very* new to livecode, so this may be a dumb question, but I'm having trouble with lineoffsets. I have a list of items in one variable, with one line set as a sort of break point to separate 2 sets of data. I want to use lineoffset to break up the data. So, I'm trying to put line 1 of said variable through lineoffset-1 into one variable, and lineoffset + 1 through the last line into a different variable.

Is this something I can do? If so, how?

Thanks so much!

Re: Lineoffset list

Posted: Thu Jun 21, 2012 4:42 pm
by Klaus
Hi laurpapo

1. welcome to the forum :D

2. Plaese check these stacks:
http://www.runrev.com/developers/lesson ... nferences/

3. Did you check "lineoffset" in the dictionary? 8)

"lineoffset" will return the NUMBER of the line, if found, or 0, if not
What is in the "one line set as a sort of break point"?
This is the most important info!


Best

Klaus

Re: Lineoffset list

Posted: Fri Jun 22, 2012 9:09 am
by bangkok
Something like that

Let's assume MyText contains 3 lines :
my first data set
*BREAK*
my second data set

Code: Select all

set the wholeMatches to true

put "*BREAK*" into myBreakPoint

put lineoffset (myBreakpoint,myText) into myResult --will contain the number of the found line, or 0

if myResult >0 then
put line (myResult-1) of myText into myDataSet1
put line (myResult+1) of myText into myDataSet2
else
answer "Not found"
end if

Re: Lineoffset list

Posted: Fri Jun 22, 2012 3:01 pm
by laurpapo
Thank you both for your help! As it turns out, I was just messing up on syntax.

My bad... :D

-Thanks!