Using "send...in <time>" wirh private commands?
Monte Goulding
monte at appisle.net
Sat Nov 7 15:17:01 EST 2015
> On 8 Nov 2015, at 4:13 am, Richard Gaskin <ambassador at fourthworld.com> wrote:
>
> This works:
>
> command SomeTimer
> DoSomething
> send "SomeTimer" to me in 500 millisecs
> end SomeTimer
>
> This doesn't work:
>
> private command SomeTimer
> DoSomething
> send "SomeTimer" to me in 500 millisecs
> end SomeTimer
>
> I can kinda understand why, but I'd like to be able to manage a timer from within a library without exposing the timer to other scripts.
>
> Anyone know of a trick for that?
>
> I suppose I could look at line -2 of the executionContexts, but that feels "unclean".
Hi Richard
I had a look in the source and I don’t think it would be all that tricky to upgrade send so you can send private handlers from the same object. Send without a timer is easy as you already have a handle to the execution context which gives you a handle to the calling object. Send in time is a little tricker but not overly so. It just involves adding the calling object in a number of calls and also to the internal pending messages data structure. I guess we could add an extra caller object reference item to the pendingMessages as a result. The engine uses the same mechanism to send a lot of messages so you would need to handle the caller being nil meaning an engine message.
Cheers
Monte
More information about the use-livecode
mailing list