Permalink
Browse files

Update errors.lua

Reduce time of Lua error notification from 30 to 10 seconds.
  • Loading branch information...
1 parent 1bd8973 commit 9eb85371a8d0d3266ee93a984ca34a8df08b2283 @robotboy655 robotboy655 committed Apr 19, 2014
Showing with 19 additions and 19 deletions.
  1. +19 −19 garrysmod/lua/menu/errors.lua
@@ -20,32 +20,32 @@ hook.Add( "OnLuaError", "MenuErrorHandler", function( str, realm, addontitle, ad
--
-- Down Vote
--
- -- steamworks.Vote( addonid, false );
+ -- steamworks.Vote( addonid, false )
--
-- Disable Naughty Addon
--
--timer.Simple( 5, function()
- -- MsgN( "Disabling addon '", addontitle, "' due to lua errors" );
- -- steamworks.SetShouldMountAddon( addonid, false );
- -- steamworks.ApplyAddons();
+ -- MsgN( "Disabling addon '", addontitle, "' due to lua errors" )
+ -- steamworks.SetShouldMountAddon( addonid, false )
+ -- steamworks.ApplyAddons()
--end )
- text = "The addon \""..addontitle.."\" is creating errors, check the console for details";
+ text = "The addon \""..addontitle.."\" is creating errors, check the console for details"
end
- if ( addonid == nil ) then addonid = 0; end
+ if ( addonid == nil ) then addonid = 0 end
if ( Errors[ addonid ] ) then
Errors[ addonid ].times = Errors[ addonid ].times + 1
Errors[ addonid ].last = SysTime()
- return;
+ return
end
- local error =
+ local error =
{
first = SysTime(),
last = SysTime(),
@@ -55,26 +55,26 @@ hook.Add( "OnLuaError", "MenuErrorHandler", function( str, realm, addontitle, ad
text = text,
}
- Errors[ addonid ] = error;
+ Errors[ addonid ] = error
end )
-local matAlert = Material( "icon16/error.png" );
+local matAlert = Material( "icon16/error.png" )
hook.Add( "DrawOverlay", "MenuDrawLuaErrors", function()
if ( table.Count( Errors ) == 0 ) then return end
- local idealy = 32;
- local height = 30;
- local EndTime = SysTime() - 30;
- local Recent = SysTime() - 0.5;
+ local idealy = 32
+ local height = 30
+ local EndTime = SysTime() - 10
+ local Recent = SysTime() - 0.5
for k, v in SortedPairsByMemberValue( Errors, "last" ) do
surface.SetFont( "DermaDefaultBold" )
if ( v.y == nil ) then v.y = idealy end
- if ( v.w == nil ) then v.w = surface.GetTextSize( v.text ); v.w = v.w + 48 end
+ if ( v.w == nil ) then v.w = surface.GetTextSize( v.text ) v.w = v.w + 48 end
draw.RoundedBox( 2, v.x+2, v.y+2, v.w, height, Color( 40, 40, 40, 255 ) )
@@ -88,13 +88,13 @@ hook.Add( "DrawOverlay", "MenuDrawLuaErrors", function()
surface.SetTextColor( 90, 90, 90, 255 )
surface.SetTextPos( v.x + 34, v.y + 8 )
- surface.DrawText( v.text );
+ surface.DrawText( v.text )
surface.SetDrawColor( 255, 255, 255, 150 + math.sin( v.y + SysTime() * 30 ) * 100 )
surface.SetMaterial( matAlert )
- surface.DrawTexturedRect( v.x + 6, v.y + 6, 16, 16 )
+ surface.DrawTexturedRect( v.x + 6, v.y + 6, 16, 16 )
- v.y = idealy;
+ v.y = idealy
idealy = idealy + 32 + 8
@@ -104,4 +104,4 @@ hook.Add( "DrawOverlay", "MenuDrawLuaErrors", function()
end
-end )
+end )

0 comments on commit 9eb8537

Please sign in to comment.