Cleaner
The Cleaner class provides a set of functions for cleaning up instances, and tables.
Functions
Cleanup
Cleaner.Cleanup(item: any,--
The item to cleanup
itemType: string?--
The item's type (impacts the cleanup function used)
) → ()This function can be used to cleanup the passed item argument.
local Cleaner = require(game:GetService("ReplicatedStorage"):WaitForChild("Commons")).Cleaner
Cleaner.Cleanup(workspace.MyPart)
CleanupTable
Cleaner.CleanupTable(table: {[any]:any}--
The table to cleanup
) → ()This function goes through a table, and deep cleans it (cleans up all values and nested tables).
local Cleaner = require(game:GetService("ReplicatedStorage"):WaitForChild("Commons")).Cleaner.Cleaner
local MyTable = {
workspace.MyPart;
{
workspace.MyOtherPart;
};
}
Cleaner.CleanupTable(MyTable) -- Will destroy Workspace.MyPart, and workspace.MyOther part, as well as clear up the table's metatables and contents