lua-5.4.0-alpha: unprotected calls in luaL_newstate

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

lua-5.4.0-alpha: unprotected calls in luaL_newstate

David Heiko Kolf-2
Hello,

while writing my own lua_WarnFunction for Lua 5.4.0-alpha to store the
warnings in a list I was looking at luaL_newstate for reference.

I noticed that it calls both lua_newuserdatauv and luaL_ref without any
pcall. Both functions are marked as being able to raise memory errors.

In the unlikely event this happens, it would go to the panic function
and shut down the entire application, or did I miss something?

This isn't a big deal for the application I am currently working on. It
has just one Lua state and would exit anyway when that fails to set up,
but it might be a bigger issue for an application that tries to create
an extra Lua state at a later time.

Best regards and thanks again to the Lua team for developing Lua!

David


(Even with my current implementation existing, I would still prefer a
normal Lua function as error handler for __gc and those __close errors
that conflict with other errors.)