You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
filepath: Path to the image file (relative to the resources directory).
Returns:
texture: Handle to the corresponding texture object or nil if the texture couldn't be loaded.
Remarks:
If the texture is not already loaded, it will be loaded during this call (which may take some time).
This function will fail if the image file has not been registered server-side using RegisterClientAssets, independently from the file existence on the host filesystem.
Only the following extensions are supported:
bmp
dds
gif
hdr
jpg / jpeg
pcx
pic
png
ppm
pgm
psd
tga
Example code
A simple script which loads a texture and print its size.
localtexture=assets.GetTexture("texture.png")
if (texture) thenprint("Texture size", texture:GetSize())
elseprint("Texture couldn't be loaded")
end