Derma Control

I have a SENT that stores objects in itself, but currently without some kind of menu all I can do is make them spew out upon someone pressing USE on the thing. I want some kind of derma menu that will allow someone to select the objects they want, then press a big button to remove them.

What I’ve started with is just a simple derma panel with a single button that you click to dump the container’s contents, and the DumpContents function is a function defined in the entity’s init file. I have a usermessage that brings up the menu for the person who presses USE on the crate.

Problem is, how the hell do I get the menu to call functions for the entity?

And in the future, I am going to have to be able to send information to the server to tell the container specifically which contents to dump; how am I going to do that?

Here’s what I have so far:
[lua]
/-------------------------------------------------------------
OH GOSH HOW DID THIS GET HERE I AM NOT GOOD WITH COMPUTER
or derma ._. poker face
-------------------------------------------------------------
/
function Showmenu(data)

local crate=data:ReadEntity()
local playah=data:ReadEntity()

if not(LocalPlayer()==playah)then return end --only want this menu to appear for the person interacting with the crate

local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 300, 325 )
DermaPanel:SetTitle( "Testing Derma Interface" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
DermaPanel:Center()

local TestingPanel = vgui.Create( "DPanel", DermaPanel )
TestingPanel:SetPos( 25, 50 )
TestingPanel:SetSize( 250, 250 )
TestingPanel.Paint = function()
	surface.SetDrawColor( 50, 50, 50, 255 )
	surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() )
end

local DermaButton = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "click to dump contents" )
DermaButton:SetPos( 20, 10 )
DermaButton:SetSize( 200, 100 )
DermaButton.DoClick = function ()
	crate:DumpContents()
end

end
usermessage.Hook(“JackyContainerUMSG”,Showmenu)
[/lua]

[editline]20th March 2011[/editline]

All that happens is a client lua error saying there’s no such thing as DumpContents()