Back to Recipes Homepage
recipe picture
Recipe: cleanup v1.0
Created by LociOiling 2 1
4.666665
Your rating: None Average: 4.7 (3 votes)

Profile

Name: cleanup v1.0
ID: 101925
Created on: Sat, 02/27/2016 - 23:18
Updated on: Sat, 02/27/2016 - 23:18
Description:

This a demo of using the xpcall function to provide a cleanup routine. The cleanup routine in this recipe can be used in any Lua recipe.



Best For


Comments

Joined: 12/27/2012
Groups: Beta Folders
cleanup function demo

This recipe shows how to use the Lua "xpcall" function to provide a cleanup routine. The cleanup function in this recipe can be used in any recipe written using version 2 of the Foldit-Lua interface.

A cleanup function lets your recipe recover when the user cancels it or when it crashes due to a Lua syntax error or an incorrect argument to a Foldit function. Having a cleanup function allows the recipe to always do normal cleanup tasks, such as resetting secondary structure, deleting bands, and restoring the best score.

To avoid duplicating code, the mainline logic in your recipe should simply call the cleanup function when it's done. When the cleanup function in this recipe is called without an argument, it's treated as a normal termination at the end of the recipe.

Want to try?
Add to Cookbook!
To download recipes to your cookbook, you need to have the game client running.
Parent

none

Children

none

Authors
Sitemap

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Microsoft, Adobe, RosettaCommons