Error VGUI.Create failed to create the VGUI component
2 replies, posted
This happens when trying to create a Module for Pointshop2
I have read and re-read the documentation and tried different things.
I just need a bit of help here
The Error
Warning: vgui.Create failed to create the VGUI component (DsoundsCreator)
[ERROR] addons/pointshop2/lua/ps2/client/tabs/management_tab/create_item/cl_dcreateitembutton.lua:8: attempt to index local 'creator' (a nil value)
1. unknown - addons/pointshop2/lua/ps2/client/tabs/management_tab/create_item/cl_dcreateitembutton.lua:8
DsoundsCreator.lua
[CODE]local PANEL = {}
function PANEL:Init()
self.textEntry = vgui.Create( "DTextEntry" )
self:addFormItem( "Property 1", self.textEntry )
end
function PANEL:SaveItem( saveTable )
self.BaseClass.SaveItem( self, saveTable )
saveTable.property1 = self.textEntry:GetText( )
end
function PANEL:EditItem( persistence, itemClass )
self.BaseClass.EditItem( self, persistence.ItemPersistence, itemClass )
self.textEntry:SetText( persistence.property1 )
end
vgui.Register( "DsoundsCreator", PANEL, "DItemCreator" )[/CODE]
cl_dcreateitembutton.lua
[CODE]local PANEL = {}
function PANEL:Init( )
end
function PANEL:OnMousePressed( )
local creator = vgui.Create( self.itemInfo.creator )
creator:Center( )
creator:MakePopup( )
creator:SetItemBase( self.itemInfo.base )
creator:SetSkin( Pointshop2.Config.DermaSkin )
end
function PANEL:SetItemInfo( itemInfo )
self.icon:SetMaterial( Material( itemInfo.icon, "noclamp smooth" ) )
self.label:SetText( itemInfo.label )
self.itemInfo = itemInfo
end
derma.DefineControl( "DCreateItemButton", "", PANEL, "DBigButton" )[/CODE]
[highlight](User was banned for this post ("Missed forum description - see Developer Discussion for gmod/lua help!" - NiandraLades))[/highlight]
self.itemInfo.creator isn't valid. What are you trying to access with the creator index?
[QUOTE=code_gs;47384204]self.itemInfo.creator isn't valid. What are you trying to access with the creator index?[/QUOTE]
Well according to the documentation its supposed to work, Im trying to access the item creator menu that appears after you click the icon In-game and it shows up but when clicked it puts that lua error.
Also to be honest still a little new to this and this and I took a break. What I'm doing is advanced and I'm surprised I got this far.
Sorry, you need to Log In to post a reply to this thread.