> For the complete documentation index, see [llms.txt](https://golua.fatality.win/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://golua.fatality.win/documentation/namespaces/materials.md).

# Materials

mat namespace

## Functions

### create

```lua
mat.create("dank_material", "VertexLitGeneric", 
[[
"VertexLitGeneric"
{
    "$ambientonly" 1	
}
]])
```

|                                                     |                                                    |                                                       |
| :-------------------------------------------------: | :------------------------------------------------: | :---------------------------------------------------: |
| [Parameter](/documentation/namespaces/materials.md) | [Datatype](/documentation/namespaces/materials.md) | [Description](/documentation/namespaces/materials.md) |
|                         name                        |                       string                       |                 name of your material                 |
|                         type                        |                       string                       |                      shader type                      |
|                     key\_values                     |                       string                       |                  material key values                  |

#### Returns:

|                                                 |                                                    |
| :---------------------------------------------: | :------------------------------------------------: |
| [Value](/documentation/namespaces/materials.md) | [Datatype](/documentation/namespaces/materials.md) |
|                 material object                 |  [material](/documentation/datatypes/material.md)  |

### find

```lua
mat.find("debug/ambientcube", "Other Textures")
```

|                                                     |                                                    |                                                                                                                            |
| :-------------------------------------------------: | :------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------: |
| [Parameter](/documentation/namespaces/materials.md) | [Datatype](/documentation/namespaces/materials.md) |                                    [Description](/documentation/namespaces/materials.md)                                   |
|                         name                        |                       string                       |                                                        material name                                                       |
|                    texture\_group                   |                       string                       | [material texture group](https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/public/texture_group_names.h) |

#### Returns:

|                                                 |                                                    |
| :---------------------------------------------: | :------------------------------------------------: |
| [Value](/documentation/namespaces/materials.md) | [Datatype](/documentation/namespaces/materials.md) |
|                 material object                 |  [material](/documentation/datatypes/material.md)  |

### for\_each\_material

```lua
mat.for_each_material(function(material)
    print(material:get_name())
end)
```

|                                                     |                                                    |                                                       |
| :-------------------------------------------------: | :------------------------------------------------: | :---------------------------------------------------: |
| [Parameter](/documentation/namespaces/materials.md) | [Datatype](/documentation/namespaces/materials.md) | [Description](/documentation/namespaces/materials.md) |
|                       callback                      |                      function                      |           callback called for each material           |

### override\_material

```lua
mat.override_material(some_material)
```

|                                                     |                                                    |                                                       |
| :-------------------------------------------------: | :------------------------------------------------: | :---------------------------------------------------: |
| [Parameter](/documentation/namespaces/materials.md) | [Datatype](/documentation/namespaces/materials.md) | [Description](/documentation/namespaces/materials.md) |
|                       material                      |  [material](/documentation/datatypes/material.md)  |                material to override to                |
