Garry's Mod Wiki

derma.SkinHook

  any derma.SkinHook( string type, string name, Panel panel, any vararg1 = nil, any vararg2 = nil )

Description

Checks if a matching hook function exists in the skin (based on the concatenation of type and name args), Then calls it.

This function is used dynamically inside Derma_Hook

Arguments

1 string type
The type of hook to run, usually Paint.
2 string name
The name of the hook/panel to run. Example: Button.
3 Panel panel
The panel to call the hook for
4 any vararg1 = nil
First parameter for the panel hook. i.e. width of the panel for Paint hooks.
5 any vararg2 = nil
Second parameter for the panel hook. i.e. height of the panel for Paint hooks.

Returns

1 any
The returned variable from the skin hook

Example: Basic Usage

Example usage from dbutton.lua

dbutton's paint function

function PANEL:Paint( w, h ) derma.SkinHook( "Paint", "Button", self, w, h ) ... end

Resulting function call in default skin

function SKIN:PaintButton( panel, w, h ) ... end