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.
Can't save stack
-
- VIP Livecode Opensource Backer
- Posts: 93
- Joined: Tue Nov 17, 2009 6:47 pm
- Location: Wellington, New Zealand
Re: Can't save stack
OK well it seems that I wasn't constructing the OnSave handler quite correctly. Apologies for inconvenience.
-
- Livecode Staff Member
- Posts: 192
- Joined: Thu Apr 18, 2013 2:48 pm
Re: Can't save stack
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
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
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Can't save stack
(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.
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.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev