• Lua error that is seemingly unexplainable
    6 replies, posted
Hey all! So, I resorted to coming here for help, because there is a grave Lua error that offers no explanation/diagnosis. First off, let me start by saying that this is not my creation. I have tried numerous times to get in contact with one of the F2S: Stronghold devs, but it seems he's essentially left the game-mode to dry. Secondly, the error below started occurring mysteriously 3 weeks ago, and it's been an issue ever since. I believe this is the result of an update. It is essentially impossible to see who is speaking in voice chat, and the console spits up an error every single time someone presses their mic button. ERROR: [>KEKSQUAD|2|STEAM_0:1:23860033] Lua Error: [ERROR] gamemodes/stronghold/gamemode/cl_hud.lua:430: attempt to index upvalue 'PlayerVoicePanels' (a nil value) 1. unknown - gamemodes/stronghold/gamemode/cl_hud.lua:430 Relevant code(will provide all if needed): local PlayerVoicePanels = nil function GM:PlayerStartVoice( ply ) if !IsValid( g_VoicePanelList ) then return end -- Damnit Garry... if PlayerVoicePanels == nil then _, PlayerVoicePanels = debug.getupvalue( self.BaseClass.PlayerStartVoice, 1 ) end -- There'd be an exta one if voice_loopback is on, so remove it. GAMEMODE:PlayerEndVoice( ply ) if !IsValid( PlayerVoicePanels[ply] ) then if PlayerVoicePanels[ply].fadeAnim then PlayerVoicePanels[ ply].fadeAnim:Stop() PlayerVoicePanels[ply].fadeAnim = nil end PlayerVoicePanels[ ply ]:SetAlpha( 255 ) return end if !IsValid( ply ) then return end local pnl = g_VoicePanelList:Add( "sh_voicenotify" ) pnl:Setup( ply ) PlayerVoicePanels[ply] = pnl end I have attempted a fresh reinstall of the game-mode in question, but it has also caused issues on its own with the exact same error.
It's the debug.getupvalue call to get the player voice panel table - don't do that. It's extremely prone to breaking and relies on behaviour of a function the gamemode doesn't create. Instead, create your own table and create the panels for each player. Example code can be found in Sandbox or the base gamemode's code.
So would I fix the issue by removing the debug? Keep in mind I'm not a coder by any means, I just want to know how to fix this.
You'll have to implement your own logic to create your own PlayerVoicePanels. Example here. The fix to the code is not too simple and will require you to understand the code minimally to make the necessary modifications. Here are some basic Lua/GLua tutorials to get your started.
[coolxpess|5|STEAM_0:1:195488891] Lua Error: ERROR! Plugin failed to load <base_plugin> CompileFile:file not found [coolxpess|5|STEAM_0:1:195488891] Lua Error: ERROR! Plugin failed to load <uplink_cmd_cowsay> CompileFile:file not found Got this after saving cl_voice.
Looks like an error from your plugin/file loader, probably with auto-refresh. Just restart your server.
Did that countless times.
Sorry, you need to Log In to post a reply to this thread.