question about This
Eric Soroos
eric-ul at soroos.net
Sat May 18 15:10:51 PDT 2002
On Sat, 18 May 2002 14:53:33 -0700 in message <B90C1B6D.D7BA%sdevore at teachesme.com>, Sam DeVore <sdevore at teachesme.com> wrote:
> On 5/18/02 12:56 PM, "Matt Neuburg" <matt at tidbits.com> wrote:
> > Oh, all right, here. Make a #tools script called getThis, as follows:
> >
> > script.newscriptobject("return this", @tools^.myWeirdScript);
> > return myWeirdScript()
> >
I wonder if this is a case of returning something that is then evaluated outside the context where it is defined.
Ordinarily, you have:
local (returnValue="foo");
return foo
will give you foo, since it's value is copied to the return stack before foo goes out of scope.
But if you:
return this
Since this is lazily evaluated, it doesn't get evaluated until its context is gone, therfore it throws an error.
I suspect that :
local (thisScript = this);
return thisScript
should return the script object that this is pointing to.
eric
More information about the Frontier-Users
mailing list