Lineoffset list

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Lineoffset list

Post by laurpapo » Thu Jun 21, 2012 4:29 pm

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!

Klaus
Posts: 14197
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Lineoffset list

Post by Klaus » Thu Jun 21, 2012 4:42 pm

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

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Lineoffset list

Post by bangkok » Fri Jun 22, 2012 9:09 am

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

laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Re: Lineoffset list

Post by laurpapo » Fri Jun 22, 2012 3:01 pm

Thank you both for your help! As it turns out, I was just messing up on syntax.

My bad... :D

-Thanks!

Post Reply