- The pcalls to run conf were triggering their error very late, and were detecting error based on the second return value of pcall being non-nil. In fact the second return value of pcall is often non-nil in the case of *success*. We should check the first parameter, success/failure, instead.
- It is possible in principle to call error() with a non-string value, so errhand should sanitize its values with tostring.
- There is a check in the main boot.lua loop whether xpcall returned a string, which is the sign luajit hit an error in an error handler. This check was occurring in the wrong place (my fault; merge error when preparing PR) so if lovr.load() hit this case we were falling back to the horrible “could not call a string” error.
General changes:
- Amended the boot.lua error handling so when an error occurs in the error handler, the inner error is printed before quitting
- Silent quit instead of crash if a user implements lovr.errhand but it doesn't return a function
Oculus Mobile changes:
- The lovr.errhand screen is now correctly invoked for errors that occur inside lovr.draw. Multiple changes were needed to make this work:
- Instead of calling renderHelper, which uses lua_call (unsafe as Oculus Mobile does not call renderHelper) the oculus driver gets hold of the Lua ref and lua_pcalls itself. A new lovrHeadsetExtractRenderFn is added to make this possible.
- A mechanism is added where if the coroutine resume in boot.lua returns a value, boot.lua treats this as the string returned from luax_getstack and invokes lovr.errhand.
- Added a custom atpanic that routes through lovrThrow (since stderr gets eaten). With the draw() changes this should never be encountered, but it's good just in case. In current testing the tracebacks this prints don't seem to be right.
- Fix major bug in android_vthrow that meant % codes didn't work in lovrThrow on Android
- Nothing to do with errors, but fix getAxis("trigger")
- Enable/disable individual modules, including enet/json
- Enable/disable different "backends" (audio/headset)
- Choose to use system vs. source versions of different libraries
- Add FORCE_FILESYSTEM
- Handle THREAD_ERROR event with noop case
- Remove hopefully redundant lovr.graphics.clear in errhand
- Finally use correct type signature for assimpFileTell
There are breaking changes:
- lovr.step is removed.
- lovr.run is expected to return a main loop wrapped in a function. The
returned function is run as a coroutine to facilitate a cooperative
main loop.
- lovr.errhand should return a loop function instead of while true-ing.