Re: Script objects 'as string' in an identifiable way
Re: Script objects 'as string' in an identifiable way
- Subject: Re: Script objects 'as string' in an identifiable way
- From: has <email@hidden>
- Date: Mon, 5 Nov 2001 20:39:43 +0000
Scott wrote:
>
On Mon, 5 Nov 2001 01:15:32 +0100, Brennan <email@hidden> asked,
>
>
> I'm in a position where it would be useful for me to distinguish one script
>
> object from another (while debugging) in the result window.
>
>
>
> Unfortunately they all appear as <<script CLASSNAME>>, with no further
>
> identifying features.
>
>
Its not really a class name. What appears after the <<script is the name of
>
that particular script. A copy won't have that name.
>
>
Specifically, on my machine (AS 1.5.5 and Script Editor 1.5.5), a script
>
defined
>
as
>
>
script foo
>
-- whatever
>
end script
>
>
appears as <<script foo>> in the result window. But if the script is defined
>
dynamically (either by copying the script above: "copy foo to bar", or by
>
returning the script from a constructor function after being created
>
anonymously,
>
>
to makefoo()
>
script
>
-- whatever
>
end script
>
end makefoo
>
>
In that case, you just get <<script>> as the result.
Handy timing... right at the moment I'm busy messing around getting to
grips with constructors myself. Might I chip in with thoughts and questions
of my own?
Why not name the script in the constructor? Or is there a reason for making
it anonymous?
'Copy foo to bar' won't preserve the name in bar and neither will 'copy
makefoo() to bar'; however 'set bar to makefoo()' will. 'Set bar to foo'
just creates a reference so you wouldn't want to use that [data sharing
strikes again].
Adding an index property sounds a pretty good idea... think I'll do that
myself (maybe a name property too, if only for security against 'copy').
Any other useful tricks one can do with script objects and constructors?
Cheers,
has