Well... Changing Lua version at this stage of the project is quite difficult.
It is very possible that there is a bug in my code and not in Lua, and in any case I have found my solution (check the return of the first pcall).
However I want to better understand how Lua works, hence the question.
According to the language spec, what are the cases that the Lua state may become undetermined/corrupt/broken/etc? Are there cases that I sould not call another function, or that calling lua_close is illegal?