saveStackRequest

Typemessage
DictionaryLCS
LibraryLiveCode Script
Syntax
saveStackRequest
Associationscard
Summary

Sent to the current card when the stack is about to be saved.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Example
on saveStackRequest -- delete all cards but the first
  repeat with x = the number of cards down to 2
    delete card x
  end repeat
  pass saveStackRequest -- or the stack won't be saved
end saveStackRequest
RelatedProperty: filename, filename of stack
Message: closeStack
Object: stack
Glossary: object, handler, current card, pass, message, trap
Description

Handle the saveStackRequest message if you need to do cleanup or other actions before a stack is saved. For example, if the stack creates temporary objects that should not be saved with the stack, you can write a saveStackRequest handler to delete those objects before the stack is saved.

The save action is triggered by the saveStackRequest message. This means that trapping the saveStackRequest message and not passing it prevents the stack from being saved. The LiveCode IDE locks messages when Save or Save As... are chosen from the File menu to ensure that the save occurs.