Error Handling |
|
|
This page contains links and discussions on Lua error handling, including exception handling. * Programming in Lua and Beginning Lua Programming (see LuaBooks) contain sections on error handling. * Lua Reference 5.1 Manual: [1] [2] [error] [lua_error] [luaL_error] * [Exception Patterns in Lua, Lua Workshop 2006] by JohnBelmonte * "Chapter 13: Exceptions in Lua" in Lua Programming Gems (see LuaBooks) by JohnBelmonte identifies limitations in the language, implements a simple try/catch function, describes issues using (non-string) error objects, and implements a D-like scope manager (alternative to try/catch). * FinalizedExceptions - discusses an exception scheme with protect and newtry functions * CatchingLuaExceptions - a set of patches that facilitate lua exception handling in C and C++ * LuaAndExceptionsHackingNotes * ErrorHandlingBetweenLuaAndCplusplus - issues in mixing Lua with C++ rather than C * LuaCarp - Perl Carp implemented in Lua (handle error level transparently) * ResourceAcquisitionIsInitialization - automatically releasing acquired resources on scope exit, RAII * ResumableVmPatch - supporting yield across a pcall (see also FeatureProposals) |
|
This page contains links and discussions on Lua error handling, including exception handling. * Programming in Lua and Beginning Lua Programming (see LuaBooks) contain sections on error handling. * Lua Reference 5.1 Manual: * Background discussion: [2.7. Error Handling (in Lua)], [3.6. Error Handling in C] * To raise an error: [error], [lua_error] (C version with error object), [luaL_error] (C version with printf-style format string) * To raise an error conditionally: [assert] - see also: [naming of this function] * To catch errors on function call: [pcall], [xpcall] (with error handler function) * To catch uncaught errors: [lua_atpanic] * To get stack trace: [debug.traceback], [luaL_traceback] (C version, 5.2-alpha) * To raise errors on bad arguments in C: [luaL_argerror] and luaL_check* functions,[luaL_typerror] (luaL_typerror deprecated in LuaFiveTwo) * [Exception Patterns in Lua, Lua Workshop 2006] by JohnBelmonte * "Chapter 13: Exceptions in Lua" in Lua Programming Gems (see LuaBooks) by JohnBelmonte identifies limitations in the language, implements a simple try/catch function, describes issues using (non-string) error objects, and implements a D-like scope manager (alternative to try/catch). * FinalizedExceptions - discusses an exception scheme with protect and newtry functions * CatchingLuaExceptions - a set of patches that facilitate lua exception handling in C and C++ * LuaAndExceptionsHackingNotes * ErrorHandlingBetweenLuaAndCplusplus - issues in mixing Lua with C++ rather than C * LuaCarp - Perl Carp implemented in Lua (handle error level transparently) * ResourceAcquisitionIsInitialization - automatically releasing acquired resources on scope exit, RAII * ResumableVmPatch - supporting yield across a pcall (see also FeatureProposals) |