Since RPS lua can call into C, but C can also call into lua (hooks and detours), error handling can get tricky. It is probably best to register an error handler for sensitive operations.
Instructions:
https://stackoverflow.com/questions/7049502/c-try-and-try-catch-finally