gm_luaerror - Hook to Lua's error display


Sample code:


lua_showerrors = CreateConVar(“lua_showerrors”, 1)

hook.Add(“LuaError”, “LE”, function(err) --Return anything other than nil to stop the standard error display
local var = lua_showerrors:GetInt()

if (var == 0) then
	return false
elseif (var == 1) then
	return false

end )[/lua]

Uhm, so this hides the lua errors?

It can if you want it to.

So many people want this. Nice work.

So bad Lua coder can hide their mistakes now. :confused:

They can hide the errors from themselves if they really want to.


hook.Add(“LuaError”, “LE”, function(err)

oh shit?

This is going to be so good for stoned to use in the lua console addon.

Another useful module is released

I already implemented it :smiley:

Oh look, it’s gmod9’s error handling.

Kinda lost as to where I put this, I’m new :confused:

garrysmod/lua/includes/modules for the dll
garrysmod/lua/autorun/client for the lua file.

Thanks bud ^^


Oh nose I don’t have an autorun file in the lua folder, what do I do :confused:

Create it.

all fine and stuff but when I open the file I don’t have a lua file to put into my newly made folders, just the a dll, cpp, and a “file h”

This module is not for you, Khyber.
It will serve you no purpose.

I want to hide the error box so yeah it would be

Use the sample code in the OP.

sorry to bother you so much skondra but what is the OP?

and where would it go?

The original post. Put the code inside a Lua file and save it where FlapJack told you to.