Equivalence to the SuperCard function call "via" object
Dar Scott
dsc at swcp.com
Wed Jul 9 11:47:00 EDT 2003
On Wednesday, July 9, 2003, at 09:04 AM, Joël Guillod wrote:
> The problem with the script you propose is that you can have variables
> with
> values containing quotes and then the script will just fail. The best
> workaround I found until yet is:
>
> call "myHandler var1,var2,var3" of myObject
> put the result into fctResult
The TD says...
The difference between the call and send commands
is that the send command changes the context so
that object references are treated relative
to the object you send the message to,
while the call command does not change the context
and continues to treat object references relative
to the original object.
The "send" also work with the above method. Depending on your need
concerning the target, send might be the one for you.
I use send a lot and I have found that my favorite way to pack
parameters is to use variables. (This is in the upcoming primer, too.)
> This is working ok but not when a var type is an array!
Also, numbers in internal format (the result of arithmetic and other
functions) will be converted to strings based on the current
numberFormat. Well, that's the case with send and I assume that's the
way it is with call.
It's the conversion to string that gets you in both cases. (In the
upcoming primer, as well.)
You may need to 'combine' the array, but with a new design, I'd try
something else. Globals? The send and call commands don't have to
return using 'the result', global variables and maybe custom properties
can be used. (Hmmm. Maybe a custom property will do what you want.)
Jan and I tinkered with some very general schemes, but they were
elaborate and slow and suitable only cases where generality was
important and speed does not have to be the highest. I think I'd look
at send/call depending on your need.
Dar Scott
More information about the use-livecode
mailing list