How to tell within LUA recipes if an autosave/quicksave-slot is already occupied?

Case number:845813-1998859
Topic:Game: Tools
Opened by:jeff101
Opened on:Friday, December 5, 2014 - 23:28
Last modified:Friday, March 8, 2019 - 18:51 says:

void absolutebest.Restore()
void creditbest.Restore()
void recentbest.Restore()
void save.Quickload(integer slot)

It would be nice if each of these functions would instead return a boolean (true/false) value
to say if it succeeded in restoring or loading its respective saved solution.

It would be nice if there were LUA functions to check if each of the above
quicksave-slots/autosaves were already occupied.

It would also be nice if there was a LUA function that would list all of the
quicksave-slots/autosaves presently occupied.

If such functions already exist, please let me know.


(Fri, 12/05/2014 - 23:28  |  2 comments)

Wipf's picture
User offline. Last seen 1 year 2 weeks ago. Offline
Joined: 10/06/2018
Groups: Go Science

For the quicksave slots I just found the lua function bool save.QuicksaveEmpty(integer slot) in the Wiki.
Unfortunately it looks like there are no such functions for the autosave slots absolutebest, creditbest and recentbest.

You also suggested to have the Restore()-functions return a boolean whether they were successful. I think, that would be a good improvement. Usually changing the return type from void to something else should not break existing scripts, but I am not an expert in LUA, so it is possible that this would break some scripts. But I think it should be easy to fix those scripts manually.

LociOiling's picture
User offline. Last seen 3 hours 29 min ago. Offline
Joined: 12/27/2012
Groups: Beta Folders

I was all ready to close this one, but then I read on. The new save.QuicksaveEmpty call covers the subject line, but the part about missing return codes is still open.

There are several other spots where the Foldit functions could use a return value. For example, structure.DeleteCut won't tell you whether it closed a cutpoint. Maybe it closed, maybe it didn't, maybe there wasn't a cutpoint there in the first place.

An added return code won't break existing recipes. Changing the parameters used in calling a function might break things, but Lua lets you ignore returned values.

See also Timo's New Lua functions, any suggestions? thread. I think some of those suggestions have been implemented in the last year or so. So far, we're not seeing new public recipes that use save.LoadSolution and some other new functions.


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