# materials

## Example available!

{% content-ref url="../../useful-information/script-examples/materials" %}
[materials](https://docs-csgo.neverlose.cc/useful-information/script-examples/materials)
{% endcontent-ref %}

## Functions:

### get

`materials.get(path: string[, force_load: boolean]):` <mark style="color:purple;">`Material`</mark>

<table><thead><tr><th width="156.2187096468122">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>path</strong></td><td><strong><code>string</code></strong></td><td>Directory to the specified material</td></tr><tr><td><strong>force_load</strong></td><td><strong><code>force_load</code></strong></td><td>Loads the material if not loaded</td></tr></tbody></table>

Returns the material object in the specified path.

### get\_materials

`materials.get_materials(partial_path: string[, force_load: boolean, callback: function]):` <mark style="color:purple;">`table`</mark>

<table><thead><tr><th width="159.2187096468122">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>partial_path</strong></td><td><strong><code>string</code></strong></td><td>Directory to the specified materials</td></tr><tr><td><strong>force_load</strong></td><td><strong><code>force_load</code></strong></td><td>Loads each material if not loaded</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>A callback with a pointer to the material object as the argument</td></tr></tbody></table>

If the callback is nil, it returns the table of material objects along the specified path. Otherwise the callback will be called. Access the material object using the arguments of the specified callback.

### create

`materials.create(name: strings, key_values: string):` <mark style="color:purple;">`Material`</mark>

<table><thead><tr><th width="163.2187096468122">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>New material name</td></tr><tr><td><strong>key_values</strong></td><td><strong><code>string</code></strong></td><td>New material values</td></tr></tbody></table>

Creates and returns a new material object

## 🔗 struct <mark style="color:purple;">`Material`</mark>

### :get\_name

`material:get_name():` <mark style="color:purple;">`string`</mark>

Returns the name of the material.

### :get\_texture\_group\_name()

`material:get_texture_group_name():` <mark style="color:purple;">`string`</mark>

Returns the texture group name of the material.

### :var\_flag

`material:var_flag(flag: number[, value: boolean]):` <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>flag</strong></td><td><strong><code>number</code></strong></td><td>Material var flag</td></tr><tr><td><strong>value</strong></td><td><strong><code>boolean</code></strong></td><td>New material var flag value</td></tr></tbody></table>

Gets or sets the value of the material var flag.

### :shader\_param

`material:shader_param(name: string[, value: any]):` <mark style="color:purple;">`any`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Shader parameter name</td></tr><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>New shader parameter value</td></tr></tbody></table>

Gets or sets the value of the material shader parameter.

### :color\_modulate

`material:color_modulate([color: color])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>New color modulation value</td></tr></tbody></table>

Gets or sets the material color modulation value.

### :alpha\_modulate

`material:alpha_modulate([alpha: number])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>alpha</strong></td><td><strong><code>number</code></strong></td><td>New alpha modulation value</td></tr></tbody></table>

Gets or sets the material alpha modulation value.

### :is\_valid

`material:is_valid():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the material is valid.

### :reset

`material:reset()`

Resets the material properties to its original values along with discarding the override.

### :override

`material:override(mat: Material)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>mat</strong></td><td><strong><code>Material</code></strong></td><td>Material object with the needed properties</td></tr></tbody></table>

Overrides material properties to properties from another material without setting them.
