Improved error-handling for Lua