engineGetModelTextures | Multi Theft Auto: Wiki Skip to content

engineGetModelTextures

Client-side
Server-side
Shared

This function allows you to get the textures of any model.

Important

This function creates an texture element for every texture on each call! That's why you should NEVER use it in per-frame events such as onClientRender. Additionally, when you no longer need the textures, remember to destroy them. If you only want to retrieve texture names, use engineGetModelTextureNames.

OOP Syntax Help! I don't understand this!

  • Method:Engine.getModelTextures(...)

Syntax

table|false engineGetModelTextures ( ​string/int modelName/modelID, [ ​string/table textureNames = nil ] )
Required Arguments
  • modelName/modelID: Either the model ID or model name.
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • textureNames (default: nil): Only return textures with specified name(s). You can provide a single string or a table of strings. Wildcard matching e.g. "ro?ds*" can be used.

Returns

  • table|false: model textures

Returns a table of texture elements [textureName, texture], false otherwise.

Code Examples

client
local textures = engineGetModelTextures(3722)
iprint(textures)
-- Prevent memory leak
for _,v in pairs(textures) do
destroyElement(v)
end

See Also

Engine Functions