Name: saveStackRequest

Type: message

Syntax: saveStackRequest

Summary:
Sent to the <current card> when the <stack> is about to be saved.

Associations: card

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, 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

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 <object|objects> that should not be saved with the
<stack>, you can write a <saveStackRequest> <handler> to delete those
<object|objects> before the <stack> is saved.

The save action is triggered by the <saveStackRequest> <message>. This
means that <trap|trapping> the <saveStackRequest> <message> and not
<pass|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.

References: object (glossary), handler (glossary),
current card (glossary), pass (glossary), message (glossary),
trap (glossary), closeStack (message), stack (object),
filename (property), filename of stack (property)

