Foldit recipes can be written in Lua, a simple programming language. Lua is also used for scripting in World of Warcraft (WOW) and Angry Birds, although those scripts are no doubt very different than Foldit recipes.
Like GUI recipes, recipes written in Lua contain Foldit commands, such as shake and wiggle. Compared to GUI recipes, Lua recipes have many more Foldit commands available, and have much more flexibility in how the commands are used.
Lua recipes also use a full array of programming features, such as variables, if-then-else statements, loops, and functions, which are not available in GUI recipes.
The Foldit Lua Interface is the set of commands (functions) that a Lua recipe can use. Version 2 of the Foldit Lua interface has been available since 2011, and is the preferred version for new recipes. Recipes written using version 1 are still supported, but the command set of version 1 is not being updated. Version 1 recipes also don't have access to several Lua standard libraries, like "string" and "math".
Lua is easy enough to learn that everyone can use it, even people who have never programmed or scripted before.
The best place to get started if you don't have any programming experience is to work through the beginner scripting tutorials. Each of these tutorials also has a technical supplement with additional background information.
|Beginner 1||Tech 1|
|Beginner 2||Tech 2|
|Beginner 3||Tech 3|
|Beginner 4||Tech 4|
|Beginner 5||Tech 5|
If, on the other hand, you have some programming experience or want to get a quicker start, begin with Lua Scripting Tutorial (Intermediate). This intermediate tutorial starts from the ground up and assumes no prior knowledge but moves through material at a more rapid pace, including basics about how to run and modify scripts as well as core programming concepts like looping and variables.
Another option for experienced programmers is to use the full Lua Interface listing (below) in combination with the Lua Reference Manual to learn the material on your own. If you already know how to program, you'll find that it's just a matter of learning Lua's simple syntax and the Foldit command set. Additional resources for working with Lua are listed below, including guides to exporting and importing scripts.
Cookbook / Recipe Scripting TutorialsEdit
- 101 - Cookbook
- Lua Scripting Tutorial (Beginner 1) (browsing, loading and running scripts, open output window)
- Lua Scripting Tutorial (Beginner 2) (Lua commands)
- Lua Scripting Tutorial (Beginner 3) (using game commands)
- Lua Scripting Tutorial (Intermediate) (similar to beginner tutorials, but more compact)
- Lua Scripting Tutorial (Advanced) (using functions and tables)
- User's Guide to Foldit Lua 2.0 API (blog entry by smith92clone )
- Foldit Scripting Preview
- Foldit Cookbook Scripting
Commands / FunctionsEdit
- Simplified list of Foldit Lua Functions (V1)
- Foldit Lua Functions (V1)
- Foldit Lua Functions (V2)
- Lua Standard Libraries (V2)
- Error Handling in Lua (V2)
- Lua Script Library (useful functions you can add to your recipes)
- Lua Export and Import of Scripts using Text and HEX editor
- Lua Export and Import of Scripts using WORDPAD++
- Lua Script Advice
- Lua Functions that should be implemented
- Foldit library for debugging
External / OtherEdit
- Lua 5.3 Reference Manual
- Lua-users wiki
- Programming in Lua Book (First Edition)
- Lua Wiki for WOW (WOW-specific but contains a lot of useful resources)
Lua Language Edit
Foldit Lua InterfaceEdit
See Foldit Lua Interface.