Writing LUA errors to a file


iv been working with lua for a while now and its really annoying how some server hosts dont provide any kind of visual console or log.

i know SOMETIMES it saves tiny bits of the console into {root}/logs but its not all of the console.

im wondering if there is a way to write lua errors to a file? (say a text document in data/)

i thought about overriding the error functions (error, Error, pcall, etc), having it write to the file then calling the old error function with the same args and its not working out too well.

then i thought about using the engire spew module then writing anything that comes out (but i dont think LUA is covered in engine spew)

so im kind of stuck atm so can anyone help?


Clientside errors won’t be written to a file on the server (easily), and that is might be what you’re noticing in console.

Put “lua_log_sv 1” into your server.cfg. This will create an error log with all server based lua errors in the base Garrysmod folder.