Skip to content

types.texture

A texture that can be used in drawables

NOTE

To save GPU memory, textures automatically expire and are deallocated if they are not used for more than 5 minutes.
Expired textures are automatically re-created (and re-downloaded if necessary) the next time they are accessed by a drawable.

Functions

from_url(url : string): types.texture

Downloads a texture from a URL

⚠️ WARNING: This API requires the --- @unsafe true metadata.

  • url (string) The URL of the texture
  • returns (types.texture) The texture instance (returns a placeholder until downloaded)

from_image(image : userdata, opt_key : string | number): types.texture

Creates a texture from a Java BufferedImage

  • image (userdata) The java.awt.image.BufferedImage instance
  • opt_key (string | number) (optional) A unique key to identify this image for caching
  • returns (types.texture) The texture instance