Skip to main content

GetTextureAspectRatio

This function was added in DSL 1

Description

Get the aspect ratio of a texture created by CreateTexture. This value is the same as dividing the width and height returned by GetTextureResolution.

function GetTextureAspectRatio(texture) --[[ ... ]] end

Parameters

  • texture: userdata - The texture to get the aspect ratio of.

Return Values

  • aspectRatio: number - The aspect ratio of the texture.

Example

local texture = CreateTexture('path/to/texture.png')
local aspectRatio = GetTextureAspectRatio(texture)
print('Aspect Ratio: ' .. aspectRatio) -- Outputs the aspect ratio of the texture

See Also