⚙️Accessor

accessor

Last modified: 03 January 2025

This type represents a safe way to access maps.

circle-info

Note that <type> indicates the specific type this instance holds. Accessor<Texture> for example means that Get will return an instance of Texture, and Set will only accept the type Texture as it's obj parameter.

__index

Function

Returns an object by key.

Arguments

Name

Type

Description

key

string

Object key.

Returns

Type

Description

<type>

Object.

Example

local main_font = draw.fonts['gui_main'];

-- this also works
local main_font_2 = draw.fonts.gui_main;

__newindex

Function

Sets an object by key.

Arguments

Name

Type

Description

key

string

Object key.

obj

<type>

Object.

Returns

Nothing.

Example

Last updated