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?
Globals and clone this stack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Globals and clone this stack
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?

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?
Re: Globals and clone this stack
Hi Mag,
globals are... well, globals! No way!
Maybe you can "get away" with LOCAL vars in the stack script?
Best
Klaus
globals are... well, globals! No way!
Maybe you can "get away" with LOCAL vars in the stack script?
Best
Klaus
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10066
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Globals and clone this stack
If you need values specific to the stack you could use custom properties, effectively binding the data to the object.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Globals and clone this stack
Thank you Klaus, I will examine the possibility to implement local vars...
FourthWorld nice idea, are the custom propperties a lot slower than globals?
FourthWorld nice idea, are the custom propperties a lot slower than globals?
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10066
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Globals and clone this stack
Measurably, but rarely noticeably.Mag wrote:FourthWorld nice idea, are the custom propperties a lot slower than globals?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Globals and clone this stack
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...
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...
Re: Globals and clone this stack
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.
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.
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10066
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Globals and clone this stack
After executing a "create" or "clone" command, the value on the local variable"it" will contain a absolute reference to the new object.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Globals and clone this stack
Thank you Richard!