How does a command find out who called it?

Ken Corey ken at kencorey.com
Wed Feb 1 11:28:43 EST 2012


On 01/02/2012 16:04, Mark Schonewille wrote:
> send "someCallback" to the target in 0 millisecs

Thanks, Mark, but I need the call from the other direction...

Let's say I have a card "testing" in stack "wild".
The stack script says:
on openCard
   start using "minihttp.livecode"
end openCard

The card script says:

on someHandler ...
   httpGet "http://blah.com","myCallback"
end someHandler

on myCallback ...
   -- do someting brilliant with the data we've requested
end myCallback


Finally, I have a stack called "minihttp.livecode".
The stack script looks like:

on httpGet pUrl,pCallback
   -- save the callback
   put pCallback into gMCB
   -- kick off asynchronous httpGet operations with a local callback
   mysocketOpen "address","mySocketCallback"
   -- now return
end httpGet

on mySocketCallback args
   -- Yay! Finally have the data.  Hand it back
   send gMCB to XXX in 0 milliseconds
end mySocketCallback


The question is: How do I know what "XXX" is in the mySocketCallback?

If there were a way in httpGet to say:
   put the name of my caller into gDataTarget

Then in mySocketCallback I could just say:
   send gMCB to gDataTarget in 0 milliseconds



See what I'm going for here?  Is there a way to get this information in 
Livecode?

-Ken




More information about the use-livecode mailing list