saveStackRequest

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

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:

# Syntax

saveStackRequest

# Examples

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 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 trap the saveStackRequest message and not pass 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.

# Tags

# See

- **property:** filename, filename of stack - **message:** closeStack - **object:** stack - **glossary:** object, handler, current card, pass, message, trap