At 10:39 AM -0500 3/19/01, steve wrote:
>How do a return a value from a child object?
>From a script I
>
>On something
>Return 10+10
>End
>
>Put something()
>But that does not seem to work with a child object.
>
>On something me
>Return 10+10
>End
>
>Put something my object()
>
Steve,
You create an object by calling the "new" handler in a parent script.
A minimal "new" handler in such a script would look like this:
-- AParentScript
on new me
return me
end
Then, you create an object from a parent script using a line like this:
myObject = new(script "AParentScript")
After executing the above line, the variable "myObject" is assigned a
value called an object reference to the child object. Using
different terminology, myObject is basically the address of where the
object lives in memory. After creating (or "instantiating") the
object, you can now call handlers (also known as "methods") in the
object. So, in your example, you had a method like this:
on something me
return 10 + 10
end
But, you need to call the method of the object to do it. You would
do this by issueing the following line:
put myObject.Something()
This line specifies that you are calling the "Something" method
within the "myObject" object. If you have a method with parameters,
you would specify them inside the parenthesis.
Hope that helps,
Irv
--
Lingo / Director / Shockwave development for all occasions.
(Over two millions lines of Lingo code served!)
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]