Get a handler from a script
gcanyon at inspiredlogic.com
Sun Mar 19 17:12:57 EST 2006
On Mar 19, 2006, at 8:12 AM, Richard Gaskin wrote:
> Since "on" or "function" must be the first word in a line to be an
> active command or function, you could simply add return to your
> evaluation to weed out comments:
> if cr&"on handlerName" is in cr&the script of myObject then
If there is a leading space on the line this won't find it.
On Mar 19, 2006, at 12:51 PM, Mark Wieder wrote:
> Here's a line I learned from Jerry Daniels:
> filter tScript with "[ofsgOFSG][nueNUE][ ntNT]*"
This won't either.
Of course, any well-formatted script won't have spaces before a
handler definition, but that doesn't stop the script from compiling.
Checking the first word of each line is (I believe) certain, and is
still reasonably fast (takes less than twice as long as the filter
command in informal testing).
Unfortunately for anyone attempting this task, this is a perfectly
/* this is a comment
as is this */on mouseUp
I don't know of a good way around that, so I have ignored it thus
More information about the Use-livecode