Using libs from several stacks

Dar Scott dsc at swcp.com
Mon Mar 1 20:06:48 EST 2004


On Sunday, February 29, 2004, at 01:15 PM, Richard Gaskin wrote:

>> May be there is libraryStack handler used and it tries to load sth 
>> second time.
>
> The libraryStack message can be problematic, since to use it robustly 
> requires the same structure for any usage which is stack-specific:
>
> on libraryStack
>   if the short name of the target is the short name of me then
>      -- do initialization stuff
>   end if
>   pass libraryStack
> end libraryStack

The above script addresses a slightly different, but important problem. 
  A problem can come up in multiple initialization in some cases.

My variation:

local inUse = false

on libraryStack
   if the target is me then
     if not inUse then
       -- first init
     else
       -- init for other than first
     end if
   else
     pass libraryStack
   end if
   put true into inUse
end libraryStack

Dar Scott



More information about the use-livecode mailing list