Unlike movie scripts, which can be called by anyone, and have unique names 
(only one is valid for the whole program), various sprites and objects can 
have their own private scripts with their own private actions and 
properties.  They don't require unique names, though, since you refer to 
them by specifying which object you want to call the script on.

So you could have a function called display, and 5 sprites could have a 
script, each with a 'display' function.  Each knows how to display 
itself.  To call them, you would say something like display(object), or 
alternatively, object.display().

So, when you say something like display(object), the variable 'object', 
which was previously assigned to whatever object it was, actually gets 
passed into the function, so it would look like:

on display me
end

where 'me' is the first parameter, and always represents the object.  It is 
passed in, in part in case you want to use it to call some OTHER function 
where you have to give back a pointer to yourself, and in part just to keep 
things straight, because it's the first parameter.

If you were to call display, and let's say display took an x and y 
coordinate, then you could call the function like so:

   display(object, 100, 382)

which presumably tells the object to display itself at coordinates 
(100,382).  The handler might look like this:

on display me, xLoc, yLoc
  ...

end

Director has always used 'me' by convention.  Some languages use 
'this'.  'Me' is not a reserved word, so you can use anything you want 
there.  For instance, this would be equally valid:

on display myObjPtr, xLoc, yLoc
  ...

end

Director examples tend to use 'me' because it's short and to the point, 
that's all.

Director always examines the first parameter to see if it's an object, and 
if so, tries to call the named function in that object, and then passes in 
the object variable itself for convenience and consistency.

- Tab


At 10:49 PM 6/23/01 +0200, Enrique Nivasch wrote:
>Hi folks,
>
>I'm new to the list and to lingo, I have experience in some programming 
>languages.
>
>I don't understand the role that "me" plays in a behavior argument list, 
>could someone please explain it to me?
>
>Thanks,
>
>Enrique


[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!]

Reply via email to