Skip to content

Advanced

Getting Started

This page is reserved for advanced stuff or for metamethods like __len, __sub and __add etc...


Metamethods


__add

1
2
3
4
5
6
local Collect = require(somewhere.Collect)

local Component = Collect.new()

-- Add a part to the cleanup list (e.g is the same as calling :Add(workspace.Baseplate) )
Component += workspace.Baseplate

__sub

1
2
3
4
5
6
local Collect = require(somewhere.Collect)

local Component = Collect.new()

-- Removed a part to the cleanup list (e.g is the same as calling :Remove(workspace.Baseplate) )
Component -= workspace.Baseplate

__tostring()

1
2
3
4
5
6
7
local Collect = require(somewhere.Collect)

local Component = Collect.new()

Component += workspace.Baseplate

print(Component) --> output : CollectComponent(1) -- 1 is the number of items in the cleanup list

__len()

1
2
3
4
5
6
7
local Collect = require(somewhere.Collect)

local Component = Collect.new()

Component += workspace.Baseplate

print(#Component) --> 1 Prints the number of clean-up items in the component