texture.create

Client

Creates a new texture instance from a file path


Syntax

local instance = texture.create(
    path
)

Parameters

TypeNameDescription
stringpathFile path to a supported texture asset
Refer Formats section

Returns

TypeNameDescription
textureinstanceCreated texture instance

Formats

FormatExtensionDescription
JPEG.jpg | .jpegLossy compressed image, best for photos
PNG.pngLossless compressed image, supports transparency
WebP.webpModern format, supports both lossy and lossless

Examples

Create a texture instance from a JPEG file
local tex = texture.create("assets/photo.jpg")
Create a texture instance from a PNG file
local tex = texture.create("assets/sprite.png")
Create a texture instance from a WebP file
local tex = texture.create("assets/image.webp")

On this page