Difference between revisions of "On unload"
From Scriptwiki
(added == See Also ==) |
|||
Line 14: | Line 14: | ||
This example would at first echo that the script is unloaded and then unset all variables beginning with ''xyz''. | This example would at first echo that the script is unloaded and then unset all variables beginning with ''xyz''. | ||
+ | == See Also == | ||
+ | To react when a script is loaded, look at the [[On_load|On load event]] (is triggered when you load the script the first time) or [[On_start|On start event]] (is triggered whenever you load the script). | ||
[[Category:Events]] | [[Category:Events]] |
Revision as of 11:47, 27 November 2005
The on UNLOAD event triggers in a script when the script is unloaded.
on <level>:UNLOAD:<commands>
Read access levels to get more info about the <level> field.
You can use this event to allow a script to cleanup, e.g. unsetting variables it did need.
Example
on *:UNLOAD: { echo -a Script xyz just unloaded. unset %xyz* }
This example would at first echo that the script is unloaded and then unset all variables beginning with xyz.
See Also
To react when a script is loaded, look at the On load event (is triggered when you load the script the first time) or On start event (is triggered whenever you load the script).