FR: full sexp 'boolean' return from lua
I have on occasion wanted to have a lua sexp return the values like SEXP_KNOWN_FALSE to mesh a little more closely with the event evaluation system. An enum for this or new userdata type seems like the cleanest way to do this.
After a little more poking at the idea that prompted this, it would likely need to include a new value $Return Type: in the sexp table, that would let the operators using it be used in the root position of an event.
Sounds about right. The return type could use an enum class with values corresponding to the SEXP_ boolean values, and then these could be converted in the LuaSEXP::getSexpReturnValue function.
lua-save-file-exists would benefit greatly from this: currently, using it in the obvious way, i.e. ( when ( lua-save-file-exists "whatever" ) ( do-something-related-to-save-files ) ), causes disk IO every frame if the file doesn't exist.
I recently added a caching mechanism to alleviate this problem: https://github.com/FSO-Scripters/fso-scripts/pull/59
But this is not to take away from your comment, which is an excellent use case for this FR.
Turns out that this can be done in a way that's fully compatible with the current API. PR shortly.
Implemented in #6063