• Help With table expected, got user data
    4 replies, posted
EDIT: I gave up on this and completely restructured to to be in a function that i can call instead e.g [CODE] function MakeJoinScreen() local frame = vgui.Create("DFrame") frame:SetSize(ScrW(),ScrH()) local booturn = vgui.Create("DButton", frame) end [/CODE] You get the idea.. So now when the netmsg is received i just do something like: (in a client file ofc) [CODE] net.Receive("dothatguithing", function() MakeJoinScreen() end) [/CODE] Thanks for your help tho guys! END OF EDIT ----------------------------------------------------------- Hi there, so im working on a gm and I came across and error There error is: [CODE] [ERROR] lua/includes/extensions/table.lua:75: bad argument #1 to 'pairs' (table expected, got userdata) 1. pairs - [C]:-1 2. Merge - lua/includes/extensions/table.lua:75 3. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:31 4. func - gamemodes/secwet/gamemode/client/cl_guihandler.lua:9 5. unknown - lua/includes/extensions/net.lua:32 [/CODE] I have done some research and to no avail, and am still curious as to what is causing it. There are two functions very similar and the first one throws an error and works. The second one throws and error and doesnt work. The code is: [CODE] net.Receive( "makegui", function(len, ply) local Gui = net.ReadString() local makeme = vgui.Create(Gui) makeme:SetVisible(true) end ) net.Receive( "delgui", function(len, ply) local AGui = net.ReadString() local closeme = vgui.Create(AGui) closeme:SetVisible(false) closeme:Close() end ) [/CODE] These NetMsgs are defined here: [CODE] function OpenGUI(ply, Gui) -- Creates a gui with arguements of which player to make it for and which gui to make if !ply then return end if !Gui then return end local Gui = tostring(Gui) util.AddNetworkString( "makegui" ) net.Start( "makegui" ) net.WriteString(Gui) net.Send(ply) end function CloseGUI(ply, Gui) -- Creates a gui with arguements of which player to make it for and which gui to make if !ply then return end if !Gui then return end local Gui = tostring(Gui) util.AddNetworkString( "delgui" ) net.Start( "delgui" ) net.WriteString(Gui) net.Send(ply) end [/CODE] Any help is appreciated, Thanks
"local closeme = vgui.Create(AGui)" Take a look here ([url]http://wiki.garrysmod.com/page/vgui/Create[/url]) and you'll see you're trying to create a vgui element using an already existing vgui element as the new one's classname.
[QUOTE=Deathking15;51255399]"local closeme = vgui.Create(AGui)" Take a look here ([url]http://wiki.garrysmod.com/page/vgui/Create[/url]) and you'll see you're trying to create a vgui element using an already existing vgui element as the new one's classname.[/QUOTE] Ahhh i see! thanks. So i have to remove the existing vgui element before creating another one.
[QUOTE=Darkislight;51257037]Ahhh i see! thanks. So i have to remove the existing vgui element before creating another one.[/QUOTE] you cannot simply send a gui over a whole netmessage as string (Especially since netmessages are limited in length) simply send a net message to the player (empty message though), then open the desired panel.
[QUOTE=whitestar;51258471]you cannot simply send a gui over a whole netmessage as string (Especially since netmessages are limited in length) simply send a net message to the player (empty message though), then open the desired panel.[/QUOTE] They're sending the name of it as far as I can see. As for the error in question at the top, it seems someone called `vgui.Register` with userdata of some kind instead of the panels meta table. What is the panel name you're sending over the net message?
Sorry, you need to Log In to post a reply to this thread.