How does a command find out who called it?

Ken Corey ken at kencorey.com
Wed Feb 1 09:42:37 CST 2012


I have some tiny http utility functions I'm using to do a 'get' on an 
iOS device.

Up to now, I've had these functions in the same card as the handlers 
dealing with that card.  Now I want to make them into a library.

The problem I'm hvaing is that they are asynchronous: they require a 
callback.

Up to now, it was in the same card, so I didn't have to specify it.

Unfortunately, now that the functions are in a separate stack being used 
as a library, I need to know the name of the calling card, so I can know 
the context in which to do the callback.

Right now my httpGet looks like this:

httpGet "http://blah.com/testing.html?a=1&b=2","myCallback"

The code returns immediately, and when the answer comes back, nyCallback 
is called with the result.

However, my library dies because there's no callback with the given name 
in it.  It's in the original calling card.

I'd rather not change the API if I could get away with it...

Anyone know how to find out who called a given command?

-Ken



More information about the use-livecode mailing list