Stack file version...

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
bogs
Posts: 3466
Joined: Sat Feb 25, 2017 10:45 pm

Stack file version...

Post by bogs » Mon Jun 17, 2019 1:51 pm

I'm not sure I am groking this property correctly.

My goal was to get the file version of a stack, then make sure it is saved back to that version. Simple, right? Dictionary even has a nice example...

Code: Select all

command legacySave pStack
  local tOldStackFileVersion
  put the stackFileVersion into tOldStackFileVersion
  set the stackFileVersion to 2.4
  save stack pStack
  set the stackFileVersion to tOldStackFileVersion
end legacySave
...so, I decided to take a look at the property in the raw, so to speak. I put this into the MessageBox...
Selection_001.png
Version version, whats your version?
Of course, I followed it up with just "put the stackFileVersion" which came back as "5.5", but that doesn't tell me the version for a specific stack, I am guessing it is the version for the IDE as a whole.

What am I missing?
Image

Klaus
Posts: 11009
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Stack file version...

Post by Klaus » Mon Jun 17, 2019 2:52 pm

I think that has always been a global property, not stack specific.

Just read the dictionary which tells me that this has been deprecated with version 8 of LC.
But to be honest, I really don't get a word of the rest of the dictionary entry... :?

bogs
Posts: 3466
Joined: Sat Feb 25, 2017 10:45 pm

Re: Stack file version...

Post by bogs » Mon Jun 17, 2019 4:46 pm

So, if I want to make sure a particular stack is always saved in say, 5.5 vers., I should use 'stack version' instead?

Or, better yet, how does everyone else make sure a format doesn't change, lets say for a plugin, which needs to maintain compatibility for multiple (and sometimes pretty old) versions of the IDE?
Image

Klaus
Posts: 11009
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Stack file version...

Post by Klaus » Mon Jun 17, 2019 5:08 pm

bogs wrote:
Mon Jun 17, 2019 4:46 pm
So, if I want to make sure a particular stack is always saved in say, 5.5 vers., I should use 'stack version' instead?
There is nothing like "stackversion" in the dictionary, this is what I find so irritating in that entry for "stackfileverison"! :?

bogs
Posts: 3466
Joined: Sat Feb 25, 2017 10:45 pm

Re: Stack file version...

Post by bogs » Mon Jun 17, 2019 6:10 pm

Heh,

Not 'stackVersion', but 'stack <space> version' :wink:
Image

Klaus
Posts: 11009
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Stack file version...

Post by Klaus » Mon Jun 17, 2019 6:31 pm

AHA! That explains it. :D

But no word about how to use it, or am I also overlooking this?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5024
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Stack file version...

Post by jacque » Mon Jun 17, 2019 6:37 pm

Every now and then the format of LC's stack binary has to change to accommodate new features. This has happened maybe 4 or 5 times over the years. The stackfileversion tells you which of these binary formats is currently in use, which is the format any open stacks will also be saved in. If you would rather always save the stack in the original format it was in when you opened it, you can set that option in LC's preferences. if you want to save the stack in a particular format only once, use "Save as..." and choose the format from the popdown button in the Save dialog.

I don't think LC actually saves the particular LC version the stack was saved in, only the file format used.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 3466
Joined: Sat Feb 25, 2017 10:45 pm

Re: Stack file version...

Post by bogs » Mon Jun 17, 2019 8:52 pm

@Klaus, no, your not overlooking it at all, there is no example in dictionary of it's use. I was just going to brute force use anything I could think of and hopefully tumble onto it, but it appears "stack version" isn't backwards compatible either ~! :?
jacque wrote:
Mon Jun 17, 2019 6:37 pm
Every now and then the format of LC's stack binary has to change to accommodate new features. This has happened maybe 4 or 5 times over the years.
OH I know all about that heh, as many versions I use frequently have had many format changes over the years, but this is a first time challenge for me, so I'm wondering specifically how others deal with it, after I tried (and failed) to figure it out on my own.

The stack has a 'save this stack' line in it's "on closeStack" handler. The stack is also a plugin. Now, I know I can stick this stack into the main plugin folder in the IDE folders, which is where it was originally, and that is fine for me. In fact, in Mc, there is no other option.

However, if someone comes along in the future and downloads this plugin, and decides they like it, as the engine changes format over the ensuing years, it is probably unlikely they will want to move it from IDE to IDE. However, they may want to use it in any one of the versions they use, no matter how old it is.

I realize I am an oddball way outside edge special snowflake test case, but I'm sure there are people using say, IDE v7 while also using say, 9, and the two formats aren't compatible. So if they open it in the 9.x IDE, I wouldn't like to see them open the 7.x IDE and have it say it can't read the stack.

I know lots write plugins that span versions, so naturally I am curious how it is normally handled.
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5024
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Stack file version...

Post by jacque » Mon Jun 17, 2019 9:36 pm

As long as they don't save the plugin, it will retain its older stackfile version. LC is almost always backward compatible so nothing bad will happen. Why do you need to save the plugin? if you just want to retain user data, write it to disk and load it in as needed instead.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 3466
Joined: Sat Feb 25, 2017 10:45 pm

Re: Stack file version...

Post by bogs » Mon Jun 17, 2019 9:44 pm

Well, in this particular stack, there are lots of cust. props that *used* to be saved as part of the IDE, which I pointed to the stack itself to get it to work in the later IDEs. I thought about doing just what you said just now, writing them all out to file, but I know there is a way to save the stack as a specific version, I just can't remember what it is at the moment.
Image

bogs
Posts: 3466
Joined: Sat Feb 25, 2017 10:45 pm

Re: Stack file version...

Post by bogs » Mon Jun 17, 2019 10:20 pm

Ah HAH! I just knew someone had pointed out the way to do this previously, and I finally remembered who!

Thank you again Panos :D

*Edit, just tested it, worked like a charm.
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”