Newbie3

dunbarx dunbarx at aol.com
Mon Dec 8 11:52:04 EST 2008


Thanks.

This is the sort of thing I wrote, too. HC code would be similar; I'll take your word for the speed.

I was wondering if there was something snazzy in Rev (that was not in HC) that did not require running through the whole body of text, in other words, directly, like the new "replaceText" function that is a one-line substitute for "fullReplace". Very Rinaldi-like.

My initial work in Rev is getting a handle on all my HC XFCN and XCMD stuff. I am trying to figure out what exists in Rev that can be used directly for these sorts of things. After all, I hear that Rev does not need externals, because they basically all exist natively.

On this topic, I like the idea that ancillary windows are implemented as stacks. This could have been done in HC also, but not nearly as well, since the stack types were limited. I used "megaWindow" by Dan Gelder just everywhere.

Craig Newman



On Dec 8, 2008, at 10:11:37 AM, "Jan Schenkel" <janschenkel at yahoo.com> wrote:
##
function MyFindLines theTextToFind, theVariable
local theLines, theLineNumber
put 0 into theLineNumber
repeat for each line theLine in theVariable
add 1 to theLineNumber
if theLine contains theTextToFind then
put theLineNumber & comma after theLines
end if
end repeat
delete char -1 of theLines -- remove trailing comma
return theLines
end MyFindLines
##

The 'repeat for each' style of loop is extremely fast
- much faster than the old 'repeat with i = 1 to the
number of lines in theVariable' style.

HTH,




More information about the use-livecode mailing list