core.texture.create

Client

Creates a new texture instance from a file path


Syntax

local instance = core.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
BMP.bmpUncompressed bitmap, no lossy artifacts
DDS.ddsGPU-native compressed format, ideal for 3D assets
KTX.ktx | .ktx2Khronos texture format, supports GPU compression and mipmaps

Examples

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

On this page