I'm hopeful someone can provide assistance with this. At the moment, I'm using set_exit_key("down") to exit my script in ALT mode. However, I also need to invoke a function to perform some cleanup tasks, which I've defined elsewhere in the script. So, my question is: is there a way in CHDK Lua to automatically call one of my functions when the script terminates? I'm aware that I could use a version of set_exit_key("no_key") and manually handle the down button to achieve this, but I'm wondering if CHDK Lua offers an option to call a user-defined function upon script termination. Thanks! G