• Lua error tracing
    18 replies, posted
Myself and random other players on the server keep getting this error spammed from time to time: [quote] lua\includes\modules\draw.lua:195: attempt to index local 'color' (a nil value) [/quote] I imagine there is some line of my code that is trying to draw something, and the color isn't defined, but I can't seem to find any pattern to it, and as it is in a built in module, I can't trace it to any of my own files. I also get a label in the upper left corner of the screen that is white text and says "label" usually along with this error. Is there a way of tracing this back any further than draw.lua?
draw.lua is as far as it goes. What you want to find out is the file that contains the error. My guess is cl_init.lua. Post the contents here.
There was a way I think debug.Trace() is a good way. Anyway post your code here or search for every call of a draw. function
The code for all the custom gamemode stuff and custom addons is over 50 files large, just for the client side. I'll look into the debug library, and see if that turns up anything.
Try this: [code]lua_run_cl if not g_OldRBEx then g_OldRBEx = draw.RoundedBoxEx end draw.RoundedBoxEx = function(b,x,y,w,h,c,...) if not c then debug.Trace() end return g_OldRBEx(b,x,y,w,h,c,unpack({...})) end[/code]
Thanks, I'll give it a try and let you know. Again, this only happens sporadically, so it is going to be a bugger to track down.
This happens on my ZS server too. Since I know you run a ZS server, I'll assume its the ZS gamemode. We're recoding from scratch anyway, JetBoom's ZS has far too many problems.
That happens to me on pythons Qbox(Sandbox) gamemode (I think i fixed it by removing all the .lua modules from my lua/includes/modules/) since it doesn't happen anymore i don't think. Constantly spammed with [lua]lua\includes\modules\draw.lua:195: attempt to index local 'color' (a nil value)[/lua] Unless i rejoin the server
Its probbably something in the base gamemode, it only happens when i lag out like fuck, on many different gamemodes
I think Garry just needs to recode the tools. Most of them are broken.
[QUOTE=|FlapJack|;24218963]This happens on my ZS server too. Since I know you run a ZS server, I'll assume its the ZS gamemode. We're recoding from scratch anyway, JetBoom's ZS has far too many problems.[/QUOTE] My ZS is recoded from scratch. Since it seems to be happening to a lot of people, it seems like this is more than just ZS...
You are just giving the function nil instead of a Color table... Its probably a simple coding mistake. I had the problem often.
[QUOTE=Wizard of Ass;24226040]You are just giving the function nil instead of a Color table... Its probably a simple coding mistake. I had the problem often.[/QUOTE] Well i think removing the lua/includes/modules fixes this problem, since it loads from the GCF.
[QUOTE=Cubar;24226875]Well i think removing the lua/includes/modules fixes this problem, since it loads from the GCF.[/QUOTE] As long the file has not been modified it doesn't matter at all. I'm sure its a coding mistake.
[QUOTE=mr.wolf;24225803]My ZS is recoded from scratch. Since it seems to be happening to a lot of people, it seems like this is more than just ZS...[/QUOTE] Fully from scratch or just "I've changed nearly everything"?
The error occurs when GM:PlayerStartVoice is called with a nil/invalid player as argument (only seems to happen in certain alt-tab or lag scenarios). The base gamemode does not check for this in its PlayerStartVoice hook, so it happily creates a VoiceNotify panel. That panel then tries to call a function on the nil player and errors out, before it can initialise its colour. It still exists though, and when it tries to draw itself its colour is nil, which results in the error spam. I tracked this down and fixed it for TTT a while ago. It is now also fixed in the base gamemode in rev 228 of the gmodgame SVN.
[QUOTE=|FlapJack|;24232550]Fully from scratch or just "I've changed nearly everything"?[/QUOTE] Fully from scratch. A very few functions were reused, but they were recoded, not copy and pasted. It was the server you were testing your FapHack on :P [editline]02:52PM[/editline] [QUOTE=BadKingUrgrain;24233603]The error occurs when GM:PlayerStartVoice is called with a nil/invalid player as argument (only seems to happen in certain alt-tab or lag scenarios). The base gamemode does not check for this in its PlayerStartVoice hook, so it happily creates a VoiceNotify panel. That panel then tries to call a function on the nil player and errors out, before it can initialise its colour. It still exists though, and when it tries to draw itself its colour is nil, which results in the error spam. I tracked this down and fixed it for TTT a while ago. It is now also fixed in the base gamemode in rev 228 of the gmodgame SVN.[/QUOTE] Awesome! Thanks for the update!
I got a trace of it: [code] Line 91"DrawGenericBackground"lua\skins\default.lua 5: Line 1024"(null)"lua\skins\default.lua 6: Line -1""(tail call) 7: Line -1""(tail call) [/code] Gonna debug it even more, hard when its on someone else the error is [editline]08:51AM[/editline] Ah damn you BKU, finally when i get a trace you find even more info
[QUOTE=Tobba;24257042]I got a trace of it: [code] Line 91"DrawGenericBackground"lua\skins\default.lua 5: Line 1024"(null)"lua\skins\default.lua 6: Line -1""(tail call) 7: Line -1""(tail call) [/code] Gonna debug it even more, hard when its on someone else the error is [editline]08:51AM[/editline] Ah damn you BKU, finally when i get a trace you find even more info[/QUOTE] He posted a day ago :raise:
Sorry, you need to Log In to post a reply to this thread.