Skip to content

Commit

Permalink
Added vgui.Exists( classname ) (#1953)
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown-gd authored Apr 17, 2023
1 parent c3724a4 commit d089448
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ baseclass.Set( "EditablePanel", panel_metatable )
-- Keep the old function
vgui.CreateX = vgui.Create

function vgui.GetControlTable( name )
return PanelFactory[ name ]
function vgui.GetControlTable( classname )
return PanelFactory[ classname ]
end

function vgui.Exists( classname )
return PanelFactory[ classname ] != nil
end

function vgui.Create( classname, parent, name )
Expand Down Expand Up @@ -68,7 +72,7 @@ function vgui.CreateFromTable( metatable, parent, name )

end

function vgui.Register( name, mtable, base )
function vgui.Register( classname, mtable, base )

-- Remove the global
PANEL = nil
Expand All @@ -77,8 +81,8 @@ function vgui.Register( name, mtable, base )
mtable.Base = base or "Panel"
mtable.Init = mtable.Init or function() end

PanelFactory[ name ] = mtable
baseclass.Set( name, mtable )
PanelFactory[ classname ] = mtable
baseclass.Set( classname, mtable )

local mt = {}
mt.__index = function( t, k )
Expand Down

0 comments on commit d089448

Please sign in to comment.