natiny.mesh.get_part_texture

Lua
natiny.mesh.get_part_texture(mesh, index) -> texture

Returns the texture owned by a mesh part.

Parameters

Name Type Description
mesh number Mesh handle
index integer Zero-based part index; negative values are clamped to 0

Returns

Type Description
number Texture handle, or 0 when the part has no texture or the index is out of range

Example

Lua
local texture = natiny.mesh.get_part_texture(mesh, 0)

Notes

  • The texture is owned by the mesh and is destroyed together with it - do not call natiny.texture.destroy on it.
  • An invalid mesh, out-of-range index or part without a texture returns 0.