Ali Lloyd ali.lloyd at livecode.com
Thu Oct 29 12:20:35 EDT 2015

Hi Richard,
It would really not take long to implement this, nor would it take much
longer to implement it for the other chunk types. The way string chunks
have been refactored, you would (for example) immediately get the item
version for free with the line version. So no need to consider question 3,
from my point of view!

On Thu, Oct 29, 2015 at 3:47 PM Richard Gaskin <ambassador at fourthworld.com>

> Currently we have the lineOffset function, a very handy way to know the
> number of a line that matches whatever we're searching for in a block of
> return-delimited text.
> However, like most chunk expressions it's able to do what it does by
> evaluating every character in the chunk, both looking for the matching
> string and counting CRs as it goes.
> Many times when we're using lineOffset it's because what we're after
> isnt the line number but the text of that line.  And getting that
> requires another traversal of the entire chunk to "get line <lineNumber>
> of <chunk>".
> Given how handy chunk expressions are in LiveCode, I'm wondering if it
> might be even handier to see the introduction of a new function,
> something that could perhaps be called "lineAtOffset".
> Like "lineOffset", "lineAtOffset" would take the same arguments and
> operate similarly, but rather than returning the number of the matching
> line it would return the text of that line.
> Questions for you folks:
> 1. Is this as useful as I think it might be?
> 2. Is there a better name for the function?
> 3. Would consistency with wordOffset, trueWordOffiset, and itemOffset
> bog this down to the point where we'd either have to face an
> inconsistent world in which only lineAtOffset is supported or wait much
> longer for a more complete implementation that would also do the others
> (itemAtOffset, etc).  Personally, I'd be fine if this were limited to
> lines since the other chunk types aren't usually long enough in my own
> work to have much impact on performance having to make two calls.  But
> as I've noted before, sometimes I'm too easily satisfied and others may
> have more demanding requirements.
> 3. Is this worth submitting to the request queue?
> --
>   Richard Gaskin
>   Fourth World Systems
>   Software Design and Development for the Desktop, Mobile, and the Web
>   ____________________________________________________________________
>   Ambassador at FourthWorld.com                http://www.FourthWorld.com
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the use-livecode mailing list