2 replies [Last post]
Joined: 01/13/2020
Groups: Go Science

This line causes Foldit.exe to crash:


I'm assuming it's because Lua arrays start at 1, not 0.

Regardless, the console should throw an error rather than the whole program crashing.

spvincent's picture
User offline. Last seen 36 min 52 sec ago. Offline
Joined: 12/07/2007
Groups: Contenders
It is more likely that the

It is more likely that the crash is due to the parameter 0 being out of range: amino acids in a protein are by convention numbered consecutively starting at 1. In any case you can handle most errors within a script quite gracefully by using Lua's xpcall mechanism (see for example https://foldit.fandom.com/wiki/Model_Recipes). And Feedback rather than Forum is probably a better place to report problems of this kind.

LociOiling's picture
User offline. Last seen 1 hour 3 min ago. Offline
Joined: 12/27/2012
Groups: Beta Folders
shouldn't cause a crash....

Good find, Pikamander2, no Foldit Lua function should crash the client. The Lua functions xpcall and pcall don't help in this case. They catch errors generated through the Lua error function, but not outright bugs. (I'm guessing that something went wrong in the parameter checking code, just before the error function or the equivalent would be called.)

For example:

good, errmsg = pcall ( current.GetSegmentEnergyScore, 0 )

still crashes the client.

I opened a feedback: https://fold.it/portal/node/2008878

See also: using pcall to trap Lua errors for more on pcall.


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, Amazon, Microsoft, Adobe, RosettaCommons