From d08944862a3caa035fd7505246aea3c1f47ddbd6 Mon Sep 17 00:00:00 2001 From: "PrikolMen:-b" <44779902+PrikolMen@users.noreply.github.com> Date: Mon, 17 Apr 2023 21:33:05 +0400 Subject: [PATCH] Added vgui.Exists( classname ) (#1953) --- .../extensions/client/panel/scriptedpanels.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/garrysmod/lua/includes/extensions/client/panel/scriptedpanels.lua b/garrysmod/lua/includes/extensions/client/panel/scriptedpanels.lua index a58a03ffac..b1e8521eb0 100644 --- a/garrysmod/lua/includes/extensions/client/panel/scriptedpanels.lua +++ b/garrysmod/lua/includes/extensions/client/panel/scriptedpanels.lua @@ -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 ) @@ -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 @@ -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 )