fumablox
API

Janitor

A small cleanup helper.

utility

A small cleanup helper. Pass instances, connections, or functions to Janitor:Add, then call Janitor:Destroy when the owner goes away.

Source

../examples/library/src/Janitor.luau:1

Properties

PropertyTypeDescriptionSource
ClassNamestringAlways "Janitor".../examples/library/src/Janitor.luau:12

Constructors

new

constructor

function Janitor.new(): Janitor

Returns

Prop

Type

../examples/library/src/Janitor.luau:16

Methods

Add

function Janitor:Add(object: T, methodName: (boolean | string)?, index: any): T

Adds an object to be cleaned up later.

Parameters

Prop

Type

Returns

Prop

Type

../examples/library/src/Janitor.luau:23

Destroy

function Janitor:Destroy()

Cleans everything the janitor owns.

Errors

Prop

Type

../examples/library/src/Janitor.luau:35

On this page