Hi,
I thought it was a really good presentation. I really like the call function as I can see that it would simplify a lot of our code.
On 30 Oct 2017, at 21:05, Andreas Weis <der_ghulbus@ghulbus-inc.de> wrote:
If you feel that I gravely misrepresented some aspect of the language or
you think that there is something that is clearly missing from the
presentation, I will gladly take your advice into consideration.
One thing that comes to mind is our biggest pain point, which is error handling. I have found very little guidance on mixing c++ exceptions and Lua.
We compile Lua as C (because we don’t really understand LUAI_THROW/LUAI_CATCH and how they mix with our own exceptions). Our understanding is that if we’re inside a C++ function, and a lua api function errors, our destructors won’t be called because it will longjmp to the nearest pcall. The most common example is calling lua_gettable on something with an __index metamethod - as there is no way to know prior to trying the gettable that the metamethod will fail.
At the moment we wrap all our code in try/catch blocks and translate any c++ exceptions to lua errors, we use lua_pcall instead of lua_call, and from the lua side, we try to ensure that nothing else can error while we’re inside a try block and there are objects that need destructors called.
Thanks,
Kev