Yes, me again. Don’t worry though, this is probably a stupid problem that will be easy to solve. I have a function that should help with creating a lot of buttons on a vgui, but I have a problem, when I try to print the vgui button that should have been created by this function, it keeps returning ‘nil’. I simplified the code quite a lot, and I’m pretty horrible at localizing, so the problem probably lies around something like that.
local function ButtonCreate(buttonname, buttonsize, buttontext, extraargs) local buttonname = self.list:Add( "DButton" ) buttonname:SetSize( buttonsize, 70 ) buttonname:SetText( buttontext ) extraargs() return buttonname end ButtonCreate(buttontest, 200, "Make the victim say something!", function() print(buttontest) end)
I’m sure it’s something obvious I missed.
[editline]30th March 2015[/editline]
By the way, I left out self.list from the example, as it shouldn’t matter.