Skip to content

Object

An object created from the class.new() function. Contains all of the members given from the class object.

Warning

An object's metatable cannot be deleted or changed. This is to prevent access to the Internal members, logic that keeps the object secure, and the logic on how it works. An object will always belong to the base type userdata.

Summary

Properties

 __locked : boolean
Internal

 Indicates if an object is locked.


 __type : string
Internal

 Indicates the class type of the object.


 objectData : Table
No Direct Access

 The object's data table that you can access by indexing the object with the member's name. (object.member or object["member"])

Methods

 constructor (...) : void
Internal

 The constructor function of the object, if it exists. Cannot be directly called.


 destructor () : void
Internal

 The destructor function of the object, if it exists. Cannot be directly called.


 Destroy () : void

 Calls the object's destructor function, destroys all the instances inside the objectData and clears it, and sets the __locked property to true.

Properties

__locked

boolean

Internal

Indicates if an object has been locked. If set to true, the object's metamethods will no longer work and all the members will become unaccessable.

__type

string

Internal

Indicates the class type of the object. Can be used to determine which class the object belongs to by using the Type.typeof() function.

objectData

Table

No Direct Access

The object's data table that stores every access specifier, and the members inside them. This data table cannot be accessed directly, so you have to index the object by using object.member or object["member"] methods to access it.

Methods

constructor

void

Internal

The constructor function inside the object, if it has been set in the classData table. This function is internal, so it will only be called when the object is created by using the class.new(...) function.

Returns

void

destructor

void

Internal

The destructor function inside the object, if it has been set in the classData table. This function accepts no parameters and is internal, so it can only be called when object:Destroy() is called, and can only be called once.

Returns

void

Destroy

void

This method first calls the object's destructor function, then after the destructor runs, it goes through the objectData table, if a key or value is found to be an Instance, it calls :Destroy() on that Instance, and sets it to nil. If not, then it simply sets the key and value to nil, and when the objectData table is finally empty, it sets the __locked property to true, preventing further access to any member, function or operator function.

Warning

At this stage, your object should be treated as empty and completely gone. Make sure to remove all references to the object, so the garbage collector can pick it up.

Returns

void