As of January 4th, 2024, this no longer works as debug.getregistry() was killed off.
Garry's Mod OnLuaError hook pure Lua implementation for Server and Client realms.
Keep the file in to lua/autorun and never change the file name. This is to keep it shared between addons.
With the exception of errors from ProtectedCall(), any error that does not halt the code will not call this hook as they aren't sent to the Error Handler.
Notable errors that aren't sent to the handler:
- Errors from
Error() - Errors from
ErrorNoHalt() - Errors from
ErrorNoHaltWithStack() - Compile fails from
CompileString() - Compile fails from
CompileFile() - Not a lua file or missing file fails from
include()