Skip to content

Texture:GetSize()

Jérôme Leclercq edited this page Dec 8, 2020 · 1 revision

API: Texture:GetSize

Description:

Retrieve the size of a texture.

Prototype:

texture:GetSize() -> size: Vec2

Returns:

  1. size: The size of the texture as a Vec2 (x being width and y being height).

Example code

A simple script which loads a texture and print its size.

local texture = assets.GetTexture("texture.png")
if (texture) then
	print("Texture size", texture:GetSize())
else
	print("Texture couldn't be loaded")
end

Clone this wiki locally