Udim

Overview

Description

UDim is a structure used to handle dimension properties, primarily in user interfaces (UI). It allows combining a scale (proportion-based) and offset (pixel-based) value for more flexible UI positioning and sizing.

Properties

Scale

number Defines the proportional component of the UDim, where 1.0 represents 100%. It is used to define sizes and positions relative to the parent container.

Code Samples

local myUDim = UDim.new(0.5, 0) 
-- This creates a UDim where Scale is 0.5 (50%) and Offset is 0.

Offset

number Defines the fixed pixel-based component of the UDim. This determines the additional fixed size or position added to the value provided by the Scale.

Code Samples

local myUDim = UDim.new(0, 100)
-- This creates a UDim where Scale is 0 and Offset is 100 pixels.

Constructors

new

Creates a new UDim object with the specified Scale and Offset values.

Parameters

number InScale

The scale component of the `UDim` (proportional).

number InOffset

The offset component of the `UDim` (fixed in pixels).

Return

UDim

A new UDim instance configured with the provided Scale and Offset values.

Code Samples

local myUDim = UDim.new(0.5, 100)
-- Creates a UDim with 50% scale (relative) and 100-pixel offset (fixed).

Methods

Last updated