Random Lua error-uninstalling did NOT fix

Ok. I have been having this error a short while now to the point where I want it fixed.


ERROR: GAMEMODE:'HUDPaint' Failed: sandbox\gamemode\cl_worldtips.lua:27: attempt to index field 'ent' (a number value)

Basically, I have deduced that it means that all the little boxes you see when looking at a wire device (or something that needs to tell you information) will not appear, and I get spammed with this error whenever I look at such an item.

I uninstalled and cleaned Gmod (Explanation below), and it still doesn’t work. I have uninstalled all my mods and re-installed them. I get this problem no matter what.

Could someone please suggest another way to fix it, or even tell me what to write into the lua file to make it work again?

For those who can help, this is how the “broken” lua file appears in my Gmod folder:





surface.CreateFont( "coolvetica", 20, 500, true, false, "GModWorldtip" )

local WorldTip = nil

local TipColor = Color( 250, 250, 200, 255 )

//
// Adds a hint to the queue
//
function AddWorldTip( unused1, text, unused2, pos, ent )

	WorldTip = {}
	
	WorldTip.dietime 	= SysTime() + 0.05
	WorldTip.text 		= text
	WorldTip.pos 		= pos
	WorldTip.ent 		= ent
	
end


local function DrawWorldTip( tip )

	if ( tip.ent && tip.ent != NULL ) then	
		tip.pos = tip.ent:GetPos()
	end
	
	local pos = tip.pos:ToScreen()
	
	local black = Color( 0, 0, 0, 255 )
	local tipcol = Color( TipColor.r, TipColor.g, TipColor.b, 255 )
	
	local x = 0
	local y = 0
	local padding = 10
	local offset = 50
	
	surface.SetFont( "GModWorldtip" )
	local w, h = surface.GetTextSize( tip.text )
	
	x = pos.x - w 
	y = pos.y - h 
	
	x = x - offset
	y = y - offset

	draw.RoundedBox( 8, x-padding-2, y-padding-2, w+padding*2+4, h+padding*2+4, black )
	
	
	local verts = {}
	verts[1] = { x=x+w/1.5-2, y=y+h+2 }
	verts[2] = { x=x+w+2, y=y+h/2-1 }
	verts[3] = { x=pos.x-offset/2+2, y=pos.y-offset/2+2 }
	
	draw.NoTexture()
	surface.SetDrawColor( 0, 0, 0, tipcol.a )
	surface.DrawPoly( verts )
	
	
	draw.RoundedBox( 8, x-padding, y-padding, w+padding*2, h+padding*2, tipcol )
	
	local verts = {}
	verts[1] = { x=x+w/1.5, y=y+h }
	verts[2] = { x=x+w, y=y+h/2 }
	verts[3] = { x=pos.x-offset/2, y=pos.y-offset/2 }
	
	draw.NoTexture()
	surface.SetDrawColor( tipcol.r, tipcol.g, tipcol.b, tipcol.a )
	surface.DrawPoly( verts )
	
	
	draw.DrawText( tip.text, "GModWorldtip", x + w/2, y, black, TEXT_ALIGN_CENTER )

end


function GM:PaintWorldTips()

	if ( WorldTip && WorldTip.dietime > SysTime() ) then
		DrawWorldTip( WorldTip )		
	end

end




Ok. Cleaning Gmod can be explained by [this.](http://wiki.garrysmod.com/?title=Cleaning_GMod)


heres my code




surface.CreateFont( "coolvetica", 20, 500, true, false, "GModWorldtip" )

local WorldTip = nil

local TipColor = Color( 250, 250, 200, 255 )

//
// Adds a hint to the queue
//
function AddWorldTip( unused1, text, unused2, pos, ent )

	WorldTip = {}
	
	WorldTip.dietime 	= SysTime() + 0.05
	WorldTip.text 		= text
	WorldTip.pos 		= pos
	WorldTip.ent 		= ent
	
end


local function DrawWorldTip( tip )

	if ( tip.ent && tip.ent != NULL ) then	
		tip.pos = tip.ent:GetPos()
	end
	
	local pos = tip.pos:ToScreen()
	
	local black = Color( 0, 0, 0, 255 )
	local tipcol = Color( TipColor.r, TipColor.g, TipColor.b, 255 )
	
	local x = 0
	local y = 0
	local padding = 10
	local offset = 50
	
	surface.SetFont( "GModWorldtip" )
	local w, h = surface.GetTextSize( tip.text )
	
	x = pos.x - w 
	y = pos.y - h 
	
	x = x - offset
	y = y - offset

	draw.RoundedBox( 8, x-padding-2, y-padding-2, w+padding*2+4, h+padding*2+4, black )
	
	
	local verts = {}
	verts[1] = { x=x+w/1.5-2, y=y+h+2 }
	verts[2] = { x=x+w+2, y=y+h/2-1 }
	verts[3] = { x=pos.x-offset/2+2, y=pos.y-offset/2+2 }
	
	draw.NoTexture()
	surface.SetDrawColor( 0, 0, 0, tipcol.a )
	surface.DrawPoly( verts )
	
	
	draw.RoundedBox( 8, x-padding, y-padding, w+padding*2, h+padding*2, tipcol )
	
	local verts = {}
	verts[1] = { x=x+w/1.5, y=y+h }
	verts[2] = { x=x+w, y=y+h/2 }
	verts[3] = { x=pos.x-offset/2, y=pos.y-offset/2 }
	
	draw.NoTexture()
	surface.SetDrawColor( tipcol.r, tipcol.g, tipcol.b, tipcol.a )
	surface.DrawPoly( verts )
	
	
	draw.DrawText( tip.text, "GModWorldtip", x + w/2, y, black, TEXT_ALIGN_CENTER )

end


function GM:PaintWorldTips()

	if ( WorldTip && WorldTip.dietime > SysTime() ) then
		DrawWorldTip( WorldTip )		
	end

end


It would seem that my code matches yours exactly.

Could there be something making Gmod not load it properly?

Or not recognize one of the lines?

Something…?

try:


surface.CreateFont( "coolvetica", 20, 500, true, false, "GModWorldtip" )

local WorldTip = nil

local TipColor = Color( 250, 250, 200, 255 )

//
// Adds a hint to the queue
//
function AddWorldTip( unused1, text, unused2, pos, ent )

	WorldTip = {}
	
	WorldTip.dietime 	= SysTime() + 0.05
	WorldTip.text 		= text
	WorldTip.pos 		= pos
	WorldTip.ent 		= ent
	
end


local function DrawWorldTip( tip )

	if ( tip.ent && tip.ent != NULL ) then	
		tip.pos = tip.ent:GetPos()
	end
	end
	local pos = tip.pos:ToScreen()
	
	local black = Color( 0, 0, 0, 255 )
	local tipcol = Color( TipColor.r, TipColor.g, TipColor.b, 255 )
	
	local x = 0
	local y = 0
	local padding = 10
	local offset = 50
	
	surface.SetFont( "GModWorldtip" )
	local w, h = surface.GetTextSize( tip.text )
	
	x = pos.x - w 
	y = pos.y - h 
	
	x = x - offset
	y = y - offset

	draw.RoundedBox( 8, x-padding-2, y-padding-2, w+padding*2+4, h+padding*2+4, black )
	
	
	local verts = {}
	verts[1] = { x=x+w/1.5-2, y=y+h+2 }
	verts[2] = { x=x+w+2, y=y+h/2-1 }
	verts[3] = { x=pos.x-offset/2+2, y=pos.y-offset/2+2 }
	
	draw.NoTexture()
	surface.SetDrawColor( 0, 0, 0, tipcol.a )
	surface.DrawPoly( verts )
	
	
	draw.RoundedBox( 8, x-padding, y-padding, w+padding*2, h+padding*2, tipcol )
	
	local verts = {}
	verts[1] = { x=x+w/1.5, y=y+h }
	verts[2] = { x=x+w, y=y+h/2 }
	verts[3] = { x=pos.x-offset/2, y=pos.y-offset/2 }
	
	draw.NoTexture()
	surface.SetDrawColor( tipcol.r, tipcol.g, tipcol.b, tipcol.a )
	surface.DrawPoly( verts )
	
	
	draw.DrawText( tip.text, "GModWorldtip", x + w/2, y, black, TEXT_ALIGN_CENTER )

end


function GM:PaintWorldTips()

	if ( WorldTip && WorldTip.dietime > SysTime() ) then
		DrawWorldTip( WorldTip )		
	end

end

Ok. There are like 2 differences. I will run Gmod with your second code.

I’ll be back in like 5 mins with the results.

Thanks by the way.

[editline]08:23PM[/editline]

OK:

I just did a mass test of props and entities from different tabs of Gmod’s interface.

Basically, world tips are appearing on stargate, life support and Gmod entities.

The only thing world tips will not appear on and cause said error is wire objects such as target finders and buttons.

I have no idea.

please help.


I am tearing my head out over this! There is NOTHING wrong with that lua file, it is ONLY affecting wire objects and NOTHING changed in between the time where it was working and the time where it wasn't.

I do not understand!

It is resolved!

yay!

The Jumper V3 SVN I downloaded was, for some reason, suddenly (I say suddenly because it began doing it completely randomly) clashing with wire and Spacebuild, and caused the lua error i mentioned.

It took me like 2 hours sifting through my mods one by one to sort this.

Thanks for the help all.

Thanks man, i had the same problem it was annoying me. Wish people would put warning about there mods conflicting with other mods

Wierd.