difference between function and command and sending parameters

william humphrey shoreagent at gmail.com
Fri Oct 17 11:08:41 EDT 2008


subject was "question that comes from programming without knowlege"
I always thought that to pass a parameter with a command it had to be a
function like.
function myfunction param
  -- do stuff with the param
end myfunction


but I just realized (from use actually) that you can do:

command mycommand param
 -- do stuff with the param
end mycommand

and it works just as well. Of course you can also say:

on mycommand param

end mycommand

and I guess "on" is a synonym for "command"

Now (if you're bored and read this far) you can "send" a command to a script
in another card or stack but you can't send a function.

send mycommand param to card "scripshere" of stack "mystack" works fine.

But you can't send a "do myfunction(param)" to a card so any functions that
you write have to be in the default stack's script if you want to use them
all over the place.

So my question is twofold.

1. How do you send a "do" to a function.

and

2. why would anyone use the function thing when they can use a command with
a parameter. What good is a function? I guess when you want multiple
parameters?



More information about the use-livecode mailing list