How to create hundreds of stacks with the same name in a loop?

Phil Davis revdev at pdslabs.net
Tue Jun 10 12:43:08 EDT 2008


Hi Tiemo,

In addition to what Mark said, you can do this, which works:

create stack "foo"
set the destroyStack of stack "foo" to true
save stack "foo" as tMyFileName
delete stack "foo"

The "delete" command removes "foo" from Rev's memory, but does not 
delete the saved file. But be careful - if "foo" were a substack, the 
"delete" command would in fact delete it from its stackfile! But since 
"foo" is a mainstack, you're OK. So use "delete" with caution.

Hope this helps -
Phil Davis


Tiemo Hollmann TB wrote:
> Hi all,
>
> I want to create in a loop hundreds of stack files as storage for datas in a
> custom property. What I wanted to do is to give the stack file a unique
> name. But the name of the stack in all files always "foo" for easier
> handling afterwords. In my loop I just create the stack, set the custom
> property, set the destroystack to true, save and close. When using a unique
> name for the stack also (foo1, foo2, foo3,.), everything works fine, each
> stack is closed one after the other after creation. But when using the same
> name "foo" for the stack, no stack is being closed, because Rev "thinks" it
> is being still used, though it is another stack file. The destroy stack
> doesn't frees the stacks, as long as any handler is running, because all
> have the same name.
>
>  
>
> Any ideas, how to create a lot of stacks with the same name - but different
> names for the stack file?
>
> Thanks for any ideas
>
> Tiemo
>   

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list