Page 1 of 1
What does "this" mean?
Posted: Sun Oct 07, 2012 6:05 pm
by sritcp
I have a programStack and a dataStack.
The openStack handler of the programStack loads the dataStack with
which makes dataStack the topStack.
Now, if the next statement refers to "this stack", does it refer to the programStack (where the script is running) or the dataStack?
Anyhow, to prevent confusion, I inserted the statement
before referring to "this stack"
When I start LC and load programStack, the dataStack continues to remain on top.
If I run "openStack" again (from messageBox), then the programStack comes up on top.
Am I right in understanding that "go stack" will also make a stack the topStack?
Thanks for your patience with me,
Sri.
Re: What does "this" mean?
Posted: Sun Oct 07, 2012 6:26 pm
by Klaus
sritcp wrote:Am I right in understanding that "go stack" will also make a stack the topStack?
Yes.
As for THIS, why not simply add this in the "places in doubt":
...
answer the short name of THIS stack
...
so you can SEE what is going on?
Seeing is believing and surely better than any explanation from other people!

Re: What does "this" mean?
Posted: Sun Oct 07, 2012 6:48 pm
by sritcp
Klaus,
Yes, I saw and I believed!

"this" does not refer to the script owner stack but the topStack.
The second part of my question still remains.
The
doesn't take effect when I start up LC. The dataStack stays on top.
It does take effect when I send openCard message again.
The difference seems to be that, when it is first loaded, the dataStack has to run its openStack (which is empty) handler
while the second time, this is not so.
I hope my description is not muddled.
Thanks,
Sri.
Re: What does "this" mean?
Posted: Sun Oct 07, 2012 7:02 pm
by Klaus
Hi sri.
need a bit more info.
When and where did you script: go stack "programStack"?
What is the main stack, what the substack?
Or are these two mainstacks?
Best
Klaus
Re: What does "this" mean?
Posted: Sun Oct 07, 2012 7:29 pm
by sritcp
Both programStack and dataStack are mainstacks.
I start LC and load programStack.
The openStack handler of programStack has these:
Code: Select all
on openStack
some statements A,B,C.......
.....
go stack URL tFilePath -- tFilePath points to dataStack
go stack "programStack"
answer the name of this stack -- here it returns "programStack"
answer "The top stack is: " & the topStack
#THE ABOVE RETURNS "dataStack" when the program starts and the openStack handler of programStack runs for the first time
#BUT RETURNS "programStack" when the message openStack is sent to programStack a second time via the messageBox
....
some statements D,E,F...... -- these run correctly in both cases
end openStack
In other words, the "go stack" message does not make the programStack the topstack the first time (i.e., when the program starts up).
I have run this a number of ways to make it work, but the result is the same.
Thanks,
Sri.
Re: What does "this" mean?
Posted: Sun Oct 07, 2012 8:50 pm
by Klaus
Hi Sri,
aha, this happens in a standalone, right?
And "load programmstack" means via Internet?
In that case the problem is that the Rev Libraries (like the internet stuff) is not yet loaded "on openstack"!
Add a little delay and all should work fine:
Code: Select all
on openStack
send "domystuff" to me in 1
end openStack
command domystuff
some statements A,B,C.......
.....
go stack URL tFilePath -- tFilePath points to dataStack
go stack "programStack"
answer the name of this stack -- here it returns "programStack"
answer "The top stack is: " & the topStack
#THE ABOVE RETURNS "dataStack" when the program starts and the openStack handler of programStack runs for the first time
#BUT RETURNS "programStack" when the message openStack is sent to programStack a second time via the messageBox
....
some statements D,E,F...... -- these run correctly in both cases
end domystuff
Or only "outsource" the "go URL..." part.
I hope I understood this correctly...
Best
Klaus
Re: What does "this" mean?
Posted: Sun Oct 07, 2012 10:15 pm
by sritcp
Hi Klaus:
No, I am still testing it on the Mac, starting LC and opening the stacks (not even standalone).
Sorry I didn't state it explicitly.
Sri.
Re: What does "this" mean?
Posted: Mon Oct 08, 2012 10:28 am
by Klaus
Hmmm...
Try to make that stack the topstack via script:
Code: Select all
...
go stack URL tFilePath -- tFilePath points to dataStack
go stack "programStack"
set the defaultstack to "programStack"
...