Page 1 of 1

Globals and clone this stack

Posted: Tue Apr 08, 2014 3:35 pm
by Mag
Hi all!

If I clone a stack the new instance of the stack uses the same globals, right? And if I would like to have different globals in each instance of the stack? :oops: :oops: :roll:

Re: Globals and clone this stack

Posted: Tue Apr 08, 2014 4:00 pm
by Klaus
Hi Mag,

globals are... well, globals! No way! :D

Maybe you can "get away" with LOCAL vars in the stack script?


Best

Klaus

Re: Globals and clone this stack

Posted: Tue Apr 08, 2014 4:32 pm
by FourthWorld
If you need values specific to the stack you could use custom properties, effectively binding the data to the object.

Re: Globals and clone this stack

Posted: Tue Apr 08, 2014 7:56 pm
by Mag
Thank you Klaus, I will examine the possibility to implement local vars...

FourthWorld nice idea, are the custom propperties a lot slower than globals?

Re: Globals and clone this stack

Posted: Wed Apr 09, 2014 12:49 am
by FourthWorld
Mag wrote:FourthWorld nice idea, are the custom propperties a lot slower than globals?
Measurably, but rarely noticeably.

Re: Globals and clone this stack

Posted: Wed Apr 09, 2014 1:59 pm
by Mag
Thank you for the info guys!

And if I have two instances of the same main stack (called for example "MyStack"), each one with their substacks, when I set a custom property for the stack MyStack from within a substack, can I be sure that the property set is the one of the current mainstack?

PS
I know, not an easy question... 8)

Re: Globals and clone this stack

Posted: Wed Apr 09, 2014 2:37 pm
by Mag
PS
I noticed that the substacks are not cloned with the main stack. So if I have to set a custom property of a main stack cloned from a substack, I have to know the name of it. This because the substacks continues to own by the original stack.

Re: Globals and clone this stack

Posted: Wed Apr 09, 2014 3:03 pm
by FourthWorld
After executing a "create" or "clone" command, the value on the local variable"it" will contain a absolute reference to the new object.

Re: Globals and clone this stack

Posted: Wed Apr 09, 2014 3:29 pm
by Mag
Thank you Richard!