The reason I think Roberts is more the ticket is that it deals with
the case where you have a handler 'jumpHigh' as well as a handler
'jump' later in the script -- this means we need to check for the end
of the handler name - which could be a space if there are parameters,
or cr if not.

We can avoid checking that for the 'end' line by using the third
parameter to lineOffset -- lines to skip, so a revised version might
be:

function extractHandlerFromScript pScript,pHandlerName
  put lineOffset("on" && pHandlerName & space, pScript) into tHandlerBegin
  if tHandlerBegin is 0 then put lineOffset("on" && pHandlerName & cr,
pScript) into tFooBar1
-- this deals with either space or cr at the end of the handler name
-- and we don't need to check for 'function' since it contains 'on'

  if tHandlerBegin is 0 then return empty
  put lineOffset("end" && pHandlerName,pScript,tHandlerBegin) into tHandlerEnd
  if pHandlerEnd is 0 then return empty
  return line tHandlerBegin to tHandlerEnd of pScript
end extractHandlerFromScript

Cheers,

Mark


Great improvements, Mark.

Robert
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to