Get a handler from a script
rjb at robelko.com
Fri Mar 17 06:42:41 EST 2006
>set the wholematches to true
>put lineOffset("on" && pHandlerName, pScript) into tStart
>if tStart is 0 then put lineOffset("function" && pHandlerName, pScript) into
>put (lineOffset("end" && pHandlerName, pScript) +1 into tEnd
>answer tStart & cr & tEnd
Unfortunately, wholematches can't be used, at least for the first
lineoffset, because there are likely some parameters further in that
line. The alternative to lineOffset is to use regex.
A truly generic function would need to know whether it searches for
command or function, because it is possible to have one of each with
the same name.
More information about the Use-livecode