Page 1 of 1

Can't save stack

Posted: Mon Sep 12, 2016 10:22 am
by pthirkell
I have a widget script which works fine in test mode and installs ok. When I create a new stack and drag out the widget however, any subsequent attempt to save the stack fails.

I get a dialog box saying... Can't save stack 'myStackName' due to an error: Error writing stack (disk full?)

Any pointers towards what I might be doing wrong are most welcome.

Re: Can't save stack

Posted: Mon Sep 12, 2016 10:48 am
by pthirkell
OK well it seems that I wasn't constructing the OnSave handler quite correctly. Apologies for inconvenience.

Re: Can't save stack

Posted: Mon Sep 12, 2016 10:51 am
by livecodeali
The most likely thing off the top of my head is that you're trying to serialise a non-primitive type in your OnSave code.

If you are trying to put a canvas type (for example Color) in the properties array, there will be issues when saving. You need to convert to String beforehand.

(this is just guessing - if not then perhaps you could post your OnSave code)

Ali

Re: Can't save stack

Posted: Sat Jun 10, 2017 12:45 am
by mwieder
(coming here from a related discussion)

the explanation makes sense, but I'm wondering:

1. what primitive types are built in?
Are these just the types listed in the com.livecode.type is<Type> functions? Those would be boolean, data, list, array, number, and string. In that case we'd have the same problems with point and rect as well as some other types probably that I can't think of off the top of my head.

2. why not make the conversion to/from strings automatic under the hood where necessary when serializing? i.e., for colors we can invoke stringFromColor to do this as a one-liner from a script level, and then colorFromString on the way back. It should be easy for the LCB engine to say "this is not a primitive type, I'll convert it for you and save the type information in order to avoid throwing an error that has no relevant information" when saving the array, and then on retrieving the array convert back if there's associated type information.