call a function?

Shao Sean shaosean at unitz.ca
Mon Jan 7 13:33:01 EST 2002


if your function is in the stack script, then it should be available to any
object in the stack.. make sure that your function is really a function (ie.
you're passing data to it and that it's returning something).. make sure
that the code you are calling the function with "gets" returned data..

stack script:
function cowSpeak pParam
  return "a cow says" && pParam
end cowSpeak

button script:
on mouseUp
  -- one way of doing it
  get cowSpeak("quack")
  answer it
  -- another way
  answer cowSpeak("moo")
end mouseUp

you can create functions that have no parameters and return nothing
(basically a handler) but you'll still need to call them with the "get"
command


----- Original Message -----
> I've created a function, but don't quite get how to
> call it. Does the function have to be in the same
> object from where it's called. I placed it in the
> stack script but it doesn't seem to get called when I
> call it from an object,





More information about the use-livecode mailing list