Get name of mainstack from substack

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Tribblehunter
Posts: 78
Joined: Wed Apr 10, 2013 9:08 pm

Get name of mainstack from substack

Post by Tribblehunter » Sun Nov 09, 2014 7:01 pm

Hi all.

Stuck on something that seems simple but I must be missing something!

I need to get the name of the mainstack from a substack. But can not seem to get the grammar correct.

this code is in the substack on preOpenStack

get the name of the mainStack of me

but it fails. Any help appreciated

Got it! was being silly.

But now i can't reference mainstack from substack

get the cVersion of the mainstack of this stack

Definately got coders block!
Last edited by Tribblehunter on Sun Nov 09, 2014 7:11 pm, edited 1 time in total.
Returning to try to learn livecode again.

But much greyer at the temples than the last time.

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Get name of mainstack from substack

Post by LCNeil » Sun Nov 09, 2014 7:09 pm

Hi Tribblehunter,

Get puts a value from an expression into the it variable, so you will have to reference this in your script.

Also, the correct syntax that you are looking for should be the following :) -

Code: Select all

on preOpenStack
   get the mainstack of me
   put it
end preOpenStack
Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.runrev.com
--

Tribblehunter
Posts: 78
Joined: Wed Apr 10, 2013 9:08 pm

Re: Get name of mainstack from substack

Post by Tribblehunter » Sun Nov 09, 2014 7:15 pm

Thanks. You gave me the solution and also nudged my brain to get the next solution!
Returning to try to learn livecode again.

But much greyer at the temples than the last time.

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: Get name of mainstack from substack

Post by Da_Elf » Tue Nov 11, 2014 2:19 pm

another useful one to use is "owner"[*]

Code: Select all

put the owner of me into grpName
answer "The group I am in is "&grpName

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Get name of mainstack from substack

Post by Mark » Tue Nov 11, 2014 10:17 pm

Hi,

Sometimes, it isn't practical to get the mainstack of me. In such cases, you can use the long id.

Code: Select all

put the long id of me into myVar
put "stack" && the last word of myVar into myStack

put the long id of the target into myVar
put "stack" && the last word of myVar into myStack
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply