engineGetModelMaterials
Client
Lists the loaded model's materials, in the order the model keeps them.
table|false engineGetModelMaterials(string|element model)
Parameters
| Name | Type | Description |
|---|---|---|
| model | string|element | The model's name or a model element. |
Returns
A list where each material has index (from 1), name, texture, shader and cutout. false when the model is not loaded.
The index and the name are what engineSetModelMaterial and the other material functions take to pick a material.
Example
local materials = engineGetModelMaterials("infernus")
if materials then
for _, material in ipairs(materials) do
outputDebugString(material.index .. " " .. material.name .. " " .. material.texture)
end
endNoteA name that is not a model is an error.